Skip to content

feat: Introducing option to control disk pre launch purge #192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ pub struct KerberosSecurityConfig {
pub struct LocalfileStoreConfig {
pub data_paths: Vec<String>,
pub min_number_of_available_disks: Option<i32>,

#[serde(default = "bool::default")]
pub launch_purge_enable: bool,

#[serde(default = "as_default_disk_high_watermark")]
pub disk_high_watermark: f32,
#[serde(default = "as_default_disk_low_watermark")]
Expand Down Expand Up @@ -184,6 +188,7 @@ impl LocalfileStoreConfig {
LocalfileStoreConfig {
data_paths,
min_number_of_available_disks: Some(1),
launch_purge_enable: false,
disk_high_watermark: as_default_disk_high_watermark(),
disk_low_watermark: as_default_disk_low_watermark(),
disk_write_buf_capacity: as_default_disk_write_buf_capacity(),
Expand Down
16 changes: 9 additions & 7 deletions src/store/localfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ impl LocalFileStore {
pub fn from(localfile_config: LocalfileStoreConfig, runtime_manager: RuntimeManager) -> Self {
let mut local_disk_instances = vec![];
for path in &localfile_config.data_paths {
// clear up all previous disk data
if let Err(e) = LocalFileStore::remove_dir_children(path.as_str()) {
panic!(
"Errors on clear up children files of path: {:?}. err: {:#?}",
path.as_str(),
e
);
if localfile_config.launch_purge_enable {
info!("Launch purging for [{}]...", path.as_str());
if let Err(e) = LocalFileStore::remove_dir_children(path.as_str()) {
panic!(
"Errors on clear up children files of path: {:?}. err: {:#?}",
path.as_str(),
e
);
}
}
local_disk_instances.push(LocalDiskDelegator::new(
&runtime_manager,
Expand Down
Loading