From c540e4b6e5412a14545cc17dde4ff0d531c8b6bb Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 1 Apr 2022 05:08:08 +0000 Subject: [PATCH] Do not save while loading --- src/replication.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/replication.cpp b/src/replication.cpp index 7cb9851d2..cc4ffbaed 100644 --- a/src/replication.cpp +++ b/src/replication.cpp @@ -1274,6 +1274,11 @@ int startBgsaveForReplication(int mincapa) { listIter li; listNode *ln; + if (g_pserver->loading && g_pserver->fActiveReplica) { + serverLog(LL_NOTICE, "Can't bgsave while loading in active replication mode"); + return C_ERR; + } + serverLog(LL_NOTICE,"Starting BGSAVE for SYNC with target: %s", socket_target ? "replicas sockets" : "disk"); @@ -4781,7 +4786,7 @@ void replicationCron(void) { } /* Check if we should connect to a MASTER */ - if (mi->repl_state == REPL_STATE_CONNECT && !fInMasterConnection) { + if (mi->repl_state == REPL_STATE_CONNECT && !fInMasterConnection && !g_pserver->loading && !g_pserver->FRdbSaveInProgress()) { serverLog(LL_NOTICE,"Connecting to MASTER %s:%d", mi->masterhost, mi->masterport); connectWithMaster(mi);