Re: Proposal: Conflict log history table for Logical Replication

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, saurabh singh <saurabh(dot)singh214(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Conflict log history table for Logical Replication
Date: 2026-08-12 15:43:07
Message-ID: CAFiTN-v+EdsS0Z=8hKvip5m+RebAihmLU+sZoTgppcD7=4g4JQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 11, 2026 at 5:38 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> A few comments:
>
> 1)
> + or both. Note that only resolved conflicts (logged at
> <literal>LOG</literal>
> + level where the apply transaction continues) are recorded in the
> conflict log
> + table. Conflicts that raise an <literal>ERROR</literal> halt
> replication and
> + are always reported exclusively to the server log.
>
> I think this is not needed in the Conflict-logging introduction
> section itself. It is more suited in 'table-logging' section. We can
> keep it as a NOTE (<note> tag) so that it catches reader’s eye. We can
> add it before 'The conflict log table serves as an audit trail'
> paragraph.

Done

>
> 2)
> +conflict_log_insert_errcontext(void *arg)
>
> I think we don't need this callbackfunction and logic around it anymore.

Fixed

> 3)
> In tuple_table_slot_to_indextup_json(), we first call
> BlessTupleDesc(tupdesc), but then free the tuple descriptor with
> FreeTupleDesc(tupdesc) before calling row_to_json().
>
> I am not entirely sure whether row_to_json() may need the tuple
> descriptor here, but it seems safer to keep the descriptor alive until
> after row_to_json() has consumed the record Datum. heap_form_tuple()
> and heap_copy_tuple_as_datum() also use the tuple descriptor while
> constructing the Datum;see heap_fill_tuple() uses the tuple
> descriptor's attributes. IMO, to be on the safe side, we could do:
>
> /* Convert to a JSON datum. */
> datum = DirectFunctionCall1(row_to_json, datum);
> FreeTupleDesc(tupdesc);
> return datum;

Changed.

--
Regards,
Dilip Kumar
Google

Attachment Content-Type Size
v69-0001-Implement-the-conflict-insertion-infrastructure-.patch application/octet-stream 73.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2026-08-12 15:53:35 Re: Credits For v19
Previous Message Daniel Gustafsson 2026-08-12 15:42:57 Re: [PATCH] pg_upgrade: add --initdb option to create the new cluster automatically