mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
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>
This commit is contained in:
@@ -129,17 +129,13 @@ get_subscription_list(void)
|
||||
*/
|
||||
oldcxt = MemoryContextSwitchTo(resultcxt);
|
||||
|
||||
sub = (Subscription *) palloc(sizeof(Subscription));
|
||||
sub = (Subscription *) palloc0(sizeof(Subscription));
|
||||
sub->oid = HeapTupleGetOid(tup);
|
||||
sub->dbid = subform->subdbid;
|
||||
sub->owner = subform->subowner;
|
||||
sub->enabled = subform->subenabled;
|
||||
sub->name = pstrdup(NameStr(subform->subname));
|
||||
|
||||
/* We don't fill fields we are not interested in. */
|
||||
sub->conninfo = NULL;
|
||||
sub->slotname = NULL;
|
||||
sub->publications = NIL;
|
||||
|
||||
res = lappend(res, sub);
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user