summaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/worker.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-04-14 13:58:46 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-04-14 13:58:46 -0400
commit887227a1cc861d87ca0f175cf8bd1447554090eb (patch)
treef0cc0f4315bd0489083742d4f7a3285fa749f2e9 /src/backend/replication/logical/worker.c
parent25371a72b95aab43b0a3547ead4d3286c1128351 (diff)
Add option to modify sync commit per subscription
This also changes default behaviour of subscription workers to synchronous_commit = off. Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
Diffstat (limited to 'src/backend/replication/logical/worker.c')
-rw-r--r--src/backend/replication/logical/worker.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 3313448e7b9..29b6c6a1689 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -1416,6 +1416,10 @@ reread_subscription(void)
MemoryContextSwitchTo(oldctx);
+ /* Change synchronous commit according to the user's wishes */
+ SetConfigOption("synchronous_commit", MySubscription->synccommit,
+ PGC_BACKEND, PGC_S_OVERRIDE);
+
if (started_tx)
CommitTransactionCommand();
@@ -1485,6 +1489,10 @@ ApplyWorkerMain(Datum main_arg)
MySubscriptionValid = true;
MemoryContextSwitchTo(oldctx);
+ /* Setup synchronous commit according to the user's wishes */
+ SetConfigOption("synchronous_commit", MySubscription->synccommit,
+ PGC_BACKEND, PGC_S_OVERRIDE);
+
if (!MySubscription->enabled)
{
ereport(LOG,