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.nenciar...@2ndquadrant.it | www.2ndQuadrant.it
signature.asc
Description: OpenPGP digital signature