Re: ERROR: subtransaction logged without previous top-level txn record
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>, Arseny Sher <a.sher@postgrespro.ru>
Cc: Andres Freund <andres@anarazel.de>, "Hsu, John" <hsuchen@amazon.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2020-02-12T08:12:23Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- 0002-Stop-demanding-that-top-xact-must-be-seen-before-sub.HEAD_12.patch (application/octet-stream) patch 0002
- 0002-Stop-demanding-that-top-xact-must-be-seen-before-sub.11_95.patch (application/octet-stream) patch 0002
On Wed, Feb 12, 2020 at 9:09 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Wed, Feb 12, 2020 at 8:46 AM Dilip Kumar <dilipbalaut@gmail.com> wrote: > > > > On Tue, Feb 11, 2020 at 5:36 PM Arseny Sher <a.sher@postgrespro.ru> wrote: > > > > > > > > > Amit Kapila <amit.kapila16@gmail.com> writes: > > > > > > >> That's weird, it reliably fails with expected error for me. There are > > > >> already two s2_checkpoint's: first establishes potential (broken) > > > >> restart_lsn (serializes snapshot after first xl_xact_assignment of s0 > > > >> xact, but before first record of s1 xact), the second ensures > > > >> s2_get_changes directly following it will actually advance the slot, > > > >> > > > > > > > > In my case, s2_get_changes doesn't seem to be advancing the restart > > > > lsn because when it processed running_xact by s2_checkpoint, the slots > > > > confirm flush location (slot->data.confirmed_flush) was behind it. As > > > > confirmed_flush was behind running_xact of s2_checkpoint, it couldn't > > > > update slot->candidate_restart_lsn (in function > > > > LogicalIncreaseRestartDecodingForSlot). I think the confirmed_flush > > > > location will only be updated at the end of get_changes. This is the > > > > reason I need extra get_changes call to generate an error. > > > > > > > > I will think and investigate this more, but thought of sharing the > > > > current situation with you. There is something different going on in > > > > my system or maybe the nature of test is like that. > > > > > > Ah, I think I know what's happening -- you have one more > > > xl_running_xacts which catches the advancement -- similar issue is > > > explained in the comment in oldest_xmin.spec. > > > > > Right, that is why in my case get_changes were required twice. After > calling get_changes as we do in oldest_xmin.spec will make test case > reliable. > Attached is a patch where I have modified the comments and slightly edited the commit message. This patch was not getting applied in v11 and branches lower than that, so I prepared a patch for those branches as well. I have tested this patch till 9.5 and it works as intended. Can you also once check the patch and verify it in back-branches? -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com
Commits
-
Stop demanding that top xact must be seen before subxact in decoding.
- 05555f7aaa08 9.5.22 landed
- 59c1a03f0736 9.6.18 landed
- b448aa44170b 10.13 landed
- bff456d7a0b3 11.8 landed
- 59112f235549 12.3 landed
- e3ff789acfb2 13.0 landed
-
logical decoding: process ASSIGNMENT during snapshot build
- bac2fae05c77 13.0 cited
- 96b5033e1171 12.0 cited
-
Fix operator naming in pg_trgm GUC option descriptions
- 959792087a10 9.6.14 cited