Skip to content

Commit

Permalink
mqbblp::RecoveryMgr: Explain why reset sync peer early
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Jing Vincent Yan <[email protected]>
  • Loading branch information
kaikulimu committed Feb 5, 2025
1 parent d3f6e8a commit f4cbbb6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/groups/mqb/mqbblp/mqbblp_recoverymanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,13 +1430,18 @@ void RecoveryManager::onPartitionPrimarySyncStatus(int partitionId, int status)
&primarySyncCtx.primarySyncStatusEventHandle());

primarySyncCtx.partitionPrimarySyncCb()(partitionId, status);
primarySyncCtx.setPrimarySyncPeer(0);

if (primarySyncCtx.fileTransferInfo().areFilesMapped()) {
// Don't clear the 'primarySyncCtx' at this time because files are
// still mapped. It will be cleaned up when the chunk deleter
// eventually invokes 'partitionSyncCleanupDispatched' routine.

// However, we have already received all sync data chunks from the sync
// peer, so we can reset our sync peer to *null*. This prevents false
// alarm of primary sync failure if that peer happens to go down before
// 'partitionSyncCleanupDispatched' is invoked.
primarySyncCtx.setPrimarySyncPeer(0);

return; // RETURN
}

Expand Down

0 comments on commit f4cbbb6

Please sign in to comment.