From 368d8270c838a6c328fc24418603cb172b5e0390 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Fri, 1 Nov 2024 13:47:24 +0200 Subject: [PATCH] Rename two functions that wake up other processes 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 | 4 ++-- src/backend/access/transam/xlogrecovery.c | 2 +- src/backend/access/transam/xlogwait.c | 2 +- src/backend/postmaster/walsummarizer.c | 4 ++-- src/include/access/xlogwait.h | 2 +- src/include/postmaster/walsummarizer.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 00fe8c8ae72..f14d3933aec 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -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). diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index 31caa49d6c3..869cb524082 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -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); diff --git a/src/backend/access/transam/xlogwait.c b/src/backend/access/transam/xlogwait.c index 9b8c2ae794f..4c489e4cea3 100644 --- a/src/backend/access/transam/xlogwait.c +++ b/src/backend/access/transam/xlogwait.c @@ -151,7 +151,7 @@ deleteLSNWaiter(void) * and set latches for all waiters. */ void -WaitLSNSetLatches(XLogRecPtr currentLSN) +WaitLSNWakeup(XLogRecPtr currentLSN) { int i; ProcNumber *wakeUpProcs; diff --git a/src/backend/postmaster/walsummarizer.c b/src/backend/postmaster/walsummarizer.c index ee6f1afc9af..48350bec524 100644 --- a/src/backend/postmaster/walsummarizer.c +++ b/src/backend/postmaster/walsummarizer.c @@ -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; diff --git a/src/include/access/xlogwait.h b/src/include/access/xlogwait.h index 7fd24c22bec..a77635eb97c 100644 --- a/src/include/access/xlogwait.h +++ b/src/include/access/xlogwait.h @@ -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); diff --git a/src/include/postmaster/walsummarizer.h b/src/include/postmaster/walsummarizer.h index aedca556764..2642aa701d7 100644 --- a/src/include/postmaster/walsummarizer.h +++ b/src/include/postmaster/walsummarizer.h @@ -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 -- 2.30.2