From 715f832b005b425842b810a5971facc8e3d5f468 Mon Sep 17 00:00:00 2001 From: Malavan Sotheeswaran <105669860+msotheeswaran@users.noreply.github.com> Date: Wed, 8 Mar 2023 16:00:53 -0500 Subject: [PATCH] make connectWithMaster error message less confusing (#592) --- src/replication.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/replication.cpp b/src/replication.cpp index 58a27d1b9..28bb401b1 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -3797,9 +3797,11 @@ int connectWithMaster(redisMaster *mi) { connSetPrivateData(mi->repl_transfer_s, mi); if (connConnect(mi->repl_transfer_s, mi->masterhost, mi->masterport, NET_FIRST_BIND_ADDR, syncWithMaster) == C_ERR) { - int sev = g_pserver->enable_multimaster ? LL_NOTICE : LL_WARNING; // with multimaster its not unheard of to intentiallionall have downed masters - serverLog(sev,"Unable to connect to MASTER: %s", - connGetLastError(mi->repl_transfer_s)); + const char *err = "Unknown Error"; + if (mi->repl_transfer_s->last_errno != 0) + err = connGetLastError(mi->repl_transfer_s); + int sev = g_pserver->enable_multimaster ? LL_NOTICE : LL_WARNING; // with multimaster its not unheard of to intentionally have downed masters + serverLog(sev, "Unable to connect to MASTER: %s", err); connClose(mi->repl_transfer_s); mi->repl_transfer_s = NULL; return C_ERR;