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 1rSFtD-00CRe3-P3 for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jan 2024 12:28:29 +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 1rSFtC-00CdeR-3z for pgsql-bugs@arkaria.postgresql.org; Tue, 23 Jan 2024 12:28:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with utf8esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSFtB-00CdeI-8V for pgsql-bugs@lists.postgresql.org; Tue, 23 Jan 2024 12:28:25 +0000 Received: from out162-62-57-49.mail.qq.com ([162.62.57.49]) by magus.postgresql.org with utf8esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rSFt5-003IXv-OX for pgsql-bugs@lists.postgresql.org; Tue, 23 Jan 2024 12:28:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1706012891; bh=krYFSZYwmqcLrSdR7gFr8hAN9dlqUo2nK2DRbLuA/+g=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=N9y0ISICH8h/K4y2bGflBJCYAvyZZJ3uwbMbFmosx9KfOeyPAbdKezitUSWDIkJ8p F6CONfYAUXqykaRBhNoUEyLHoGC8ZYgivr9+/uBcv4125YTqsIVKFhEQJrB9idzZ4C C+dcHDUD1tzJrFNmBhBUQW+B7SpwupQ2Hdvp+C20= Received: from smtpclient.apple ([140.205.11.22]) by newxmesmtplogicsvrszc5-1.qq.com (NewEsmtp) with SMTP id 70A1A88C; Tue, 23 Jan 2024 20:28:10 +0800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x7nbzWFUHrqXq0Bl4zVZcC5XD0= X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= From: feichanghong X-OQ-MSGID: <3C316703-10A6-4E1E-8163-7C957FF26CBC@qq.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_D6A057FB-412F-40ED-B5B7-C10BB814778F" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.100.2.1.4\)) Subject: Re: BUG #18280: logical decoding build wrong snapshot for subtransactions Date: Tue, 23 Jan 2024 20:27:59 +0800 In-Reply-To: Cc: pgsql-bugs To: Amit Kapila References: <18280-4c8060178cb41750@postgresql.org> X-Mailer: Apple Mail (2.3774.100.2.1.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_D6A057FB-412F-40ED-B5B7-C10BB814778F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Thank you for your attention. > On Jan 23, 2024, at 19:42, Amit Kapila = wrote: >=20 > On Wed, Jan 10, 2024 at 7:56=E2=80=AFPM feichanghong = wrote: >>=20 >>> SnapBuildXidSetCatalogChanges (introduced in 272248a) skipping the = check for >>> the sub-transactions when the parent transaction has been marked as >>> containing catalog changes should be the root cause of the problem. >>=20 >> My fix is to remove the ReorderBufferXidHasCatalogChanges condition = from the SnapBuildXidSetCatalogChanges function. This approach has a = false positive; the subtransactions that didn't change catalog to the = snapshot are also added to the commit list. But that won't be a problem = since we use snapshot built during decoding only to read system = catalogs, as 272248a's commit message says. >>=20 >=20 > Thanks, your analysis sounds correct to me. BTW, I think this should > occur only in 15 and 14 because in prior branches we didn't check if > the xact has catalog changes before marking its subxacts. =46rom 16 > onwards, we already accurately serialize the xacts and subxacts that > have made any catalog changes, so this problem shouldn't be there. Can > you please once verify the same? >=20 Yes, I verified versions 11 to 16 one by one, and this problem only = occurs in 14 and 15. Best Regards, Fei Changhong Alibaba Cloud Computing Ltd. --Apple-Mail=_D6A057FB-412F-40ED-B5B7-C10BB814778F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Thank you for = your attention.

On Jan 23, 2024, at 19:42, Amit Kapila = <amit.kapila16@gmail.com> wrote:

On Wed, Jan 10, 2024 at = 7:56=E2=80=AFPM feichanghong <feichanghong@qq.com> = wrote:

SnapBuildXidSetCatalogChanges (introduced in 272248a) = skipping the check for
the sub-transactions when the parent = transaction has been marked as
containing catalog changes should be = the root cause of the problem.

My fix is to remove = the ReorderBufferXidHasCatalogChanges condition from the = SnapBuildXidSetCatalogChanges function. This approach has a false = positive; the subtransactions that didn't change catalog to the snapshot = are also added to the commit list. But that won't be a problem since we = use snapshot built during decoding only to read system catalogs, as = 272248a's commit message says.


Thanks, your = analysis sounds correct to me. BTW, I think this should
occur only in = 15 and 14 because in prior branches we didn't check if
the xact has = catalog changes before marking its subxacts. =46rom 16
onwards, we = already accurately serialize the xacts and subxacts that
have made = any catalog changes, so this problem shouldn't be there. Can
you = please once verify the same?

Yes, I = verified versions 11 to 16 one by one, and this problem only = occurs
in 14 and 15.

Best Regards,
Fei = Changhong
Alibaba Cloud Computing Ltd.

= --Apple-Mail=_D6A057FB-412F-40ED-B5B7-C10BB814778F--