Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc64339f

Browse files
committed
When updating ShmemVariableCache from a checkpoint record, be sure to set
all the values derived from oldestXid, not just that field. Brain fade inone of my patches associated with flat file removal, exposed by a reportfrom Fujii Masao.With this change, xidVacLimit should always be valid, so remove a couple ofbits of complexity associated with the previous assumption that sometimesit wouldn't get set right away.
1 parent711804f commitc64339f

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

‎src/backend/access/transam/varsup.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.88 2010/02/14 18:42:12 rhaas Exp $
9+
* $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.89 2010/02/17 03:10:33 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -71,13 +71,9 @@ GetNewTransactionId(bool isSubXact)
7171
* If we're past xidStopLimit, refuse to execute transactions, unless
7272
* we are running in a standalone backend (which gives an escape hatch
7373
* to the DBA who somehow got past the earlier defenses).
74-
*
75-
* Test is coded to fall out as fast as possible during normal operation,
76-
* ie, when the vac limit is set and we haven't violated it.
7774
*----------
7875
*/
79-
if (TransactionIdFollowsOrEquals(xid,ShmemVariableCache->xidVacLimit)&&
80-
TransactionIdIsValid(ShmemVariableCache->xidVacLimit))
76+
if (TransactionIdFollowsOrEquals(xid,ShmemVariableCache->xidVacLimit))
8177
{
8278
/*
8379
* For safety's sake, we release XidGenLock while sending signals,
@@ -340,11 +336,11 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid)
340336
* another iteration immediately if there are still any old databases.
341337
*/
342338
if (TransactionIdFollowsOrEquals(curXid,xidVacLimit)&&
343-
IsUnderPostmaster)
339+
IsUnderPostmaster&& !InRecovery)
344340
SendPostmasterSignal(PMSIGNAL_START_AUTOVAC_LAUNCHER);
345341

346342
/* Give an immediate warning if past the wrap warn point */
347-
if (TransactionIdFollowsOrEquals(curXid,xidWarnLimit))
343+
if (TransactionIdFollowsOrEquals(curXid,xidWarnLimit)&& !InRecovery)
348344
{
349345
char*oldest_datname=get_database_name(oldest_datoid);
350346

@@ -399,8 +395,9 @@ ForceTransactionIdLimitUpdate(void)
399395

400396
if (!TransactionIdIsNormal(oldestXid))
401397
return true;/* shouldn't happen, but just in case */
402-
if (TransactionIdFollowsOrEquals(nextXid,xidVacLimit)&&
403-
TransactionIdIsValid(xidVacLimit))
398+
if (!TransactionIdIsValid(xidVacLimit))
399+
return true;/* this shouldn't happen anymore either */
400+
if (TransactionIdFollowsOrEquals(nextXid,xidVacLimit))
404401
return true;/* past VacLimit, don't delay updating */
405402
if (!SearchSysCacheExists1(DATABASEOID,ObjectIdGetDatum(oldestXidDB)))
406403
return true;/* could happen, per comments above */

‎src/backend/access/transam/xlog.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.373 2010/02/12 09:49:08 heikki Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.374 2010/02/17 03:10:33 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -4761,8 +4761,7 @@ BootStrapXLOG(void)
47614761
ShmemVariableCache->nextOid=checkPoint.nextOid;
47624762
ShmemVariableCache->oidCount=0;
47634763
MultiXactSetNextMXact(checkPoint.nextMulti,checkPoint.nextMultiOffset);
4764-
ShmemVariableCache->oldestXid=checkPoint.oldestXid;
4765-
ShmemVariableCache->oldestXidDB=checkPoint.oldestXidDB;
4764+
SetTransactionIdLimit(checkPoint.oldestXid,checkPoint.oldestXidDB);
47664765

47674766
/* Set up the XLOG page header */
47684767
page->xlp_magic=XLOG_PAGE_MAGIC;
@@ -5597,8 +5596,7 @@ StartupXLOG(void)
55975596
ShmemVariableCache->nextOid=checkPoint.nextOid;
55985597
ShmemVariableCache->oidCount=0;
55995598
MultiXactSetNextMXact(checkPoint.nextMulti,checkPoint.nextMultiOffset);
5600-
ShmemVariableCache->oldestXid=checkPoint.oldestXid;
5601-
ShmemVariableCache->oldestXidDB=checkPoint.oldestXidDB;
5599+
SetTransactionIdLimit(checkPoint.oldestXid,checkPoint.oldestXidDB);
56025600

56035601
/*
56045602
* We must replay WAL entries using the same TimeLineID they were created
@@ -7447,8 +7445,7 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
74477445
ShmemVariableCache->oidCount=0;
74487446
MultiXactSetNextMXact(checkPoint.nextMulti,
74497447
checkPoint.nextMultiOffset);
7450-
ShmemVariableCache->oldestXid=checkPoint.oldestXid;
7451-
ShmemVariableCache->oldestXidDB=checkPoint.oldestXidDB;
7448+
SetTransactionIdLimit(checkPoint.oldestXid,checkPoint.oldestXidDB);
74527449

74537450
/* Check to see if any changes to max_connections give problems */
74547451
if (standbyState!=STANDBY_DISABLED)
@@ -7502,10 +7499,8 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
75027499
checkPoint.nextMultiOffset);
75037500
if (TransactionIdPrecedes(ShmemVariableCache->oldestXid,
75047501
checkPoint.oldestXid))
7505-
{
7506-
ShmemVariableCache->oldestXid=checkPoint.oldestXid;
7507-
ShmemVariableCache->oldestXidDB=checkPoint.oldestXidDB;
7508-
}
7502+
SetTransactionIdLimit(checkPoint.oldestXid,
7503+
checkPoint.oldestXidDB);
75097504

75107505
/* ControlFile->checkPointCopy always tracks the latest ckpt XID */
75117506
ControlFile->checkPointCopy.nextXidEpoch=checkPoint.nextXidEpoch;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp