Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check version before alter region #2433

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/mito2/src/worker/handle_alter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use std::sync::Arc;

use common_query::Output;
use common_telemetry::{error, info};
use common_telemetry::{error, info, warn};
use snafu::ResultExt;
use store_api::metadata::{RegionMetadata, RegionMetadataBuilder, RegionMetadataRef};
use store_api::region_request::RegionAlterRequest;
Expand Down Expand Up @@ -47,6 +47,15 @@ impl<S> RegionWorkerLoop<S> {

// Get the version before alter.
let version = region.version();
if version.metadata.schema_version > request.schema_version {
evenyag marked this conversation as resolved.
Show resolved Hide resolved
warn!(
"Ignored alert request, region id:{}, region schema version {} is greater than request schema version {}",
region_id, version.metadata.schema_version, request.schema_version
);
// Returns if it altered.
sender.send(Ok(Output::AffectedRows(0)));
WenyXu marked this conversation as resolved.
Show resolved Hide resolved
return;
}
// Checks whether we can alter the region directly.
if !version.memtables.is_empty() {
// If memtable is not empty, we can't alter it directly and need to flush
Expand Down
Loading