Skip to content

Commit

Permalink
update tantivy (#5433)
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz authored Sep 18, 2024
1 parent 8db78d4 commit 98328db
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
18 changes: 9 additions & 9 deletions quickwit/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion quickwit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ quickwit-serve = { path = "quickwit-serve" }
quickwit-storage = { path = "quickwit-storage" }
quickwit-telemetry = { path = "quickwit-telemetry" }

tantivy = { git = "https://github.com/quickwit-oss/tantivy/", rev = "9f81d59", default-features = false, features = [
tantivy = { git = "https://github.com/quickwit-oss/tantivy/", rev = "55b0b52", default-features = false, features = [
"lz4-compression",
"mmap",
"quickwit",
Expand Down
8 changes: 4 additions & 4 deletions quickwit/quickwit-search/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use quickwit_proto::types::SplitId;
use serde::Deserialize;
use tantivy::aggregation::agg_req::{get_fast_field_names, Aggregations};
use tantivy::aggregation::intermediate_agg_result::IntermediateAggregationResults;
use tantivy::aggregation::{AggregationLimits, AggregationSegmentCollector};
use tantivy::aggregation::{AggregationLimitsGuard, AggregationSegmentCollector};
use tantivy::collector::{Collector, SegmentCollector};
use tantivy::columnar::{ColumnType, MonotonicallyMappableToU64};
use tantivy::fastfield::Column;
Expand Down Expand Up @@ -717,7 +717,7 @@ pub(crate) struct QuickwitCollector {
pub max_hits: usize,
pub sort_by: SortByPair,
pub aggregation: Option<QuickwitAggregations>,
pub aggregation_limits: AggregationLimits,
pub aggregation_limits: AggregationLimitsGuard,
search_after: Option<PartialHit>,
}

Expand Down Expand Up @@ -1015,7 +1015,7 @@ pub(crate) fn sort_by_from_request(search_request: &SearchRequest) -> SortByPair
pub(crate) fn make_collector_for_split(
split_id: SplitId,
search_request: &SearchRequest,
aggregation_limits: AggregationLimits,
aggregation_limits: AggregationLimitsGuard,
) -> crate::Result<QuickwitCollector> {
let aggregation = match &search_request.aggregation_request {
Some(aggregation) => Some(serde_json::from_str(aggregation)?),
Expand All @@ -1036,7 +1036,7 @@ pub(crate) fn make_collector_for_split(
/// Builds a QuickwitCollector that's only useful for merging fruits.
pub(crate) fn make_merge_collector(
search_request: &SearchRequest,
aggregation_limits: &AggregationLimits,
aggregation_limits: &AggregationLimitsGuard,
) -> crate::Result<QuickwitCollector> {
let aggregation = match &search_request.aggregation_request {
Some(aggregation) => Some(serde_json::from_str(aggregation)?),
Expand Down
10 changes: 5 additions & 5 deletions quickwit/quickwit-search/src/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use quickwit_storage::{
StorageResolver,
};
use tantivy::aggregation::agg_req::{AggregationVariants, Aggregations};
use tantivy::aggregation::AggregationLimits;
use tantivy::aggregation::AggregationLimitsGuard;
use tantivy::directory::FileSlice;
use tantivy::fastfield::FastFieldReaders;
use tantivy::schema::Field;
Expand Down Expand Up @@ -350,7 +350,7 @@ async fn leaf_search_single_split(
split: SplitIdAndFooterOffsets,
doc_mapper: Arc<dyn DocMapper>,
split_filter: Arc<RwLock<CanSplitDoBetter>>,
aggregations_limits: AggregationLimits,
aggregations_limits: AggregationLimitsGuard,
) -> crate::Result<LeafSearchResponse> {
rewrite_request(
&mut search_request,
Expand Down Expand Up @@ -1157,7 +1157,7 @@ async fn resolve_storage_and_leaf_search(
storage_resolver: StorageResolver,
splits: Vec<SplitIdAndFooterOffsets>,
doc_mapper: Arc<dyn DocMapper>,
aggregations_limits: AggregationLimits,
aggregations_limits: AggregationLimitsGuard,
) -> crate::Result<LeafSearchResponse> {
let storage = storage_resolver.resolve(&index_uri).await?;

Expand Down Expand Up @@ -1208,7 +1208,7 @@ pub async fn leaf_search(
index_storage: Arc<dyn Storage>,
splits: Vec<SplitIdAndFooterOffsets>,
doc_mapper: Arc<dyn DocMapper>,
aggregations_limits: AggregationLimits,
aggregations_limits: AggregationLimitsGuard,
) -> Result<LeafSearchResponse, SearchError> {
info!(splits_num = splits.len(), split_offsets = ?PrettySample::new(&splits, 5));

Expand Down Expand Up @@ -1317,7 +1317,7 @@ async fn leaf_search_single_split_wrapper(
split_filter: Arc<RwLock<CanSplitDoBetter>>,
incremental_merge_collector: Arc<Mutex<IncrementalCollector>>,
leaf_split_search_permit: tokio::sync::OwnedSemaphorePermit,
aggregations_limits: AggregationLimits,
aggregations_limits: AggregationLimitsGuard,
) {
crate::SEARCH_METRICS.leaf_searches_splits_total.inc();
let timer = crate::SEARCH_METRICS
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-search/src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ fn finalize_aggregation(
Default::default()
};
let final_aggregation_results: AggregationResults = intermediate_aggregation_results
.into_final_result(aggregations, &searcher_context.get_aggregation_limits())?;
.into_final_result(aggregations, searcher_context.get_aggregation_limits())?;
serde_json::to_string(&final_aggregation_results)?
}
};
Expand Down
8 changes: 4 additions & 4 deletions quickwit/quickwit-search/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use quickwit_proto::search::{
use quickwit_storage::{
MemorySizedCache, QuickwitCache, SplitCache, StorageCache, StorageResolver,
};
use tantivy::aggregation::AggregationLimits;
use tantivy::aggregation::AggregationLimitsGuard;
use tokio::sync::Semaphore;
use tokio_stream::wrappers::UnboundedReceiverStream;

Expand Down Expand Up @@ -459,7 +459,7 @@ pub struct SearcherContext {
/// List fields cache. Caches the list fields response for a given split.
pub list_fields_cache: ListFieldsCache,
/// The aggregation limits are passed to limit the memory usage.
pub aggregation_limit: AggregationLimits,
pub aggregation_limit: AggregationLimitsGuard,
}

impl std::fmt::Debug for SearcherContext {
Expand Down Expand Up @@ -500,7 +500,7 @@ impl SearcherContext {
LeafSearchCache::new(searcher_config.partial_request_cache_capacity.as_u64() as usize);
let list_fields_cache =
ListFieldsCache::new(searcher_config.partial_request_cache_capacity.as_u64() as usize);
let aggregation_limit = AggregationLimits::new(
let aggregation_limit = AggregationLimitsGuard::new(
Some(searcher_config.aggregation_memory_limit.as_u64()),
Some(searcher_config.aggregation_bucket_limit),
);
Expand All @@ -519,7 +519,7 @@ impl SearcherContext {
}

/// Returns the shared instance to track the aggregation memory usage.
pub fn get_aggregation_limits(&self) -> AggregationLimits {
pub fn get_aggregation_limits(&self) -> AggregationLimitsGuard {
self.aggregation_limit.clone()
}
}

0 comments on commit 98328db

Please sign in to comment.