diff --git a/quickwit/quickwit-directories/src/caching_directory.rs b/quickwit/quickwit-directories/src/caching_directory.rs index e55c49f7fad..58d5ffd8028 100644 --- a/quickwit/quickwit-directories/src/caching_directory.rs +++ b/quickwit/quickwit-directories/src/caching_directory.rs @@ -39,7 +39,7 @@ pub struct CachingDirectory { impl CachingDirectory { /// Creates a new CachingDirectory. /// - /// Warming: The resulting CacheDirectory will cache all information without ever + /// Warning: The resulting CacheDirectory will cache all information without ever /// removing any item from the cache. pub fn new_unbounded(underlying: Arc) -> CachingDirectory { let byte_range_cache = ByteRangeCache::with_infinite_capacity( @@ -50,7 +50,7 @@ impl CachingDirectory { /// Creates a new CachingDirectory. /// - /// Warming: The resulting CacheDirectory will cache all information without ever + /// Warning: The resulting CacheDirectory will cache all information without ever /// removing any item from the cache. pub fn new(underlying: Arc, cache: ByteRangeCache) -> CachingDirectory { CachingDirectory { underlying, cache } diff --git a/quickwit/quickwit-search/src/leaf.rs b/quickwit/quickwit-search/src/leaf.rs index dd11743c6cb..ac3adb98760 100644 --- a/quickwit/quickwit-search/src/leaf.rs +++ b/quickwit/quickwit-search/src/leaf.rs @@ -1402,7 +1402,8 @@ async fn leaf_search_single_split_wrapper( ) .await; - // We explicitly drop it, to highlight it to the reader + // Explicitly drop the permit for readability. + // This should always happen after the ephemeral search cache is dropped. std::mem::drop(search_permit); if leaf_search_single_split_res.is_ok() { diff --git a/quickwit/quickwit-search/src/list_terms.rs b/quickwit/quickwit-search/src/list_terms.rs index cfd2b724689..f241a162303 100644 --- a/quickwit/quickwit-search/src/list_terms.rs +++ b/quickwit/quickwit-search/src/list_terms.rs @@ -40,7 +40,6 @@ use tracing::{debug, error, info, instrument}; use crate::leaf::open_index_with_caches; use crate::search_job_placer::group_jobs_by_index_id; -use crate::search_permit_provider::SearchPermit; use crate::{resolve_index_patterns, ClusterClient, SearchError, SearchJob, SearcherContext}; /// Performs a distributed list terms. @@ -216,7 +215,6 @@ async fn leaf_list_terms_single_split( search_request: &ListTermsRequest, storage: Arc, split: SplitIdAndFooterOffsets, - _search_permit: SearchPermit, ) -> crate::Result { let cache = ByteRangeCache::with_infinite_capacity(&quickwit_storage::STORAGE_METRICS.shortlived_cache); @@ -352,10 +350,14 @@ pub async fn leaf_list_terms( request, index_storage_clone, split.clone(), - leaf_split_search_permit, ) .await; timer.observe_duration(); + + // Explicitly drop the permit for readability. + // This should always happen after the ephemeral search cache is dropped. + std::mem::drop(leaf_split_search_permit); + leaf_search_single_split_res.map_err(|err| (split.split_id.clone(), err)) } })