Skip to content

Commit

Permalink
Try to fix the test
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin <[email protected]>
  • Loading branch information
enjoy-binbin committed Mar 4, 2025
1 parent 7a38a41 commit 6bbe4b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3516,18 +3516,17 @@ int clusterProcessPacket(clusterLink *link) {
/* Primary turned into a replica! Reconfigure the node. */
if (sender_claimed_primary && areInSameShard(sender_claimed_primary, sender)) {
/* `sender` was a primary and was in the same shard as its new primary */
if (nodeIsPrimary(sender_claimed_primary) &&
sender_claimed_primary->configEpoch > sender_claimed_config_epoch) {
if (nodeEpoch(sender_claimed_primary) > sender_claimed_config_epoch) {
serverLog(LL_NOTICE,
"Ignore stale message from %.40s (%s) in shard %.40s;"
" gossip config epoch: %llu, current config epoch: %llu",
sender->name, sender->human_nodename, sender->shard_id,
(unsigned long long)sender_claimed_config_epoch,
(unsigned long long)sender_claimed_primary->configEpoch);
(unsigned long long)nodeEpoch(sender_claimed_primary));
/* This packet is stale so we avoid processing it anymore. Otherwise
* this may cause a primary-replica chain issue. */
return 1;
} else {
} else if (nodeIsReplica(sender_claimed_primary)) {
/* `primary` is still a `replica` in this observer node's view;
* update its role and configEpoch */
clusterSetNodeAsPrimary(sender_claimed_primary);
Expand Down

0 comments on commit 6bbe4b0

Please sign in to comment.