diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 6ff8d8699b3..447b6e3de7f 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -1916,12 +1916,13 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) TransactionIdIsNormal(xid) && TransactionIdPrecedesOrEquals(xid, xmin)) { - /* Install xmin */ + /* + * Install xmin and propagate the vacuumFlags that affect how the + * value is interpreted by vacuum. + */ MyPgXact->xmin = TransactionXmin = xmin; - - /* Flags being copied must be valid copy-able flags. */ - Assert((pgxact->vacuumFlags & (~PROC_COPYABLE_FLAGS)) == 0); - MyPgXact->vacuumFlags = pgxact->vacuumFlags; + MyPgXact->vacuumFlags = (MyPgXact->vacuumFlags & ~PROC_XMIN_FLAGS) | + (pgxact->vacuumFlags & PROC_XMIN_FLAGS); result = true; } diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 9cf9684b41c..7c85b5645b7 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -63,11 +63,10 @@ struct XidCache (PROC_IN_VACUUM | PROC_IN_ANALYZE | PROC_VACUUM_FOR_WRAPAROUND) /* - * Flags that are valid to copy from another proc, the parallel leader - * process in practice. Currently, a flag that is set during parallel - * vacuum is allowed. + * Xmin-related flags. Make sure any flags that affect how the process' Xmin + * value is interpreted by VACUUM are included here. */ -#define PROC_COPYABLE_FLAGS (PROC_IN_VACUUM) +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM) /* * We allow a small number of "weak" relation locks (AccessShareLock,