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 1whfAG-000LxK-2m for pgsql-committers@arkaria.postgresql.org; Thu, 09 Jul 2026 03:11:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1whfAE-00AZjM-31 for pgsql-committers@arkaria.postgresql.org; Thu, 09 Jul 2026 03:11:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1whfAE-00AZjE-2M for pgsql-committers@lists.postgresql.org; Thu, 09 Jul 2026 03:11:03 +0000 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1whfAC-00000000ORR-2ZMC for pgsql-committers@lists.postgresql.org; Thu, 09 Jul 2026 03:11:03 +0000 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-69e9b037d82so1044531eaf.2 for ; Wed, 08 Jul 2026 20:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783566659; x=1784171459; darn=lists.postgresql.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Y5FRipbW2h5hLJ7V/5lMpI4sHF5zDRUfIRT4lYp1YYE=; b=Y5k7X+t/R5blCZOm2HIOby2JgDqWOzEXY77FY9BjhNPLPDcMDs6SeGCtuUWpv4f4Gq kok53r7k/orHPShbP1CWzM1pFEYCg3BRCAWBG1e3qI7dK/NgmO4eu3WDaDeQ0tC2LtQv tLre22N3VJgruQh1qtAKDK0JGMNdau2cefeFPh8t/dbR5Yo4odBJ/z+jwQWRp//ZRE6g FBAQV6bCGo6zv8+I5AGyVtFREQgv89mq02NnXz5LiX+1dPQzrFOm0N9o/FQzrMoRhSaq 4AXlc06Ld57O+kuJlofJ2X2yttNZuqzSODxE7NLzMsyKw91GuYHbAI4jnT+R4ndtKeCz 0D2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783566659; x=1784171459; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Y5FRipbW2h5hLJ7V/5lMpI4sHF5zDRUfIRT4lYp1YYE=; b=VBor0452Fg55onxm9wO1cRFwpaGgOk0ZsVuYDhCxVEZ0MPBXOiu3xs2f1J2nmfmGTi luPlyqyY+DZkfFX6lqr1niISDHHefaXliJ6Ls/p9O7OAW0Or4j3OUF7+g6T53Pz6TSA7 tCITJjt8h1zaM3Gqw5UTgMklVjA2t5Bty3KnvA2zbIREmk/KVDRRbynB5I6s8ldgOfW3 TotdNzQPI/CuVu0LJlED+hJLldabt5ud/RQYXX4LC1CjP4QzH2P3AFaI3lI8v+naqJlK RELGnO+dJPgSJytukDXwzTj8zTThFBGLjy5nvhMrpi7jsOoHi6mgeyoy0gE0+s9cB5J2 vnSg== X-Gm-Message-State: AOJu0Yyt3tnoITm3yhX89qFThxd0W41jlrCJMEeLw06N3oFqg7SSdXBO 06rTxW7QZtC008d2Pg0YF1lFUmU4b41DR6qgzsb2srcXYyfO6FqxAicXsr4bmQ== X-Gm-Gg: AfdE7cnKnev367AsV9VrK07T85XDYczDwjGrZ65zVbQtk9nD0ULjJMynCwuQ41Ckj9l zAIURj4bcGMsQC1Ro12l7eykmYebGZFndn1somz+BjtfTxUJLCB7ex5uu7ck2UC6ZrYU60ntjMk gN26sRRraI/gto1b8DkJn+LBAr6Q6Z5XqNAn3CeO8OGY+x4mkAsKQw5kQepI6ZnC2XR6n5pvLCn nwoHXV1+svWXnlp1AaPedfIGz4SQh8UkvlGtzWKCzotlpZZchQgoJ5OGwSuVnNMHovA5QGRJHWg gZZdH36UEIFuir2EdlXzCjJCtA44h/d0hSjUedBzfn4Z0gC72QRx5sKlVc3AFAsmnTMizISqIfY I/7o00BIIVR+9rYZs5kpmNAF+0o0v/E44BVJmOJxpgkTNGjf2E2E/OQJW4SA2drDkM4m+fVYReV r5BDKewdEdtJCLJXfN57/YBL5Xpn488bpsFUqADyrFhaD+C/39TszCVg1qDpQnf6mKUmQTOfeIs TxBLIvCn4wNBzeIx70bBQ== X-Received: by 2002:a05:6820:a292:20b0:6a3:74fd:a86e with SMTP id 006d021491bc7-6a374fdb235mr1911494eaf.26.1783566658693; Wed, 08 Jul 2026 20:10:58 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-6a36a5ecddesm3085636eaf.4.2026.07.08.20.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2026 20:10:57 -0700 (PDT) Date: Wed, 8 Jul 2026 22:10:55 -0500 From: Nathan Bossart To: Heikki Linnakangas Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Refactor how some aux processes advertise their ProcNumber Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ZSeM+bMDGEqBUycH" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --ZSeM+bMDGEqBUycH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jul 08, 2026 at 05:43:01PM +0000, Heikki Linnakangas wrote: > 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. Since removing volatile qualifiers is on my mind, I noticed that this patch makes it possible to remove two more. Patch attached. -- nathan --ZSeM+bMDGEqBUycH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=remove_more_volatile.patch diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index a09d4097d51..f6351f1eb10 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -1114,8 +1114,7 @@ RequestCheckpoint(int flags) #define MAX_SIGNAL_TRIES 600 /* max wait 60.0 sec */ for (ntries = 0;; ntries++) { - volatile PROC_HDR *procglobal = ProcGlobal; - ProcNumber checkpointerProc = pg_atomic_read_u32(&procglobal->checkpointerProc); + ProcNumber checkpointerProc = pg_atomic_read_u32(&ProcGlobal->checkpointerProc); if (checkpointerProc == INVALID_PROC_NUMBER) { @@ -1536,8 +1535,7 @@ FirstCallSinceLastCheckpoint(void) void WakeupCheckpointer(void) { - volatile PROC_HDR *procglobal = ProcGlobal; - ProcNumber checkpointerProc = pg_atomic_read_u32(&procglobal->checkpointerProc); + ProcNumber checkpointerProc = pg_atomic_read_u32(&ProcGlobal->checkpointerProc); if (checkpointerProc != INVALID_PROC_NUMBER) SetLatch(&GetPGProcByNumber(checkpointerProc)->procLatch); --ZSeM+bMDGEqBUycH--