Skip to content

Commit

Permalink
feat: create regions persist true (#3590)
Browse files Browse the repository at this point in the history
* feat: change open-region-step's status persist as true

* feat: avoid cloning

* fix: fix unit test
  • Loading branch information
fengjiachun committed Mar 27, 2024
1 parent 922b1a9 commit 5fa01e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/common/meta/src/ddl/create_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,8 @@ impl CreateTableProcedure {
// Safety: the table route must be allocated.
match self.table_route()?.clone() {
TableRouteValue::Physical(x) => {
let region_routes = x.region_routes.clone();
let request_builder = self.new_region_request_builder(None)?;
self.create_regions(&region_routes, request_builder).await
self.create_regions(&x.region_routes, request_builder).await
}
TableRouteValue::Logical(x) => {
let physical_table_id = x.physical_table_id();
Expand Down Expand Up @@ -288,9 +287,8 @@ impl CreateTableProcedure {

self.creator.data.state = CreateTableState::CreateMetadata;

// Ensures the procedures after the crash start from the `DatanodeCreateRegions` stage.
// TODO(weny): Add more tests.
Ok(Status::executing(false))
Ok(Status::executing(true))
}

/// Creates table metadata
Expand Down
2 changes: 1 addition & 1 deletion src/meta-srv/src/procedure/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async fn test_on_datanode_create_regions() {
});

let status = procedure.on_datanode_create_regions().await.unwrap();
assert!(matches!(status, Status::Executing { persist: false }));
assert!(matches!(status, Status::Executing { persist: true }));
assert!(matches!(
procedure.creator.data.state,
CreateTableState::CreateMetadata
Expand Down

0 comments on commit 5fa01e7

Please sign in to comment.