7
7
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
8
8
* Portions Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.73 2001/08/10 18:57:33 tgl Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.74 2001/08/23 23:06:37 tgl Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -2349,7 +2349,7 @@ BootStrapXLOG(void)
2349
2349
checkPoint .redo .xrecoff = SizeOfXLogPHD ;
2350
2350
checkPoint .undo = checkPoint .redo ;
2351
2351
checkPoint .ThisStartUpID = 0 ;
2352
- checkPoint .nextXid = FirstTransactionId ;
2352
+ checkPoint .nextXid = FirstNormalTransactionId ;
2353
2353
checkPoint .nextOid = BootstrapObjectIdData ;
2354
2354
checkPoint .time = time (NULL );
2355
2355
@@ -2508,7 +2508,7 @@ StartupXLOG(void)
2508
2508
wasShutdown ? "TRUE" : "FALSE" );
2509
2509
elog (LOG , "next transaction id: %u; next oid: %u" ,
2510
2510
checkPoint .nextXid , checkPoint .nextOid );
2511
- if (checkPoint .nextXid < FirstTransactionId )
2511
+ if (! TransactionIdIsNormal ( checkPoint .nextXid ) )
2512
2512
elog (STOP , "invalid next transaction id" );
2513
2513
2514
2514
ShmemVariableCache -> nextXid = checkPoint .nextXid ;
@@ -2550,8 +2550,10 @@ StartupXLOG(void)
2550
2550
if (XLByteLT (checkPoint .redo , RecPtr ))
2551
2551
record = ReadRecord (& (checkPoint .redo ), STOP , buffer );
2552
2552
else
2553
- /* read past CheckPoint record */
2553
+ {
2554
+ /* read past CheckPoint record */
2554
2555
record = ReadRecord (NULL , LOG , buffer );
2556
+ }
2555
2557
2556
2558
if (record != NULL )
2557
2559
{
@@ -2560,8 +2562,13 @@ StartupXLOG(void)
2560
2562
ReadRecPtr .xlogid , ReadRecPtr .xrecoff );
2561
2563
do
2562
2564
{
2563
- if (record -> xl_xid >= ShmemVariableCache -> nextXid )
2564
- ShmemVariableCache -> nextXid = record -> xl_xid + 1 ;
2565
+ /* nextXid must be beyond record's xid */
2566
+ if (TransactionIdFollowsOrEquals (record -> xl_xid ,
2567
+ ShmemVariableCache -> nextXid ))
2568
+ {
2569
+ ShmemVariableCache -> nextXid = record -> xl_xid ;
2570
+ TransactionIdAdvance (ShmemVariableCache -> nextXid );
2571
+ }
2565
2572
if (XLOG_DEBUG )
2566
2573
{
2567
2574
char buf [8192 ];
@@ -3101,7 +3108,8 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
3101
3108
3102
3109
memcpy (& checkPoint , XLogRecGetData (record ), sizeof (CheckPoint ));
3103
3110
/* In an ONLINE checkpoint, treat the counters like NEXTOID */
3104
- if (ShmemVariableCache -> nextXid < checkPoint .nextXid )
3111
+ if (TransactionIdPrecedes (ShmemVariableCache -> nextXid ,
3112
+ checkPoint .nextXid ))
3105
3113
ShmemVariableCache -> nextXid = checkPoint .nextXid ;
3106
3114
if (ShmemVariableCache -> nextOid < checkPoint .nextOid )
3107
3115
{
0 commit comments