diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-17 03:10:33 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-02-17 03:10:33 +0000 |
commit | c64339face6e9abd041ab58ade2aceb48a9f4956 (patch) | |
tree | 36496185d3ecc39934b5f551ab2d557bc17ded01 /src/backend/access/transam/xlog.c | |
parent | 711804fddd54ea3c20d32c4b53d05a8c59bcbe4f (diff) | |
download | postgresql-c64339face6e9abd041ab58ade2aceb48a9f4956.tar.gz postgresql-c64339face6e9abd041ab58ade2aceb48a9f4956.zip |
When updating ShmemVariableCache from a checkpoint record, be sure to set
all the values derived from oldestXid, not just that field. Brain fade in
one of my patches associated with flat file removal, exposed by a report
from Fujii Masao.
With this change, xidVacLimit should always be valid, so remove a couple of
bits of complexity associated with the previous assumption that sometimes
it wouldn't get set right away.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index e7b4516ee94..3c1b077c5af 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.373 2010/02/12 09:49:08 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.374 2010/02/17 03:10:33 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -4761,8 +4761,7 @@ BootStrapXLOG(void) ShmemVariableCache->nextOid = checkPoint.nextOid; ShmemVariableCache->oidCount = 0; MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); - ShmemVariableCache->oldestXid = checkPoint.oldestXid; - ShmemVariableCache->oldestXidDB = checkPoint.oldestXidDB; + SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB); /* Set up the XLOG page header */ page->xlp_magic = XLOG_PAGE_MAGIC; @@ -5597,8 +5596,7 @@ StartupXLOG(void) ShmemVariableCache->nextOid = checkPoint.nextOid; ShmemVariableCache->oidCount = 0; MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); - ShmemVariableCache->oldestXid = checkPoint.oldestXid; - ShmemVariableCache->oldestXidDB = checkPoint.oldestXidDB; + SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB); /* * We must replay WAL entries using the same TimeLineID they were created @@ -7447,8 +7445,7 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record) ShmemVariableCache->oidCount = 0; MultiXactSetNextMXact(checkPoint.nextMulti, checkPoint.nextMultiOffset); - ShmemVariableCache->oldestXid = checkPoint.oldestXid; - ShmemVariableCache->oldestXidDB = checkPoint.oldestXidDB; + SetTransactionIdLimit(checkPoint.oldestXid, checkPoint.oldestXidDB); /* Check to see if any changes to max_connections give problems */ if (standbyState != STANDBY_DISABLED) @@ -7502,10 +7499,8 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record) checkPoint.nextMultiOffset); if (TransactionIdPrecedes(ShmemVariableCache->oldestXid, checkPoint.oldestXid)) - { - ShmemVariableCache->oldestXid = checkPoint.oldestXid; - ShmemVariableCache->oldestXidDB = checkPoint.oldestXidDB; - } + SetTransactionIdLimit(checkPoint.oldestXid, + checkPoint.oldestXidDB); /* ControlFile->checkPointCopy always tracks the latest ckpt XID */ ControlFile->checkPointCopy.nextXidEpoch = checkPoint.nextXidEpoch; |