]> granicus.if.org Git - postgresql/commitdiff
Fix initialization of fake LSN for unlogged relations master github/master
authorMichael Paquier <michael@paquier.xyz>
Sun, 27 Oct 2019 04:54:12 +0000 (13:54 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sun, 27 Oct 2019 04:54:12 +0000 (13:54 +0900)
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

src/backend/access/transam/xlog.c
src/bin/pg_resetwal/pg_resetwal.c

index 46d41318992dae7fb92646cc1398062902e008b2..2e3cc510060b63aa46040331bfb8a43c41d4a3e5 100644 (file)
@@ -6687,7 +6687,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
index c83f865246c6b547cfb657946d9a454a0f24ab3e..c4ee0168a918f598b80778e7f3e16f317ea4cfa8 100644 (file)
@@ -699,7 +699,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 */