pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marco Nenciarini <marco.nenciarini@2ndquadrant.it>
To: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Logical decoding of TRUNCATE
Date: Tue, 2 Jan 2018 19:11:11 +0100
Message-ID: <f7b0fe6b-d564-87cc-9b57-3c01d00480dd@2ndquadrant.it> (raw)
In-Reply-To: <20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de>
References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it>
	<20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de>

Hi,

Il 29/12/17 20:55, Andres Freund ha scritto:
> Hi,
> 
> On 2017-12-29 14:15:22 +0100, Marco Nenciarini wrote:
>> This patch implements support for TRUNCATE statements
>> in logical replication. The work has mainly done by Simon Riggs then
>> finished by me. Tests are written by me.
>>
>> TRUNCATE is treated as a form of DELETE for the purpose of deciding
>> whether to publish, or not.
> 
> It'd be good if you explained exactly what the chosen behaviour is, and
> why that's the right behaviour in comparison to other alternatives.
> 

here is the description of how the patch works:

* A new WAL record type has been added (XLOG_HEAP_TRUNCATE) to allow a
precise logical decoding of the TRUNCATE operation. It contains the
TRUNCATE flags and the list of the involved tables and sequences. It is
treated as a NO-OP during the WAL reply as all the physical operations
are logged in SMGR WAL records.

* A new TRUNCATE message has been added to the logical protocol. It
carries the information about the truncation of one single table
specifying if CASCADE or RESTART IDENTITY has been specified.

* The ExecuteTruncateGuts function has been extracted from
ExecuteTruncate. This function is used by the logical apply process to
replicate the TRUNCATE operations, honouring the eventual CASCADE and
RESTART IDENTITY flag.

Regards,
Marco

-- 
Marco Nenciarini - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
marco.nenciarini@2ndQuadrant.it | www.2ndQuadrant.it

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (48+ messages)  latest in thread

Message-ID: <f7b0fe6b-d564-87cc-9b57-3c01d00480dd@2ndquadrant.it>
Permalink:  ../f7b0fe6b-d564-87cc-9b57-3c01d00480dd@2ndquadrant.it/
Also on:    postgresql.org/message-id/f7b0fe6b-d564-87cc-9b57-3c01d00480dd@2ndquadrant.it

 · 

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: marco.nenciarini@2ndquadrant.it, andres@anarazel.de, pgsql-hackers@postgresql.org
  Subject: Re: [PATCH] Logical decoding of TRUNCATE
  In-Reply-To: <f7b0fe6b-d564-87cc-9b57-3c01d00480dd@2ndquadrant.it>
  References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it> <20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de> <f7b0fe6b-d564-87cc-9b57-3c01d00480dd@2ndquadrant.it>

* 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