diff options
author | Alexander Korotkov | 2024-10-24 11:37:53 +0000 |
---|---|---|
committer | Alexander Korotkov | 2024-10-24 11:37:53 +0000 |
commit | 5035172e4ab58e4e8eef1bc60b0712fc59e0be31 (patch) | |
tree | cfdb3a6caf509c3c1711e5a2ad379c90caee1a36 /src/include/commands | |
parent | b85a9d046efdd27775cbe7db9e92aad96aab4ada (diff) |
Move LSN waiting declarations and definitions to better place
3c5db1d6b implemented the pg_wal_replay_wait() stored procedure. Due to
the patch development history, the implementation resided in
src/backend/commands/waitlsn.c (src/include/commands/waitlsn.h for headers).
014f9f34d moved pg_wal_replay_wait() itself to
src/backend/access/transam/xlogfuncs.c near to the WAL-manipulation functions.
But most of the implementation stayed in place.
The code in src/backend/commands/waitlsn.c has nothing to do with commands,
but is related to WAL. So, this commit moves this code into
src/backend/access/transam/xlogwait.c (src/include/access/xlogwait.h for
headers).
Reported-by: Peter Eisentraut
Discussion: https://postgr.es/m/18c0fa64-0475-415e-a1bd-665d922c5201%40eisentraut.org
Reviewed-by: Pavel Borisov
Diffstat (limited to 'src/include/commands')
-rw-r--r-- | src/include/commands/waitlsn.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/include/commands/waitlsn.h b/src/include/commands/waitlsn.h deleted file mode 100644 index bb5ac858dcc..00000000000 --- a/src/include/commands/waitlsn.h +++ /dev/null @@ -1,81 +0,0 @@ -/*------------------------------------------------------------------------- - * - * waitlsn.h - * Declarations for LSN replay waiting routines. - * - * Copyright (c) 2024, PostgreSQL Global Development Group - * - * src/include/commands/waitlsn.h - * - *------------------------------------------------------------------------- - */ -#ifndef WAIT_LSN_H -#define WAIT_LSN_H - -#include "lib/pairingheap.h" -#include "postgres.h" -#include "port/atomics.h" -#include "storage/latch.h" -#include "storage/spin.h" -#include "tcop/dest.h" - -/* - * WaitLSNProcInfo - the shared memory structure representing information - * about the single process, which may wait for LSN replay. An item of - * waitLSN->procInfos array. - */ -typedef struct WaitLSNProcInfo -{ - /* LSN, which this process is waiting for */ - XLogRecPtr waitLSN; - - /* - * A pointer to the latch, which should be set once the waitLSN is - * replayed. - */ - Latch *latch; - - /* A pairing heap node for participation in waitLSNState->waitersHeap */ - pairingheap_node phNode; - - /* - * A flag indicating that this item is present in - * waitLSNState->waitersHeap - */ - bool inHeap; -} WaitLSNProcInfo; - -/* - * WaitLSNState - the shared memory state for the replay LSN waiting facility. - */ -typedef struct WaitLSNState -{ - /* - * The minimum LSN value some process is waiting for. Used for the - * fast-path checking if we need to wake up any waiters after replaying a - * WAL record. Could be read lock-less. Update protected by WaitLSNLock. - */ - pg_atomic_uint64 minWaitedLSN; - - /* - * A pairing heap of waiting processes order by LSN values (least LSN is - * on top). Protected by WaitLSNLock. - */ - pairingheap waitersHeap; - - /* - * An array with per-process information, indexed by the process number. - * Protected by WaitLSNLock. - */ - WaitLSNProcInfo procInfos[FLEXIBLE_ARRAY_MEMBER]; -} WaitLSNState; - -extern PGDLLIMPORT WaitLSNState *waitLSNState; - -extern Size WaitLSNShmemSize(void); -extern void WaitLSNShmemInit(void); -extern void WaitLSNSetLatches(XLogRecPtr currentLSN); -extern void WaitLSNCleanup(void); -extern void WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout); - -#endif /* WAIT_LSN_H */ |