Skip to content

Commit e42351a

Browse files
committed
Simplify some code in logical replication launcher
Avoid unnecessary locking calls when a subscription is disabled. Author: Yugo Nagata <[email protected]>
1 parent 270fec9 commit e42351a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/replication/logical/launcher.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -929,11 +929,14 @@ ApplyLauncherMain(Datum main_arg)
929929
Subscription *sub = (Subscription *) lfirst(lc);
930930
LogicalRepWorker *w;
931931

932+
if (!sub->enabled)
933+
continue;
934+
932935
LWLockAcquire(LogicalRepWorkerLock, LW_SHARED);
933936
w = logicalrep_worker_find(sub->oid, InvalidOid, false);
934937
LWLockRelease(LogicalRepWorkerLock);
935938

936-
if (sub->enabled && w == NULL)
939+
if (w == NULL)
937940
{
938941
last_start_time = now;
939942
wait_time = wal_retrieve_retry_interval;

0 commit comments

Comments
 (0)