Skip to content

Commit

Permalink
fix: only alter writable region
Browse files Browse the repository at this point in the history
  • Loading branch information
evenyag committed Sep 13, 2023
1 parent 0e8a2c6 commit b5fb517
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
13 changes: 0 additions & 13 deletions src/mito2/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,6 @@ impl RegionMap {
regions.get(&region_id).cloned()
}

/// Gets region by region id or call the failure callback.
pub(crate) fn get_region_or<F: OnFailure>(
&self,
region_id: RegionId,
cb: &mut F,
) -> Option<MitoRegionRef> {
let region_opt = self.get_region(region_id);
if region_opt.is_none() {
cb.on_failure(RegionNotFoundSnafu { region_id }.build());
}
region_opt
}

/// Gets writable region by region id.
///
/// Returns error if the region does not exist or is readonly.
Expand Down
2 changes: 1 addition & 1 deletion src/mito2/src/worker/handle_alter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl<S> RegionWorkerLoop<S> {
request: RegionAlterRequest,
mut sender: OptionOutputTx,
) {
let Some(region) = self.regions.get_region_or(region_id, &mut sender) else {
let Some(region) = self.regions.writable_region_or(region_id, &mut sender) else {
return;
};

Expand Down

0 comments on commit b5fb517

Please sign in to comment.