Commit 51970fa8 authored by Michael Paquier's avatar Michael Paquier

Fix initialization of fake LSN for unlogged relations

9155580f 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
parent b8045213
...@@ -6687,7 +6687,7 @@ StartupXLOG(void) ...@@ -6687,7 +6687,7 @@ StartupXLOG(void)
if (ControlFile->state == DB_SHUTDOWNED) if (ControlFile->state == DB_SHUTDOWNED)
XLogCtl->unloggedLSN = ControlFile->unloggedLSN; XLogCtl->unloggedLSN = ControlFile->unloggedLSN;
else else
XLogCtl->unloggedLSN = 1; XLogCtl->unloggedLSN = FirstNormalUnloggedLSN;
/* /*
* We must replay WAL entries using the same TimeLineID they were created * We must replay WAL entries using the same TimeLineID they were created
......
...@@ -699,7 +699,7 @@ GuessControlValues(void) ...@@ -699,7 +699,7 @@ GuessControlValues(void)
ControlFile.state = DB_SHUTDOWNED; ControlFile.state = DB_SHUTDOWNED;
ControlFile.time = (pg_time_t) time(NULL); ControlFile.time = (pg_time_t) time(NULL);
ControlFile.checkPoint = ControlFile.checkPointCopy.redo; ControlFile.checkPoint = ControlFile.checkPointCopy.redo;
ControlFile.unloggedLSN = 1; ControlFile.unloggedLSN = FirstNormalUnloggedLSN;
/* minRecoveryPoint, backupStartPoint and backupEndPoint can be left zero */ /* minRecoveryPoint, backupStartPoint and backupEndPoint can be left zero */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment