Skip to content

Commit be46985

Browse files
author
Amit Kapila
committed
Fix the check to limit sync workers.
We don't allow to invoke more sync workers once we have reached the sync worker limit per subscription. But the check to enforce this also doesn't allow to launch an apply worker if it gets restarted. This code was introduced by commit de43897 but we caught the problem only with the test added by recent commit c91f71b which started failing occasionally in the buildfarm. As per buildfarm. Diagnosed-by: Amit Kapila, Masahiko Sawada, Tomas Vondra Author: Amit Kapila Backpatch-through: 10 Discussion: https://postgr.es/m/CAH2L28vddB_NFdRVpuyRBJEBWjz4BSyTB=_ektNRH8NJ1jf95g@mail.gmail.com https://postgr.es/m/f90d2b03-4462-ce95-a524-d91464e797c8@enterprisedb.com
1 parent 2ceec5b commit be46985

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/replication/logical/launcher.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,11 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid,
375375
}
376376

377377
/*
378-
* If we reached the sync worker limit per subscription, just exit
379-
* silently as we might get here because of an otherwise harmless race
380-
* condition.
378+
* We don't allow to invoke more sync workers once we have reached the sync
379+
* worker limit per subscription. So, just return silently as we might get
380+
* here because of an otherwise harmless race condition.
381381
*/
382-
if (nsyncworkers >= max_sync_workers_per_subscription)
382+
if (OidIsValid(relid) && nsyncworkers >= max_sync_workers_per_subscription)
383383
{
384384
LWLockRelease(LogicalRepWorkerLock);
385385
return;

0 commit comments

Comments
 (0)