Re: Add backendType to PGPROC, replacing isRegularBackend

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Subject: Re: Add backendType to PGPROC, replacing isRegularBackend
Date: 2026-02-04 11:08:45
Message-ID: 9386d916-47f5-4aaf-93a0-c8b116e21526@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 03/02/2026 23:04, Nathan Bossart wrote:
> On Tue, Feb 03, 2026 at 10:55:20PM +0200, Heikki Linnakangas wrote:
>> I propose a little refactoring, attached, to replace the "isRegularBackend"
>> field in PGPROC with full "backendType".
>>
>> Andres briefly suggested this a while back [1]:
>>
>> On Fri, 22 Nov 2024 at 22:13, Andres Freund <andres(at)anarazel(dot)de>
>> wrote:
>>> Or we could have a copy of the backend type in PGPROC.
>>
>> but we didn't follow up on that approach. I don't see why, it seems so much
>> simpler than what we ended up doing. Am I missing something?
>
> At a glance, it looks reasonable to me. I don't recall whether I explored
> this approach, but at the very least I'm unaware of any reason it wouldn't
> work.

Ok.

>> @@ -684,7 +684,7 @@ InitAuxiliaryProcess(void)
>> MyProc->databaseId = InvalidOid;
>> MyProc->roleId = InvalidOid;
>> MyProc->tempNamespaceId = InvalidOid;
>> - MyProc->isRegularBackend = false;
>> + MyProc->backendType = B_INVALID;
>> MyProc->delayChkptFlags = 0;
>> MyProc->statusFlags = 0;
>> MyProc->lwWaiting = LW_WS_NOT_WAITING;
>
> Hm. So for auxiliary processes, this would always be unset? That appears
> to be alright for today's use-cases, but it could be a problem down the
> road.

Right, that was just a silly mistake.

Fixed that and pushed, thanks!

- Heikki

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2026-02-04 11:15:11 Re: Undefined behavior detected by new clang's ubsan
Previous Message Peter Eisentraut 2026-02-04 10:46:22 Re: Change copyObject() to use typeof_unqual