Re: Tighten asserts on ParallelWorkerNumber a little bit

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Tighten asserts on ParallelWorkerNumber a little bit
Date: 2026-03-14 14:53:21
Message-ID: 77609a7a-4d7f-4c24-890a-5af9ebcfe9bd@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/13/26 11:53, Bertrand Drouvot wrote:
> ...
>
>> So AFAICS the assert(s) should be
>>
>> Assert(ParallelWorkerNumber < node->shared_info->num_workers);
>
> I think that you're right. It looks like the first one has been introduced
> by bf11e7ee2e3 and then the others are probably copy/paste.
>
>> 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.
>
> I do agree.
>
> With that patch applied, the remaining one:
>
> $ git grep "<=.*num_workers"
> src/backend/executor/nodeGatherMerge.c: Assert(nreaders <= castNode(GatherMerge, gm_state->ps.plan)->num_workers);
>
> does not need to be fixed, so I think that your patch does not miss any and
> LGTM.
>

Thanks. Pushed and backpatched.

--
Tomas Vondra

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-03-14 15:06:04 Re: pg_plan_advice
Previous Message Jelte Fennema-Nio 2026-03-14 14:16:56 Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup