Refactor to split Apply and Tablesync Workers code.
authorAmit Kapila <akapila@postgresql.org>
Thu, 3 Aug 2023 03:29:50 +0000 (08:59 +0530)
committerAmit Kapila <akapila@postgresql.org>
Thu, 3 Aug 2023 03:29:50 +0000 (08:59 +0530)
commit02c1b64fb15ca018f0c159a0152497c8d6704d40
treee00d9c84a1df14e4f34aa457352a1dab762a5490
parent0125c4e21d7e9c8b3da95ffcd3e34c0f61c9b69a
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
src/backend/postmaster/bgworker.c
src/backend/replication/logical/applyparallelworker.c
src/backend/replication/logical/launcher.c
src/backend/replication/logical/tablesync.c
src/backend/replication/logical/worker.c
src/include/replication/logicalworker.h
src/include/replication/worker_internal.h