Re: Potential data loss due to race condition during logical replication slot creation
Masahiko Sawada <sawada.mshk@gmail.com>
From: Masahiko Sawada <sawada.mshk@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, "Callahan,
Drew" <callaan@amazon.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2024-03-19T16:42:15Z
Lists: pgsql-bugs
On Mon, Mar 18, 2024 at 6:08 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > If so, one idea to > achieve could be that we maintain the highest_running_xid while > serailizing the snapshot and then during restore if that > highest_running_xid is <= builder->initial_xmin_horizon, then we > ignore restoring the snapshot. We already have few such cases handled > in SnapBuildRestore(). I think that builder->initial_xmin_horizon could be older than highest_running_xid, for example, when there is a logical replication slot whose catalog_xmin is old. However, even in this case, we might need to ignore restoring the snapshot. For example, a slightly modified test case still can cause the same problem. The test case in the Kuroda-san's v2 patch: permutation "s0_init" "s0_begin" "s0_insert1" "s1_init" "s2_checkpoint" "s2_get_changes_slot0" "s0_insert2" "s0_commit" "s1_get_changes_slot0"\ "s1_get_changes_slot1" Modified-version test case (add "s0_insert1" between "s0_init" and "s0_begin"): permutation "s0_init" "s0_insert1" "s0_begin" "s0_insert1" "s1_init" "s2_checkpoint" "s2_get_changes_slot0" "s0_insert2" "s0_commit" "s1_get_changes_slot0\ " "s1_get_changes_slot1" Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com
Commits
-
Fix possibility of logical decoding partial transaction changes.
- bb19b70081e2 18.0 landed
- 068674f4ab44 17.0 landed
- 2f3304ce133f 16.4 landed
- aee8c2b95492 15.8 landed
- f7d3caf9ddbf 14.13 landed
- cf2c69ec5a5b 13.16 landed
- 1b370758770c 12.20 landed