Skip to content

Commit 8d9d128

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 3f712ea commit 8d9d128

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
@@ -2686,12 +2686,13 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
26862686
TransactionIdIsNormal(xid) &&
26872687
TransactionIdPrecedesOrEquals(xid, xmin))
26882688
{
2689-
/* Install xmin */
2689+
/*
2690+
* Install xmin and propagate the statusFlags that affect how the
2691+
* value is interpreted by vacuum.
2692+
*/
26902693
MyProc->xmin = TransactionXmin = xmin;
2691-
2692-
/* Flags being copied must be valid copy-able flags. */
2693-
Assert((proc->statusFlags & (~PROC_COPYABLE_FLAGS)) == 0);
2694-
MyProc->statusFlags = proc->statusFlags;
2694+
MyProc->statusFlags = (MyProc->statusFlags & ~PROC_XMIN_FLAGS) |
2695+
(proc->statusFlags & PROC_XMIN_FLAGS);
26952696
ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags;
26962697

26972698
result = true;

src/include/storage/proc.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@ struct XidCache
6666
(PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND)
6767

6868
/*
69-
* Flags that are valid to copy from another proc, the parallel leader
70-
* process in practice. Currently, flags that are set during parallel
71-
* vacuum and parallel index creation are allowed.
69+
* Xmin-related flags. Make sure any flags that affect how the process' Xmin
70+
* value is interpreted by VACUUM are included here.
7271
*/
73-
#define PROC_COPYABLE_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC)
72+
#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC)
7473

7574
/*
7675
* We allow a small number of "weak" relation locks (AccessShareLock,

0 commit comments

Comments
 (0)