Skip to content

Commit

Permalink
refactor: remove cluster version (#669)
Browse files Browse the repository at this point in the history
* refactor: remove version of region in WAL

* refactor: set up server

* refactor: setup procedure

* refactor: fix unit test

* chore: rename context to build context

* fix: avoid wal dropped when reopen

* chore: avoid useless config updating in ut

* fix: wrong config for test write buffer

* fix: implement close region for table-kv based wal

* chore: fix missing wals for no meta mode
  • Loading branch information
ShiKaiWi authored Mar 8, 2023
1 parent 00db4f6 commit ac04659
Show file tree
Hide file tree
Showing 32 changed files with 598 additions and 616 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion analytic_engine/src/instance/close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ impl Instance {
let snapshot_request = SnapshotRequest {
space_id: space.id,
table_id: table_data.id,
cluster_version: table_data.shard_info.cluster_version,
shard_id: table_data.shard_info.shard_id,
};
self.space_store
Expand Down
6 changes: 1 addition & 5 deletions analytic_engine/src/instance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,5 @@ pub type InstanceRef = Arc<Instance>;

#[inline]
pub(crate) fn create_wal_location(table_id: TableId, shard_info: TableShardInfo) -> WalLocation {
WalLocation::new(
shard_info.shard_id as u64,
shard_info.cluster_version,
table_id,
)
WalLocation::new(shard_info.shard_id as u64, table_id)
}
1 change: 0 additions & 1 deletion analytic_engine/src/instance/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ impl Instance {
let load_req = LoadRequest {
space_id,
table_id,
cluster_version: request.cluster_version,
shard_id: request.shard_id,
};
let manifest_data = self
Expand Down
39 changes: 6 additions & 33 deletions analytic_engine/src/manifest/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,7 @@ impl Manifest for ManifestImpl {

let table_id = request.meta_update.table_id();
let shard_id = request.shard_info.shard_id;
let location = WalLocation::new(
shard_id as u64,
request.shard_info.cluster_version,
table_id.as_u64(),
);
let location = WalLocation::new(shard_id as u64, table_id.as_u64());
let space_id = request.meta_update.space_id();
let table_id = request.meta_update.table_id();
self.store_update_to_wal(request.meta_update, location)
Expand All @@ -310,11 +306,7 @@ impl Manifest for ManifestImpl {
async fn load_data(&self, load_req: &LoadRequest) -> GenericResult<Option<TableManifestData>> {
info!("Manifest load data, request:{:?}", load_req);

let location = WalLocation::new(
load_req.shard_id as u64,
load_req.cluster_version,
load_req.table_id.as_u64(),
);
let location = WalLocation::new(load_req.shard_id as u64, load_req.table_id.as_u64());

let log_store = WalBasedLogStore {
opts: self.opts.clone(),
Expand All @@ -340,11 +332,7 @@ impl Manifest for ManifestImpl {
info!("Manifest do snapshot, request:{:?}", request);

let table_id = request.table_id;
let location = WalLocation::new(
request.shard_id as u64,
request.cluster_version,
table_id.as_u64(),
);
let location = WalLocation::new(request.shard_id as u64, table_id.as_u64());
let space_id = request.space_id;
let table_id = request.table_id;

Expand Down Expand Up @@ -1078,7 +1066,6 @@ mod tests {
let load_req = LoadRequest {
table_id,
shard_id: DEFAULT_SHARD_ID,
cluster_version: DEFAULT_CLUSTER_VERSION,
space_id: ctx.schema_id.as_u32(),
};
let expected_table_manifest_data = manifest_data_builder.build();
Expand Down Expand Up @@ -1161,11 +1148,7 @@ mod tests {
expr: Bytes::from("test"),
linear: false,
}));
let location = WalLocation::new(
DEFAULT_SHARD_ID as u64,
DEFAULT_CLUSTER_VERSION,
table_id.as_u64(),
);
let location = WalLocation::new(DEFAULT_SHARD_ID as u64, table_id.as_u64());
let mut manifest_data_builder = TableManifestDataBuilder::default();
let manifest = ctx.open_manifest().await;
ctx.add_table_with_manifest(
Expand All @@ -1191,7 +1174,6 @@ mod tests {
let load_req = LoadRequest {
space_id: ctx.schema_id.as_u32(),
table_id,
cluster_version: DEFAULT_CLUSTER_VERSION,
shard_id: DEFAULT_SHARD_ID,
};
ctx.check_table_manifest_data_with_manifest(
Expand All @@ -1212,7 +1194,6 @@ mod tests {
let load_req = LoadRequest {
space_id: ctx.schema_id.as_u32(),
table_id,
cluster_version: DEFAULT_CLUSTER_VERSION,
shard_id: table_id.as_u64() as u32,
};
let mut manifest_data_builder = TableManifestDataBuilder::default();
Expand All @@ -1236,11 +1217,7 @@ mod tests {
)
.await;

let location = WalLocation::new(
DEFAULT_SHARD_ID as u64,
DEFAULT_CLUSTER_VERSION,
table_id.as_u64(),
);
let location = WalLocation::new(DEFAULT_SHARD_ID as u64, table_id.as_u64());
manifest
.maybe_do_snapshot(ctx.schema_id.as_u32(), table_id, location, true)
.await
Expand Down Expand Up @@ -1369,11 +1346,7 @@ mod tests {
input_updates: Vec<MetaUpdate>,
updates_after_snapshot: Vec<MetaUpdate>,
) {
let location = WalLocation::new(
DEFAULT_SHARD_ID as u64,
DEFAULT_CLUSTER_VERSION,
table_id.as_u64(),
);
let location = WalLocation::new(DEFAULT_SHARD_ID as u64, table_id.as_u64());
let log_store = MemLogStore::from_updates(&input_updates);
let snapshot_store = MemSnapshotStore::new();

Expand Down
1 change: 0 additions & 1 deletion analytic_engine/src/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::{
pub struct LoadRequest {
pub space_id: SpaceId,
pub table_id: TableId,
pub cluster_version: u64,
pub shard_id: ShardId,
}

Expand Down
Loading

0 comments on commit ac04659

Please sign in to comment.