Re: Skipping logical replication transactions on subscriber side
Masahiko Sawada <sawada.mshk@gmail.com>
Attachments
- v19-0001-Add-a-subscription-worker-statistics-view-pg_sta.patch (application/x-patch) patch v19-0001
On Thu, Oct 28, 2021 at 7:40 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Thu, Oct 28, 2021 at 10:36 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > On Wed, Oct 27, 2021 at 7:02 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > On Thu, Oct 21, 2021 at 10:29 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > > > > > > > > > I've attached updated patches. > > > > Thank you for the comments! > > > > > > > > Few comments: > > > ============== > > > 1. Is the patch cleaning tablesync error entries except via vacuum? If > > > not, can't we send a message to remove tablesync errors once tablesync > > > is successful (say when we reset skip_xid or when tablesync is > > > finished) or when we drop subscription? I think the same applies to > > > apply worker. I think we may want to track it in some way whether an > > > error has occurred before sending the message but relying completely > > > on a vacuum might be the recipe of bloat. I think in the case of a > > > drop subscription we can simply send the message as that is not a > > > frequent operation. I might be missing something here because in the > > > tests after drop subscription you are expecting the entries from the > > > view to get cleared > > > > Yes, I think we can have tablesync worker send a message to drop stats > > once tablesync is successful. But if we do that also when dropping a > > subscription, I think we need to do that only the transaction is > > committed since we can drop a subscription that doesn't have a > > replication slot and rollback the transaction. Probably we can send > > the message only when the subscritpion does have a replication slot. > > > > Right. And probably for apply worker after updating skip xid. I'm not sure it's better to drop apply worker stats after resetting skip xid (i.g., after skipping the transaction). Since the view is a cumulative view and has last_error_time, I thought we can have the apply worker stats until the subscription gets dropped. Since the error reporting message could get lost, no entry in the view doesn’t mean the worker doesn’t face an issue. > > > In other cases, we can remember the subscriptions being dropped and > > send the message to drop the statistics of them after committing the > > transaction but I’m not sure it’s worth having it. > > > > Yeah, let's not go to that extent. I think in most cases subscriptions > will have corresponding slots. Agreed. > > FWIW, we completely > > rely on pg_stat_vacuum_stats() for cleaning up the dead tables and > > functions. And we don't expect there are many subscriptions on the > > database. > > > > True, but we do send it for the database, so let's do it for the cases > you explained in the first paragraph. Agreed. I've attached a new version patch. Since the syntax of skipping transaction id is under the discussion I've attached only the error reporting patch for now. 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