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 1whnhd-000QcY-0N for pgsql-committers@arkaria.postgresql.org; Thu, 09 Jul 2026 12:18:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whnhb-00D1GF-1M for pgsql-committers@arkaria.postgresql.org; Thu, 09 Jul 2026 12:18:04 +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 1whnhb-00D1G6-0M for pgsql-committers@lists.postgresql.org; Thu, 09 Jul 2026 12:18:03 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1whnhZ-00000000JdA-16Jt for pgsql-committers@lists.postgresql.org; Thu, 09 Jul 2026 12:18:03 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4gwv9t0Fksz49Q1d; Thu, 09 Jul 2026 15:17:53 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783599474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x1052cbdBytcv44bvPFvQGIR7gp2D4RIsqonrJtaooA=; b=cNuhg4F4R5yQYEjyFiEwXdjAjPy25fVfrTWyIO+2drKzcStQWwAP9hqR1QfvM8oyL4Chnw h0c6RsGLL7aKoUZ5MdvDsD9vf34h5kIfXYN1HVf1DSaPd+OgSyUIOzTPp9L0Sw9uwdbGja z8xM/KN7hzIarUp3wPOqatGs/oH/yJrA8diEodLu6tdyO7z3msrfMSqp+/F3LDqcIiav3b XHX6NB0FGiFSeWYLvjSJOcOptm4x9Miyy2mWuyV8Tfry4500KIqV7wcOoYrmr4JRPSn+B5 VIbmsXqY08NMQDG4aFConAVTwZSScY/Ikhd6wAl9YldONUEL6y3NAC49Si1dXw== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1783599474; b=BkIfNdWGfolxbMex2Esj9goTvR+X+9DpdTvlUvAgkmPMoymuWpHDDsSqy6mnHHJQu5O6D/ Nb7cN0/MMt4Pj20GWLtajF/XXVFE45Ilj1jvJaEh7zGrKE2nWnWI4VLvIuRjeyoDdAtQv6 vGi8jOijtJ4jD5a8PW8Gn1p06wUy65zsswaVLE0wCixydyxoLBZQr5UwhSpjGzc3DD/QWe FJ+SVvK1RGfGcfF0ujBFB27ZEDvXR6GiBzjNoTywKq+hveq9m8AywctO9uPmu3AdxMAp6+ dFByogY7ZFppl1KklffGQ2Ji5wLj9Vs3vmZg1SUz/650GvB/kUAb9xnyw5HAbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783599474; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x1052cbdBytcv44bvPFvQGIR7gp2D4RIsqonrJtaooA=; b=UDwxt7ab2fBNWCA/8L0H/uwpOTGDg227B2jMueaRO5PcgLdAVRLONRzJBRK+4BJpV5rX2I tdaos4Z86Wq4NZ8SxarR90/2/MJuB3BsEbO6pLpo7BHa1/qak9hKPh+tzmZqfqGrK6SfpJ yVzJ4lb3CbySgljdhR2B40X9EVoPMSXY1U+g9Nri7ENCL4LpuQR9wjmsnMspXpI5YNgS6Z SoTk9jNvc0xBk3C4R7pPT2rzEh4cZGjFQjDT5H0AoLbz6i8iqeITr39R7mkNniH9uhB3nA T+VawpOiW95Hm/zIPNysxUaF9LsbZz2QR7Kh6pLja3ApmiY0wQUisPn2NPN6AA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: Date: Thu, 9 Jul 2026 15:17:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Refactor how some aux processes advertise their ProcNumber To: Fujii Masao , Thom Brown Cc: pgsql-committers@lists.postgresql.org References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 09/07/2026 03:57, Fujii Masao wrote: > On Thu, Jul 9, 2026 at 6:57 AM Thom Brown wrote: >> @@ -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(). > > You're right. The autovacuum launcher does not go through > AuxiliaryProcessMainCommon(), so it never calls > InitAuxiliaryProcess(). Instead, it initializes its PGPROC with > InitProcess(). > > As a result, the avLauncherProc assignment added to > InitAuxiliaryProcess() is never executed for the launcher, and the > corresponding cleanup in AuxiliaryProcKill() is never reached either. Huh, you're right. That raises some questions: Why is the autovacuum launcher not an aux process? I guess it's because it needs to acquire a heavy-weight lock in order to read the list of databases. How come none of the tests failed? I guess the path to wake up the launcher isn't critical for correctness, it just makes autovacuum slower to react. > It seems we should move the avLauncherProc set/clear operations to > InitProcess()/ProcKill() path, as in the attached patch. Thanks! Committed that, and also Nathan's volatile removal. - Heikki