diff options
author | Amit Kapila <akapila@postgresql.org> | 2023-08-03 08:59:50 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2023-08-03 08:59:50 +0530 |
commit | 02c1b64fb15ca018f0c159a0152497c8d6704d40 (patch) | |
tree | e00d9c84a1df14e4f34aa457352a1dab762a5490 /src/include/replication/worker_internal.h | |
parent | 0125c4e21d7e9c8b3da95ffcd3e34c0f61c9b69a (diff) | |
download | postgresql-02c1b64fb15ca018f0c159a0152497c8d6704d40.tar.gz postgresql-02c1b64fb15ca018f0c159a0152497c8d6704d40.zip |
Refactor to split Apply and Tablesync Workers code.
Both apply and tablesync workers were using ApplyWorkerMain() as entry
point. As the name implies, ApplyWorkerMain() should be considered as
the main function for apply workers. Tablesync worker's path was hidden
and does not have enough in common to share the same main function with
apply worker.
Also, most of the code shared by both worker types is already combined
in LogicalRepApplyLoop(). There is no need to combine the rest in
ApplyWorkerMain() anymore.
This patch introduces TablesyncWorkerMain() as a new entry point for
tablesync workers. This aims to increase code readability and would help
with future improvements like the reuse of tablesync workers in the
initial synchronization.
Author: Melih Mutlu based on suggestions by Melanie Plageman
Reviewed-by: Peter Smith, Kuroda Hayato, Amit Kapila
Discussion: http://postgr.es/m/CAGPVpCTq=rUDd4JUdaRc1XUWf4BrH2gdSNf3rtOMUGj9rPpfzQ@mail.gmail.com
Diffstat (limited to 'src/include/replication/worker_internal.h')
-rw-r--r-- | src/include/replication/worker_internal.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h index 343e7818965..672a7117c0c 100644 --- a/src/include/replication/worker_internal.h +++ b/src/include/replication/worker_internal.h @@ -19,6 +19,7 @@ #include "datatype/timestamp.h" #include "miscadmin.h" #include "replication/logicalrelation.h" +#include "replication/walreceiver.h" #include "storage/buffile.h" #include "storage/fileset.h" #include "storage/lock.h" @@ -243,7 +244,6 @@ extern int logicalrep_sync_worker_count(Oid subid); extern void ReplicationOriginNameForLogicalRep(Oid suboid, Oid relid, char *originname, Size szoriginname); -extern char *LogicalRepSyncTableStart(XLogRecPtr *origin_startpos); extern bool AllTablesyncsReady(void); extern void UpdateTwoPhaseState(Oid suboid, char new_state); @@ -265,7 +265,17 @@ extern void maybe_reread_subscription(void); extern void stream_cleanup_files(Oid subid, TransactionId xid); -extern void InitializeApplyWorker(void); +extern void set_stream_options(WalRcvStreamOptions *options, + char *slotname, + XLogRecPtr *origin_startpos); + +extern void start_apply(XLogRecPtr origin_startpos); + +extern void InitializeLogRepWorker(void); + +extern void SetupApplyOrSyncWorker(int worker_slot); + +extern void DisableSubscriptionAndExit(void); extern void store_flush_position(XLogRecPtr remote_lsn, XLogRecPtr local_lsn); |