Re: Logical Replication of sequences

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(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-04-24 10:29:46
Message-ID: CALDaNm3fAmDy4N8L06u3kPkYFDGBqPif-XBdqhTPjPZ2qoKgzQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 24 Apr 2025 at 05:07, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Vignesh,
>
> Some review comments for patch v20250422-0003.
>
> ======
> src/backend/replication/logical/syncutils.c
>
> 1.
> +/*
> + * Exit routine for synchronization worker.
> + */
> +pg_noreturn void
> +SyncFinishWorker(void)
>
> Why does this have the pg_noreturn annotation? None of the other void
> functions do.

It indicates that the function will not return control flow to the
calling function after it finishes. This is not a new function, it was
just moved from tablesync.c
> ======
> src/include/replication/worker_internal.h
>
> 4.
> @@ -250,6 +252,7 @@ extern void logicalrep_worker_stop(Oid subid, Oid relid);
> extern void logicalrep_pa_worker_stop(ParallelApplyWorkerInfo *winfo);
> extern void logicalrep_worker_wakeup(Oid subid, Oid relid);
> extern void logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker);
> +pg_noreturn extern void SyncFinishWorker(void);
>
> extern int logicalrep_sync_worker_count(Oid subid);
>
> @@ -259,9 +262,13 @@ extern void
> ReplicationOriginNameForLogicalRep(Oid suboid, Oid relid,
> extern bool AllTablesyncsReady(void);
> extern void UpdateTwoPhaseState(Oid suboid, char new_state);
>
> -extern void process_syncing_tables(XLogRecPtr current_lsn);
> -extern void invalidate_syncing_table_states(Datum arg, int cacheid,
> - uint32 hashvalue);
> +extern bool FetchRelationStates(bool *started_tx);
> +extern bool WaitForRelationStateChange(Oid relid, char expected_state);
> +extern void ProcessSyncingTablesForSync(XLogRecPtr current_lsn);
> +extern void ProcessSyncingTablesForApply(XLogRecPtr current_lsn);
> +extern void SyncProcessRelations(XLogRecPtr current_lsn);
> +extern void SyncInvalidateRelationStates(Datum arg, int cacheid,
> + uint32 hashvalue);
>
> ~
>
> 4a.
> Why does SyncFinishWorker have the pg_noreturn annotation? None of the
> other void functions do.

This is same as comment #1

The rest of the comments were fixed.
Also the comments from [1] and [2] are fixed in the attached v20250424 version.
[1] - https://www.postgresql.org/message-id/CAHut%2BPticXRg4_W%3Dd7H37DWPh5LNePbcQ5RKc3vUW5HCzAX_fg%40mail.gmail.com
[2] - https://www.postgresql.org/message-id/CAHut%2BPtBhb89%2B1DAYUFc%3D1Ojkh1mHro%2Bg3UCqMZAQoSpPQoqZA%40mail.gmail.com

Regards,
Vignesh

Attachment Content-Type Size
v20250424-0001-Introduce-pg_sequence_state-function-for-e.patch application/octet-stream 6.7 KB
v20250424-0004-Enhance-sequence-synchronization-during-su.patch application/octet-stream 97.9 KB
v20250424-0003-Reorganize-tablesync-Code-and-Introduce-sy.patch application/octet-stream 23.0 KB
v20250424-0002-Introduce-ALL-SEQUENCES-support-for-Postgr.patch application/octet-stream 106.5 KB
v20250424-0005-Documentation-for-sequence-synchronization.patch application/octet-stream 26.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message George MacKerron 2025-04-24 10:31:09 Re: sslmode=secure by default (Re: Making sslrootcert=system work on Windows psql)
Previous Message shveta malik 2025-04-24 10:27:22 Re: Fix slot synchronization with two_phase decoding enabled