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 1vApD2-006LS0-28 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Oct 2025 12:41:55 +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 1vApD0-00HNtB-VL for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Oct 2025 12:41:54 +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.94.2) (envelope-from ) id 1vApD0-00HNt2-Ld for pgsql-hackers@lists.postgresql.org; Mon, 20 Oct 2025 12:41:53 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vApCx-003EDY-1H for pgsql-hackers@postgresql.org; Mon, 20 Oct 2025 12:41:53 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-b6093f8f71dso2902988a12.3 for ; Mon, 20 Oct 2025 05:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760964109; x=1761568909; darn=postgresql.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=B+IYfZrPaydc/6iBSDswwwt7RjQfbd9pPwZxBMNk+uw=; b=hNZIkTokDQWXWP7cMJQhsS8HQ/ijrxlh2sNXSLlk6N7oQ40oGDZ7djplJVmOY62q+O LgzWzGXkPGZAdN3nDTkecko4AW6Zmt1whM1XQNx4gMFEfIHD2nX4JEUTaH/GCc//QiRd gUotCLwNyyywg2BH9tw5PsK/mDruykOCSoO5lcpnZzFgXwoi73UEWJAZ/RLmGqxttCle S+PSAC1abcGDA5H+KADIvfAlyTYI8cSnWfCTTZv7mYQXprvmraKzSuDQAgCf56tGBNzt L9b+cOXBV1ERE2pIaWpP9CpfwhyYstbXT20dFU/Wr6x2Loo2bJQM4t0Xmv8wTpzb/kj/ GFtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760964109; x=1761568909; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=B+IYfZrPaydc/6iBSDswwwt7RjQfbd9pPwZxBMNk+uw=; b=CPekauv/IBw+YckP8InUCZxD1dc3OBaXM4MjIynlAJKIsJwZtSVKwHiUaRAJV80mdA tmO9HJ2BseOlXGFN00Nspgd1sCZrcMINIvngJdTdFQyfQocDdGt/2yGtFS3AlPoHFAVz 7MtnKb3t8V2zmOqaysPj3QYN6net3skH6HKqykjMjxYNC6QJG1qZSMZCu972RzIae7q/ W42p/TueJi+bQMCq6oMu/Bjxx/2KDi3zGWwgHQliwK4XV14KmM1jDIdGl5fiBQfJzGNr RJLp4zfRGuMOcvsv4xxCQgXwWtD2IgyakMRNpUkZWHDNALqzu7b2tNruWyHMsL/WbgE+ FRyg== X-Forwarded-Encrypted: i=1; AJvYcCWM2FJbpY8L8cz0fSVgzZaTr8G024O3DFMtwpnEnFZRrWTZl8Jgu3DlWwOtbyag7zefm3f3IK8rNW5HKI2O@postgresql.org X-Gm-Message-State: AOJu0YxIKHKtTjKHTCygwe3mXZfpDDrNKzADqgHRPNMWkPdUDeZ12SlD d5T0OcSAbV47wFAuXlVbzTnfUUSSxN5bwTQ3Cb/WB7/9ULIcfkmK3PmQC5F1xOkS X-Gm-Gg: ASbGncuyQyAFzJMYyPw7MdShvUiVJ5ZLTqCc7lO+AG6cuTFAfG41+HzcipP9j/DAEGA Iahiebpzkh4i/yBh6f4mgdDjd0p1WKjp8DeyieBkPDMhsxED9KbXeCJMJc7FJ/otaDwWfaJ1TmR 3SQXsyG+XyiwyXdytcNYgCdiWeMD4NowqqOO5B9tqqb7PQYqONRrV5nPSX3Z0qLwxOeNjlw+u4D kHt6m5iNk1BN+SKSBDRhM50OpafWvkYS2Mia1qOD9XkFwjf6B9NI1g3GqHXAmO1GP1zCn5q6b8h 4MoPQG1i0E1LQzDIsEtJwrKNLR71jZk7LDng2/VWfLw4XlJbvC4aN1XnMiV8X7PZr5Lp1uY93Yu 5B5uoGGDvIqdjLdiPWf6vcQ3d5SJh8GRhSrnRgfqOnG6TY+1lhsZSpUjY545xCspbpS11pYrFH5 sf32cVewIKYdwLs4VxamHMTjD2FoCyd6CS4saiadB2MzN9 X-Google-Smtp-Source: AGHT+IFkK02/FDsrfY1Uw0YY2s9vrEY6+ZujvKkWclB9Bg4b7VrKUKDL1uB5eItKls5gBi73vXcfNQ== X-Received: by 2002:a17:902:da89:b0:248:7018:c739 with SMTP id d9443c01a7336-290cba4ef0amr164084395ad.28.1760964108880; Mon, 20 Oct 2025 05:41:48 -0700 (PDT) Received: from localhost ([2804:14d:328a:a59c:e05c:11ed:b9c4:ebee]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-292471d55d8sm78808605ad.61.2025.10.20.05.41.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Oct 2025 05:41:48 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 20 Oct 2025 09:41:43 -0300 Message-Id: Cc: "Matheus Alcantara" , "Masahiko Sawada" , "Rishu Bagga" , "Yura Sokolov" , "Daniil Davydov" <3danissimo@gmail.com>, "Alexandra Wang" , "pgsql-hackers" , "Tom Lane" Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue From: "Matheus Alcantara" To: "Joel Jacobson" , =?utf-8?q?=C3=81lvaro_Herrera?= , "Arseniy Mukhin" X-Mailer: aerc 0.21.0 References: <202510171347.twmkbitfsgfh@alvherre.pgsql> <25651193-da4e-4185-a564-f2efa6b0c8a4@app.fastmail.com> In-Reply-To: <25651193-da4e-4185-a564-f2efa6b0c8a4@app.fastmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun Oct 19, 2025 at 2:14 PM -03, Joel Jacobson wrote: > On Fri, Oct 17, 2025, at 15:51, =C3=81lvaro Herrera wrote: >> I have the impression that this thread has lost focus on the idea of >> producing a backpatchable bugfix. The last proposed patch has a lot of >> new mechanism that doesn't seem suitable for backpatch. I could be >> wrong of course. > > I've tried to create a minimal isolated fix, hopefully suitable for > backpatching, with no new mechanisms, other than the added > GetOldestQueuedNotifyXid used by vac_update_datfrozenxid. > > It's based on the approach discussed earlier in this thread, that just > goes through the notification queue from QUEUE_TAIL to QUEUE_HEAD, to > find the oldestXid in the current database. > > Implementation: > > * Break out SLRU read page code from asyncQueueReadAllNotifications into > new helper-function asyncQueueReadPageToBuffer. > > * Add GetOldestQueuedNotifyXid which uses the new helper-function > asyncQueueReadPageToBuffer. > > It passes the 001_xid_freeze.pl test, not included in this patch. > This is similar to what was already proposed at [1]. This approach was abandoned because a notification on the queue may block datfrozenxid advance and clog truncation which can cause other issues for the users [2]. [1] https://www.postgresql.org/message-id/CAFY6G8cJm73_MM9SuynZUqtqcaTuepUD= gDuvS661oLW7U0dgsg%40mail.gmail.com [2] https://www.postgresql.org/message-id/d186fba0-dc65-4274-aa96-3906bbb2e= 530%40postgrespro.ru -- Matheus Alcantara