aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-10-27 13:54:20 +0900
committerMichael Paquier <michael@paquier.xyz>2019-10-27 13:54:20 +0900
commit9f0172bba75028a7a5b1a470406adcc2af0f3b86 (patch)
tree670c07a4fc308f45e2f4b6a3157a08f0c35ef64f
parent63ebe2009145347680eefd240d2a690fdcdbccdf (diff)
downloadpostgresql-9f0172bba75028a7a5b1a470406adcc2af0f3b86.tar.gz
postgresql-9f0172bba75028a7a5b1a470406adcc2af0f3b86.zip
Fix initialization of fake LSN for unlogged relations
9155580 has changed the value of the first fake LSN for unlogged relations from 1 to FirstNormalUnloggedLSN (aka 1000), GiST requiring a non-zero LSN on some pages to allow an interlocking logic to work, but its value was still initialized to 1 at the beginning of recovery or after running pg_resetwal. This fixes the initialization for both code paths. Author: Takayuki Tsunakawa Reviewed-by: Dilip Kumar, Kyotaro Horiguchi, Michael Paquier Discussion: https://postgr.es/m/OSBPR01MB2503CE851940C17DE44AE3D9FE6F0@OSBPR01MB2503.jpnprd01.prod.outlook.com Backpatch-through: 12
-rw-r--r--src/backend/access/transam/xlog.c2
-rw-r--r--src/bin/pg_resetwal/pg_resetwal.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index e01a0780b84..1a870422235 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6683,7 +6683,7 @@ StartupXLOG(void)
if (ControlFile->state == DB_SHUTDOWNED)
XLogCtl->unloggedLSN = ControlFile->unloggedLSN;
else
- XLogCtl->unloggedLSN = 1;
+ XLogCtl->unloggedLSN = FirstNormalUnloggedLSN;
/*
* We must replay WAL entries using the same TimeLineID they were created
diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c
index 2734f873187..349347593cf 100644
--- a/src/bin/pg_resetwal/pg_resetwal.c
+++ b/src/bin/pg_resetwal/pg_resetwal.c
@@ -706,7 +706,7 @@ GuessControlValues(void)
ControlFile.state = DB_SHUTDOWNED;
ControlFile.time = (pg_time_t) time(NULL);
ControlFile.checkPoint = ControlFile.checkPointCopy.redo;
- ControlFile.unloggedLSN = 1;
+ ControlFile.unloggedLSN = FirstNormalUnloggedLSN;
/* minRecoveryPoint, backupStartPoint and backupEndPoint can be left zero */