feat: create regions persist true (#3590)

* feat: change open-region-step's status persist as true

* feat: avoid cloning

* fix: fix unit test
This commit is contained in:
JeremyHi
2024-03-27 14:26:58 +08:00
committed by GitHub
parent 922b1a9b66
commit 5fa01e7a96
2 changed files with 3 additions and 5 deletions

View File

@@ -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();
@@ -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

View File

@@ -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