Rename two functions that wake up other processes
authorHeikki Linnakangas <[email protected]>
Fri, 1 Nov 2024 11:47:24 +0000 (13:47 +0200)
committerHeikki Linnakangas <[email protected]>
Fri, 1 Nov 2024 11:47:24 +0000 (13:47 +0200)
Instead of talking about setting latches, which is a pretty low-level
mechanism, emphasize that they wake up other processes.

This is in preparation for replacing Latches with a new abstraction.
That's still work in progress, but this seems a little tidier anyway,
so let's get this refactoring out of the way already.

Discussion: https://www.postgresql.org/message-id/391abe21-413e-4d91-a650-b663af49500c%40iki.fi

src/backend/access/transam/xlog.c
src/backend/access/transam/xlogrecovery.c
src/backend/access/transam/xlogwait.c
src/backend/postmaster/walsummarizer.c
src/include/access/xlogwait.h
src/include/postmaster/walsummarizer.h

index 00fe8c8ae7241b42d9bd9bb70d515971bd3e5340..f14d3933aec28bd37ea460dcb186566b4595ce6f 100644 (file)
@@ -6178,7 +6178,7 @@ StartupXLOG(void)
     * Wake up all waiters for replay LSN.  They need to report an error that
     * recovery was ended before reaching the target LSN.
     */
-   WaitLSNSetLatches(InvalidXLogRecPtr);
+   WaitLSNWakeup(InvalidXLogRecPtr);
 
    /*
     * Shutdown the recovery environment.  This must occur after
@@ -7303,7 +7303,7 @@ CreateCheckPoint(int flags)
     * until after the above call that flushes the XLOG_CHECKPOINT_ONLINE
     * record.
     */
-   SetWalSummarizerLatch();
+   WakeupWalSummarizer();
 
    /*
     * Let smgr do post-checkpoint cleanup (eg, deleting old files).
index 31caa49d6c30883ff1ad3f11f9f2fa570f19bf41..869cb524082341f668405fa840ddc0ddd358bc82 100644 (file)
@@ -1837,7 +1837,7 @@ PerformWalRecovery(void)
            if (waitLSNState &&
                (XLogRecoveryCtl->lastReplayedEndRecPtr >=
                 pg_atomic_read_u64(&waitLSNState->minWaitedLSN)))
-               WaitLSNSetLatches(XLogRecoveryCtl->lastReplayedEndRecPtr);
+               WaitLSNWakeup(XLogRecoveryCtl->lastReplayedEndRecPtr);
 
            /* Else, try to fetch the next WAL record */
            record = ReadRecord(xlogprefetcher, LOG, false, replayTLI);
index 9b8c2ae794f272405ff9ba02cf0f8ad648f010ac..4c489e4cea31e8a7ba6293c359e65fc02ed9d727 100644 (file)
@@ -151,7 +151,7 @@ deleteLSNWaiter(void)
  * and set latches for all waiters.
  */
 void
-WaitLSNSetLatches(XLogRecPtr currentLSN)
+WaitLSNWakeup(XLogRecPtr currentLSN)
 {
    int         i;
    ProcNumber *wakeUpProcs;
index ee6f1afc9af82ec5a3def814748ba36c4152fc7b..48350bec524fc5beac858ee87e4d50a9e7a303cb 100644 (file)
@@ -626,7 +626,7 @@ GetOldestUnsummarizedLSN(TimeLineID *tli, bool *lsn_is_exact)
 }
 
 /*
- * Attempt to set the WAL summarizer's latch.
+ * Wake up the WAL summarizer process.
  *
  * This might not work, because there's no guarantee that the WAL summarizer
  * process was successfully started, and it also might have started but
@@ -634,7 +634,7 @@ GetOldestUnsummarizedLSN(TimeLineID *tli, bool *lsn_is_exact)
  * latch set, but there's no guarantee.
  */
 void
-SetWalSummarizerLatch(void)
+WakeupWalSummarizer(void)
 {
    ProcNumber  pgprocno;
 
index 7fd24c22bec561aa0e00e7e85dc13bf2c62ae44d..a77635eb97cce72862dafb4c193255547e826885 100644 (file)
@@ -82,7 +82,7 @@ extern PGDLLIMPORT WaitLSNState *waitLSNState;
 
 extern Size WaitLSNShmemSize(void);
 extern void WaitLSNShmemInit(void);
-extern void WaitLSNSetLatches(XLogRecPtr currentLSN);
+extern void WaitLSNWakeup(XLogRecPtr currentLSN);
 extern void WaitLSNCleanup(void);
 extern WaitLSNResult WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout);
 
index aedca556764c45e5b302ad15d40aa8341ee86736..2642aa701d71c8f4ca0ba8734f75c34028db707e 100644 (file)
@@ -29,7 +29,7 @@ extern void GetWalSummarizerState(TimeLineID *summarized_tli,
                                  int *summarizer_pid);
 extern XLogRecPtr GetOldestUnsummarizedLSN(TimeLineID *tli,
                                           bool *lsn_is_exact);
-extern void SetWalSummarizerLatch(void);
+extern void WakeupWalSummarizer(void);
 extern void WaitForWalSummarization(XLogRecPtr lsn);
 
 #endif