diff --git a/src/metric-engine/src/engine/region_metadata.rs b/src/metric-engine/src/engine/region_metadata.rs index a67b78202d40..9d7924af279b 100644 --- a/src/metric-engine/src/engine/region_metadata.rs +++ b/src/metric-engine/src/engine/region_metadata.rs @@ -14,8 +14,9 @@ //! Implementation of retrieving logical region's region metadata. -use common_telemetry::info; use std::collections::HashMap; + +use common_telemetry::info; use store_api::metadata::ColumnMetadata; use store_api::storage::RegionId; @@ -43,7 +44,7 @@ impl MetricEngineInner { .collect::>(); // Update cache - let mutable_state = self.state.write().unwrap(); + let mut mutable_state = self.state.write().unwrap(); // Merge with existing cached columnd. let existing_columns = mutable_state .logical_columns() @@ -61,10 +62,7 @@ impl MetricEngineInner { .collect::>(); // Sort columns on column name to ensure the order dedup_columns.sort_unstable_by(|c1, c2| c1.column_schema.name.cmp(&c2.column_schema.name)); - self.state - .write() - .unwrap() - .set_logical_columns(logical_region_id, dedup_columns.clone()); + mutable_state.set_logical_columns(logical_region_id, dedup_columns.clone()); Ok(dedup_columns) }