Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edkQ9-0006Fw-H8 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jan 2018 22:18:29 +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 1edkQ8-0005ZC-SY for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jan 2018 22:18: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 1edkQ8-0005Z2-IA for pgsql-hackers@lists.postgresql.org; Mon, 22 Jan 2018 22:18:28 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1edkQ5-0002nZ-Do for pgsql-hackers@postgresql.org; Mon, 22 Jan 2018 22:18:26 +0000 Received: by mail-wr0-x243.google.com with SMTP id e41so10374459wre.9 for ; Mon, 22 Jan 2018 14:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DEHwN4jn6Sv486QNs/hefH/eCWJl6eI02EUCoem+XHE=; b=fu0ySLNPrpDM79qAH9NnIAczWk3FcNNB2JEUguFoZC1sbph2qOFXPCdmUK9OBMHta4 cvluIJvqN/cWk20nKg9ZYXEap49Cg+hdKk8C8MdSzkjz8l9hkFvI6gVtUZccr8CVdzWV DIVdjUiLCt6bCxHPr9wMVeLiaYDFF5oAgQqw+9IZBbXvkjXWqInJjfFFgJnmCjClKvWM n353K9K8Ayk4zyBXSRY1MNZmUvHbb/yg6rC9I8MZup1PM6xk4Q4UdaHyVn4E9zs8Cg6N g0k7a94qmxRnImvXpLrfVrz+vvjUxZPGi88fextsNvy5cf6vOQTheY3g1tptq40g0vPd YldA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DEHwN4jn6Sv486QNs/hefH/eCWJl6eI02EUCoem+XHE=; b=iEJZLuKAKtb2TYRHUj1VwExOmZRNYbXcmJuAbn/8JEAVyJS0XzY6gfoXsIqELpEUJ6 rYsx6z9z1GTaLodmus/EihpAzC3uQYUVEbtY3dh9Q/VC5WgwPf4EPC24s/AzA5uVMlwX 0mbguVvFOCOj0dVQWbtO2a6uMO9XhDor3J4NLy//gYzd8uc0kv4OTbgnTrhMK3ZFowrx 8WYbxvizQOOkYY4p/nwlisEiVvvp5GgwlzCFZ8mBD7Q9CIxu1zkMTHOkSQMVND+tJ03W vZAH3XFqxdzoORg21CfRAONmr/dal7pueDwOCM0lAwMb21UsocbPf9I6dxudYS8JEeBl KkWw== X-Gm-Message-State: AKwxytfbbhIEmHTrEsO6QqY9iBLOenSX8dLlrSLK7ykOMvjnylwVrdNh 6U6ni30/IB7h8TJFcCvrAdy7WlCIfiKc8CxVtE7oqXHeUZtTOUckTRpr+VxPK0Oe19vuSE4hdnv TiKWe6tIo6lrOQgwIiB9PsL6NXcSGiBty4cW96wbSMsg8dzrT+fX8dY6q5UPlk+Cj/Rct02IGmW Jm6SGq3atjDsk= X-Google-Smtp-Source: AH8x2276tvYR506NB5/p8GAwDV8XEwkzgJNrCyYDN2mE0w09RFxdSPLb0FAG/9g965T6eSwUvJgbjg== X-Received: by 10.223.144.195 with SMTP id i61mr305444wri.73.1516659503436; Mon, 22 Jan 2018 14:18:23 -0800 (PST) Received: from [192.168.0.106] (150.123.broadband11.iol.cz. [90.178.123.150]) by smtp.gmail.com with ESMTPSA id c48sm14733780wra.57.2018.01.22.14.18.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jan 2018 14:18:22 -0800 (PST) Subject: Re: [PATCH] Logical decoding of TRUNCATE From: Petr Jelinek To: Marco Nenciarini , Simon Riggs Cc: PostgreSQL-development References: <269bf0d2-6ac4-c032-6979-22aad6a9f5fb@2ndquadrant.it> <20171229195536.cdzmgllfkln6wo6t@alap3.anarazel.de> <35a1d60b-f66d-4001-499b-2336ca81fc6c@2ndquadrant.it> <1a4ace10-1997-6644-d17a-5a17bf250270@2ndquadrant.it> <28a59551-b1f5-8ed4-65cf-76d17e7ee7e6@2ndquadrant.it> <1cb9bd52-9e3a-21bf-0c0c-afa90f463629@2ndquadrant.com> Message-ID: Date: Mon, 22 Jan 2018 23:18:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1cb9bd52-9e3a-21bf-0c0c-afa90f463629@2ndquadrant.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 22/01/18 19:45, Petr Jelinek wrote: > On 19/01/18 12:37, Marco Nenciarini wrote: >> Hi All, >>>>> + /* logicalrep_rel_close call not needed, because ExecuteTruncateGuts >>>>> + * already closes the relations. Setting localrel to NULL in the map entry >>>>> + * is still needed. >>>>> + */ >>>>> + rel->localrel = NULL; >>>> >>>> This is somewhat ugly. Perhaps the ExecuteTruncateGuts should track >>>> which relations it opened and only close those and the rest should be >>>> closed by caller? That should also remove the other ugly part which is >>>> that the ExecuteTruncateGuts modifies the input list. What if caller >>>> wanted to use those relations it sent as parameter later? >>> >>> Agreed >>> >> >> Attached a new version of the patch addressing these issues. >> > > Besides the small thing I wrote for the 0001 in the other thread I am > pretty much happy with this now. > Actually on second look, I don't like the new boolean parameter much. I'd rather we didn't touch the input list and always close only relations opened inside the ExecuteTruncateGuts(). It may mean more list(s) but the current interface is still not clean. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services