Keep the Vector Set replay channel alive across AofProcessor disposal - #1997
Draft
tiagonapoli wants to merge 1 commit into
Draft
Keep the Vector Set replay channel alive across AofProcessor disposal#1997tiagonapoli wants to merge 1 commit into
tiagonapoli wants to merge 1 commit into
Conversation
AofProcessor.Dispose called VectorManager.ShutdownReplayTasks, which is a permanent shutdown: it completes the replication replay channel writer and parks the replay tasks for good. The VectorManager, however, belongs to the database rather than to the processor, and a node constructs and disposes several AofProcessors over its lifetime. SingleDatabaseManager.ReplayAOF builds a transient one during startup AOF recovery, so on any node started with Recover enabled the channel was already closed before the node began serving. From that point HandleVectorSetAddReplication could no longer queue, and it discards whatever it cannot queue without logging, so the node silently dropped every VADD replicated to it while reporting healthy AOF offsets. Dispose now only drains. VectorManager.Dispose still performs the real shutdown when the database goes away. Adds ClusterVectorSetRecoveryTests, which restarts the replica, the primary, and both nodes with tryRecover enabled - the configuration that exposed this. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9cdb19eb-7ffa-44cb-ab05-566f44d79d70
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.
Problem
AofProcessor.Dispose()calledVectorManager.ShutdownReplayTasks(), which is a permanent shutdown — it completes the replication replay channel writer and parks the replay tasks for good.But the
VectorManagerbelongs to the database, not to the processor, and a node constructs and disposes severalAofProcessors over its lifetime.SingleDatabaseManager.ReplayAOFbuilds a transient one during startup AOF recovery.So on any node started with
Recoverenabled — a normal production replica config — the channel was already closed before the node began serving. From that pointHandleVectorSetAddReplicationcould no longer queue:It discards whatever it cannot queue, silently. The node dropped every VADD replicated to it while continuing to report healthy AOF offsets — silent data loss with no signal at all.
Fix
Dispose()now only drains.VectorManager.Dispose()still performs the real shutdown when the database goes away.Tests
Adds
ClusterVectorSetRecoveryTests, which restarts the replica, the primary, and both nodes withtryRecover: true— the configuration that exposed this.Note these tests also depend on #1996: without it, an aborted recovery leaves the store corrupt enough that a subsequent read dies with
AccessViolationExceptioninTsavoriteKV.TraceBackForKeyMatch, taking down the test host. That is why this is the top of the stack.Validation
Garnet.test.cluster.vectorsets80/80,replication.disklesssync28/28,replication103/103.ShutdownReplayTasks()is left public but now has no callers.