Re: Allow non-superuser to cancel superuser tasks.

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>, "Andrey M(dot) Borodin" <x4mmm(at)yandex-team(dot)ru>, Michael Paquier <michael(at)paquier(dot)xyz>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, "Leung, Anthony" <antholeu(at)amazon(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow non-superuser to cancel superuser tasks.
Date: 2024-11-23 02:44:34
Message-ID: Z0FBkr1tNqiOBr_M@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 22, 2024 at 06:13:16PM -0500, Andres Freund wrote:
>> - if (procStatus && procStatus->st_backendType == B_AUTOVAC_WORKER)
>> + if (pgstat_get_backend_type(pid) == B_AUTOVAC_WORKER)
>
> Because we already mapped the pid to a ProcNumber, it'd be cheaper to access
> the backend status via procnumber.

D'oh, I missed that ProcNumber could be used as an index for the
BackendStatusArray. Is the attached more like what you are imagining?

> We don't need the pgstat_begin_read_activity() protocol when just accessing a
> single 4 byte value - we assume in lots of places that can be read in a
> non-tearable way.
>
>> + if (pgstat_read_activity_complete(before_changecount,
>> + after_changecount))
>> + break;
>> +
>> + CHECK_FOR_INTERRUPTS();
>> + }
>> +
>> + if (found)
>> + return beentry->st_backendType;
>
> But if we were to follow it, we'd certainly need to use it here too.

I see.

--
nathan

Attachment Content-Type Size
v2-0001-avoid-calling-pgstat_read_current_status-in-pg_si.patch text/plain 2.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2024-11-23 02:59:55 Re: SIMD optimization for list_sort
Previous Message Thomas Munro 2024-11-22 23:43:48 Re: Windows pg_basebackup unable to create >2GB pg_wal.tar tarballs ("could not close file: Invalid argument" when creating pg_wal.tar of size ~ 2^31 bytes)