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

Commit060bb38

Browse files
committed
Ignore nextOid when replaying an ONLINE checkpoint.
The nextOid value is from the start of the checkpoint and may well be stalecompared to values from more recent XLOG_NEXTOID records. Previously, weadopted it anyway, allowing the OID counter to go backwards during a crash.While this should be harmless, it contributed to the severity of the bugfixed in commit0408e1e, by allowing duplicate TOAST OIDs to be assignedimmediately following a crash. Without this error, that issue would onlyhave arisen when TOAST objects just younger than a multiple of 2^32 OIDswere deleted and then not vacuumed in time to avoid a conflict.Pavan DeolaseeDiscussion:https://postgr.es/m/CABOikdOgWT2hHkYG3Wwo2cyZJq2zfs1FH0FgX-=h4OLosXHf9w@mail.gmail.com
1 parent8bba10f commit060bb38

File tree

1 file changed

+14
-5
lines changed
  • src/backend/access/transam

1 file changed

+14
-5
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9420,11 +9420,20 @@ xlog_redo(XLogReaderState *record)
94209420
checkPoint.nextXid))
94219421
ShmemVariableCache->nextXid=checkPoint.nextXid;
94229422
LWLockRelease(XidGenLock);
9423-
/* ... but still treat OID counter as exact */
9424-
LWLockAcquire(OidGenLock,LW_EXCLUSIVE);
9425-
ShmemVariableCache->nextOid=checkPoint.nextOid;
9426-
ShmemVariableCache->oidCount=0;
9427-
LWLockRelease(OidGenLock);
9423+
9424+
/*
9425+
* We ignore the nextOid counter in an ONLINE checkpoint, preferring
9426+
* to track OID assignment through XLOG_NEXTOID records. The nextOid
9427+
* counter is from the start of the checkpoint and might well be stale
9428+
* compared to later XLOG_NEXTOID records. We could try to take the
9429+
* maximum of the nextOid counter and our latest value, but since
9430+
* there's no particular guarantee about the speed with which the OID
9431+
* counter wraps around, that's a risky thing to do. In any case,
9432+
* users of the nextOid counter are required to avoid assignment of
9433+
* duplicates, so that a somewhat out-of-date value should be safe.
9434+
*/
9435+
9436+
/* Handle multixact */
94289437
MultiXactAdvanceNextMXact(checkPoint.nextMulti,
94299438
checkPoint.nextMultiOffset);
94309439

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp