| From: | Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Tighten asserts on ParallelWorkerNumber |
| Date: | 2026-03-14 14:48:20 |
| Message-ID: | E1w1QHr-0008Tr-0C@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Tighten asserts on ParallelWorkerNumber
The comment about ParallelWorkerNumbr in parallel.c says:
In parallel workers, it will be set to a value >= 0 and < the number
of workers before any user code is invoked; each parallel worker will
get a different parallel worker number.
However asserts in various places collecting instrumentation allowed
(ParallelWorkerNumber == num_workers). That would be a bug, as the value
is used as index into an array with num_workers entries.
Fixed by adjusting the asserts accordingly. Backpatch to all supported
versions.
Discussion: https://postgr.es/m/5db067a1-2cdf-4afb-a577-a04f30b69167@vondra.me
Reviewed-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Backpatch-through: 14
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/2fa42feb7921d9486d56a38608d2b27b8f4e607c
Modified Files
--------------
src/backend/executor/nodeAgg.c | 2 +-
src/backend/executor/nodeIncrementalSort.c | 2 +-
src/backend/executor/nodeMemoize.c | 2 +-
src/backend/executor/nodeSort.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomas Vondra | 2026-03-14 14:48:29 | pgsql: Tighten asserts on ParallelWorkerNumber |
| Previous Message | Tomas Vondra | 2026-03-14 14:48:12 | pgsql: Tighten asserts on ParallelWorkerNumber |