xlogarchive.c: Make TLI a parameter for XLogArchiveNotifySeg().
authorRobert Haas <[email protected]>
Fri, 29 Oct 2021 17:28:09 +0000 (13:28 -0400)
committerRobert Haas <[email protected]>
Fri, 29 Oct 2021 17:38:50 +0000 (13:38 -0400)
This means we don't need to depend on ThisTimeLineID.

src/backend/access/transam/xlog.c
src/backend/access/transam/xlogarchive.c
src/include/access/xlogarchive.h

index 23a3d49f77091de40c3a08d095b804937a1ba366..53e31070e45d0afad5a7f92a24060fa03bbf3a60 100644 (file)
@@ -2641,7 +2641,7 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible)
                                LogwrtResult.Flush = LogwrtResult.Write;        /* end of page */
 
                                if (XLogArchivingActive())
-                                       XLogArchiveNotifySeg(openLogSegNo);
+                                       XLogArchiveNotifySeg(openLogSegNo, ThisTimeLineID);
 
                                XLogCtl->lastSegSwitchTime = (pg_time_t) time(NULL);
                                XLogCtl->lastSegSwitchLSN = LogwrtResult.Flush;
index 26b023e754b00309ec39285356c858d375e00433..7d56dad0def113dd687ae0b7ffa721e84a087e96 100644 (file)
@@ -498,11 +498,13 @@ XLogArchiveNotify(const char *xlog)
  * Convenience routine to notify using segment number representation of filename
  */
 void
-XLogArchiveNotifySeg(XLogSegNo segno)
+XLogArchiveNotifySeg(XLogSegNo segno, TimeLineID tli)
 {
        char            xlog[MAXFNAMELEN];
 
-       XLogFileName(xlog, ThisTimeLineID, segno, wal_segment_size);
+       Assert(tli != 0);
+
+       XLogFileName(xlog, tli, segno, wal_segment_size);
        XLogArchiveNotify(xlog);
 }
 
index 3edd1a976c1b48ba38a9778346e04bd49adbb75e..7dcf1bd2dd2e873451ba0d9c182dd1f76bd6ee8d 100644 (file)
@@ -24,7 +24,7 @@ extern void ExecuteRecoveryCommand(const char *command, const char *commandName,
                                                                   bool failOnSignal);
 extern void KeepFileRestoredFromArchive(const char *path, const char *xlogfname);
 extern void XLogArchiveNotify(const char *xlog);
-extern void XLogArchiveNotifySeg(XLogSegNo segno);
+extern void XLogArchiveNotifySeg(XLogSegNo segno, TimeLineID tli);
 extern void XLogArchiveForceDone(const char *xlog);
 extern bool XLogArchiveCheckDone(const char *xlog);
 extern bool XLogArchiveIsBusy(const char *xlog);