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

Commitaaceb0d

Browse files
committed
Don't advance checkPoint.nextXid near the end of a checkpoint sequence.
This reverts commitc111306 in favor ofactually fixing the problem: namely, that we should never have beenmodifying the checkpoint record's nextXid at this point to begin with.The nextXid should match the state as of the checkpoint's logical WALposition (ie the redo point), not the state as of its physical position.It's especially bogus to advance it in some wal_levels and not others.In any case there is no need for the checkpoint record to carry thesame nextXid shown in the XLOG_RUNNING_XACTS record just emitted byLogStandbySnapshot, as any replay operation will already have adoptedthat value as current.This fixes bug #7710 from Tarvi Pillessaar, and probably also explains bug#6291 from Daniel Farina, in that if a checkpoint were in progress at theinstant of XID wraparound, the epoch bump would be lost as reported.(And, of course, these days there's at least a 50-50 chance of a checkpointbeing in progress at any given instant.)Diagnosed by me and independently by Andres Freund. Back-patch to allbranches supporting hot standby.
1 parentc3f64ad commitaaceb0d

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8019,18 +8019,9 @@ CreateCheckPoint(int flags)
80198019
*
80208020
* If we are shutting down, or Startup process is completing crash
80218021
* recovery we don't need to write running xact data.
8022-
*
8023-
* Update checkPoint.nextXid since we may have a later value. If we
8024-
* do update the value, and we have wrapped, increment epoch also.
80258022
*/
80268023
if (!shutdown&&XLogStandbyInfoActive())
8027-
{
8028-
TransactionIdprevXid=checkPoint.nextXid;
8029-
8030-
LogStandbySnapshot(&checkPoint.nextXid);
8031-
if (checkPoint.nextXid<prevXid)
8032-
checkPoint.nextXidEpoch++;
8033-
}
8024+
LogStandbySnapshot();
80348025

80358026
START_CRIT_SECTION();
80368027

‎src/backend/storage/ipc/standby.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ standby_desc(StringInfo buf, uint8 xl_info, char *rec)
865865
* from a time when they were possible.
866866
*/
867867
void
868-
LogStandbySnapshot(TransactionId*nextXid)
868+
LogStandbySnapshot(void)
869869
{
870870
RunningTransactionsrunning;
871871
xl_standby_lock*locks;
@@ -894,8 +894,6 @@ LogStandbySnapshot(TransactionId *nextXid)
894894
LogCurrentRunningXacts(running);
895895
/* GetRunningTransactionData() acquired XidGenLock, we must release it */
896896
LWLockRelease(XidGenLock);
897-
898-
*nextXid=running->nextXid;
899897
}
900898

901899
/*

‎src/include/storage/standby.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@ typedef RunningTransactionsData *RunningTransactions;
110110
externvoidLogAccessExclusiveLock(OiddbOid,OidrelOid);
111111
externvoidLogAccessExclusiveLockPrepare(void);
112112

113-
externvoidLogStandbySnapshot(TransactionId*nextXid);
113+
externvoidLogStandbySnapshot(void);
114114

115115
#endif/* STANDBY_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp