Re: Single transaction in the tablesync worker?

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Peter Smith <smithpb2250(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-30 13:19:27
Message-ID: CAA4eK1+8Xx6cLS0cUthB_P1-g7_g5=FALz7e4W_NXQyge0OnoA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 29, 2021 at 4:07 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
>
> Differences from v21:
> + Patch is rebased to latest OSS HEAD @ 29/Jan.
> + Includes new code as suggested [ak0128] to ensure no dangling slots
> at Drop/AlterSubscription.
> + Removes the slot/origin cleanup down by process interrupt logic
> (cleanup_at_shutdown function).
> + Addresses some minor review comments.
>

I have made the below changes in the patch. Let me know what you think
about these?
1. It was a bit difficult to understand the code in DropSubscription
so I have rearranged the code to match the way we are doing in HEAD
where we drop the slots at the end after finishing all the other
cleanup.
2. In AlterSubscription_refresh(), we can't allow workers to be
stopped at commit time as we have already dropped the slots because
the worker can access the dropped slot. We need to stop the workers
before dropping slots. This makes all the code related to
logicalrep_worker_stop_at_commit redundant.
3. In AlterSubscription_refresh(), we need to acquire the lock on
pg_subscription_rel only when we try to remove any subscription rel.
4. Added/Changed quite a few comments.

--
With Regards,
Amit Kapila.

Attachment Content-Type Size
v23-0001-Tablesync-Solution1.patch application/octet-stream 50.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Kincaid 2021-01-30 13:23:11 Re: Key management with tests
Previous Message Thomas Munro 2021-01-30 13:11:06 Re: Fix DROP TABLESPACE on Windows with ProcSignalBarrier?