Skip to content

Commit 5fd0ccc

Browse files
committed
Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS
This is a slight, convenient semantics change from what commit 0f0cfb4 ("Fix parallel operations that prevent oldest xmin from advancing") introduced that lets us simplify the coding in the one place where it is used. Backpatch to 13. This is related to commit 6fea655 ("Tighten ComputeXidHorizons' handling of walsenders") rewriting the code site where this is used, which has not yet been backpatched, but it may well be in the future. Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/202204191637.eldwa2exvguw@alvherre.pgsql
1 parent 5139db5 commit 5fd0ccc

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,12 +1916,13 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
19161916
TransactionIdIsNormal(xid) &&
19171917
TransactionIdPrecedesOrEquals(xid, xmin))
19181918
{
1919-
/* Install xmin */
1919+
/*
1920+
* Install xmin and propagate the vacuumFlags that affect how the
1921+
* value is interpreted by vacuum.
1922+
*/
19201923
MyPgXact->xmin = TransactionXmin = xmin;
1921-
1922-
/* Flags being copied must be valid copy-able flags. */
1923-
Assert((pgxact->vacuumFlags & (~PROC_COPYABLE_FLAGS)) == 0);
1924-
MyPgXact->vacuumFlags = pgxact->vacuumFlags;
1924+
MyPgXact->vacuumFlags = (MyPgXact->vacuumFlags & ~PROC_XMIN_FLAGS) |
1925+
(pgxact->vacuumFlags & PROC_XMIN_FLAGS);
19251926

19261927
result = true;
19271928
}

src/include/storage/proc.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ struct XidCache
6363
(PROC_IN_VACUUM | PROC_IN_ANALYZE | PROC_VACUUM_FOR_WRAPAROUND)
6464

6565
/*
66-
* Flags that are valid to copy from another proc, the parallel leader
67-
* process in practice. Currently, a flag that is set during parallel
68-
* vacuum is allowed.
66+
* Xmin-related flags. Make sure any flags that affect how the process' Xmin
67+
* value is interpreted by VACUUM are included here.
6968
*/
70-
#define PROC_COPYABLE_FLAGS (PROC_IN_VACUUM)
69+
#define PROC_XMIN_FLAGS (PROC_IN_VACUUM)
7170

7271
/*
7372
* We allow a small number of "weak" relation locks (AccessShareLock,

0 commit comments

Comments
 (0)