From 873d64d2dc270ec1135860f043acdcb3ffca2590 Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Tue, 15 Oct 2024 11:38:46 +0900 Subject: [PATCH] adding post filter of index_uids --- .../quickwit-index-management/src/garbage_collection.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/quickwit/quickwit-index-management/src/garbage_collection.rs b/quickwit/quickwit-index-management/src/garbage_collection.rs index ab578857bf7..f5a7545c1f4 100644 --- a/quickwit/quickwit-index-management/src/garbage_collection.rs +++ b/quickwit/quickwit-index-management/src/garbage_collection.rs @@ -187,8 +187,10 @@ pub async fn run_garbage_collect( let updated_before_timestamp = OffsetDateTime::now_utc().unix_timestamp() - deletion_grace_period.as_secs() as i64; + let index_uid_set = index_uids.into_iter().collect(); + Ok(delete_splits_marked_for_deletion_several_indexes( - index_uids, + index_uid_set, updated_before_timestamp, metastore, indexes, @@ -304,7 +306,7 @@ async fn list_splits_metadata( /// rather than short, heavy bursts on the metastore and storage system itself. #[instrument(skip(index_uids, storages, metastore, progress_opt, metrics), fields(num_indexes=%index_uids.len()))] async fn delete_splits_marked_for_deletion_several_indexes( - index_uids: Vec, + index_uids: HashSet, updated_before_timestamp: i64, metastore: MetastoreServiceClient, storages: HashMap>, @@ -351,6 +353,7 @@ async fn delete_splits_marked_for_deletion_several_indexes( let splits_metadata_to_delete_per_index: HashMap> = splits_metadata_to_delete .into_iter() + .filter(|meta| index_uids.contains(&meta.index_uid)) .map(|meta| (meta.index_uid.clone(), meta)) .into_group_map();