Re: Potential data loss due to race condition during logical replication slot creation
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Masahiko Sawada <sawada.mshk@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-07-10T03:43:27Z
Lists: pgsql-bugs
On Wed, Jul 10, 2024 at 7:52 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > Overall I think the patches are in good shape, so I'm going to push > them tomorrow, barring any objections and further comments. > Agreed. Below are a few minor comments that you might want to consider: 1. @@ -76,6 +77,7 @@ extern SnapBuildState SnapBuildCurrentState(SnapBuild *builder); extern Snapshot SnapBuildGetOrBuildSnapshot(SnapBuild *builder); extern bool SnapBuildXactNeedsSkip(SnapBuild *builder, XLogRecPtr ptr); +extern void SnapBuildSetFindStartPoint(SnapBuild *builder, bool find_start_point); This is not required in the latest version. 2. + /* + * Indicates if we are using the snapshot builder for the initial creation + * of a logical replication slot. The word 'initial' in the above comment is not required. If you consider this then a similar wording change is required in lower branches as well. 3. HEAD and v17 --------------------- - /* b) valid on disk state and not building full snapshot */ + + /* + * b) valid on disk state and while neither building full snapshot nor + * finding the start point. + */ else if (!builder->building_full_snapshot && + !builder->in_slot_creation && V16 and below --------------------- - /* b) valid on disk state and not building full snapshot */ + + /* + * b) valid on disk state and neither building full snapshot nor while + * creating a slot. + */ else if (!builder->building_full_snapshot && + !ctx->in_create && Isn't it better to use the same comment in both places? -- With Regards, Amit Kapila.
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