pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Petr Jelinek <petr.jelinek@2ndquadrant.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Marco Nenciarini <marco.nenciarini@2ndquadrant.it>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Logical decoding of TRUNCATE
Date: Sun, 28 Jan 2018 17:01:03 +0100
Message-ID: <e9c2f17c-bba5-95d4-8b48-51ee4e56d08c@2ndquadrant.com> (raw)
In-Reply-To: <7f0589c2-c82e-27f3-9d2c-68c0a1bb0b6e@2ndquadrant.com>
References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it>
	<1a4ace10-1997-6644-d17a-5a17bf250270@2ndquadrant.it>
	<28a59551-b1f5-8ed4-65cf-76d17e7ee7e6@2ndquadrant.it>
	<f45ec6eb-1dda-9b7f-6fb8-85deb40ff968@2ndquadrant.com>
	<CANP8+jJzf-K0AnN2X=xpoaFq+Ncdjzbk6b4=JrMJoiMbgO39YQ@mail.gmail.com>
	<fdd6d0ec-ab81-af7b-aaf6-595c2ac88af9@2ndquadrant.it>
	<1cb9bd52-9e3a-21bf-0c0c-afa90f463629@2ndquadrant.com>
	<f6352c33-f3e3-0e35-dbd2-29949b9c2b59@2ndquadrant.com>
	<de2a9d73-1e25-797c-03f8-9faa57f75e85@2ndquadrant.it>
	<ffb116ef-a072-2b9b-dd92-e288dbfa0f6c@2ndquadrant.com>
	<0361327b-5d59-32b0-cb13-e844acf0f0d0@2ndquadrant.it>
	<31773cc5-3b29-1740-e7d2-dc48e80a06ce@2ndquadrant.com>
	<fde57e23-9828-8741-bb60-2b2d9e4ad55a@2ndquadrant.it>
	<35df4fd5-6b74-9c15-9246-ead8854cc669@2ndquadrant.com>
	<5462dc00-4941-167e-b287-d7bd9b2283e9@2ndquadrant.com>
	<3952d6e6-f438-f393-9a02-aae871d2fc3e@2ndquadrant.com>
	<7f0589c2-c82e-27f3-9d2c-68c0a1bb0b6e@2ndquadrant.com>

On 26/01/18 03:44, Peter Eisentraut wrote:
> On 1/24/18 07:53, Petr Jelinek wrote:
>> That depends on if we consider this to be part of sequence handling or
>> truncate statement replication handling. It's true that if we had
>> sequence replication, the restart would get propagated that way anyway.
>> OTOH, if we'll want to add option in the future to propagate cascade (to
>> any additional tables on downstream), it may need to reset sequences
>> which are not even present upstream and as such would not be handled by
>> sequence replication.
> 
> Logical replication, as it currently is designed, replicates discrete
> actions, not commands.  A delete command that deletes five rows and
> cascades to delete three more rows somewhere else ends up being
> replicated as eight changes.  So I think a TRUNCATE command that
> cascades to four tables and resets six sequences should end up being
> replicated as ten changes.  (Since we currently don't handle sequences
> at all, we'll omit the six sequence changes for now.)
> 

Well, that depends, I think there are two separate problems a) decoding
b) replication.

I think it's useful for plugins to know if reset sequence or cascade was
specified in the command so I think it should be decoded. Some plugins
will definitely want to forward that info.

But it's true that since we don't handle sequences in logical
replication, the sequence reset does not need to be replicated there.

-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services




view thread (48+ messages)  latest in thread

Message-ID: <e9c2f17c-bba5-95d4-8b48-51ee4e56d08c@2ndquadrant.com>
Permalink:  ../e9c2f17c-bba5-95d4-8b48-51ee4e56d08c@2ndquadrant.com/
Also on:    postgresql.org/message-id/e9c2f17c-bba5-95d4-8b48-51ee4e56d08c@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: petr.jelinek@2ndquadrant.com, peter.eisentraut@2ndquadrant.com, marco.nenciarini@2ndquadrant.it, simon@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: [PATCH] Logical decoding of TRUNCATE
  In-Reply-To: <e9c2f17c-bba5-95d4-8b48-51ee4e56d08c@2ndquadrant.com>
  References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it> <28a59551-b1f5-8ed4-65cf-76d17e7ee7e6@2ndquadrant.it> <f45ec6eb-1dda-9b7f-6fb8-85deb40ff968@2ndquadrant.com> <CANP8+jJzf-K0AnN2X=xpoaFq+Ncdjzbk6b4=JrMJoiMbgO39YQ@mail.gmail.com> <fdd6d0ec-ab81-af7b-aaf6-595c2ac88af9@2ndquadrant.it> <1cb9bd52-9e3a-21bf-0c0c-afa90f463629@2ndquadrant.com> <f6352c33-f3e3-0e35-dbd2-29949b9c2b59@2ndquadrant.com> <de2a9d73-1e25-797c-03f8-9faa57f75e85@2ndquadrant.it> <ffb116ef-a072-2b9b-dd92-e288dbfa0f6c@2ndquadrant.com> <0361327b-5d59-32b0-cb13-e844acf0f0d0@2ndquadrant.it> <31773cc5-3b29-1740-e7d2-dc48e80a06ce@2ndquadrant.com> <fde57e23-9828-8741-bb60-2b2d9e4ad55a@2ndquadrant.it> <35df4fd5-6b74-9c15-9246-ead8854cc669@2ndquadrant.com> <5462dc00-4941-167e-b287-d7bd9b2283e9@2ndquadrant.com> <3952d6e6-f438-f393-9a02-aae871d2fc3e@2ndquadrant.com> <7f0589c2-c82e-27f3-9d2c-68c0a1bb0b6e@2ndquadrant.com> <e9c2f17c-bba5-95d4-8b48-51ee4e56d08c@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox