diff --git a/src/gausskernel/process/postmaster/pgarch.cpp b/src/gausskernel/process/postmaster/pgarch.cpp index ce3c82596..c75262630 100644 --- a/src/gausskernel/process/postmaster/pgarch.cpp +++ b/src/gausskernel/process/postmaster/pgarch.cpp @@ -127,6 +127,7 @@ static void initLastTaskLsn(); static bool SendArchiveThreadStatusInternal(bool is_archive_activited); static void SendArchiveThreadStatus(bool status); static bool NotifyPrimaryArchiverActived(ThreadId* last_walrcv_pid, bool* sent_archive_status); +static void NotifyPrimaryArchiverShutdown(bool sent_archive_status); static void ChangeArchiveTaskStatus2Done(); AlarmCheckResult DataInstArchChecker(Alarm* alarm, AlarmAdditionalParam* additionalParam) @@ -368,6 +369,7 @@ static void pgarch_MainLoop(void) t_thrd.arch.got_SIGHUP = false; ProcessConfigFile(PGC_SIGHUP); if (!XLogArchivingActive()) { + NotifyPrimaryArchiverShutdown(sent_archive_status); ereport(LOG, (errmsg("PgArchiver exit"))); return; } @@ -511,9 +513,7 @@ static void pgarch_MainLoop(void) * in the loop, the sent_archive_status will be set to true. We don't need to send the archive status when * the sent_archive_status is false, so we don't need to check the version number in this step. */ - if (sent_archive_status) { - SendArchiveThreadStatus(ARCHIVE_OFF); - } + NotifyPrimaryArchiverShutdown(sent_archive_status); } /* @@ -1224,6 +1224,13 @@ static bool NotifyPrimaryArchiverActived(ThreadId* last_walrcv_pid, bool* sent_a return false; } +static void NotifyPrimaryArchiverShutdown(bool sent_archive_status) +{ + if (sent_archive_status) { + SendArchiveThreadStatus(ARCHIVE_OFF); + } +} + static void ChangeArchiveTaskStatus2Done() { if (IsServerModeStandby()) { diff --git a/src/gausskernel/storage/replication/walrcvwriter.cpp b/src/gausskernel/storage/replication/walrcvwriter.cpp index 0fd7f891c..b819c3691 100644 --- a/src/gausskernel/storage/replication/walrcvwriter.cpp +++ b/src/gausskernel/storage/replication/walrcvwriter.cpp @@ -152,14 +152,14 @@ static void XLogWalRcvWrite(WalRcvCtlBlock *walrcb, char *buf, Size nbytes, XLog errmsg("could not close log file %s: %m", XLogFileNameP(t_thrd.xlog_cxt.ThisTimeLineID, recvSegNo)))); +#ifdef ENABLE_MULTIPLE_NODES /* * Create .done file forcibly to prevent the restored segment from * being archived again later. */ XLogFileName(xlogfname, recvFileTLI, recvSegNo); - if (!u_sess->attr.attr_common.XLogArchiveMode) { - XLogArchiveForceDone(xlogfname); - } + XLogArchiveForceDone(xlogfname); +#endif } recvFile = -1;