Repository navigation
fix(#9857): a replica's vector graph picks up vectors replicated after its first search - #9859
Conversation
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Up to standards ✅🟢 Issues
|
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…cated after its first search applyReplicatedPageUpdate() kept only the vector location index in step with replicated LSM_VECTOR pages. Unlike put()/remove() it queued no delta entry, counted no mutation and never promoted graphState, so a follower that had built its graph on an earlier search kept searching that graph forever, and a follower promoted to leader kept the same gap. Only a restart or REBUILD INDEX recovered. A replicated page now does what a local write does: an id the index has never seen is queued as a delta entry (no payload: deltaVectorOf() reads it from the page) and a newly tombstoned id counts as a removal, both as mutations, and graphState is promoted to MUTABLE. A page carries every entry it holds, so a re-applied page changes nothing. Compacted pages are left out: a compaction adds and removes no vector, and since ArcadeData#5870 its ids are renumbered. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
da0ef71 to
9ae0350
Compare
|
@claude review |
|
Claude finished @robfrank's task in 33s —— View job Review of PR #9859The fix is small and well targeted, and I think it is correct for the reported bug. I found no blocking issues. This is a read-only review of the diff and the surrounding What I checked
Points to consider (non-blocking)
Test
Process notes
Overall this looks good to merge once points 1 and 2 are answered. |
LSMVectorIndex.applyReplicatedPageUpdate conflict resolved to main's version: main already fixed ArcadeData#9857 (6928f57, 6473e14, fe238c8). The branch keeps Issue9857VectorReplicaSeesReplicatedInsertsIT, which passes against main's fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r its first search (#9859) applyReplicatedPageUpdate() kept only the vector location index in step with replicated LSM_VECTOR pages. Unlike put()/remove() it queued no delta entry, counted no mutation and never promoted graphState, so a follower that had built its graph on an earlier search kept searching that graph forever, and a follower promoted to leader kept the same gap. Only a restart or REBUILD INDEX recovered. A replicated page now does what a local write does: an id the index has never seen is queued as a delta entry (no payload: deltaVectorOf() reads it from the page) and a newly tombstoned id counts as a removal, both as mutations, and graphState is promoted to MUTABLE. A page carries every entry it holds, so a re-applied page changes nothing. Compacted pages are left out: a compaction adds and removes no vector, and since #5870 its ids are renumbered. Co-authored-by: robfrank <ro.franchini@gmail.com> (cherry picked from commit c3d6668)
What does this PR do?
It makes a follower's
LSM_VECTORgraph pick up vectors that are replicated after its first search.LSMVectorIndex.applyReplicatedPageUpdate()(called fromTransactionManager.applyChanges()) kept only the vector location index in step with a replicated page. A localput()/remove()also queues a delta entry, counts a mutation and promotesgraphStatetoMUTABLE. The replicated path did none of that, so:rebuildGraphBeforeSearch()never fired on a follower whose graph was already built;Only a restart or
REBUILD INDEXrecovered.A replicated page now does what a local write does:
deltaVectorOf()reads the vector from the page that was just written;graphStateis promoted toMUTABLEunder the index write lock, asput()does.Only genuinely new state counts. A page carries every entry it holds, not just the new ones, so "new" means an id that is neither live nor tombstoned before the page is applied. A re-applied page therefore changes nothing. Compacted pages are left out entirely: a compaction adds and removes no vector, and since #5870 its ids are renumbered.
Motivation
We hit this while evaluating ArcadeDB HA as a Neo4j replacement (Bolt plus
db.index.vector.queryNodes). After the second batch, both followers returned 0 of 50 newly inserted vectors by self-lookup, while the leader returned 50 of 50 andcount()matched on every node. Full reproduction in #9857.Related issues
Fixes #9857.
Related but different: #9428 / #9507 (vectors inserted on a follower) and #9758 (snapshot-installed vecgraph).
Additional Notes
Test.
Issue9857VectorReplicaSeesReplicatedInsertsIT(3 nodes,@Tag("slow")):It fails without the fix (
server 0 must find record 200 by its own embedding) and passes with it.Other verification:
*Vector*+*Compact*tests: 983/983.*Vector*,*Compaction*,*Snapshot*,Issue9428*,Issue9758*: 455/455.Things I'd like a maintainer's eye on:
put()takes on the leader inside commit. I saw no deadlock under stress, but you know the lock ordering withgraphBuildLockand the build paths better than a stress test can show.applyChanges()also runs during WAL recovery at startup, so replayed vector pages now take the same path. The restart tests pass.Pre-commit: the hooks that apply to Java files (trailing whitespace, final newline, line endings, BOM) were checked on every changed file.
pre-commititself was not run.Checklist
mvn clean packagecommand. Not the full reactor: I built and installed the touched modules (-pl ha-raft -am install) and ran the suites listed above.🤖 Generated with Claude Code
Summary by CodeRabbit