aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/subscriptioncmds.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-04-25 14:40:33 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-04-25 14:40:33 -0400
commita3f17b9c315512e9c116dbc243056aad8b372e18 (patch)
tree3cc5b11b9e0ecf99c4abde9899f72cba339f8bb1 /src/backend/commands/subscriptioncmds.c
parentef0ba572b6e163328a2292bf9d6de7c919bd7cdd (diff)
downloadpostgresql-a3f17b9c315512e9c116dbc243056aad8b372e18.tar.gz
postgresql-a3f17b9c315512e9c116dbc243056aad8b372e18.zip
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>
Diffstat (limited to 'src/backend/commands/subscriptioncmds.c')
-rw-r--r--src/backend/commands/subscriptioncmds.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index c29a57ed52d..6a404bbe1e3 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -644,6 +644,9 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
BoolGetDatum(enabled);
replaces[Anum_pg_subscription_subenabled - 1] = true;
+ if (enabled)
+ ApplyLauncherWakeupAtCommit();
+
update_tuple = true;
break;
}