Skip to content

Commit eadb461

Browse files
committed
cargo fmt
1 parent eb60ebe commit eadb461

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

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

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,23 @@ pub async fn run_garbage_collect(
9494
dry_run: bool,
9595
progress_opt: Option<&Progress>,
9696
) -> anyhow::Result<SplitRemovalInfo> {
97-
98-
99-
10097
let grace_period_timestamp =
10198
OffsetDateTime::now_utc().unix_timestamp() - staged_grace_period.as_secs() as i64;
10299

103100
let index_uids: Vec<IndexUid> = indexes.keys().cloned().collect();
104101

105-
let Some(list_splits_query_for_index_uids) = ListSplitsQuery::try_from_index_uids(index_uids.clone()) else {
106-
return Ok(SplitRemovalInfo::default())
102+
let Some(list_splits_query_for_index_uids) =
103+
ListSplitsQuery::try_from_index_uids(index_uids.clone())
104+
else {
105+
return Ok(SplitRemovalInfo::default());
107106
};
108107
let list_splits_query = list_splits_query_for_index_uids
109108
.clone()
110109
.with_split_state(SplitState::Staged)
111110
.with_update_timestamp_lte(grace_period_timestamp);
112111

113-
let list_deletable_staged_request = ListSplitsRequest::try_from_list_splits_query(&list_splits_query)?;
112+
let list_deletable_staged_request =
113+
ListSplitsRequest::try_from_list_splits_query(&list_splits_query)?;
114114
let deletable_staged_splits: Vec<SplitMetadata> = protect_future(
115115
progress_opt,
116116
metastore.list_splits(list_deletable_staged_request),
@@ -120,8 +120,8 @@ pub async fn run_garbage_collect(
120120
.await?;
121121

122122
if dry_run {
123-
let marked_for_deletion_query = list_splits_query_for_index_uids
124-
.with_split_state(SplitState::MarkedForDeletion);
123+
let marked_for_deletion_query =
124+
list_splits_query_for_index_uids.with_split_state(SplitState::MarkedForDeletion);
125125
let marked_for_deletion_request =
126126
ListSplitsRequest::try_from_list_splits_query(&marked_for_deletion_query)?;
127127
let mut splits_marked_for_deletion: Vec<SplitMetadata> = protect_future(
@@ -244,15 +244,20 @@ async fn delete_splits(
244244
use anyhow::Context;
245245

246246
/// Fetch the list metadata from the metastore and returns them as a Vec.
247-
async fn list_splits_metadata(metastore: &MetastoreServiceClient, query: &ListSplitsQuery) -> anyhow::Result<Vec<SplitMetadata>> {
247+
async fn list_splits_metadata(
248+
metastore: &MetastoreServiceClient,
249+
query: &ListSplitsQuery,
250+
) -> anyhow::Result<Vec<SplitMetadata>> {
248251
let list_splits_request = ListSplitsRequest::try_from_list_splits_query(&query)
249252
.context("failed to build list splits request")?;
250253
let metastore = metastore.clone();
251-
let splits_to_delete_stream =
252-
metastore
253-
.list_splits(list_splits_request).await
254-
.context("failed to fetch stream splits")?;
255-
let splits = splits_to_delete_stream.collect_splits_metadata().await
254+
let splits_to_delete_stream = metastore
255+
.list_splits(list_splits_request)
256+
.await
257+
.context("failed to fetch stream splits")?;
258+
let splits = splits_to_delete_stream
259+
.collect_splits_metadata()
260+
.await
256261
.context("failed to collect splits")?;
257262
Ok(splits)
258263
}
@@ -284,7 +289,12 @@ async fn delete_splits_marked_for_deletion_several_indexes(
284289
.sort_by_index_uid();
285290

286291
loop {
287-
let splits_metadata_to_delete: Vec<SplitMetadata> = match protect_future(progress_opt, list_splits_metadata(&metastore, &list_splits_query)).await {
292+
let splits_metadata_to_delete: Vec<SplitMetadata> = match protect_future(
293+
progress_opt,
294+
list_splits_metadata(&metastore, &list_splits_query),
295+
)
296+
.await
297+
{
288298
Ok(splits) => splits,
289299
Err(list_splits_err) => {
290300
error!(error=?list_splits_err, "failed to list splits");

quickwit/quickwit-search/src/list_terms.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ pub async fn root_list_terms(
9191
.map(|index_metadata| index_metadata.index_uid.clone())
9292
.collect();
9393

94-
let Some(mut query) = quickwit_metastore::ListSplitsQuery::try_from_index_uids(index_uids) else {
94+
let Some(mut query) = quickwit_metastore::ListSplitsQuery::try_from_index_uids(index_uids)
95+
else {
9596
return Ok(ListTermsResponse::default());
9697
};
9798
query = query.with_split_state(quickwit_metastore::SplitState::Published);

0 commit comments

Comments
 (0)