refactor: skip checking the existence of the SST files (#4602)

refactor: skip checking the existence of the SST files when region is directly edited
This commit is contained in:
LFC
2024-08-22 16:32:27 +08:00
committed by GitHub
parent d628079f4c
commit 883c5bc5b0
2 changed files with 1 additions and 24 deletions

View File

@@ -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<bool> {
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`.

View File

@@ -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<S> RegionWorkerLoop<S> {
/// 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));