mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-28 19:00:39 +00:00
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:
@@ -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`.
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user