fix(search): wait for merge threads before dropping the bulk writer#6731
Open
Azur1337 wants to merge 1 commit into
Open
fix(search): wait for merge threads before dropping the bulk writer#6731Azur1337 wants to merge 1 commit into
Azur1337 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6731 +/- ##
==========================================
- Coverage 89.92% 89.91% -0.02%
==========================================
Files 398 398
Lines 111157 111161 +4
Branches 111157 111161 +4
==========================================
- Hits 99954 99946 -8
- Misses 7400 7412 +12
Partials 3803 3803 ☔ View full report in Codecov by Harness. |
5bb7102 to
6cb8ec9
Compare
Signed-off-by: Azur <azur99@web.de>
6cb8ec9 to
fa5f4d5
Compare
Merging this PR will improve performance by 98.38%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | Restore session [memory store] |
224.5 ms | 113.1 ms | +98.38% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing Azur1337:fix/search-bulk-execute-wait-merges (fa5f4d5) with main (7bf142a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RoomIndex::bulk_executeoepns a tantivyIndexWriter, commits, and then lets it drop without callingwait_merging_threads(). The writers background merge threads can outlive it and still be running when the nextbulk_executeopens a new writer on the same index, so the two race over the same segmentsDuring bulk indexing (e.g. backfilling a room history) this surfaces as
warnings and leaves the index more fragmented than necessary
To fix this, we wait for the writers merge threads to finish before it is dropped at the end of
bulk_execute. No public api change