diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2021-07-31 09:50:26 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2021-07-31 09:50:26 +0300 |
commit | 317632f3073fc06047a42075eb5e28a9577a4f96 (patch) | |
tree | a9d01818156027ccafe91e2110feadb9c012b8d4 /src/backend/access | |
parent | 4fe8dcdff3af73f6ca16eb3edfa3339c7ee0d2c4 (diff) | |
download | postgresql-317632f3073fc06047a42075eb5e28a9577a4f96.tar.gz postgresql-317632f3073fc06047a42075eb5e28a9577a4f96.zip |
Move InRecovery and standbyState global vars to xlogutils.c.
They are used in code that runs both during normal operation and during
WAL replay, and needs to behave differently during replay. Move them to
xlogutils.c, because that's where we have other helper functions used by
redo routines.
Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/heap/visibilitymap.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/commit_ts.c | 1 | ||||
-rw-r--r-- | src/backend/access/transam/multixact.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/slru.c | 1 | ||||
-rw-r--r-- | src/backend/access/transam/varsup.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/xlog.c | 16 | ||||
-rw-r--r-- | src/backend/access/transam/xlogutils.c | 20 |
7 files changed, 25 insertions, 19 deletions
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index 4720b35ee5c..114fbbdd307 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -88,7 +88,7 @@ #include "access/heapam_xlog.h" #include "access/visibilitymap.h" -#include "access/xlog.h" +#include "access/xlogutils.h" #include "miscadmin.h" #include "port/pg_bitutils.h" #include "storage/bufmgr.h" diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c index 0985fa155ca..42ea8e53f2c 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -28,6 +28,7 @@ #include "access/htup_details.h" #include "access/slru.h" #include "access/transam.h" +#include "access/xlogutils.h" #include "catalog/pg_type.h" #include "funcapi.h" #include "miscadmin.h" diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index b643564f16a..e6c70ed0bc2 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -74,8 +74,8 @@ #include "access/twophase.h" #include "access/twophase_rmgr.h" #include "access/xact.h" -#include "access/xlog.h" #include "access/xloginsert.h" +#include "access/xlogutils.h" #include "catalog/pg_type.h" #include "commands/dbcommands.h" #include "funcapi.h" diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c index 82149ad7821..7585ae24ce9 100644 --- a/src/backend/access/transam/slru.c +++ b/src/backend/access/transam/slru.c @@ -54,6 +54,7 @@ #include "access/slru.h" #include "access/transam.h" #include "access/xlog.h" +#include "access/xlogutils.h" #include "miscadmin.h" #include "pgstat.h" #include "storage/fd.h" diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 5b4898bb786..a6e98e71bd1 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -18,7 +18,7 @@ #include "access/subtrans.h" #include "access/transam.h" #include "access/xact.h" -#include "access/xlog.h" +#include "access/xlogutils.h" #include "commands/dbcommands.h" #include "miscadmin.h" #include "postmaster/autovacuum.h" diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 1e601d6282f..efb3ca273ed 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -193,22 +193,6 @@ CheckpointStatsData CheckpointStats; */ TimeLineID ThisTimeLineID = 0; -/* - * Are we doing recovery from XLOG? - * - * This is only ever true in the startup process; it should be read as meaning - * "this process is replaying WAL records", rather than "the system is in - * recovery mode". It should be examined primarily by functions that need - * to act differently when called from a WAL redo function (e.g., to skip WAL - * logging). To check whether the system is in recovery regardless of which - * process you're running in, use RecoveryInProgress() but only after shared - * memory startup and lock initialization. - */ -bool InRecovery = false; - -/* Are we in Hot Standby mode? Only valid in startup process, see xlog.h */ -HotStandbyState standbyState = STANDBY_DISABLED; - static XLogRecPtr LastRec; /* Local copy of WalRcv->flushedUpto */ diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index d17d660f460..b1702bc6bef 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -25,6 +25,7 @@ #include "access/xlogutils.h" #include "miscadmin.h" #include "pgstat.h" +#include "storage/fd.h" #include "storage/smgr.h" #include "utils/guc.h" #include "utils/hsearch.h" @@ -35,6 +36,25 @@ bool ignore_invalid_pages = false; /* + * Are we doing recovery from XLOG? + * + * This is only ever true in the startup process; it should be read as meaning + * "this process is replaying WAL records", rather than "the system is in + * recovery mode". It should be examined primarily by functions that need + * to act differently when called from a WAL redo function (e.g., to skip WAL + * logging). To check whether the system is in recovery regardless of which + * process you're running in, use RecoveryInProgress() but only after shared + * memory startup and lock initialization. + * + * This is updated from xlog.c, but lives here because it's mostly read by + * WAL redo functions. + */ +bool InRecovery = false; + +/* Are we in Hot Standby mode? Only valid in startup process, see xlogutils.h */ +HotStandbyState standbyState = STANDBY_DISABLED; + +/* * During XLOG replay, we may see XLOG records for incremental updates of * pages that no longer exist, because their relation was later dropped or * truncated. (Note: this is only possible when full_page_writes = OFF, |