From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Sergey Tatarintsev <s(dot)tatarintsev(at)postgrespro(dot)ru> |
Cc: | Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: create subscription with (origin = none, copy_data = on) |
Date: | 2025-01-27 08:57:40 |
Message-ID: | CAA4eK1Jo1mbTpUqEa_CDz98YcO93NyseVaFxuLhg4xfd+EgGsQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Jan 24, 2025 at 5:43 PM Sergey Tatarintsev
<s(dot)tatarintsev(at)postgrespro(dot)ru> wrote:
>
> I think there is another problem - publisher can modify publication
> during the execution of "CREATE SUBSCRIPTION" (Rarely, this situation
> occurred in my tests.)
>
> I.e.:
>
> 1. Publisher: CREATE PUBLICATION ... FOR TABLE t1;
>
> 2. Subscriber (starts CREATE SUBSCRIPTION ...): check_publications_origin()
>
> 3. Publisher: ALTER PUBLICATION ... ADD TABLE t2;
>
> 4. Subscriber (still process CREATE SUBSCRIPTION ...): fetch_table_list()
>
> So, we check publication with only t1, but fetch t1,t2
>
> I think we must start transaction on publisher while executing
> CreateSubscription() on subscriber (Or may be take an lock on publisher )
>
We don't want to make the code complex for this, especially in
back-branches as that can introduce more bugs. We already document
that "... it is the user's responsibility to make the necessary checks
to ensure the copied data origins are really as wanted or not.". We
should try to give this WARNING in possible scenarios without
complicating the code too much. Anyway, even after this WARNING it is
possible that the data is not copied from the publisher and there is
no danger of copying the wrong origin. So, I suggest leaving the above
case as it is.
--
With Regards,
Amit Kapila.
From | Date | Subject | |
---|---|---|---|
Next Message | Jelte Fennema-Nio | 2025-01-27 09:03:07 | Re: New process of getting changes into the commitfest app |
Previous Message | Jelte Fennema-Nio | 2025-01-27 08:54:04 | Re: New process of getting changes into the commitfest app |