Add log about old primary after myself failover (#1058)

Sometims it is hard to see the old primary during a
multi primaries failover, adding this log can help
use to find the old primary node.

Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Ping Xie <pingxie@outlook.com>
This commit is contained in:
Binbin 2024-09-20 14:15:19 +08:00 committed by GitHub
parent 56fd97733b
commit 7fab15795f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4476,7 +4476,10 @@ void clusterFailoverReplaceYourPrimary(void) {
if (clusterNodeIsPrimary(myself) || old_primary == NULL) return;
/* 1) Turn this node into a primary . */
serverLog(LL_NOTICE, "Setting myself to primary in shard %.40s after failover; my old primary is %.40s (%s)",
myself->shard_id, old_primary->name, old_primary->human_nodename);
/* 1) Turn this node into a primary. */
clusterSetNodeAsPrimary(myself);
replicationUnsetPrimary();