| From: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
|---|---|
| To: | vignesh C <vignesh21(at)gmail(dot)com> |
| Cc: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com> |
| Subject: | Re: sequencesync worker race with REFRESH SEQUENCES |
| Date: | 2026-07-21 07:19:03 |
| Message-ID: | CAJpy0uDzLjgMGAUYGJDGettVv8==V0u1ygNkEU3Fs6atHrGO=g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Jul 21, 2026 at 11:04 AM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> On Tue, 21 Jul 2026 at 10:48, Hayato Kuroda (Fujitsu)
> <kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
> >
> > My assumption was that the connection was not so heavy operation.
> > If it's not correct, yes the connection should be established later.
>
> FYI, the v3-0002 patch from [1], which fixes this issue, applies
> cleanly to both the master and PG19 branches. I'm re-attaching the
> same patch here to make it easier for reviewers to access and review
> it.
>
> [1] - https://www.postgresql.org/message-id/CALDaNm0wi5XxbHsmKT%2BphLHwV%3DNtUeFeCpiKkjx29RanJjJ7UQ%40mail.gmail.com
>
The logic of fix looks good. A few comments:
1)
Note
Sequence synchronization requires the publisher to be running
PostgreSQL 19 or later.
This note appears to be at odd position in
logical-replication-sequences.html. Please have a look at html and
move it to end of that section if you agree.
2)
+ from the tables themselves. Note that
+ <link linkend="sql-altersubscription-params-refresh-sequences">
+ <command>ALTER SUBSCRIPTION ... REFRESH SEQUENCES</command></link> only
+ re-synchronizes sequences that are already known to the subscription
+ (see <xref linkend="logical-replication-sequences"/>); in particular, it
+ requires the publisher to be running <productname>PostgreSQL</productname>
+ 19 or later. Before relying on it to prepare for a switchover or
+ failover, confirm that the publisher's version supports sequence
+ replication and that the sequences of interest are already known to the
+ subscription.
Do you think above is necessary? At subscription creation time, a
publisher running a version earlier than PostgreSQL 19 cannot have a
publication containing all sequences, so the subscription cannot have
such sequences known to it. Furthermore, ALTER SUBSCRIPTION to change
publisher-connection will report an error if the required
prerequisites are not met. Therefore, asking users to separately
verify the publisher version and sequence membership seems redundant
to me.
3)
+bool
+HasSubscriptionSequences(Oid subid)
Do you think we can resuse HasSubscriptionTables instead of
duplicating the complete code? We can have
HasSubscriptionRelations(subid, bool *has_tables, bool
*has_sequences)) Or is it not worth?
thanks
Shveta
| From | Date | Subject | |
|---|---|---|---|
| Next Message | yuanchao zhang | 2026-07-21 07:37:17 | Re: Validate SERVER subscription conninfo during ALTER SUBSCRIPTION ... OWNER TO |
| Previous Message | Peter Eisentraut | 2026-07-21 06:53:29 | Re: SQL:2011 Application Time Update & Delete |