Describe the bug suppose we have a slave change the role frequently, like slave->master->slave->master In principle, if a slave node is elected as a master, it cannot succeed in the second election within twice the time, but in our test, if it becomes a slave and initiates another election, then it can succeed in the election , without asking for votes and self-increasing epoch。
To reproduce suppose cluster timeout is 15s; the node1 of port 51002 is master , the node2 of port 51003 is slave
redis-cli -p 51003 cluster failover sleep 14s; redis-cli -p 51002 cluster failover sleep 14s; redis-cli -p 51003 cluster failover sleep 14s;
then node1 has initiated two elections round in 2*timeout, and both round it has wonned election, but can not change to master , it will fullsync again as a slave role , the egative impact is that the slave will fullsync again
Expected behavior if node has initiated two elections round in 2*timeout ,if it win in first time, it should not win election in second time
Additional information LOG: 4018:S 07 Apr 2021 17:08:15.364 # Manual failover user request accepted. 4018:S 07 Apr 2021 17:08:15.364 # Received replication offset for paused master manual failover: 112 4018:S 07 Apr 2021 17:08:15.364 # All master replication stream processed, manual failover can start. 4018:S 07 Apr 2021 17:08:15.364 # Failover election won: I'm the new master.