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.98.2) (envelope-from ) id 1xI37u-00000003Ruu-1Zwz for pgsql-hackers@arkaria.postgresql.org; Sat, 17 Oct 2026 12:03:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xI37s-000000009CR-0tsg for pgsql-hackers@arkaria.postgresql.org; Sat, 17 Oct 2026 12:03:00 +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.98.2) (envelope-from ) id 1xI37r-000000009CI-3pdT for pgsql-hackers@lists.postgresql.org; Sat, 17 Oct 2026 12:02:59 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1xI37p-00000002Um1-2Ky4 for pgsql-hackers@lists.postgresql.org; Sat, 17 Oct 2026 12:02:58 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-2db3728f0c4so1056775ad.0 for ; Sat, 17 Oct 2026 05:02:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1792238576; x=1792843376; darn=lists.postgresql.org; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Ft4n5nX/Pk3ZuME2ZaTJpDbqdzERf0aZ6VwpJ7AspgY=; b=FgtGgYrOWlHjStqeeSG7NKb79UMQV1VfghNvDBN62ZFKhQDr/SHZPxjTJCLAzvD9Qn ogi+HvxgFvsRUJYP1jSfTwB3jbvK3x/OuCIaVyeFOcFsmaP7M4RsoGtDbiFEAJtRiq4r QAlwdaL47Uvlp7Sf4t0MDNGM3LCAfx4d68McNyNASj0azftdvQg6NtRorDOiOJNx47zU vV5zSWIlzCxOQf1JFZ39Wn4dYjMesjhhzuhrlOrmTyxxOkC987Qzrx3yG/bOqRoVD6GF cq6lTNq5RqUNhOHMgLWhUOQMonn3P7WHFZmTvL7KeiprfjcNfIiZCfH/8shNZ6Riqa8N PUrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792238576; x=1792843376; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Ft4n5nX/Pk3ZuME2ZaTJpDbqdzERf0aZ6VwpJ7AspgY=; b=clDHpEIJCcbOXpH+7AGiDBY+8gXV2wUx2VGhoK/f7hI9EP090LMPp3Wsj+FN77YqxX Zc7Yu82/8B7vL8qAbtcjKmKCYiUW0xN3KP7MhFJWeKTWMqxr/x+XaIMLWSLcHxBj9uZs JDBOD9PvfU/o2qyw/mXwnNoBfopz7UGCdEX7kEcYQXi7e1nzuFib0Wqbjx1Xl77UZrJy 34mwmN1yRZnCbAaezawdIkpcku/dN73C7fH639caIspT9Nlwh62BxB2Gu/7OM0ZsaQYh DlXNazPKubA6cjclqURBVFGTW6zhEb8w1qYrKbcGeSIFsLOmrRd1vgWf7PGbaXRg2Au9 Wb/g== X-Forwarded-Encrypted: i=1; AKwUvBxhnuox5dTdBjmevM/mewQUgpXVYJYpDYumCiZD3L8IvCPadgoUNXZIKmfOOm0+sRgYn/JwpuRKVIaHFi9h@lists.postgresql.org X-Gm-Message-State: AFq9FYJ0Z9tOTGnpGr8Iexp6KWPBh5+2zhRkRMxjcKdwSxkgN6bzvArh VV4+CbeQUlc0Fk/k0oskQKwUWYK8U8mYuL5LVqJdur7NikpeteKdHyex3hxnSgqa X-Gm-Gg: AYBFou3BzT7vBkb/ihtVrU/KbDQsS/JxngFJwUF2fXjXqdlyhOOubqo9KE6x5BiUnll eJfdpmdQEcfjITR6FirBz6topqeHCTL+d4C8Zqro/LycaibcbucGya1f1tpv+cF/nte57RPzjcE 2MPUOMqta4SPk/jfIEC2Mnb3a145X+HGf/AsRZzVrXPvgMTctyhi2F+l8iDUbvA+PDDGVXMe4U6 ft6AQAjy6tOjZ1LxRhykJQ2G7Weqv478sdksHs7smFdqAsRu89c9Vg+Z9ymMXMh+ntt82hZ8SgT izd8Xwlt1KyuaOMqIBJufQYE+tV7CBIzTnQNJrmzgRombR6xIdzk5vmT4dC5bNY4hQNSSnYNkdy ibvBYXqDt5/1GsSQHZq2FJL7aJaFez3YozYf/16eX/0oja/1uX/P8rX6g43ypSZ5nd4iBxNE+NY Q6onty3xjub7l8fdiliRNNfp2HVvOxdWZfz8FXmBl6TsmWByNh58X6vFWkMgeGuFviC9gF3eG7x 4ZsjBQQq+4mbg2Gv2MMdeA3c6dm6BS4P96H5SlOVEYdfaXKnjkZGxMzKyyCQuq+Gv7gUF7adtnA FL38qWFGbs+6hOUB+M4xNWHc+A== X-Received: by 2002:a17:903:b07:b0:2e9:5714:607b with SMTP id d9443c01a7336-2e9a66fafe2mr38888465ad.0.1792238575743; Sat, 17 Oct 2026 05:02:55 -0700 (PDT) Received: from 192.168.1.109 ([2803:3c90:cee:ea00:5c3c:7e70:29e3:7a55]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-185aaea8b24sm6302587c88.19.2026.10.17.05.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Oct 2026 05:02:54 -0700 (PDT) From: Manu To: Ayush Tiwari Cc: "alvherre@kurilemu.de" , Bingshuai Li , Zhijie Hou , "Hayato Kuroda (Fujitsu)" , Michael Paquier , Tom Lane , Alexander Lakhin , Mark Dilger , Amit Kapila , Masahiko Sawada , Andrey Rachitskiy , "a.kozhemyakin@postgrespro.ru" , pgsql-hackers@lists.postgresql.org Subject: Re: Bug in logical decoding with DDL and subtransactions Date: Sat, 17 Oct 2026 09:02:49 -0300 Message-ID: <179223856913.4155965.12786541965300839444@gmail.com> In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Ayush, > Could we skip that scan when none of the aborting xids has catalog > changes? [...] I can prepare a patch if the direction looks right. The direction looks right. I built your guard on current master (26bd08fb5c, which has beff3cd0098) and measured it: - Correctness: across 60,000 random transactions (DDL plus DML, nested savepoints with RELEASE, and a DML-only savepoint rolled back after the DDL), the build with your guard decoded byte-for-byte the same stream as master. I also instrumented the skip path to walk the list anyway and count what it would have removed: in 50,287 skipped aborts, 0 had any tuplecid to remove. - The loop over the subxacts is necessary, as you noted. Without it, a tuplecid_nested permutation with an INSERT at the outer savepoint (the outer subxact has no catalog changes of its own; the entries belong to a released inner subxact) fails on the cmin Assert, and the same thing crashes the differential fuzzer in every shard. With the loop, all of it passes. (ReorderBufferBuildTupleCidHash() already gates on rbtxn_has_catalog_changes() the same way; the flag is set in ReorderBufferXidSetCatalogChanges() and cleared nowhere, so it is a sound gate here too.) - Saving: it grows as (tuplecid list length) x (DML-only aborts). For short lists it is in the noise -- around 0.1 ms at 1k tuplecids and 100 aborts. It becomes real higher up: 10k/1k is 19 ms -> 3.6 ms, 50k/10k is 1067 ms -> 18 ms, and 100k/10k is 5213 ms -> 36 ms. One thing worth documenting: the guard relies on the catalog-changes flag never being cleared once set. That holds today, but a short comment or an Assert at the skip would make the dependency explicit for whoever adds a flag path later. Happy to share the extra test permutation and the fuzz/benchmark scripts if they are useful for the patch. Regards, Manu