[HACKERS] subscription worker doesn't start immediately on eabled - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject [HACKERS] subscription worker doesn't start immediately on eabled
Date
Msg-id 20170406.212441.177025736.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
Responses Re: [HACKERS] subscription worker doesn't start immediately on eabled
Re: [HACKERS] subscription worker doesn't start immediately on eabled
Re: [HACKERS] subscription worker doesn't start immediately on eabled
List pgsql-hackers
Hello. I found dubious behavior while playing with logical
replication.

When we disable a subscription, replication worker immediately stops.

=# ALTER SUBSCRIPTION s1 DISABLE;

On the other hand even if we enable a subscription, worker
doesn't start immediately. It takes 3 minutes in the worst
case. (DEFAULT_NAPTIME_PER_CYCLE)

The attached patch wakes up launcher when a subscription is
enabled. This fails when a subscription is enabled immedaitely
after disabling but it won't be a matter.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 5bf8d93..63550f8 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -608,6 +608,9 @@ AlterSubscription(AlterSubscriptionStmt *stmt)                    BoolGetDatum(enabled);
   replaces[Anum_pg_subscription_subenabled - 1] = true;
 
+                if (enabled)
+                    ApplyLauncherWakeupAtCommit();
+                update_tuple = true;                break;            }

pgsql-hackers by date:

Previous
From: Aleksander Alekseev
Date:
Subject: Re: [HACKERS] [PATCH] Remove unused argument in btree_xlog_split
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] identity columns