Re: Skipping logical replication transactions on subscriber side
Masahiko Sawada <sawada.mshk@gmail.com>
Attachments
- v9-0001-Add-ALTER-SUBSCRIPTION-.-SKIP-to-skip-the-transac.patch (application/x-patch) patch v9-0001
On Fri, Jan 21, 2022 at 1:18 AM Peter Eisentraut
<peter.eisentraut@enterprisedb.com> wrote:
>
> On 18.01.22 07:05, Masahiko Sawada wrote:
> > I've attached a rebased patch.
>
> I think this is now almost done. Attached I have a small fixup patch
> with some documentation proof-reading, and removing some comments I felt
> are redundant. Some others have also sent you some documentation
> updates, so feel free to merge mine in with them.
Thank you for reviewing the patch and attaching the fixup patch!
>
> Some other comments:
>
> parse_subscription_options() and AlterSubscriptionStmt mixes regular
> options and skip options in ways that confuse me. It seems to work
> correctly, though. I guess for now it's okay, but if we add more skip
> options, it might be better to separate those more cleanly.
Agreed.
>
> I think the superuser check in AlterSubscription() might no longer be
> appropriate. Subscriptions can now be owned by non-superusers. Please
> check that.
IIUC we don't allow non-superuser to own the subscription yet. We
still have the following superuser checks:
In CreateSubscription():
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to create subscriptions")));
and in AlterSubscriptionOwner_internal();
/* New owner must be a superuser */
if (!superuser_arg(newOwnerId))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to change owner of
subscription \"%s\"",
NameStr(form->subname)),
errhint("The owner of a subscription must be a superuser.")));
Also, doing superuser check here seems to be consistent with
pg_replication_origin_advance() which is another way to skip
transactions and also requires superuser permission.
>
> The display order in psql \dRs+ is a bit odd. I would put it at the
> end, certainly not between Two phase commit and Synchronous commit.
Fixed.
>
> Please run pgperltidy over 028_skip_xact.pl.
Fixed.
>
> Is the setting of logical_decoding_work_mem in the test script required?
> If so, comment why.
Yes, it makes the tests check streaming logical replication cases
easily. Added the comment.
>
> Please document arguments origin_lsn and origin_timestamp of
> stop_skipping_changes(). Otherwise, one has to dig quite deep to find
> out what they are for.
Added.
Also, after reading the documentation updates, I realized that there
are two paragraphs describing almost the same things so merged them.
Please check the doc updates in the latest patch.
I've attached an updated patch that incorporated these commends as
well as other comments I got so far.
Regards,
--
Masahiko Sawada
EDB: https://www.enterprisedb.com/
Commits
-
Test ALIGNOF_DOUBLE==4 compatibility under ALIGNOF_DOUBLE==8.
- c1da0acbb06e 15.0 landed
-
Reorder subskiplsn in pg_subscription to avoid alignment issues.
- 79b716cfb7a1 15.0 landed
-
Add ALTER SUBSCRIPTION ... SKIP.
- 208c5d65bbd6 15.0 landed
-
Optionally disable subscriptions on error.
- 705e20f8550c 15.0 cited
-
Update docs of logical replication for commit 8d74fc96db.
- 85c61ba8920b 15.0 landed
-
Respect permissions within logical replication.
- a2ab9c06ea15 15.0 cited
-
Fix regression test failure caused by commit 8d74fc96db.
- 41e66fee0516 15.0 landed
-
Add a view to show the stats of subscription workers.
- 8d74fc96db5f 15.0 landed
-
Add logical change details to logical replication worker errcontext.
- abc0910e2e0a 15.0 landed
-
Rename LOGICAL_REP_MSG_STREAM_END to LOGICAL_REP_MSG_STREAM_STOP.
- 4cd7a1896871 15.0 landed
-
Fix typo in protocol.sgml.
- e1915646658d 14.0 landed
- 0ac1aee0d7d8 15.0 landed
-
Remove unused argument in apply_handle_commit_internal().
- f4b939f1a372 14.0 landed
- 16bd4becee32 15.0 landed
-
Fix replication of in-progress transactions in tablesync worker.
- 0926e96c4934 14.0 cited
-
Reorder pg_sequence columns to avoid alignment issue
- f3b421da5f4a 10.0 cited