Skip to content

Commit

Permalink
[fix][store] Fixup merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
visualYJD authored and rock-git committed Dec 20, 2024
1 parent b87eb94 commit ba4c1ac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/store/region_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,9 @@ butil::Status MergeRegionTask::MergeRegion() {

ADD_REGION_CHANGE_RECORD(*region_cmd_);

// Disable region change
store_region_meta->UpdateTemporaryDisableChange(source_region, true);
store_region_meta->UpdateTemporaryDisableChange(target_region, true);
// Commit raft cmd
auto ctx = std::make_shared<Context>();
ctx->SetRegionId(source_region->Id());
Expand All @@ -898,13 +901,10 @@ butil::Status MergeRegionTask::MergeRegion() {
status = Server::GetInstance().GetStorage()->PrepareMerge(ctx, region_cmd_->job_id(), target_region->Definition(),
min_applied_log_id);
if (!status.ok()) {
store_region_meta->UpdateTemporaryDisableChange(source_region, false);
store_region_meta->UpdateTemporaryDisableChange(target_region, false);
return status;
}

// Disable region change
store_region_meta->UpdateTemporaryDisableChange(source_region, true);
store_region_meta->UpdateTemporaryDisableChange(target_region, true);

return butil::Status();
}

Expand Down

0 comments on commit ba4c1ac

Please sign in to comment.