Re: [PATCH] Logical decoding of TRUNCATE

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>, Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Logical decoding of TRUNCATE
Date: 2018-04-07 23:40:11
Message-ID: 1baed811-47b2-5b7d-c641-4b7eb01d650f@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 4/5/18 13:07, Alvaro Herrera wrote:
> Note that you start the loop having the Relation; yet you go extra
> length to grab the relnamespace and relname from syscache instead of
> just relations[i]->rd_rel->relname etc.

fixed

> Maybe not a big deal, but for future pg_waldump users I'm sure it'll be
> nice to have the OIDs here.

done

>> +void
>> +ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
>> + DropBehavior behavior, bool restart_seqs)
>> +{
>
> Please add a comment atop this function.

done

>> + /*
>> + * Write a WAL record to allow this set of actions to be logically decoded.
>> + *
>> + * Assemble an array of relids so we can write a single WAL record for the
>> + * whole action.
>> + */
>> + if (list_length(relids_logged) > 0)
>> + {
>> + xl_heap_truncate xlrec;
>> + int i = 0;
>
> I wonder if this should happen only if logical decoding? (Maybe it
> already occurs because relids_logged would be empty? Worth a comment in
> that case)

Added an assertion and a comment.

Committed with those changes.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rory Campbell-Lange 2018-04-08 10:40:12 Re: dump/restore problem due to CVE-2018-1058 (9.5.12)
Previous Message Adrian Klaver 2018-04-07 19:46:52 Re: dump/restore problem due to CVE-2018-1058 (9.5.12)

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-04-07 23:41:11 Re: [PATCH] session_replication_role = replica with TRUNCATE
Previous Message David Rowley 2018-04-07 23:38:23 Re: pgsql: Support partition pruning at execution time