agora inbox for pgsql-hackers@postgresql.orghelp / color / mirror / Atom feed
[PATCH v2] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS 6+ messages / 1 participants [nested] [flat]
* [PATCH v2] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS @ 2022-05-14 14:51 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2022-05-14 14:51 UTC (permalink / raw) This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 17 +++++++---------- src/include/storage/proc.h | 7 +++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index ca22336e35..cd58c5faf0 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -2685,17 +2685,14 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) TransactionIdIsNormal(xid) && TransactionIdPrecedesOrEquals(xid, xmin)) { - /* Install xmin */ + /* + * Install xmin and propagate the statusFlags that affect how the + * value is interpreted by vacuum. + */ MyProc->xmin = TransactionXmin = xmin; - - /* walsender cheats by passing proc == MyProc, don't check its flags */ - if (proc != MyProc) - { - /* Flags being copied must be valid copy-able flags. */ - Assert((proc->statusFlags & (~PROC_COPYABLE_FLAGS)) == 0); - MyProc->statusFlags = proc->statusFlags; - ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags; - } + MyProc->statusFlags = (MyProc->statusFlags & ~PROC_XMIN_FLAGS) | + (proc->statusFlags & PROC_XMIN_FLAGS); + ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags; result = true; } diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 15be21c00a..2579e619eb 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -69,11 +69,10 @@ struct XidCache (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND) /* - * Flags that are valid to copy from another proc, the parallel leader - * process in practice. Currently, flags that are set during parallel - * vacuum and parallel index creation are 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 | PROC_IN_SAFE_IC) +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) /* * We allow a small number of "weak" relation locks (AccessShareLock, -- 2.30.2 --zgl76stv2tlmzxb2-- ^ permalink raw reply [nested|flat] 6+ messages in thread
* [PATCH v2] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS @ 2022-05-14 14:51 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2022-05-14 14:51 UTC (permalink / raw) This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 17 +++++++---------- src/include/storage/proc.h | 7 +++---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index ca22336e35..cd58c5faf0 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -2685,17 +2685,14 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) TransactionIdIsNormal(xid) && TransactionIdPrecedesOrEquals(xid, xmin)) { - /* Install xmin */ + /* + * Install xmin and propagate the statusFlags that affect how the + * value is interpreted by vacuum. + */ MyProc->xmin = TransactionXmin = xmin; - - /* walsender cheats by passing proc == MyProc, don't check its flags */ - if (proc != MyProc) - { - /* Flags being copied must be valid copy-able flags. */ - Assert((proc->statusFlags & (~PROC_COPYABLE_FLAGS)) == 0); - MyProc->statusFlags = proc->statusFlags; - ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags; - } + MyProc->statusFlags = (MyProc->statusFlags & ~PROC_XMIN_FLAGS) | + (proc->statusFlags & PROC_XMIN_FLAGS); + ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags; result = true; } diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 15be21c00a..2579e619eb 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -69,11 +69,10 @@ struct XidCache (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND) /* - * Flags that are valid to copy from another proc, the parallel leader - * process in practice. Currently, flags that are set during parallel - * vacuum and parallel index creation are 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 | PROC_IN_SAFE_IC) +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) /* * We allow a small number of "weak" relation locks (AccessShareLock, -- 2.30.2 --zgl76stv2tlmzxb2-- ^ permalink raw reply [nested|flat] 6+ messages in thread
* [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS @ 2022-05-14 14:51 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2022-05-14 14:51 UTC (permalink / raw) This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 11 ++++++----- src/include/storage/proc.h | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 6ff8d8699b..447b6e3de7 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 9cf9684b41..7c85b5645b 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, -- 2.30.2 --gseizntho2k3boor Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v14-0001-Repurpose-PROC_COPYABLE_FLAGS-as-PROC_XMIN_FLAGS.patch" ^ permalink raw reply [nested|flat] 6+ messages in thread
* [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS @ 2022-05-14 14:51 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2022-05-14 14:51 UTC (permalink / raw) This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 11 ++++++----- src/include/storage/proc.h | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 127be9c017..08053a7e8f 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -2686,12 +2686,13 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) TransactionIdIsNormal(xid) && TransactionIdPrecedesOrEquals(xid, xmin)) { - /* Install xmin */ + /* + * Install xmin and propagate the statusFlags that affect how the + * value is interpreted by vacuum. + */ MyProc->xmin = TransactionXmin = xmin; - - /* Flags being copied must be valid copy-able flags. */ - Assert((proc->statusFlags & (~PROC_COPYABLE_FLAGS)) == 0); - MyProc->statusFlags = proc->statusFlags; + MyProc->statusFlags = (MyProc->statusFlags & ~PROC_XMIN_FLAGS) | + (proc->statusFlags & PROC_XMIN_FLAGS); ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags; result = true; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 11b514c9ae..1464fad9b9 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -66,11 +66,10 @@ struct XidCache (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND) /* - * Flags that are valid to copy from another proc, the parallel leader - * process in practice. Currently, flags that are set during parallel - * vacuum and parallel index creation are 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 | PROC_IN_SAFE_IC) +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) /* * We allow a small number of "weak" relation locks (AccessShareLock, -- 2.30.2 --gseizntho2k3boor-- ^ permalink raw reply [nested|flat] 6+ messages in thread
* [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS @ 2022-05-14 14:51 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2022-05-14 14:51 UTC (permalink / raw) This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 11 ++++++----- src/include/storage/proc.h | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 6ff8d8699b..447b6e3de7 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 9cf9684b41..7c85b5645b 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, -- 2.30.2 --gseizntho2k3boor Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v14-0001-Repurpose-PROC_COPYABLE_FLAGS-as-PROC_XMIN_FLAGS.patch" ^ permalink raw reply [nested|flat] 6+ messages in thread
* [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS @ 2022-05-14 14:51 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 6+ messages in thread From: Alvaro Herrera @ 2022-05-14 14:51 UTC (permalink / raw) This is a slight, convenient semantics change from what commit 0f0cfb494004 introduced that lets us simplify the coding in the one place where it is used. --- src/backend/storage/ipc/procarray.c | 11 ++++++----- src/include/storage/proc.h | 7 +++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 127be9c017..08053a7e8f 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -2686,12 +2686,13 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) TransactionIdIsNormal(xid) && TransactionIdPrecedesOrEquals(xid, xmin)) { - /* Install xmin */ + /* + * Install xmin and propagate the statusFlags that affect how the + * value is interpreted by vacuum. + */ MyProc->xmin = TransactionXmin = xmin; - - /* Flags being copied must be valid copy-able flags. */ - Assert((proc->statusFlags & (~PROC_COPYABLE_FLAGS)) == 0); - MyProc->statusFlags = proc->statusFlags; + MyProc->statusFlags = (MyProc->statusFlags & ~PROC_XMIN_FLAGS) | + (proc->statusFlags & PROC_XMIN_FLAGS); ProcGlobal->statusFlags[MyProc->pgxactoff] = MyProc->statusFlags; result = true; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 11b514c9ae..1464fad9b9 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -66,11 +66,10 @@ struct XidCache (PROC_IN_VACUUM | PROC_IN_SAFE_IC | PROC_VACUUM_FOR_WRAPAROUND) /* - * Flags that are valid to copy from another proc, the parallel leader - * process in practice. Currently, flags that are set during parallel - * vacuum and parallel index creation are 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 | PROC_IN_SAFE_IC) +#define PROC_XMIN_FLAGS (PROC_IN_VACUUM | PROC_IN_SAFE_IC) /* * We allow a small number of "weak" relation locks (AccessShareLock, -- 2.30.2 --gseizntho2k3boor-- ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2022-05-14 14:51 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-05-14 14:51 [PATCH v2] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS Alvaro Herrera <alvherre@alvh.no-ip.org> 2022-05-14 14:51 [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS Alvaro Herrera <alvherre@alvh.no-ip.org> 2022-05-14 14:51 [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS Alvaro Herrera <alvherre@alvh.no-ip.org> 2022-05-14 14:51 [PATCH v2] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS Alvaro Herrera <alvherre@alvh.no-ip.org> 2022-05-14 14:51 [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS Alvaro Herrera <alvherre@alvh.no-ip.org> 2022-05-14 14:51 [PATCH] Repurpose PROC_COPYABLE_FLAGS as PROC_XMIN_FLAGS Alvaro Herrera <alvherre@alvh.no-ip.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox