Commit e42351ae authored by Peter Eisentraut's avatar Peter Eisentraut

Simplify some code in logical replication launcher

Avoid unnecessary locking calls when a subscription is disabled.

Author: Yugo Nagata <nagata@sraoss.co.jp>
parent 270fec9f
...@@ -929,11 +929,14 @@ ApplyLauncherMain(Datum main_arg) ...@@ -929,11 +929,14 @@ ApplyLauncherMain(Datum main_arg)
Subscription *sub = (Subscription *) lfirst(lc); Subscription *sub = (Subscription *) lfirst(lc);
LogicalRepWorker *w; LogicalRepWorker *w;
if (!sub->enabled)
continue;
LWLockAcquire(LogicalRepWorkerLock, LW_SHARED); LWLockAcquire(LogicalRepWorkerLock, LW_SHARED);
w = logicalrep_worker_find(sub->oid, InvalidOid, false); w = logicalrep_worker_find(sub->oid, InvalidOid, false);
LWLockRelease(LogicalRepWorkerLock); LWLockRelease(LogicalRepWorkerLock);
if (sub->enabled && w == NULL) if (w == NULL)
{ {
last_start_time = now; last_start_time = now;
wait_time = wal_retrieve_retry_interval; wait_time = wal_retrieve_retry_interval;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment