| From: | Tomas Vondra <tomas(at)vondra(dot)me> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Tighten asserts on ParallelWorkerNumber a little bit |
| Date: | 2026-03-12 18:59:43 |
| Message-ID: | 5db067a1-2cdf-4afb-a577-a04f30b69167@vondra.me |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
While hacking on something I happened to notice a couple asserts on
ParallelWorkerNumber when collecting shared instrumentation:
Assert(ParallelWorkerNumber <= node->shared_info->num_workers);
This is not quire right, because num_workers is used to size arrays
indexed by ParallelWorkerNumber. And the comment in parallel.c also
claims (ParallelWorkerNumber < num_workers).
So AFAICS the assert(s) should be
Assert(ParallelWorkerNumber < node->shared_info->num_workers);
I don't think we had issues with this not catching a bug. But it may be
a bit misleading, so worth fixing and (probably) backpatching.
regards
--
Tomas Vondra
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Tighten-asserts-on-ParallelWorkerNumber.patch | text/x-patch | 5.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Treat | 2026-03-12 19:15:13 | Re: Adding REPACK [concurrently] |
| Previous Message | Bruce Momjian | 2026-03-12 18:57:45 | Re: <productname> on SGML files is used for what ? |