From 39e0e1184ee2de230c6f203c8896d7c58f77ca6d Mon Sep 17 00:00:00 2001 From: WenyXu Date: Mon, 18 Sep 2023 11:09:56 +0000 Subject: [PATCH 1/3] fix: check version before alter region --- src/mito2/src/worker/handle_alter.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mito2/src/worker/handle_alter.rs b/src/mito2/src/worker/handle_alter.rs index 61cb343e8072..7251e4d394ba 100644 --- a/src/mito2/src/worker/handle_alter.rs +++ b/src/mito2/src/worker/handle_alter.rs @@ -47,6 +47,19 @@ impl RegionWorkerLoop { // Get the version before alter. let version = region.version(); +<<<<<<< Updated upstream + if version.metadata.schema_version >= request.schema_version { +======= + if version.metadata.schema_version > request.schema_version { + warn!( + "region schema version {} greater than request schema version {}", + version.metadata.schema_version, request.schema_version + ); +>>>>>>> Stashed changes + // Returns if it altered. + sender.send(Ok(Output::AffectedRows(0))); + 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 From e2266811a481f485aa3bbbaf8fadb5255c20be96 Mon Sep 17 00:00:00 2001 From: WenyXu Date: Mon, 18 Sep 2023 11:16:47 +0000 Subject: [PATCH 2/3] chore: apply suggestions from CR --- src/mito2/src/worker/handle_alter.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/mito2/src/worker/handle_alter.rs b/src/mito2/src/worker/handle_alter.rs index 7251e4d394ba..598c93d23c0c 100644 --- a/src/mito2/src/worker/handle_alter.rs +++ b/src/mito2/src/worker/handle_alter.rs @@ -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; @@ -47,15 +47,11 @@ impl RegionWorkerLoop { // Get the version before alter. let version = region.version(); -<<<<<<< Updated upstream - if version.metadata.schema_version >= request.schema_version { -======= if version.metadata.schema_version > request.schema_version { warn!( - "region schema version {} greater than request schema version {}", - version.metadata.schema_version, request.schema_version + "region id:{}, region schema version {} greater than request schema version {}", + region_id, version.metadata.schema_version, request.schema_version ); ->>>>>>> Stashed changes // Returns if it altered. sender.send(Ok(Output::AffectedRows(0))); return; From b871a6739fdadca7e390a11c85c6c90556f5e45d Mon Sep 17 00:00:00 2001 From: Weny Xu Date: Mon, 18 Sep 2023 20:36:04 +0900 Subject: [PATCH 3/3] Update src/mito2/src/worker/handle_alter.rs Co-authored-by: dennis zhuang --- src/mito2/src/worker/handle_alter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mito2/src/worker/handle_alter.rs b/src/mito2/src/worker/handle_alter.rs index 598c93d23c0c..468bfa6b404f 100644 --- a/src/mito2/src/worker/handle_alter.rs +++ b/src/mito2/src/worker/handle_alter.rs @@ -49,7 +49,7 @@ impl RegionWorkerLoop { let version = region.version(); if version.metadata.schema_version > request.schema_version { warn!( - "region id:{}, region schema version {} greater than request schema version {}", + "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.