Skip to content

Commit 81ccbe5

Browse files
author
Amit Kapila
committed
Simplify some of the logical replication worker-type checks.
Author: Peter Smith Reviewed-by: Hou Zhijie Discussion: http://postgr.es/m/CAHut+Pv-xkEpuPzbEJ=ZSi7Hp2RoGJf=VA-uDRxLi1KHSneFjg@mail.gmail.com
1 parent 7516056 commit 81ccbe5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/backend/replication/logical/worker.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -3863,7 +3863,7 @@ apply_worker_exit(void)
38633863
* subscription is still active, and so that we won't leak that hash table
38643864
* entry if it isn't.
38653865
*/
3866-
if (!am_tablesync_worker())
3866+
if (am_leader_apply_worker())
38673867
ApplyLauncherForgetWorkerStartTime(MyLogicalRepWorker->subid);
38683868

38693869
proc_exit(0);
@@ -3906,8 +3906,9 @@ maybe_reread_subscription(void)
39063906
MySubscription->name)));
39073907

39083908
/* Ensure we remove no-longer-useful entry for worker's start time */
3909-
if (!am_tablesync_worker() && !am_parallel_apply_worker())
3909+
if (am_leader_apply_worker())
39103910
ApplyLauncherForgetWorkerStartTime(MyLogicalRepWorker->subid);
3911+
39113912
proc_exit(0);
39123913
}
39133914

@@ -4589,8 +4590,9 @@ InitializeLogRepWorker(void)
45894590
MyLogicalRepWorker->subid)));
45904591

45914592
/* Ensure we remove no-longer-useful entry for worker's start time */
4592-
if (!am_tablesync_worker() && !am_parallel_apply_worker())
4593+
if (am_leader_apply_worker())
45934594
ApplyLauncherForgetWorkerStartTime(MyLogicalRepWorker->subid);
4595+
45944596
proc_exit(0);
45954597
}
45964598

@@ -4715,7 +4717,7 @@ DisableSubscriptionAndExit(void)
47154717
CommitTransactionCommand();
47164718

47174719
/* Ensure we remove no-longer-useful entry for worker's start time */
4718-
if (!am_tablesync_worker() && !am_parallel_apply_worker())
4720+
if (am_leader_apply_worker())
47194721
ApplyLauncherForgetWorkerStartTime(MyLogicalRepWorker->subid);
47204722

47214723
/* Notify the subscription has been disabled and exit */

0 commit comments

Comments
 (0)