Repository navigation
A just-indexed chunk stays searchable, because a late automatic reload can no longer swap in an older commit - #1458
Merged
WaylandYang merged 2 commits intoOct 29, 2026
Conversation
…d can no longer swap in an older commit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Aschenbath <Aschenbath@users.noreply.github.com>
7 tasks done
WaylandYang
approved these changes
Oct 29, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thanks — every commit already reloads under the writer lock and the server holds the only writer, so Manual loses nothing. Merging.
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.
Split out of #1131 at review.
SearchIndexopens its reader with Tantivy's defaultOnCommitWithDelaypolicy, and every write (index_chunks,clear,delete_document) also callsreader.reload()itself under the writer lock so the write is readable right away. With both active, two reloads can race. In Tantivy 0.26.1,InnerIndexReader::reloadbuilds a searcher from the segment metas it reads and then callsArcSwap::storeunconditionally. If the watcher's reload reads the metas for commit N, the explicit reload after commit N+1 then stores N+1, and the watcher finishes last, the reader goes back to N and the chunk just indexed disappears from search until the next reload.This came up in #1131's local full workspace run (Linux x86_64, 2 CPUs, PostgreSQL 16/pgvector): a chat citation regression could not find a chunk it had just indexed.
The reader now uses
ReloadPolicy::Manual. Nothing that was visible before stops being visible: the server holds the index's onlyIndexWriter(Tantivy's directory lock rules out a second one), and every commit through it is already followed by an explicit reload. A comment above the builder says why.Not run locally on this branch: I don't build Rust on this machine, so CI's
cargo test --workspaceis the check. The change is the reader construction only; the existing citation and search tests cover reads after writes. There is no deterministic test for the race, because it depends on the watcher thread's timing.