aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kapila <akapila@postgresql.org>2022-04-19 08:54:37 +0530
committerAmit Kapila <akapila@postgresql.org>2022-04-19 08:54:37 +0530
commitc9dea58e270236a8d256a686f71f6bab960f0b80 (patch)
tree04ac00a456ac25f869da1883ef62f710bd69625d
parente805735a83f7bb5bfe773b9690f96a52ba2b84b2 (diff)
downloadpostgresql-c9dea58e270236a8d256a686f71f6bab960f0b80.tar.gz
postgresql-c9dea58e270236a8d256a686f71f6bab960f0b80.zip
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 de43897122 but we caught the problem only with the test added by recent commit c91f71b9dc 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
-rw-r--r--src/backend/replication/logical/launcher.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index e3b11daa897..cf9c1ba9560 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -344,11 +344,11 @@ retry:
}
/*
- * If we reached the sync worker limit per subscription, just exit
- * silently as we might get here because of an otherwise harmless race
- * condition.
+ * We don't allow to invoke more sync workers once we have reached the sync
+ * worker limit per subscription. So, just return silently as we might get
+ * here because of an otherwise harmless race condition.
*/
- if (nsyncworkers >= max_sync_workers_per_subscription)
+ if (OidIsValid(relid) && nsyncworkers >= max_sync_workers_per_subscription)
{
LWLockRelease(LogicalRepWorkerLock);
return;