Re: Single transaction in the tablesync worker?

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Single transaction in the tablesync worker?
Date: 2021-01-08 09:11:48
Message-ID: CAHut+Pvby4zg6kM1RoGd_j-xs9OtPqZPPVhbiC53gCCRWdNSrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit.

PSA the v13 patch for the Tablesync Solution1.

Differences from v12:
+ Fixed whitespace errors of v12-0001
+ Modify TCOPYDONE state comment (houzj feedback)
+ WIP fix for AlterSubscripion_refresh (Amit feedback)

====

Features:

* The tablesync slot is now permanent instead of temporary. The
tablesync slot name is no longer tied to the Subscription slot na

* The tablesync slot cleanup (drop) code is added for DropSubscription
and for process_syncing_tables_for_sync functions

* The tablesync worker is now allowing multiple tx instead of single tx

* A new state (SUBREL_STATE_TCOPYDONE) is persisted after a successful
copy_table in LogicalRepSyncTableStart.

* If a re-launched tablesync finds state SUBREL_STATE_TCOPYDONE then
it will bypass the initial copy_table phase.

* Now tablesync sets up replication origin tracking in
LogicalRepSyncTableStart (similar as done for the apply worker). The
origin is advanced when first created.

* The tablesync replication origin tracking is cleaned up during
DropSubscription and/or process_syncing_tables_for_apply.

* The DropSubscription cleanup code was enhanced (v7+) to take care of
any crashed tablesync workers.

* Updates to PG docs

TODO / Known Issues:

* Address review comments

* ALTER PUBLICATION DROP TABLE can mean knowledge of tablesyncs gets
lost causing resource cleanup to be missed. There is a WIP fix for
this in the AlterSubscription_refresh, however it is not entirely
correct; there are known race conditions. See FIXME comments.

---

Kind Regards,
Peter Smith.
Fujitsu Australia

On Thu, Jan 7, 2021 at 6:52 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Amit.
>
> PSA the v12 patch for the Tablesync Solution1.
>
> Differences from v11:
> + Added PG docs to mention the tablesync slot
> + Refactored tablesync slot drop (done by
> DropSubscription/process_syncing_tables_for_sync)
> + Fixed PG docs mentioning wrong state code
> + Fixed wrong code comment describing TCOPYDONE state
>
> ====
>
> Features:
>
> * The tablesync slot is now permanent instead of temporary. The
> tablesync slot name is no longer tied to the Subscription slot na
>
> * The tablesync slot cleanup (drop) code is added for DropSubscription
> and for process_syncing_tables_for_sync functions
>
> * The tablesync worker is now allowing multiple tx instead of single tx
>
> * A new state (SUBREL_STATE_TCOPYDONE) is persisted after a successful
> copy_table in LogicalRepSyncTableStart.
>
> * If a re-launched tablesync finds state SUBREL_STATE_TCOPYDONE then
> it will bypass the initial copy_table phase.
>
> * Now tablesync sets up replication origin tracking in
> LogicalRepSyncTableStart (similar as done for the apply worker). The
> origin is advanced when first created.
>
> * The tablesync replication origin tracking is cleaned up during
> DropSubscription and/or process_syncing_tables_for_apply.
>
> * The DropSubscription cleanup code was enhanced (v7+) to take care of
> any crashed tablesync workers.
>
> * Updates to PG docs
>
> TODO / Known Issues:
>
> * Address review comments
>
> * Patch applies with whitespace warning
>
> ---
>
> Kind Regards,
> Peter Smith.
> Fujitsu Australia

Attachment Content-Type Size
v13-0002-Tablesync-extra-logging.patch application/octet-stream 7.8 KB
v13-0001-Tablesync-Solution1.patch application/octet-stream 33.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-01-08 09:18:44 Re: Parallel INSERT (INTO ... SELECT ...)
Previous Message Pavel Stehule 2021-01-08 09:11:24 Re: proposal: enhancing plpgsql debug API - returns text value of variable content