Re: Selective logical replication

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: konstantin knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Selective logical replication
Date: 2015-11-19 09:13:29
Message-ID: CAB7nPqQkMNgMFPa6MrKno-nRma41k5be1Kwoi9eCwpgfHL6WKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 19, 2015 at 5:48 PM, konstantin knizhnik
<k(dot)knizhnik(at)postgrespro(dot)ru> wrote:
> 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?

What you are looking for to prevent this infinite recursion is the
concept of replication origin:
http://www.postgresql.org/docs/devel/static/replication-origins.html

Regarding receiver_raw/decoder_raw, I never got around to use that and
prevent the problem you are seeing :) But patches are welcome if
provided.
Regards,
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jan.dirk.zijlstra 2015-11-19 09:41:26 BUG #13779: Inherited check constraint becomes non-inherited when related column is changed
Previous Message Amit Langote 2015-11-19 09:13:19 Re: Selective logical replication