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.94.2) (envelope-from ) id 1vCusI-001rjx-EC for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Oct 2025 07:09:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vCusF-004VIt-OI for pgsql-hackers@arkaria.postgresql.org; Sun, 26 Oct 2025 07:09:06 +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.94.2) (envelope-from ) id 1vCusF-004VIk-6k for pgsql-hackers@lists.postgresql.org; Sun, 26 Oct 2025 07:09:06 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1vCusC-003om4-17 for pgsql-hackers@postgresql.org; Sun, 26 Oct 2025 07:09:05 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 886A17A017D; Sun, 26 Oct 2025 03:09:03 -0400 (EDT) Received: from phl-imap-03 ([10.202.2.93]) by phl-compute-04.internal (MEProxy); Sun, 26 Oct 2025 03:09:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=compiler.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1761462543; x=1761548943; bh=3F6L/X+gyoZuUomuUphWbFyBU/Z+QOPZo5/rRD5kwqU=; b= BDLm1UUb8LrNQihWvj9W8VSDVoC3bRmu0IRBLz/2Q/3Pf1Ltp3wK4GygNBCy0Gqp /NAdXF39xCny4pQkgVRX93ZRKJUSxJj58m6oGLqYz3usFB7713fq4ZyuZml00EW0 ZMQ8xtHPdrHx0Z1Nt/yUH4FQtSttkSRVpodb7XzY9TTkyQQrVIPSuuTatOCqd2ly fUBmf2fIm99D7pamxz5HJhki6xDwRr+c0m69XvxGPsGRi+OzjJuz+G63mtLRrwJc Rxxhnj3KlA3zyx4qEe+oODs1g5FmVj9pz1fuEdsLeLk+Ea7+tRWbrhRp8ePZvA9z MdaB0FEXLhrMQ5AtFvfmAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1761462543; x= 1761548943; bh=3F6L/X+gyoZuUomuUphWbFyBU/Z+QOPZo5/rRD5kwqU=; b=k MqwZnoVdAwTE3JLSPWUEwhX1k/0JuRDYN1MXKfZJLNQ3NuzyX1tCBzDafMho5diI uT6GSSqmdX8+mylYQ8zZBbp2e1O+M/1uhgqpNU9dXTMHkKYao3ruoIITYO0wTP8s KrccWqABOcUgDCkUL4ZLndZYtetzuX8dT9giGSyo8o4H6a17FWvoBazKKogI1qXL AUz4L8AWlehVfSKPLMfQ4M1bvXSEvYngqv6Zo6htIXrF7H1xiPpN287ct6FkdZHd 6uBaEC7raozdUwbvw14Xnd9RsOpCcW6OOiYLmX/Zts4RoWLyDk3TaBSxYnqeYOzd JrQvhYRgEwTEaf2dbxBZQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduheeggeehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvvefkjghfufgtgfesthejre dtredttdenucfhrhhomhepfdflohgvlhculfgrtghosghsohhnfdcuoehjohgvlhestgho mhhpihhlvghrrdhorhhgqeenucggtffrrghtthgvrhhnpeefheelffegvdelfeevteejtd ekteefleeihfdtudelkeeijedtvefgueevieekieenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehjohgvlhestghomhhpihhlvghrrdhorhhgpd hnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrrhhs vghnihihrdhmuhhkhhhinhdruggvvhesghhmrghilhdrtghomhdprhgtphhtthhopehlih drvghvrghnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhh rggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehtghhlsehssh hsrdhpghhhrdhprgdruhhs X-ME-Proxy: Feedback-ID: ic6394509:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 093F618E0069; Sun, 26 Oct 2025 03:09:03 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: AE1r89ybsZ1g Date: Sun, 26 Oct 2025 08:08:42 +0100 From: "Joel Jacobson" To: "Chao Li" , "Arseniy Mukhin" Cc: "Tom Lane" , pgsql-hackers Message-Id: <17b2225a-90d6-4b6f-af45-f6ec243893e5@app.fastmail.com> In-Reply-To: <55d24cbb-e9ef-491f-a99b-b3dbd7cecdf9@app.fastmail.com> References: <6899c044-4a82-49be-8117-e6f669765f7e@app.fastmail.com> <165530.1752362320@sss.pgh.pa.us> <02a7cd37-e2fc-4212-8b19-f8c239c95fb8@app.fastmail.com> <96f00bf1-cc9d-4520-9d02-9e14e7767c88@app.fastmail.com> <30c2aa7d-dd6c-4b68-a2e4-f217a1a34acf@app.fastmail.com> <0b4d402a-9ac2-4aa8-acf8-8231dbe579ea@app.fastmail.com> <3095599.1758644879@sss.pgh.pa.us> <0dc6a2cc-5216-4dc1-9dd2-430cafc6095b@app.fastmail.com> <52CC167F-763B-4ECA-B0B4-DAB381816828@gmail.com> <9186C6D0-F7A9-482A-9183-89E530B57E36@gmail.com> <1073593.1759423179@sss.pgh.pa.us> <4bd5e6c4-6fa7-44bb-869d-59a32a331fa8@app.fastmail.com> <85828f29-e72e-4400-94f3-9a69bc8dc239@app.fastmail.com> <2495353.1759860890@sss.pgh.pa.us> <8aeae418-92a6-4bbd-9c06-9574c79e59f7@app.fastmail.com> <2531672.1759868124@sss.pgh.pa.us> <474efa78-337c-41cd-a73a-f845a0115109@app.fastmail.com> <2749343.1759949176@sss.pgh.pa.us> <8bfca2be-1ec0-4e15-aafb-0b7b661fe936@app.fastmail.com> <9eba307f-f2fb-48f0-9507-2e197f39ef9e@app.fastmail.com> <8c71183a-0d28-4bcf-a806-78446ff95404@app.fastmail.com> <1009807.1760476747@sss.pgh.pa.us> <1F7227F5-C33D-4E2C-8511-33F1468590D0@gmail.com> <0a5a20d3-4621-46b3-b2ab-903f63a20dea@app.fastmail.com> <6F913129-ABEF-4004-AAF3-F22FC34!29AE8@gmail.com> <1547585.1760645808@sss.pgh.pa.us> <14865EB6-0BF4-462B-9072-10BDAC10C052@gmail.com> <0BCA1C2D-B92C-459E-B1A6-6D06BA4C62CF@gmail.com> <55d24cbb-e9ef-491f-a99b-b3dbd7cecdf9@app.fastmail.com> Subject: Re: Optimize LISTEN/NOTIFY Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Oct 26, 2025, at 07:33, Joel Jacobson wrote: > Trying to apply them on top of current master > (39dcfda2d23ac39f14ecf4b83e01eae85d07d9e5): > > ``` > % git apply 0001-optimize_listen_notify-v20.patch > % git apply 0002-optimize_listen_notify-v20.patch > % git apply 0002-optimize_listen_notify-v20-alt3.txt > % git apply 0001-TAP-test-with-listener-pos-race.patch.nocfbot > % git apply fix-race.patch > fix-race.patch:100: indent with spaces. > (QUEUE_POS_PRECEDES(queueHeadBeforeWrite, pos) && > QUEUE_POS_PRECEDES(pos, queueHeadAfterWrite))) && > error: patch failed: src/backend/commands/async.c:250 > error: src/backend/commands/async.c: patch does not apply > error: patch failed: src/test/authentication/t/008_listen-pos-race.pl:8 > error: src/test/authentication/t/008_listen-pos-race.pl: patch does not > apply > ``` > > I'll try to resolve it manually, but in case you're quicker to reply, > I'm sending this now. I see the problem; seems like you based fix-race.patch on top of 0002-optimize_listen_notify-v19-alt3.txt because fix-race.patch contains this diff block which is only present in that version: ``` @@ -2441,21 +2485,29 @@ asyncQueueReadAllNotifications(void) page_buffer.buf, snapshot); - /* - * Update our position in shared memory. The 'pos' variable now - * holds our new position (advanced past all messages we just - * processed). This ensures that if we fail while processing ``` I've compared 0002-optimize_listen_notify-v19-alt3.txt with 0002-optimize_listen_notify-v20-alt3.txt and it's only the addition of QUEUE_POS_PRECEDES which fix-race.patch also adds, and some locking and pos handling differences. /Joel