From 7fab15795f5d419acc284e002119190b00718881 Mon Sep 17 00:00:00 2001 From: Binbin Date: Fri, 20 Sep 2024 14:15:19 +0800 Subject: [PATCH] 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 Co-authored-by: Ping Xie --- src/cluster_legacy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cluster_legacy.c b/src/cluster_legacy.c index 469530adc..f14695666 100644 --- a/src/cluster_legacy.c +++ b/src/cluster_legacy.c @@ -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();