Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whaGr-000JLv-09 for pgsql-committers@arkaria.postgresql.org; Wed, 08 Jul 2026 21:57:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whaGo-009kKT-12 for pgsql-committers@arkaria.postgresql.org; Wed, 08 Jul 2026 21:57:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whaGo-009kKJ-0N for pgsql-committers@lists.postgresql.org; Wed, 08 Jul 2026 21:57:30 +0000 Received: from mail-wm1-f46.google.com ([209.85.128.46]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1whaGm-00000000Dj0-2tC5 for pgsql-committers@lists.postgresql.org; Wed, 08 Jul 2026 21:57:30 +0000 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-493b27c7451so3850695e9.0 for ; Wed, 08 Jul 2026 14:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783547847; cv=none; d=google.com; s=arc-20260327; b=b0D25vtzYfRGwZdEK4qCT+VV+59RhFlJyPVABigCHAvVPMJGWHJ+eSRgyttBSQ5pa3 u1w8Co/YEnXnBSaEaUw1NlhAEM+ej+YFoxkRnitki3Q4FoWWAZG5GwJaETnB0WhLjwwV Sk46NgNYcPvJDszxVC/vcpEXYQFL2YG/2QNRfklgtqUomQeeAmBN4JExGH19tWjK6qwa 9ZNTaB74AFwHm9FQD/k7ptS15TKPzjrXTMKGHmeftYyKERumSIiFNyHdQYkQXVh9+yo5 Oa/ayUHYW8tGg27Eq3z3f5tdsye/YCIHjgs6N1rsZVWM0O89EaQCktaTREug6oB+x53N yzoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version; bh=INpKZ99XD8IN/wGVaSaFvlhbsr3yGCstPtX8yJvxvFA=; fh=p7ZEYg3Rm0RjhhNwrqSzLyG955bO7ogRFcToIoJzPAY=; b=G9ratN94Kwv1/1o5t2w8uSbxOuvrE3Fltxsq0ktymmKZFrRLbuDRVOUSeoPxQr3sox +mYMy6BSuzo2SP7SpK/Fk05cAXSqvBi8/QSsI/bZsb4xzwEHQz9WMd7xVzn3wlbEt45v ZqkwmcTqEDq6UHakokUQSWzG5PPF6ova+4Tz66nqbTfe6JciVXFGpOyYf4N3QuyDcL4h GsQg8dPMS7b5ZXdcRbCnq/FVLwwS1+7CYXzupcSxjrV4zYF5b4tc/Zn1IxjZ+5IMlLms amIdWQkputX9ikfvcAkR+cjY1mFiqTUncVu4MYfj5Ljstrq1QWfOGo4hbvKqcsPxxBoq qaVw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783547847; x=1784152647; h=content-type:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=INpKZ99XD8IN/wGVaSaFvlhbsr3yGCstPtX8yJvxvFA=; b=rVCGZ1uZxOXfNyME40jV5pYwDOyK8WqxYPnKSytLdFnb13+XrIKbwTEW8rrsAXRZ/+ IhPmzuLWtiVGS3QAP1Nml0sOmBDH6+Iq5MRyes2V+JaCRblsF0hkM/cZI0Az+d+gfW88 o/4HzAo7LSSyouoxtUA9wEvFJ0rvDjy7wS0lgua/MXV2F/3ny4P03zqv81B2V6yvs3/T kALhRcsOuNwEuPQhTDApt+q+rwiGC8b3RQvwNRtsKKg3tAvET34riBr4BFQ3podN5v2V /0etlO4GiFhiXmqa50pm2ibK0kt8NADaqtGaBjMkv6F4y9h+Vf4yFxK4t2HWfNzBu7Z2 HIXw== X-Gm-Message-State: AOJu0YxXBeLlpe9mXGnRiCvW56AgL2yXPHJfgA05cMNql9KiNx3zUcKl WNlsuSncreOt9dHJ919RW90QrhAmds5GM0gAnJGF66kAkyzBOLpCvhYmMDz2Wn0XzOsGWRowoXy N3EcEjFm4X/xZMUEv3ZzvwiXCPLucALE= X-Gm-Gg: AfdE7ckcqBfEq+fe6QaBYnYzFcCBL0l56UZv7rCEoDKySQnYdAPM4cafPV5im6aOupq fszURCfAS52Swt3qtvIIq5/3qcuXbG1Ck4rUDY3wR64Lt2r6fU4nE5jGtGHndPhu3B80NqpcYGq nGiRY5v7+RSNQPAMJPAmGH0UZyxngYQsffHjUj5zxgrINzPJhJnmgSaL/YtdMsfP7pqTN2tYI+W SNh0Hx5FSx+J1xwr1O8vyNmJne24U7VDzumjqK4FbV+5t5PW+detEug8+up5nI4KJl6hjMU X-Received: by 2002:a05:6000:25eb:b0:473:c2ec:7a79 with SMTP id ffacd0b85a97d-47df754dfa3mr91317f8f.12.1783547847208; Wed, 08 Jul 2026 14:57:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Thom Brown Date: Wed, 8 Jul 2026 22:57:00 +0100 X-Gm-Features: AUfX_myQM69OI9z53awq_962XV2A5eYWkyJX7R2wTobiSmKHeYbZz_vUrynJEac Message-ID: Subject: Re: pgsql: Refactor how some aux processes advertise their ProcNumber To: Heikki Linnakangas Cc: pgsql-committers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 8 Jul 2026 at 18:43, Heikki Linnakangas wrote: > > Refactor how some aux processes advertise their ProcNumber > > This moves the responsibility of setting the ProcGlobal->walwriterProc > and checkpointerProc fields into InitAuxiliaryProcess. Also switch to > the same pattern to advertise the autovacuum launcher's ProcNumber, > replacing the ad hoc av_launcherpid field in shared memory. This can > easily be extended to other aux processes in the future, if other > processes need to find them. > > Switch to pg_atomic_uint32 for the fields. Seems easier to reason > about than volatile pointers. There was some precedence for that, as > were already using pg_atomic_uint32 for the procArrayGroupFirst and > clogGroupFirst fields, which also store ProcNumbers. > > Todo: We could also replace WalRecv->procno with this, but that's a > little more code churn so I left that for the future. > > Reviewed-by: Andres Freund > Discussion: https://www.postgresql.org/message-id/818bafaf-1e77-4c78-8037-d7120878d87c@iki.fi > > Branch > ------ > master > > Details > ------- > https://git.postgresql.org/pg/commitdiff/842169b6c110f48c9f7a2dc29d0cedcc97c2ff29 > > Modified Files > -------------- > src/backend/access/transam/xlog.c | 3 +-- > src/backend/postmaster/autovacuum.c | 19 ++++++++++--------- > src/backend/postmaster/checkpointer.c | 14 ++++---------- > src/backend/postmaster/walwriter.c | 6 ------ > src/backend/storage/lmgr/proc.c | 32 ++++++++++++++++++++++++++++++-- > src/include/storage/proc.h | 7 ++++--- > 6 files changed, 49 insertions(+), 32 deletions(-) @@ -724,6 +725,14 @@ InitAuxiliaryProcess(void) */ PGSemaphoreReset(MyProc->sem); + /* Some aux processes are also advertised in ProcGlobal */ + if (MyBackendType == B_AUTOVAC_LAUNCHER) + pg_atomic_write_u32(&ProcGlobal->avLauncherProc, MyProcNumber); I'm looking for the places this gets called from. I can only see auxprocess.c which the launcher doesn't go through. The same question for similar code in AuxiliaryProcKill(). Thom