Describe the bug

Sentinel publishing wrong master switch info on switch-master event, whereas the sentinel logs shows the correct master switch info.

To reproduce

Couldn't reproduce, this was detected with Jedis client as it subscribe for +switch-master. Problem happens when one of the 3 sentinels is down for patching and meanwhile master switches. And when the patched sentinel comes back up, it publishes +switch-master[problem always happened with this particular publish]

Expected behavior

Jedis client basically change the master, and try writing to replica.

Additional information

Any additional information that is relevant to the problem.

Comment From: enjoy-binbin

can you post the event and the sentinel logs?

Comment From: benimohit

Sentinel logs One running sentinel
17:X 20 Nov 2023 22:16:31.682 # +switch-master master-6371 ad1-fd1-401 6371 ad3-fd1-401 6371 Other Sentinel publishing +switch-master once its up 13:X 20 Nov 2023 22:27:53.117 # +switch-master master-6371 ad1-fd1-401 6371 ad3-fd1-401 6371

client switching the pool to a new master[Correctly] 20 Nov 2023 22:16:31.694 Created JedisSentinelPool to master at ad3-fd1-401:6371 client switching the pool to a new master[Incorrectly] 20 Nov 2023 22:27:53.132 Created JedisSentinelPool to master at ad1-fd1-401:6371

Comment From: benimohit

My suspicion is on Sentinel because we have been using the same jedis client version for almost 2 years now and started seeing this issue when we made infrastructure changes that allow one sentinel to be down during failover. Also, it's really hard to reproduce and when this happens it happens with all 10-15 of our clients using jedis.