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
This commit is contained in:
Alexander Korotkov 2024-10-24 14:37:53 +03:00
parent b85a9d046e
commit 5035172e4a
12 changed files with 18 additions and 18 deletions

View File

@ -36,7 +36,8 @@ OBJS = \
xlogreader.o \
xlogrecovery.o \
xlogstats.o \
xlogutils.o
xlogutils.o \
xlogwait.o
include $(top_srcdir)/src/backend/common.mk

View File

@ -24,6 +24,7 @@ backend_sources += files(
'xlogrecovery.c',
'xlogstats.c',
'xlogutils.c',
'xlogwait.c',
)
# used by frontend programs to build a frontend xlogreader

View File

@ -31,6 +31,7 @@
#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"
@ -38,7 +39,6 @@
#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"

View File

@ -62,11 +62,11 @@
#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"

View File

@ -22,8 +22,8 @@
#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"

View File

@ -40,10 +40,10 @@
#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"

View File

@ -1,13 +1,13 @@
/*-------------------------------------------------------------------------
*
* 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
*
*-------------------------------------------------------------------------
*/
@ -20,7 +20,7 @@
#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"

View File

@ -61,7 +61,6 @@ OBJS = \
vacuum.o \
vacuumparallel.o \
variable.o \
view.o \
waitlsn.o
view.o
include $(top_srcdir)/src/backend/common.mk

View File

@ -50,5 +50,4 @@ backend_sources += files(
'vacuumparallel.c',
'variable.c',
'view.c',
'waitlsn.c',
)

View File

@ -24,8 +24,8 @@
#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"

View File

@ -36,7 +36,7 @@
#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"

View File

@ -1,16 +1,16 @@
/*-------------------------------------------------------------------------
*
* 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"
@ -78,4 +78,4 @@ extern void WaitLSNSetLatches(XLogRecPtr currentLSN);
extern void WaitLSNCleanup(void);
extern void WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout);
#endif /* WAIT_LSN_H */
#endif /* XLOG_WAIT_H */