pgsql: Refactor to split Apply and Tablesync Workers code. - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Refactor to split Apply and Tablesync Workers code.
Date
Msg-id E1qRPUq-000CJB-LT@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/02c1b64fb15ca018f0c159a0152497c8d6704d40

Modified Files
--------------
src/backend/postmaster/bgworker.c                  |   3 +
.../replication/logical/applyparallelworker.c      |   2 +-
src/backend/replication/logical/launcher.c         |  32 +-
src/backend/replication/logical/tablesync.c        |  91 ++++-
src/backend/replication/logical/worker.c           | 380 ++++++++++-----------
src/include/replication/logicalworker.h            |   1 +
src/include/replication/worker_internal.h          |  14 +-
7 files changed, 299 insertions(+), 224 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: First-draft release notes for 15.4.
Next
From: Etsuro Fujita
Date:
Subject: pgsql: Update comments on CustomPath struct.