3c5db1d6b implemented the pg_wal_replay_wait() stored procedure. Due to
the 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 EisentrautDiscussion: https://postgr.es/m/
18c0fa64-0475-415e-a1bd-
665d922c5201%40eisentraut.org
Reviewed-by: Pavel Borisov xlogreader.o \
xlogrecovery.o \
xlogstats.o \
- xlogutils.o
+ xlogutils.o \
+ xlogwait.o
include $(top_srcdir)/src/backend/common.mk
'xlogrecovery.c',
'xlogstats.c',
'xlogutils.c',
+ 'xlogwait.c',
)
# used by frontend programs to build a frontend xlogreader
#include "access/xloginsert.h"
#include "access/xlogrecovery.h"
#include "access/xlogutils.h"
+#include "access/xlogwait.h"
#include "catalog/index.h"
#include "catalog/namespace.h"
#include "catalog/pg_enum.h"
#include "commands/async.h"
#include "commands/tablecmds.h"
#include "commands/trigger.h"
-#include "commands/waitlsn.h"
#include "common/pg_prng.h"
#include "executor/spi.h"
#include "libpq/be-fsstubs.h"
#include "access/xlogreader.h"
#include "access/xlogrecovery.h"
#include "access/xlogutils.h"
+#include "access/xlogwait.h"
#include "backup/basebackup.h"
#include "catalog/catversion.h"
#include "catalog/pg_control.h"
#include "catalog/pg_database.h"
-#include "commands/waitlsn.h"
#include "common/controldata_utils.h"
#include "common/file_utils.h"
#include "executor/instrument.h"
#include "access/xlog_internal.h"
#include "access/xlogbackup.h"
#include "access/xlogrecovery.h"
+#include "access/xlogwait.h"
#include "catalog/pg_type.h"
-#include "commands/waitlsn.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "access/xlogreader.h"
#include "access/xlogrecovery.h"
#include "access/xlogutils.h"
+#include "access/xlogwait.h"
#include "backup/basebackup.h"
#include "catalog/pg_control.h"
#include "commands/tablespace.h"
-#include "commands/waitlsn.h"
#include "common/file_utils.h"
#include "miscadmin.h"
#include "pgstat.h"
/*-------------------------------------------------------------------------
*
- * waitlsn.c
+ * xlogwait.c
* Implements waiting for the given replay LSN, which is used in
* CALL pg_wal_replay_wait(target_lsn pg_lsn, timeout float8).
*
* Copyright (c) 2024, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * src/backend/commands/waitlsn.c
+ * src/backend/access/transam/xlogwait.c
*
*-------------------------------------------------------------------------
*/
#include "pgstat.h"
#include "access/xlog.h"
#include "access/xlogrecovery.h"
-#include "commands/waitlsn.h"
+#include "access/xlogwait.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "storage/latch.h"
vacuum.o \
vacuumparallel.o \
variable.o \
- view.o \
- waitlsn.o
+ view.o
include $(top_srcdir)/src/backend/common.mk
'vacuumparallel.c',
'variable.c',
'view.c',
- 'waitlsn.c',
)
#include "access/twophase.h"
#include "access/xlogprefetcher.h"
#include "access/xlogrecovery.h"
+#include "access/xlogwait.h"
#include "commands/async.h"
-#include "commands/waitlsn.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
#include "access/transam.h"
#include "access/twophase.h"
#include "access/xlogutils.h"
-#include "commands/waitlsn.h"
+#include "access/xlogwait.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
/*-------------------------------------------------------------------------
*
- * waitlsn.h
+ * xlogwait.h
* Declarations for LSN replay waiting routines.
*
* Copyright (c) 2024, PostgreSQL Global Development Group
*
- * src/include/commands/waitlsn.h
+ * src/include/access/xlogwait.h
*
*-------------------------------------------------------------------------
*/
-#ifndef WAIT_LSN_H
-#define WAIT_LSN_H
+#ifndef XLOG_WAIT_H
+#define XLOG_WAIT_H
#include "lib/pairingheap.h"
#include "postgres.h"
extern void WaitLSNCleanup(void);
extern void WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout);
-#endif /* WAIT_LSN_H */
+#endif /* XLOG_WAIT_H */