summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kapila2022-04-19 03:19:49 +0000
committerAmit Kapila2022-04-19 03:19:49 +0000
commitdd4ab6fd6528e160571986fa8817cee9f2645aa8 (patch)
treef229b95dc56cda074b612d823ff1f2d0d0efeb82
parent587de223f03e6086d511dab16b17406eb21277ce (diff)
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/[email protected]
-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 6f25b2c2ad..0adb2d1d66 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;