]> granicus.if.org Git - postgresql/commitdiff
Simplify some code in logical replication launcher
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 15 Aug 2017 19:13:06 +0000 (15:13 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 15 Aug 2017 19:13:06 +0000 (15:13 -0400)
Avoid unnecessary locking calls when a subscription is disabled.

Author: Yugo Nagata <nagata@sraoss.co.jp>

src/backend/replication/logical/launcher.c

index 4c6d4b27723ea2fc3699077a7cd1869907549dfe..6c894421a396214027dd083eb008edd46a3ea196 100644 (file)
@@ -929,11 +929,14 @@ ApplyLauncherMain(Datum main_arg)
                                Subscription *sub = (Subscription *) lfirst(lc);
                                LogicalRepWorker *w;
 
+                               if (!sub->enabled)
+                                       continue;
+
                                LWLockAcquire(LogicalRepWorkerLock, LW_SHARED);
                                w = logicalrep_worker_find(sub->oid, InvalidOid, false);
                                LWLockRelease(LogicalRepWorkerLock);
 
-                               if (sub->enabled && w == NULL)
+                               if (w == NULL)
                                {
                                        last_start_time = now;
                                        wait_time = wal_retrieve_retry_interval;