enhance: add expression filter cache for two-stage search#48883
enhance: add expression filter cache for two-stage search#48883sparknack wants to merge 3 commits intomilvus-io:masterfrom
Conversation
Add per-segment LRU cache (ExprFilterCache) to avoid re-executing filter expressions in Stage 2 of two-stage search. Stage 1 writes the filter bitset into cache via Put (clone), Stage 2 reads it via one-shot Take (move out + delete entry). Cache is only activated when enable_expr_cache=true, which is exclusively set by two-stage search — normal search/query paths are unaffected. Key design: - Cache lives on ChunkedSegmentSealedImpl (sealed segments only) - Key: filter plan ToString() (exact match, no hash collision risk) - Value: (TargetBitmap, valid_bitset) pre-MVCC (MvccNode re-applies) - LRU with configurable capacity (autoIndex.twoStageSearch.exprCacheSize, default 16) - Move + one-shot Take semantics: zero-copy on read, auto-cleanup - No TTL needed: Take deletes entry, stale entries evicted by LRU Signed-off-by: Shawn Wang <shawn.wang@zilliz.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sparknack The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
[ci-v2-notice] To rerun ci-v2 checks, comment with:
If you have any questions or requests, please contact @zhikunyao. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #48883 +/- ##
===========================================
- Coverage 84.44% 77.83% -6.62%
===========================================
Files 642 2150 +1508
Lines 101106 353267 +252161
===========================================
+ Hits 85382 274969 +189587
- Misses 15724 69806 +54082
- Partials 0 8492 +8492
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Shawn Wang <shawn.wang@zilliz.com>
|
@sre-ci-robot /retest |
|
/ci-rerun-code-check |
|
@sre-ci-robot /ci-rerun-code-check |
|
/ci-rerun-code-check |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Shawn Wang <shawn.wang@zilliz.com>
|
/ci-rerun-e2e-default |
|
/hold let's try reuse the existing expr cache |
Summary
ExprFilterCache) to avoid re-executing filter expressions in Stage 2 of two-stage searchPut(clone), Stage 2 reads it via one-shotTake(move out + delete entry)enable_expr_cache=true, which is exclusively set by two-stage search — normal search/query paths are unaffectedKey design
ChunkedSegmentSealedImpl(sealed segments only)ToString()(exact match, no hash collision risk)(TargetBitmap, valid_bitset)pre-MVCC (MvccNodere-applies)autoIndex.twoStageSearch.exprCacheSize, default 16)Takesemantics: zero-copy on read, auto-cleanupTakedeletes entry, stale entries evicted by LRUissue: #47219
Test plan
test_expr_filter_cache.cppcovering Put/Take/LRU eviction🤖 Generated with Claude Code