From 883c5bc5b077d14a74c515164475052dc3b2a89a Mon Sep 17 00:00:00 2001 From: LFC <990479+MichaelScofield@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:32:27 +0800 Subject: [PATCH] refactor: skip checking the existence of the SST files (#4602) refactor: skip checking the existence of the SST files when region is directly edited --- src/mito2/src/access_layer.rs | 8 -------- src/mito2/src/worker/handle_manifest.rs | 17 +---------------- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/mito2/src/access_layer.rs b/src/mito2/src/access_layer.rs index c8f3de8785..752b36fd1e 100644 --- a/src/mito2/src/access_layer.rs +++ b/src/mito2/src/access_layer.rs @@ -175,14 +175,6 @@ impl AccessLayer { Ok(sst_info) } - /// Returns whether the file exists in the object store. - pub(crate) async fn is_exist(&self, file_meta: &FileMeta) -> Result { - let path = location::sst_file_path(&self.region_dir, file_meta.file_id); - self.object_store - .is_exist(&path) - .await - .context(OpenDalSnafu) - } } /// `OperationType` represents the origin of the `SstWriteRequest`. diff --git a/src/mito2/src/worker/handle_manifest.rs b/src/mito2/src/worker/handle_manifest.rs index 4ca2fc9c9f..1f8dfac608 100644 --- a/src/mito2/src/worker/handle_manifest.rs +++ b/src/mito2/src/worker/handle_manifest.rs @@ -19,10 +19,9 @@ use std::collections::{HashMap, VecDeque}; use common_telemetry::{info, warn}; -use snafu::ensure; use store_api::storage::RegionId; -use crate::error::{InvalidRequestSnafu, RegionBusySnafu, RegionNotFoundSnafu, Result}; +use crate::error::{RegionBusySnafu, RegionNotFoundSnafu, Result}; use crate::manifest::action::{ RegionChange, RegionEdit, RegionMetaAction, RegionMetaActionList, RegionTruncate, }; @@ -289,20 +288,6 @@ impl RegionWorkerLoop { /// Checks the edit, writes and applies it. async fn edit_region(region: &MitoRegionRef, edit: RegionEdit) -> Result<()> { let region_id = region.region_id; - for file_meta in &edit.files_to_add { - let is_exist = region.access_layer.is_exist(file_meta).await?; - ensure!( - is_exist, - InvalidRequestSnafu { - region_id, - reason: format!( - "trying to add a not exist file '{}' when editing region", - file_meta.file_id - ) - } - ); - } - info!("Applying {edit:?} to region {}", region_id); let action_list = RegionMetaActionList::with_action(RegionMetaAction::Edit(edit));