diff --git a/src/backend/postmaster/interrupt.c b/src/backend/postmaster/interrupt.c index e2e5a1373b..e64029fac4 100644 --- a/src/backend/postmaster/interrupt.c +++ b/src/backend/postmaster/interrupt.c @@ -99,7 +99,7 @@ SignalHandlerForCrashExit(SIGNAL_ARGS) * * Typically, this handler would be used for SIGTERM, but some processes use * other signals. In particular, the checkpointer exits on SIGUSR2, and the WAL - * writer and the logical replication parallel apply worker exit on either + * writer and the logical replication parallel apply worker exits on either * SIGINT or SIGTERM. * * ShutdownRequestPending should be checked at a convenient place within the diff --git a/src/backend/replication/logical/applyparallelworker.c b/src/backend/replication/logical/applyparallelworker.c index 85bb909104..384ee32d44 100644 --- a/src/backend/replication/logical/applyparallelworker.c +++ b/src/backend/replication/logical/applyparallelworker.c @@ -155,8 +155,9 @@ static HTAB *ParallelApplyWorkersHash = NULL; /* * A list to maintain the active parallel apply workers. The information for * the new worker is added to the list after successfully launching it. The - * list entry is removed at the end of the transaction if there are already - * enough workers in the worker pool. For more information about the worker + * list entry is removed if there are already enough workers in the worker + * pool either at the end of the transaction or while trying to find a free + * worker for applying the transaction. For more information about the worker * pool, see comments atop worker.c. */ static List *ParallelApplyWorkersList = NIL; @@ -297,14 +298,14 @@ pa_allocate_worker(TransactionId xid) HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); } - /* First, try to get a parallel apply worker from the pool. */ + /* + * First, try to get a parallel apply worker from the pool, if available. + * Otherwise, try to start a new parallel apply worker. + */ winfo = pa_get_available_worker(); - if (!winfo) { - /* Try to start a new parallel apply worker. */ winfo = pa_init_and_launch_worker(); - if (!winfo) return; } @@ -454,7 +455,7 @@ pa_free_worker_info(ParallelApplyWorkerInfo *winfo) } /* - * Interrupt handler for main loops of parallel apply worker. + * Interrupt handler for main loop of parallel apply worker. */ static void ProcessParallelApplyInterrupts(void)