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 1utLak-005Lfa-W7 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Sep 2025 07:38:11 +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 1utLak-002apA-5b for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Sep 2025 07:38:10 +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 1utLaj-002ap1-Sh for pgsql-hackers@lists.postgresql.org; Tue, 02 Sep 2025 07:38:10 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1utLah-0007bm-0p for pgsql-hackers@postgresql.org; Tue, 02 Sep 2025 07:38:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1756798680; bh=rO4k0fmTjJP+ojM+rzFW1IoRG0G+5DUepsSEnuQgG4k=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=Gn2MmDI5db9KlVAwiCSFyKYQp3k6T4FM248UitU5nRJArjKaEal6VIEBbgs0BA3ux eolxuCxncLxN/i/tvHkYEJ9FUbZhMHkJUJnkOlcoL+if2MiOy+sZVBFVdRECv4tZWY BRNACFtGXVX1kkFkRCvjHXD/ASHGyYnTM4ZoKoSsEk77ONMQ4zg2fv2Jqz/21kp3g9 kbnG9zTdGk4wDi8S98qschy7DCMwoGJ0kFN2jEIjDUTSZLR7dOtQPiql5SxBH8c4v2 ZVNuxKXZz/+2rmGNNP7Df3Y1sYpu2qwpIa4Y7lTe6Iz4nBA/vVXxaU/Ay/kOrbs371 KMTjLhPm3oaVg== Received: from [172.30.50.174] (debian11-template.l.postgrespro.ru [192.168.2.254]) (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) (Client did not present a certificate) (Authenticated sender: y.sokolov@postgrespro.ru) by mail.postgrespro.ru (Postfix/465) with ESMTPSA id 4B4AE60C2E; Tue, 2 Sep 2025 10:38:00 +0300 (MSK) Message-ID: Date: Tue, 2 Sep 2025 10:37:59 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue To: Matheus Alcantara , Masahiko Sawada Cc: Daniil Davydov <3danissimo@gmail.com>, =?UTF-8?Q?=C3=81lvaro_Herrera?= , Alexandra Wang , PostgreSQL Hackers References: <202508061044.ptcyt7aqsaaa@alvherre.pgsql> Content-Language: en-US From: Yura Sokolov In-Reply-To: Content-Type: text/plain; charset=UTF-8 X-KSMG-AntiPhishing: NotDetected, bases: 2025/09/02 05:01:00 X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/09/02 06:50:00 #27726024 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 29.08.2025 01:31, Matheus Alcantara =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > On Thu Aug 21, 2025 at 8:14 PM -03, Matheus Alcantara wrote: >> I'll work on this considering the initial Daniil comments at [1] >> >> [1] https://www.postgresql.org/message-id/CAJDiXgg1ArRB1-6wLtXfVVnQ38P= 9Y%2BCDfEc9M2TXiOf_4kfBMg%40mail.gmail.com >> > I've been working on this on the last few days, please see the attached > patch version. >=20 > In this new version I tried to follow the suggestion from Daniil of > scanning all pages from tail to head of the async queue. Since we still need to scan those pages, couldn't we mark finished transactions as committed/aborted? This way we may to not hold datfrozenxid for a long time and will allow both safe clog truncation and safe async queue notification. More over, most notifications could be marked as completed in AtCommit_Notify already. So there is a need to recheck a few notification= s that were written but not marked in AtCommit_Notify. Since AsyncQueueEntry field is used only to check visibility, looks like = it is safe to set it to FrozenTransactionId. --=20 regards Yura Sokolov aka funny-falcon