Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit317632f

Browse files
committed
Move InRecovery and standbyState global vars to xlogutils.c.
They are used in code that runs both during normal operation and duringWAL replay, and needs to behave differently during replay. Move them toxlogutils.c, because that's where we have other helper functions used byredo routines.Reviewed-by: Andres FreundDiscussion:https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi
1 parent4fe8dcd commit317632f

File tree

17 files changed

+75
-67
lines changed

17 files changed

+75
-67
lines changed

‎src/backend/access/heap/visibilitymap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
#include"access/heapam_xlog.h"
9090
#include"access/visibilitymap.h"
91-
#include"access/xlog.h"
91+
#include"access/xlogutils.h"
9292
#include"miscadmin.h"
9393
#include"port/pg_bitutils.h"
9494
#include"storage/bufmgr.h"

‎src/backend/access/transam/commit_ts.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include"access/htup_details.h"
2929
#include"access/slru.h"
3030
#include"access/transam.h"
31+
#include"access/xlogutils.h"
3132
#include"catalog/pg_type.h"
3233
#include"funcapi.h"
3334
#include"miscadmin.h"

‎src/backend/access/transam/multixact.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@
7474
#include"access/twophase.h"
7575
#include"access/twophase_rmgr.h"
7676
#include"access/xact.h"
77-
#include"access/xlog.h"
7877
#include"access/xloginsert.h"
78+
#include"access/xlogutils.h"
7979
#include"catalog/pg_type.h"
8080
#include"commands/dbcommands.h"
8181
#include"funcapi.h"

‎src/backend/access/transam/slru.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include"access/slru.h"
5555
#include"access/transam.h"
5656
#include"access/xlog.h"
57+
#include"access/xlogutils.h"
5758
#include"miscadmin.h"
5859
#include"pgstat.h"
5960
#include"storage/fd.h"

‎src/backend/access/transam/varsup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include"access/subtrans.h"
1919
#include"access/transam.h"
2020
#include"access/xact.h"
21-
#include"access/xlog.h"
21+
#include"access/xlogutils.h"
2222
#include"commands/dbcommands.h"
2323
#include"miscadmin.h"
2424
#include"postmaster/autovacuum.h"

‎src/backend/access/transam/xlog.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,6 @@ CheckpointStatsData CheckpointStats;
193193
*/
194194
TimeLineIDThisTimeLineID=0;
195195

196-
/*
197-
* Are we doing recovery from XLOG?
198-
*
199-
* This is only ever true in the startup process; it should be read as meaning
200-
* "this process is replaying WAL records", rather than "the system is in
201-
* recovery mode". It should be examined primarily by functions that need
202-
* to act differently when called from a WAL redo function (e.g., to skip WAL
203-
* logging). To check whether the system is in recovery regardless of which
204-
* process you're running in, use RecoveryInProgress() but only after shared
205-
* memory startup and lock initialization.
206-
*/
207-
boolInRecovery= false;
208-
209-
/* Are we in Hot Standby mode? Only valid in startup process, see xlog.h */
210-
HotStandbyStatestandbyState=STANDBY_DISABLED;
211-
212196
staticXLogRecPtrLastRec;
213197

214198
/* Local copy of WalRcv->flushedUpto */

‎src/backend/access/transam/xlogutils.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include"access/xlogutils.h"
2626
#include"miscadmin.h"
2727
#include"pgstat.h"
28+
#include"storage/fd.h"
2829
#include"storage/smgr.h"
2930
#include"utils/guc.h"
3031
#include"utils/hsearch.h"
@@ -34,6 +35,25 @@
3435
/* GUC variable */
3536
boolignore_invalid_pages= false;
3637

38+
/*
39+
* Are we doing recovery from XLOG?
40+
*
41+
* This is only ever true in the startup process; it should be read as meaning
42+
* "this process is replaying WAL records", rather than "the system is in
43+
* recovery mode". It should be examined primarily by functions that need
44+
* to act differently when called from a WAL redo function (e.g., to skip WAL
45+
* logging). To check whether the system is in recovery regardless of which
46+
* process you're running in, use RecoveryInProgress() but only after shared
47+
* memory startup and lock initialization.
48+
*
49+
* This is updated from xlog.c, but lives here because it's mostly read by
50+
* WAL redo functions.
51+
*/
52+
boolInRecovery= false;
53+
54+
/* Are we in Hot Standby mode? Only valid in startup process, see xlogutils.h */
55+
HotStandbyStatestandbyState=STANDBY_DISABLED;
56+
3757
/*
3858
* During XLOG replay, we may see XLOG records for incremental updates of
3959
* pages that no longer exist, because their relation was later dropped or

‎src/backend/commands/tablespace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
#include"access/sysattr.h"
5757
#include"access/tableam.h"
5858
#include"access/xact.h"
59-
#include"access/xlog.h"
6059
#include"access/xloginsert.h"
60+
#include"access/xlogutils.h"
6161
#include"catalog/catalog.h"
6262
#include"catalog/dependency.h"
6363
#include"catalog/indexing.h"

‎src/backend/postmaster/startup.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include"postgres.h"
2121

2222
#include"access/xlog.h"
23+
#include"access/xlogutils.h"
2324
#include"libpq/pqsignal.h"
2425
#include"miscadmin.h"
2526
#include"pgstat.h"

‎src/backend/storage/buffer/bufmgr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include<unistd.h>
3535

3636
#include"access/tableam.h"
37-
#include"access/xlog.h"
37+
#include"access/xlogutils.h"
3838
#include"catalog/catalog.h"
3939
#include"catalog/storage.h"
4040
#include"executor/instrument.h"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp