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 1wM2NU-002Bf7-2h for pgsql-hackers@arkaria.postgresql.org; Sun, 10 May 2026 11:31:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wM2NT-00EqcH-2N for pgsql-hackers@arkaria.postgresql.org; Sun, 10 May 2026 11:31:19 +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 1wM2NT-00Eqc8-1S for pgsql-hackers@lists.postgresql.org; Sun, 10 May 2026 11:31:19 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wM2NR-00000001Xqk-15f0 for pgsql-hackers@lists.postgresql.org; Sun, 10 May 2026 11:31:18 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-39393ec4ed0so30198341fa.0 for ; Sun, 10 May 2026 04:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778412676; cv=none; d=google.com; s=arc-20240605; b=T0PAh/UMHhknVAHWsVOjM9pt+Cw1ooUiQjcBZdi5PCfNGu7empN/Yo/4g5B3MmQ3bD 4LbNS7nFUc65Tt7ifWxD2subPCWUjdEalAXgrIGVPg1j4wKugfOgbcSteZfE5tYMDV/n Rcr2NCWLe1fLusZhIoZqJ1HwyU0U/yh4gu2OQ1ZHMJIMvDzgfWrrvvWCFaUyziv/D2Ig KGN6fv+if7EFlAH/HLtPeG2ZrUFexI5d8xLuj3yfvQeE7DlGlTZRiQfBObkRKVYc7O3Y QCsKmFNT1Y9sPgMUhFwDs/0ccoXnRTNsrT0obTY2mmgAoTJ4X6HBTcyBt2sY8hxSj/IH eI7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=93ULh1PhCYb7Al3lMdntEubrMC5lpk4G3FWuS8NmkUU=; fh=xys7d5AjEzciK+KNimFgbXbk1ZPLMe6I+HYWNoYz/PY=; b=R0CLxfxjasG0m5WkzlfNYzk/kkHVl2tJQvaczEuJnM96fuCI6XWpqh4SIx9FU89B7e AV6/HtNAomtgoxLOOdCMuM5CrnWY3tH9kmk6PdjPRfvpvbDt9Y7+++bpOUHGT1QqK+/1 xrj6cvENkcR9/HOcCLZgRevD5b6o0JbxCGPK0VwdKa9UTjG6ZUutAjsF1/CeHk470rBC +mMeO6vROluzbUmZlhNjvPZGEN//FO5evTeH+D4DyNbExe2mQ7RvqzGfNHTOc7pvh9+a LNY4MfQqBkQhY6QuGV5ASPdaqfJ6Dowyq9OW+XfoW9aGYVm5q8VkLJ0bNU9hCWb0rDl/ 5V2Q==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778412676; x=1779017476; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=93ULh1PhCYb7Al3lMdntEubrMC5lpk4G3FWuS8NmkUU=; b=IGyjjUSKnChT8+HkB02kQg6fLPeuiy4ISmuU6iut6GCep/CjSRTkK4qShEh0eK6fkq lBVN8G/DDy7QOS48JMrOucPDgA7yZjoRwusCg+K84NscQytvLJ7dGrID8tb955LVoDcp g3MAh6Gj5jBbedDPRREtNTJuCXJT/T+LwW1sV86nla94SnunrrXDNgjWHlZbDcYH0VSn 69uepqX/BdkX38OhCB75dAh+ZIaXoozYGNRYnrBMSU/SXxLeLjNtxXg0GTnJDVYin+ou D5Z8un17LIOjjJawIHF1b7bauBIEwTi3BL8xr0Uwz9RUYg0qSDCz+ZvHS1Oo7z2rKDw4 dKTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778412676; x=1779017476; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=93ULh1PhCYb7Al3lMdntEubrMC5lpk4G3FWuS8NmkUU=; b=IpixdomlMYU996BGpfQkzfnljiUA0gi5HJItsBYXz0FK2ihbR4xKrAxTiOhmyKzp0Y D7DkobReECo6yt1qKkEuEKfcN0UqP54jUdq3Zy4/AFQ2OySYnFyiu2d3HpAtiD8NXJrn os16WWvnI5pGMTrepA6BK319Nf4DnR8bdy1S1DQDbXB/xR5WzX/xVPhn/VQR5eIN+Mrn xOSVn0omS3LcEYGtHgSdm6W1OHPfC5GKNQX91JAv0N6D6AZymonZoHSaT+3thGC5MS9g sq2pz6aZ7639y79fhMJyX20LP3BmFpGwLddaUsxDZvEyUgqhp1t+ZBSyEv4j3baum35v cBPg== X-Forwarded-Encrypted: i=1; AFNElJ8jhVxGLEIT9kfumQxy8xd1Krc8P0MHYKl3jS45m2XsaCjSFKmIY4xTek3niUDaN1j0nYAS9nDknYf0+9/U@lists.postgresql.org X-Gm-Message-State: AOJu0Yz9848bZq1e+LQ0kDv1S2h6fmNOxEOS6RRv9IPAtHyJK4egPqi7 8dD4Td6WlDiHWYSVX5vvzwLAEfotKl0WOTPzdSCMLTL2UU8EmIBmVW6pJ3I9Z/CUfvjaXlTo/Dk h79DeL4E3qyx3bCwXt9034Be/wPsR52MgmJyVUb4= X-Gm-Gg: Acq92OG0swN9VW+vgwAVLISyRGHc1Bf7UKuXrQlxV3VSsM4A1iijTkrFsCPvyKdYvxR AU19fj9mMSXdFwCmJXz9t8w4ghe3ZGhuFuK/24wsKZO9r6Gc0aolF5bYqVoJ2NvUGYBBxhm+j4V GbXwuS48YNcXLN9MT3lKXGAgiYbXLGCmmsLNEJjX5LqiYhuq5RCtpQKYZDy9WMPWT+kJMWbTgP2 zoG4KsWkXODU20uf/EuFmVw5Gddm/Kqlrn1ySQ7O/nJ+nhdMQdhTA2nSe2Z1Y+ACCJdpBytlbb2 dV+jomRDlEYDgTpeTjWR/68tCOZcAf3jZ2dXJJuRYNZ1VbBzQHBAgR7iLOxGo6Z4fp5zSXtnRwf HbNp9CoiS X-Received: by 2002:a05:651c:e09:b0:394:1b05:4554 with SMTP id 38308e7fff4ca-3941b054827mr4711551fa.4.1778412675930; Sun, 10 May 2026 04:31:15 -0700 (PDT) MIME-Version: 1.0 References: <202604071230.b5axxf3qna3m@alvherre.pgsql> <227677.1775576304@localhost> <85813.1777901089@localhost> <27869.1777985266@localhost> In-Reply-To: <27869.1777985266@localhost> From: Amit Kapila Date: Sun, 10 May 2026 17:01:04 +0530 X-Gm-Features: AVHnY4Iz4mS9wcWP1pElkJXkwuUuZr_eKwjyqSXQr7ik_1m2J4SP6MkJKybjTnE Message-ID: Subject: Re: Adding REPACK [concurrently] To: Antonin Houska Cc: Mihail Nikalayeu , Andres Freund , Alvaro Herrera , Srinath Reddy Sadipiralla , Matthias van de Meent , Pg Hackers , Robert Treat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, May 5, 2026 at 6:17=E2=80=AFPM Antonin Houska wrot= e: > > Antonin Houska wrote: > > I think the problem is that with database-specific snapshot, > SnapBuildProcessRunningXacts() returns early, w/o adjusting builder->xmin > > /* > * Database specific transaction info may exist to reach CONSISTE= NT state > * faster, however the code below makes no use of it. Moreover, s= uch > * record might cause problems because the following normal (clus= ter-wide) > * record can have lower value of oldestRunningXid. In that case,= let's > * wait with the cleanup for the next regular cluster-wide record= . > */ > if (OidIsValid(running->dbid)) > return; > > and thus some transactions whose XID is below running->oldestRunningXid m= ay > continue to be incorrectly considered running. > > I originally thought that this should not happen because such transaction= s > will be added to the builder's array of committed transactions by > SnapBuildCommitTxn() anyway. However, I failed to notice that COMMIT reco= rd of > a transaction listed in the xl_running_xacts WAL record is not guaranteed= to > follow the xl_running_xacts record in WAL. In other words, even if > xl_running_xacts is created before a COMMIT record of the contained > transaction, it may end up at higher LSN in WAL. So the cleanup I relied = on > might not take place. > BTW, is it possible to write a test by using injection_points or via manual steps (by using debugger, etc) so that we can more clearly understand this problem and proposed fix? --=20 With Regards, Amit Kapila.