From 44290efb4f8146d139739f0a2a2db76488dc52bf Mon Sep 17 00:00:00 2001 From: Remi Dettai Date: Thu, 19 Sep 2024 11:51:50 +0200 Subject: [PATCH] Rename grpc field interval to interval_secs --- quickwit/quickwit-control-plane/src/control_plane.rs | 4 ++-- .../src/source/queue_sources/shared_state.rs | 2 +- .../metastore/file_backed/file_backed_index/shards.rs | 8 ++++---- quickwit/quickwit-metastore/src/tests/shard.rs | 10 +++++----- .../quickwit-proto/protos/quickwit/metastore.proto | 2 +- .../src/codegen/quickwit/quickwit.metastore.rs | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/quickwit/quickwit-control-plane/src/control_plane.rs b/quickwit/quickwit-control-plane/src/control_plane.rs index 112f4677d59..b24764c8ec9 100644 --- a/quickwit/quickwit-control-plane/src/control_plane.rs +++ b/quickwit/quickwit-control-plane/src/control_plane.rs @@ -789,8 +789,8 @@ impl Handler for ControlPlane { _ctx: &ActorContext, ) -> Result, ActorExitStatus> { let interval = request - .interval - .map(|interval| Duration::from_secs(interval as u64)) + .interval_secs + .map(|interval_secs| Duration::from_secs(interval_secs as u64)) .unwrap_or_else(|| PRUNE_SHARDS_DEFAULT_COOLDOWN_PERIOD); // A very basic debounce is enough here, missing one call to the pruning API is fine diff --git a/quickwit/quickwit-indexing/src/source/queue_sources/shared_state.rs b/quickwit/quickwit-indexing/src/source/queue_sources/shared_state.rs index ea76cd6e864..45fbf1b1ce7 100644 --- a/quickwit/quickwit-indexing/src/source/queue_sources/shared_state.rs +++ b/quickwit/quickwit-indexing/src/source/queue_sources/shared_state.rs @@ -100,7 +100,7 @@ impl QueueSharedState { source_id: source_id.clone(), max_age_secs, max_count, - interval: Some(pruning_interval.as_secs() as u32), + interval_secs: Some(pruning_interval.as_secs() as u32), }) .await; if let Err(err) = result { diff --git a/quickwit/quickwit-metastore/src/metastore/file_backed/file_backed_index/shards.rs b/quickwit/quickwit-metastore/src/metastore/file_backed/file_backed_index/shards.rs index 84b669e63fa..b7875bda8ca 100644 --- a/quickwit/quickwit-metastore/src/metastore/file_backed/file_backed_index/shards.rs +++ b/quickwit/quickwit-metastore/src/metastore/file_backed/file_backed_index/shards.rs @@ -642,7 +642,7 @@ mod tests { source_id: source_id.clone(), max_age_secs: None, max_count: None, - interval: None, + interval_secs: None, }; let MutationOccurred::No(()) = shards.prune_shards(request).unwrap() else { panic!("expected `MutationOccurred::No`"); @@ -653,7 +653,7 @@ mod tests { source_id: source_id.clone(), max_age_secs: Some(50), max_count: None, - interval: None, + interval_secs: None, }; let MutationOccurred::No(()) = shards.prune_shards(request).unwrap() else { panic!("expected `MutationOccurred::No`"); @@ -690,7 +690,7 @@ mod tests { source_id: source_id.clone(), max_age_secs: Some(150), max_count: None, - interval: None, + interval_secs: None, }; let MutationOccurred::Yes(()) = shards.prune_shards(request).unwrap() else { panic!("expected `MutationOccurred::Yes`"); @@ -701,7 +701,7 @@ mod tests { source_id: source_id.clone(), max_age_secs: Some(150), max_count: None, - interval: None, + interval_secs: None, }; let MutationOccurred::No(()) = shards.prune_shards(request).unwrap() else { panic!("expected `MutationOccurred::No`"); diff --git a/quickwit/quickwit-metastore/src/tests/shard.rs b/quickwit/quickwit-metastore/src/tests/shard.rs index 144efe0a22f..f8597e84a90 100644 --- a/quickwit/quickwit-metastore/src/tests/shard.rs +++ b/quickwit/quickwit-metastore/src/tests/shard.rs @@ -654,7 +654,7 @@ pub async fn test_metastore_prune_shards< source_id: test_index.source_id.clone(), max_age_secs: None, max_count: None, - interval: None, + interval_secs: None, }; metastore.prune_shards(prune_index_request).await.unwrap(); let all_shards = metastore @@ -670,7 +670,7 @@ pub async fn test_metastore_prune_shards< source_id: test_index.source_id.clone(), max_age_secs: Some(oldest_shard_age - 350), max_count: None, - interval: None, + interval_secs: None, }; metastore.prune_shards(prune_index_request).await.unwrap(); @@ -690,7 +690,7 @@ pub async fn test_metastore_prune_shards< source_id: test_index.source_id.clone(), max_age_secs: None, max_count: Some(90), - interval: None, + interval_secs: None, }; metastore.prune_shards(prune_index_request).await.unwrap(); let mut all_shards = metastore @@ -708,7 +708,7 @@ pub async fn test_metastore_prune_shards< source_id: test_index.source_id.clone(), max_age_secs: Some(oldest_shard_age - 2950), max_count: Some(80), - interval: None, + interval_secs: None, }; metastore.prune_shards(prune_index_request).await.unwrap(); let all_shards = metastore @@ -722,7 +722,7 @@ pub async fn test_metastore_prune_shards< source_id: test_index.source_id.clone(), max_age_secs: Some(oldest_shard_age - 4000), max_count: Some(50), - interval: None, + interval_secs: None, }; metastore.prune_shards(prune_index_request).await.unwrap(); let all_shards = metastore diff --git a/quickwit/quickwit-proto/protos/quickwit/metastore.proto b/quickwit/quickwit-proto/protos/quickwit/metastore.proto index 2928cbb0600..8ae7a8a4400 100644 --- a/quickwit/quickwit-proto/protos/quickwit/metastore.proto +++ b/quickwit/quickwit-proto/protos/quickwit/metastore.proto @@ -462,7 +462,7 @@ message PruneShardsRequest { // The maximum number of the shards to keep. Delete older shards first. optional uint32 max_count = 6; // The interval between two pruning operations, in seconds. - optional uint32 interval = 7; + optional uint32 interval_secs = 7; } message ListShardsRequest { diff --git a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs index 21355b5cff0..08b12006db3 100644 --- a/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs +++ b/quickwit/quickwit-proto/src/codegen/quickwit/quickwit.metastore.rs @@ -424,7 +424,7 @@ pub struct PruneShardsRequest { pub max_count: ::core::option::Option, /// The interval between two pruning operations, in seconds. #[prost(uint32, optional, tag = "7")] - pub interval: ::core::option::Option, + pub interval_secs: ::core::option::Option, } #[derive(serde::Serialize, serde::Deserialize, utoipa::ToSchema)] #[allow(clippy::derive_partial_eq_without_eq)]