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

Commit802bde8

Browse files
Remove cut-off bug from RunningTransactionData
32ac7a1 tried to fix a Hot Standby issuereported by Greg Stark, but in doing so causeda different bug to appear, noted by Andres Freund.Revoke the core changes from32ac7a1,leaving in its place a minor change in codeordering and comments to explain for the future.
1 parent9178133 commit802bde8

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
19071907
* GetRunningTransactionData -- returns information about running transactions.
19081908
*
19091909
* Similar to GetSnapshotData but returns more information. We include
1910-
* all PGXACTs with an assigned TransactionId,but not VACUUM processes.
1910+
* all PGXACTs with an assigned TransactionId,even VACUUM processes.
19111911
*
19121912
* We acquire XidGenLock and ProcArrayLock, but the caller is responsible for
19131913
* releasing them. Acquiring XidGenLock ensures that no new XIDs enter the proc
@@ -1995,10 +1995,6 @@ GetRunningTransactionData(void)
19951995
volatilePGXACT*pgxact=&allPgXact[pgprocno];
19961996
TransactionIdxid;
19971997

1998-
/* Ignore procs running LAZY VACUUM */
1999-
if (pgxact->vacuumFlags&PROC_IN_VACUUM)
2000-
continue;
2001-
20021998
/* Fetch xid just once - see GetNewTransactionId */
20031999
xid=pgxact->xid;
20042000

@@ -2009,13 +2005,26 @@ GetRunningTransactionData(void)
20092005
if (!TransactionIdIsValid(xid))
20102006
continue;
20112007

2012-
xids[count++]=xid;
2013-
2008+
/*
2009+
* Be careful not to exclude any xids before calculating the values of
2010+
* oldestRunningXid and suboverflowed, since these are used to clean
2011+
* up transaction information held on standbys.
2012+
*/
20142013
if (TransactionIdPrecedes(xid,oldestRunningXid))
20152014
oldestRunningXid=xid;
20162015

20172016
if (pgxact->overflowed)
20182017
suboverflowed= true;
2018+
2019+
/*
2020+
* If we wished to exclude xids this would be the right place for it.
2021+
* Procs with the PROC_IN_VACUUM flag set don't usually assign xids,
2022+
* but they do during truncation at the end when they get the lock
2023+
* and truncate, so it is not much of a problem to include them if they
2024+
* are seen and it is cleaner to include them.
2025+
*/
2026+
2027+
xids[count++]=xid;
20192028
}
20202029

20212030
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp