Re: Selective logical replication

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: konstantin knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: Selective logical replication
Date: 2015-11-19 09:13:19
Message-ID: 564D92AF.2050702@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015/11/19 17:48, konstantin knizhnik wrote:
> Hi,
>
> I want to use logical replication for implementing multimaster (so all nodes are both sending and receiving changes).
> But there is one "stupid" problem: how to prevent infinite recursion and not to rereplicate replicated data.
> I.e. node receives change set from some other node, applies it within some transaction, it is written to the log and ... is replicated to other nodes.
> In my experiments with receiver_raw/decoder_raw infinite recursion actually doesn't happen because unique constraint violation.
> But it is neither nice, neither efficient way of stopping infinite recursion.
>
> I wonder if there is some better way to prevent some particular transaction from been replicated?

I wonder if stuff in src/backend/replication/logical/origin.c has anything
to do with being able to help with kind of problems you mention. The file
header comment has the following text in it:

*
* This infrastructure is intended to be used in cooperation with logical
* decoding. When replaying from a remote system the configured origin is
* provided to output plugins, allowing prevention of replication loops and
* other filtering.
*

Thanks,
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-11-19 09:13:29 Re: Selective logical replication
Previous Message Amit Kapila 2015-11-19 08:53:26 Re: [DESIGN] ParallelAppend