From: | vignesh C <vignesh21(at)gmail(dot)com> |
---|---|
To: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
Cc: | Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Euler Taveira <euler(at)eulerto(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org> |
Subject: | Re: Logical Replication of sequences |
Date: | 2025-09-23 13:09:27 |
Message-ID: | CALDaNm3H0vAzhC7aEChxF9_eQahnsAS-2WcPX_x_sbFZe9sXrw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, 22 Sept 2025 at 12:03, shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> On Thu, Sep 18, 2025 at 4:07 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > Thanks for the comments, these are handled in the attached patch.
> >
>
> Please find a few comments:
>
>
> patch005:
> 1)
> GetSubscriptionRelations:
> + /* Skip sequences if they were not requested */
> + if (!get_sequences && (relkind == RELKIND_SEQUENCE))
> + continue;
> +
> + /* Skip tables if they were not requested */
> + if (!get_tables && (relkind != RELKIND_SEQUENCE))
> + continue;
>
> The use of negated conditions makes the logic harder to follow,
> especially in the second if block.
>
> Can we write it as:
> bool is_sequence = (relkind == RELKIND_SEQUENCE);
>
> /* Skip if the relation type is not requested */
> if ((get_tables && is_sequence) ||
> (get_sequences && !is_sequence))
> continue;
>
> Or at-least:
> /* Skip sequences if they were not requested */
> if (get_tables && (relkind == RELKIND_SEQUENCE))
> continue;
>
> /* Skip tables if they were not requested */
> if (get_sequences && (relkind != RELKIND_SEQUENCE))
> continue;
I felt this would not work. Say we want both sequences and tables,
won't it skip the sequence this way from:
if (get_tables && (relkind == RELKIND_SEQUENCE))
continue;
Rest of the comments were fixed, also the comment from [1] is fixed in
the attached patch.
[1] - https://www.postgresql.org/message-id/CAJpy0uAdD9XtZCE34BJhbvncMgfmMuTS0ZXLP1P=g+wpRC8vqQ@mail.gmail.com
Regards,
Vignesh
Attachment | Content-Type | Size |
---|---|---|
v20250923-0001-Enhance-pg_get_sequence_data-function.patch | text/x-patch | 8.3 KB |
v20250923-0004-Update-ALTER-SUBSCRIPTION-REFRESH-to-ALTER.patch | text/x-patch | 8.9 KB |
v20250923-0003-Reorganize-tablesync-Code-and-Introduce-sy.patch | text/x-patch | 26.5 KB |
v20250923-0005-Introduce-REFRESH-PUBLICATION-SEQUENCES-fo.patch | text/x-patch | 40.5 KB |
v20250923-0002-Introduce-ALL-SEQUENCES-support-for-Postgr.patch | text/x-patch | 111.2 KB |
v20250923-0006-New-worker-for-sequence-synchronization-du.patch | text/x-patch | 89.4 KB |
v20250923-0007-Documentation-for-sequence-synchronization.patch | text/x-patch | 39.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Sharma | 2025-09-23 13:10:52 | Re: Clear logical slot's 'synced' flag on promotion of standby |
Previous Message | Ashutosh Sharma | 2025-09-23 12:58:18 | Re: Report bytes and transactions actually sent downtream |