Skip to content

Commit a3f17b9

Browse files
committed
Wake up launcher when enabling a subscription
Otherwise one would have to wait up to DEFAULT_NAPTIME_PER_CYCLE until the subscription worker is considered for starting. There is a small race condition: If one enables a subscription right after disabling it, the launcher might not have registered the stopping when receiving the wakeup signal for the re-enabling. The start will then not happen right away but after the full cycle time. Author: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
1 parent ef0ba57 commit a3f17b9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/commands/subscriptioncmds.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,9 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
644644
BoolGetDatum(enabled);
645645
replaces[Anum_pg_subscription_subenabled - 1] = true;
646646

647+
if (enabled)
648+
ApplyLauncherWakeupAtCommit();
649+
647650
update_tuple = true;
648651
break;
649652
}

0 commit comments

Comments
 (0)