Skip to content

Fix copy-paste bug in disk-based replica sync sending wrong AOF address#1633

Merged
vazois merged 1 commit intovazois/mmrt-devfrom
vazois/fix-sr-no-checkpoint-restart
Mar 16, 2026
Merged

Fix copy-paste bug in disk-based replica sync sending wrong AOF address#1633
vazois merged 1 commit intovazois/mmrt-devfrom
vazois/fix-sr-no-checkpoint-restart

Conversation

@vazois
Copy link
Contributor

@vazois vazois commented Mar 16, 2026

Problem

ClusterSRNoCheckpointRestartSecondary tests fail because the replica remains stuck at AOF offset 64 (kFirstValidAofAddress) after restart, never syncing with the primary.

Error: [127.0.0.1:7000]: 1,140288 != [127.0.0.1:7001]: 1,64

Root Cause

Copy-paste bug in ReplicaDiskbasedSync.TryReplicateDiskbasedSync() introduced in commit 6fb99e58 when converting from ToByteArray() to Span-based calls. The aofTailAddress parameter was accidentally set to beginAddress.Span instead of tailAddress.Span.

The primary uses the replica's tail address in ComputeAofSyncReplayAddress() to determine the AOF sync replay range. With both parameters being the begin address, the primary couldn't determine where the replica's AOF ended, so the replica never received AOF records after restart.

Fix

One-line fix: beginAddress.Span to tailAddress.Span for the aofTailAddress parameter of ExecuteClusterInitiateReplicaSync.

Testing

All 4 ClusterReplicationTLS.ClusterSRNoCheckpointRestartSecondary variants now pass.

…k-based replica sync

In TryReplicateDiskbasedSync, ExecuteClusterInitiateReplicaSync was
sending beginAddress.Span for both the aofBeginAddress and aofTailAddress
parameters. This was introduced in commit 6fb99e5 when converting from
ToByteArray() to Span-based calls.

The primary uses the replica's tail address to compute the AOF sync replay
range. With both parameters being the begin address, the primary couldn't
determine where the replica's AOF actually ended, causing the replica to
never receive AOF records and remain stuck at offset 64 (kFirstValidAofAddress).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vazois vazois merged commit 3bbec09 into vazois/mmrt-dev Mar 16, 2026
1 check passed
@vazois vazois deleted the vazois/fix-sr-no-checkpoint-restart branch March 16, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant