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 1wN8nM-000bgH-0r for pgsql-hackers@arkaria.postgresql.org; Wed, 13 May 2026 12:34:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wN8nK-008n1q-30 for pgsql-hackers@arkaria.postgresql.org; Wed, 13 May 2026 12:34:35 +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 1wN8nK-008n1f-1x for pgsql-hackers@lists.postgresql.org; Wed, 13 May 2026 12:34:34 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wN8nI-00000000OmR-1gYe for pgsql-hackers@lists.postgresql.org; Wed, 13 May 2026 12:34:34 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-38ea6a5a0b3so56900281fa.3 for ; Wed, 13 May 2026 05:34:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778675670; cv=none; d=google.com; s=arc-20240605; b=SonWA2/jNx3oUI1G9a6lW9NstDlPaSHOoEWylj29I7VHfcGuF3a6Ux4FMq9febLWrE 0mS6kSz8i/fSkl3mNXaoVLf8thpEWUHl6A4KZXy3cvIOtq3VQTzNh2TJCTPsU9G3AM65 4MPNJOJTl5h4AJBXieY+rKZlvOZt49tyBXe/Wu7n9DLpELpgsdllFzOjsuZwGxkn/HT/ LIplBSS4qD5nYmkx/t1l+oPjxduhUzlQHxTdvaXvAwWNp76mbezuWfI3gx6R7Oj3A9sS UT1sE+G6+uqz6naQ/pXJoX9ur5pTZBVDp6t1F8/B80NYOagumd6mvcfRg8aGwcDnZL92 ugtw== 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=l0pDXVUXLPS6kADTrGtVy6wwf7mWo9djJMLj0gk4rIs=; fh=vxeOBpQBQ63wN1PkZQBv/xjGhJej1LPDbP4Xksflj3E=; b=gr21P9f8dbM7jyU1F8dUhJ7dyWVZ8DsYAtqF27eKBwtn6Viyhb1zrH4msUHkmR9htO hDCZIiKbbVfGFJI2Px7uj7BO0lo505FHNgajFQQim9dpY1Uvqg4BcJ3A8o5C5XtjxKBW NOdTLdyjsQdzjhtieAEMfGITtOOjy9R/ZzgKeK1CFSB4GR/d+s5EzH5I+oj3BQUwaVYi 3afgVIQ98QfxNfQ4CiuViZz2eXXq7KxyDWp1yjahdJcMaFwWZDjTVPNlTvCGK0h7ebYO 6qzSuz/PMqCC5tJNzKWMQ/HZLPQkGgevc6m3sXfJaHLERBPHCpOC/gKbWjYihZgX1u2h GQQg==; 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=1778675670; x=1779280470; 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=l0pDXVUXLPS6kADTrGtVy6wwf7mWo9djJMLj0gk4rIs=; b=YI92T+Wd0wA3lCYMFoA4QwMAG7I8hewMvH32RA49mDRHnlqOabc9pMc5wD5nLzWrew gxoGMNjUulwGt8mxqbVC4mB9vJvu3YnVJU03K6l31KJUDoQv32uI3JCZWW9D7HgNW1iA 18al1mTJhHh5VZqhJ6cEBmPo+tys2E+UJkquyWej1qVw4hUYNMFrtdLRIUcVKm5Aed4d pOCzl16AANYURGh4biK5v84NgayCYGqz91igliH9aJMBodh62BaYBBKrApjONPT6tGs8 AiPb7giEr4y/brseVfXFEhyJa2Exe4bF7R8LC51jUxT+BDyC+pqb8u7tx3+ohT9rPUWa ufVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778675670; x=1779280470; 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=l0pDXVUXLPS6kADTrGtVy6wwf7mWo9djJMLj0gk4rIs=; b=rRqeqenKi4nMZ8ZmCCfU+asuG9/d+9zZjZ8gcmz/tgStkl0Z3dLAxr7dDhpAtyY2wA YjuPipDE8s1IAe9seOABhFsr8EMpD7PxOzGwSUnoQYqI+1Zrgh5pZUKwAz2kaHwXHlXR u0g37YpPFgbboCoOTZQVVonl9JroeuaDofAKySt9vXDbE67MD3dju9hZtKF5j3hgwteM YZRbheUUsdMwhIMsnBzSsHc3E7tZRxPSFi7Sa1KGuV/SCXutTOeRXa3nAX/tAmSz3Qcd cEju28Z/agoSQd5I390HXi0IPo49uVROFU5bN7KZwEuh1VQh9vMaoZhm06Uw3cUm+LSc ycJA== X-Forwarded-Encrypted: i=1; AFNElJ8NierjoSnjrRwYpEUEl1GGjt88dJ6JkWZBxCZZWC14gnZF6ig5sJf7cI7KYaAEZW4TKXoJeDIRUKkWy4F9@lists.postgresql.org X-Gm-Message-State: AOJu0Yyqb/Dkh2s4ezh/ceVyzXwgnMUMkj+TGpIMH23/hH0Ff47SSJK+ 628ycPq6OAmIKN9T35Ah95qFCnM7Bh9FWxoKBFjHgQbxkLyfGoEUBgnA4PHFU0eHJcgCLufB92I Kow+mb9bvLAEgbTw62UHsD4NWs639GUo= X-Gm-Gg: Acq92OGNHxTvLI5qr14pUurP8bTxgDW3+YtNZdhW74ylQ7k9MEs3xrOmIGPCksjC1CD 4GrjT4o5XLuFugLvtrLzvIXGnnc1hNKFVQ+uCOZgvTKn44RuSmS5Wd3QFEvy1yXP35UHv0T3FaW Iya+l3pXRX6+JfO05HUc09NJGWkIvzQFxgGdJKY7TEe2yqDlt7TKvprAik1Sv7yPf3tvi/4LWFV SatLVZLVtADLBDGzIK/HkHzsb4dGGSeZjTn1TLXfBU2AB2M1YCY/TOlIPFxVJ5rTaHEJcxpD9w+ RRbhgoLDdivySWhOqsC/zBsql65katNHbnb6LvWm5kJOmOX5Z8gvkUZBI68UJ2KAGvwQ7a5M2Um xgCYf+lpwRw== X-Received: by 2002:a05:651c:e0a:b0:386:fa6b:44e0 with SMTP id 38308e7fff4ca-3944b593f74mr10996481fa.10.1778675670187; Wed, 13 May 2026 05:34:30 -0700 (PDT) MIME-Version: 1.0 References: <202604071230.b5axxf3qna3m@alvherre.pgsql> <227677.1775576304@localhost> <85813.1777901089@localhost> <27869.1777985266@localhost> <70574.1778512672@localhost> <82942.1778527801@localhost> <40976.1778584100@localhost> In-Reply-To: <40976.1778584100@localhost> From: Amit Kapila Date: Wed, 13 May 2026 18:04:17 +0530 X-Gm-Features: AVHnY4LJOG663knUWMubM_4Rrxl6mTBbDdTDAnBzZ8u4V-l2QYqQoMj1IrJ7444 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 12, 2026 at 4:38=E2=80=AFPM Antonin Houska wro= te: > > Amit Kapila wrote: > > > > > I see your point. Due to this, once the xmin regresses based on > > cluster-wide running_xact, some transaction could appear to be running > > when it should have appeared as committed. > > The problem is that xmin does not advance when it should. Attached is a t= est > that reproduces the problem (it includes [1], to handle injection points = in > background worker), I hope the comments in the specification file are hel= pful. > Yes, the comments were helpful. IIUC, the test skipped insert into repack_test because the transaction doing that insert happened before the snapbuild reached FULL_SNAPSHOT/CONSISTENT state, so its commit is not decoded. Then we also didn't update builder->xmin after reaching CONSISTENT state in the last running_xact record for MyDatabase. So, the insert is neither covered in initial copy, nor decoded, so after repack (concurrently) is finished the table is empty. I think the patch proposed will fix this specific issue but apart from other points raised for this patch few more are: (a) Post CONSISTENT state, for cleanup of db_specific snapshots, we need to separately again LOG db-specific running xacts whenever we encounter another running_xacts, (b) Other point is that because repack-concurrently always use full-snapshot, the serialization of snapshot is useless because it can't be used by others. > It's actually not exactly the problem reported in the stress test, but IM= O the > core issue is the same: effects of some transactions are lost. In the str= ess > test, tuple deletion was lost, so the error was "could not create unique > index". Here I only demonstrate lost INSERT. > > > Assuming, the problematic case is something > > like what I described, even than the fix of skipping cluster-wide > > running xacts and instead LOG db-specific running_xacts to help > > updating builder's xmin sounds inelegant and probably inefficient. For > > example, I think such a dependency means we can never enable > > db-specific snapshots on standby. > > ok > So now the question is where do we go from here. I am not confident that the current code to achieve db-specific snapshots in logical decoding is the best possible solution both because of the drawbacks (like we won't be able to enable this on standby) and inefficiencies pointed out by me in this and previous emails in this work. --=20 With Regards, Amit Kapila.