Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWR2C-0000Ge-Mm for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jan 2018 18:11:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWR28-0003kH-H1 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jan 2018 18:11:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eWR27-0003k7-UU for pgsql-hackers@lists.postgresql.org; Tue, 02 Jan 2018 18:11:28 +0000 Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eWR20-0003eT-CQ for pgsql-hackers@postgresql.org; Tue, 02 Jan 2018 18:11:26 +0000 Received: by mail-wr0-x22e.google.com with SMTP id p17so25572576wre.7 for ; Tue, 02 Jan 2018 10:11:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant.it; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to; bh=1j4ZAYASyaGFw4QRoVyxqLgd6D1rkabSiAtzpx0B3aU=; b=fUfUfQGqMTV3C62Ud3vUtKCQgkq39/e28zmksIGZUccjPzSAfrYt9T4KM9ErmEtogK CrXOgTfoC9jgMQDeWBTw7jJZoS0UsGgqp7cHS2iCKX9EI0bAvZPSSINlPc0PzP1DDLY2 Caxl1cBHFDnZBRE9jbvxZKfrdhRpBsBSbnfuU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=1j4ZAYASyaGFw4QRoVyxqLgd6D1rkabSiAtzpx0B3aU=; b=g6G/h5KWaXm1H49Z7K13haqHylzF/UX8xAOwT5+VFWxYMYIN+Qswa6sNo0JsVIZL8y u8bCYNPOs0ZCevmvXlrCJl9oUJyVc+IQ1Fy03Jed2xYXz/mbuRZFBlHeJFpprDPZpbUN HT2NUz11WLcBkmgZDL7KkUAIz9ERetzcy5dSVgxjEM/MKT8hbCOq74Mp1Bfz18K+NQL6 r77hYrJaFQ45hFCkNlT+7x/7/WBMfkfBFSLN4oizJwwDa+yhS4876mxhhEOlwFh9qOSf cszggDCV3RcJ5Uixg6c00LBOUub4RGiUesgbMb7TrpOAkEjzVWhipFgpNoDPqmce+9oW GD0w== X-Gm-Message-State: AKGB3mK4YGccI6KJsxtHIb14TbGdyPt3lOBf2NHCr2XSjGRlLaD1nmYI u9Yy7W5U8sVr/EGa59CV70X6sTTwYwT17mCOWft1Z7JAFSfcOw24K09EGwOi5FKGDnlFp2xMmjD hPGtOIEbcCibzTVIQnx0g5fe1tGEXflIkWV8/Ur7t7cH+5/tNUIl7IpPimg8JTk+X67iEEsNEiz rtAX9p+RIa/jpIH7o= X-Google-Smtp-Source: ACJfBouLk9QxP7aSVGkNiQpu3LyQxoJMfSD3uttO1y35G3my3WzZBBzg8x4kUtapSqsV4wFDMEuyYA== X-Received: by 10.223.139.135 with SMTP id o7mr31987088wra.263.1514916676702; Tue, 02 Jan 2018 10:11:16 -0800 (PST) Received: from titanium.local (net-37-182-231-222.cust.vodafonedsl.it. [37.182.231.222]) by smtp.googlemail.com with ESMTPSA id x75sm21382413wme.44.2018.01.02.10.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jan 2018 10:11:15 -0800 (PST) Subject: Re: [PATCH] Logical decoding of TRUNCATE To: Andres Freund Cc: PostgreSQL-development References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it> <20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de> From: Marco Nenciarini Message-ID: Date: Tue, 2 Jan 2018 19:11:11 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="s6HbacUquZTLFuX7vU4x3toqWb0pWoNlB" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --s6HbacUquZTLFuX7vU4x3toqWb0pWoNlB Content-Type: multipart/mixed; boundary="QOSePc18HmOjF6XZHtAgsPpRqD3eE6p9n"; protected-headers="v1" From: Marco Nenciarini To: Andres Freund Cc: PostgreSQL-development Message-ID: Subject: Re: [PATCH] Logical decoding of TRUNCATE References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it> <20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de> In-Reply-To: <20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de> --QOSePc18HmOjF6XZHtAgsPpRqD3eE6p9n Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hi, Il 29/12/17 20:55, Andres Freund ha scritto: > Hi, >=20 > 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. >=20 > 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. >=20 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 --=20 Marco Nenciarini - 2ndQuadrant Italy PostgreSQL Training, Services and Support marco.nenciarini@2ndQuadrant.it | www.2ndQuadrant.it --QOSePc18HmOjF6XZHtAgsPpRqD3eE6p9n-- --s6HbacUquZTLFuX7vU4x3toqWb0pWoNlB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEfCO4BD5l0pgKIbbiWJ8D8BulUDgFAlpLy0AACgkQWJ8D8Bul UDidwA//S3z3TQ/a4/7xHszXC/nhp3QQtXao1LKgCJ0oSb+eTz37hdBkHCscPMjg Pf/Wc/LnNXwDuiMS73GiGy7nd4QPfte2enNnxX7SseF1fRaHsE0GnP7ZCz1PU81l ByoooCw0NU8u/uPB7OsyWhXi1xgN73c7D6LHPToLi2968FraacWuR/6NqOXUo3OO SiN8Y5sTB7rmit6KiLonQFSV8ug9OOPMHXlizDYxa098YAu7nNI56tQzQkm2lNUs M+AKkVFdvgFMXc+JtjBCV2zRgMZ5PgqeLqGA3EAJpZELBfUEBUDtulO/h1racOae fVJh3gHWEeapPtNyOE6lA4h4lprQ2SXvg+I0DycntSc8Ac5eIl3XKriGFuC6ylHS 31QBQfz/UpK5GstCDtsgm/O8XkengVtcr6eiEPe8CbbOgRGBgdReR+quiS2vX70q cjjIkL9gmyIe7aMJxayBM5ly8xzrg8245/vcr5zQUaEh0L+ShLf96EU5HYPzq8oi +a4zFU34JdZbeQpON17beCDmQlZ3InAIo4ziPL3j5dYLliOWPEaFH54lx85ipBxm 8kI/uzKbxgCumUl8UMo9dpeOMAssCn9cICBTnG0q9JuigoJr0gIwoUuKmlZCQsPx 8+y2bJkUJJAj5C/VD40TdyxDME4Me2NxCvyA4XKx63wwfjPgK3Y= =Pjbh -----END PGP SIGNATURE----- --s6HbacUquZTLFuX7vU4x3toqWb0pWoNlB--