From e5e1596cf711a7a52b529450401ad0d00285e05e Mon Sep 17 00:00:00 2001 From: alterego655 <824662526@qq.com> Date: Tue, 27 Jan 2026 13:59:29 +0800 Subject: [PATCH v3 2/3] Refactor: move XLogSource enum to xlogrecovery.h Move the XLogSource enum definition from xlogrecovery.c to the public header xlogrecovery.h to make it available for external use. This is preparation for exposing WAL source information via the pg_stat_recovery view. The xlogSourceNames array remains in the implementation file as it's only used for debugging output. No functional change. --- src/backend/access/transam/xlogrecovery.c | 12 ------------ src/include/access/xlogrecovery.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index 31806dcf008..680caee7a43 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -204,18 +204,6 @@ typedef struct XLogPageReadPrivate /* flag to tell XLogPageRead that we have started replaying */ static bool InRedo = false; -/* - * Codes indicating where we got a WAL file from during recovery, or where - * to attempt to get one. - */ -typedef enum -{ - XLOG_FROM_ANY = 0, /* request to read WAL from any source */ - XLOG_FROM_ARCHIVE, /* restored using restore_command */ - XLOG_FROM_PG_WAL, /* existing file in pg_wal */ - XLOG_FROM_STREAM, /* streamed from primary */ -} XLogSource; - /* human-readable names for XLogSources, for debugging output */ static const char *const xlogSourceNames[] = {"any", "archive", "pg_wal", "stream"}; diff --git a/src/include/access/xlogrecovery.h b/src/include/access/xlogrecovery.h index 3d1ee491f39..514595f0ee6 100644 --- a/src/include/access/xlogrecovery.h +++ b/src/include/access/xlogrecovery.h @@ -61,6 +61,18 @@ typedef enum RecoveryPauseState RECOVERY_PAUSED, /* recovery is paused */ } RecoveryPauseState; +/* + * Codes indicating where we got a WAL file from during recovery, or where + * to attempt to get one. + */ +typedef enum XLogSource +{ + XLOG_FROM_ANY = 0, /* request to read WAL from any source */ + XLOG_FROM_ARCHIVE, /* restored using restore_command */ + XLOG_FROM_PG_WAL, /* existing file in pg_wal */ + XLOG_FROM_STREAM, /* streamed from primary */ +} XLogSource; + /* * Shared-memory state for WAL recovery. */ -- 2.51.0