Skip to content

Commit 70a248b

Browse files
committed
Make janitor index GC concurrency configurable via env var
1 parent 58944fc commit 70a248b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

quickwit/quickwit-index-management/src/garbage_collection.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ async fn delete_splits(
232232
}
233233
}
234234
})
235-
.buffer_unordered(10);
235+
.buffer_unordered(get_index_gc_concurrency().unwrap_or(10));
236+
236237
let mut error_encountered = false;
237238
while let Some(delete_split_result) = delete_split_from_index_res_stream.next().await {
238239
match delete_split_result {
@@ -298,15 +299,20 @@ async fn list_splits_metadata(
298299
/// In order to avoid hammering the load on the metastore, we can throttle the rate of split
299300
/// deletion by setting this environment variable.
300301
fn get_maximum_split_deletion_rate_per_sec() -> Option<usize> {
301-
static MAXIMUM_SPLIT_DELETION_RATE_PER_SEC: std::sync::OnceLock<Option<usize>> =
302-
OnceLock::new();
303-
*MAXIMUM_SPLIT_DELETION_RATE_PER_SEC.get_or_init(|| {
302+
static MAX_SPLIT_DELETION_RATE_PER_SEC: OnceLock<Option<usize>> = OnceLock::new();
303+
*MAX_SPLIT_DELETION_RATE_PER_SEC.get_or_init(|| {
304304
quickwit_common::get_from_env_opt::<usize>("QW_MAX_SPLIT_DELETION_RATE_PER_SEC")
305305
})
306306
}
307307

308+
fn get_index_gc_concurrency() -> Option<usize> {
309+
static INDEX_GC_CONCURRENCY: OnceLock<Option<usize>> = OnceLock::new();
310+
*INDEX_GC_CONCURRENCY
311+
.get_or_init(|| quickwit_common::get_from_env_opt::<usize>("QW_INDEX_GC_CONCURRENCY"))
312+
}
313+
308314
/// Removes any splits marked for deletion which haven't been
309-
/// updated after `updated_before_timestamp` in batches of 1000 splits.
315+
/// updated after `updated_before_timestamp` in batches of 1,000 splits.
310316
///
311317
/// Only splits from index_uids in the `storages` map will be deleted.
312318
///
@@ -463,7 +469,7 @@ pub async fn delete_splits_from_storage_and_metastore(
463469
error!(
464470
error=?bulk_delete_error.error,
465471
index_id=index_uid.index_id,
466-
"Failed to delete split file(s) {:?} from storage.",
472+
"failed to delete split file(s) {:?} from storage",
467473
PrettySample::new(&failed_split_paths, 5),
468474
);
469475
storage_error = Some(bulk_delete_error);

0 commit comments

Comments
 (0)