From: | Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it> |
---|---|
To: | Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Logical decoding of TRUNCATE |
Date: | 2018-01-23 17:19:36 |
Message-ID: | 0361327b-5d59-32b0-cb13-e844acf0f0d0@2ndquadrant.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Il 23/01/18 18:13, Petr Jelinek ha scritto:
> Hi,
>
> On 23/01/18 15:38, Marco Nenciarini wrote:
>> Il 22/01/18 23:18, Petr Jelinek ha scritto:
>>> On 22/01/18 19:45, Petr Jelinek wrote:
>>>
>>> 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.
>>>
>>
>> Now ExecuteTruncateGuts unconditionally closes the relations that it
>> opens. The caller has now always the responsibility to close the
>> relations passed with the explicit_rels list.
>
> This looks good.
>
>>
>> Version 15 attached.
>>
>
> I see you still do CASCADE on the subscriber though.
>
No it doesn't. The following code in worker.c prevents that.
+ /*
+ * Even if we used CASCADE on the upstream master we explicitly
+ * default to replaying changes without further cascading.
+ * This might be later changeable with a user specified option.
+ */
+ cascade = false;
There is also a test that check it works as intended:
+ # should not cascade on replica
+ $node_publisher->safe_psql('postgres', "TRUNCATE tab_rep CASCADE");
+
+ $node_publisher->wait_for_catchup($appname);
+
+ $result = $node_subscriber->safe_psql('postgres',
+ "SELECT count(*), min(a), max(a) FROM tab_notrep_fk");
+ is($result, qq(1|-1|-1),
+ 'check replicated truncate does not cascade on replica');
+
+ $result = $node_subscriber->safe_psql('postgres',
+ "SELECT nextval('seq_notrep')");
+ is($result, qq(102),
+ 'check replicated truncate does not restart identities');
+
Regards,
Marco
--
Marco Nenciarini - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
marco(dot)nenciarini(at)2ndQuadrant(dot)it | www.2ndQuadrant.it
From | Date | Subject | |
---|---|---|---|
Next Message | Petr Jelinek | 2018-01-23 17:25:05 | Re: [PATCH] Logical decoding of TRUNCATE |
Previous Message | Petr Jelinek | 2018-01-23 17:13:09 | Re: [PATCH] Logical decoding of TRUNCATE |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2018-01-23 17:20:02 | Re: [HACKERS] Support for Secure Transport SSL library on macOS as OpenSSL alternative |
Previous Message | Petr Jelinek | 2018-01-23 17:13:09 | Re: [PATCH] Logical decoding of TRUNCATE |