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 156ab99 commit be0d9ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/cluster_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -3516,17 +3516,18 @@ 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 (sender->configEpoch > sender_claimed_config_epoch) {
if (nodeIsPrimary(sender_claimed_primary) &&
sender_claimed_primary->configEpoch > 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->configEpoch);
(unsigned long long)sender_claimed_primary->configEpoch);
/* 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
3 changes: 3 additions & 0 deletions tests/cluster/cluster.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ proc wait_for_cluster_propagation {} {
wait_for_condition 1000 50 {
[cluster_config_consistent] eq 1
} else {
for {set j 0} {$j < [llength $::servers]} {incr j} {
puts "R $j cluster slots output: [R $j cluster slots]"
}
fail "cluster config did not reach a consistent state"
}
}
Expand Down
3 changes: 3 additions & 0 deletions tests/support/cluster_util.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ proc wait_for_cluster_propagation {} {
wait_for_condition 1000 50 {
[cluster_config_consistent] eq 1
} else {
for {set j 0} {$j < [llength $::servers]} {incr j} {
puts "R $j cluster slots output: [R $j cluster slots]"
}
fail "cluster config did not reach a consistent state"
}
}
Expand Down

0 comments on commit be0d9ba

Please sign in to comment.