Do not save while loading

This commit is contained in:
John Sully 2022-04-01 05:08:08 +00:00
parent e941f16c37
commit c540e4b6e5

View File

@ -1274,6 +1274,11 @@ int startBgsaveForReplication(int mincapa) {
listIter li; listIter li;
listNode *ln; 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", serverLog(LL_NOTICE,"Starting BGSAVE for SYNC with target: %s",
socket_target ? "replicas sockets" : "disk"); socket_target ? "replicas sockets" : "disk");
@ -4781,7 +4786,7 @@ void replicationCron(void) {
} }
/* Check if we should connect to a MASTER */ /* 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", serverLog(LL_NOTICE,"Connecting to MASTER %s:%d",
mi->masterhost, mi->masterport); mi->masterhost, mi->masterport);
connectWithMaster(mi); connectWithMaster(mi);