Re: Add the replication origin name and commit-LSN to logical replication worker errcontext

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add the replication origin name and commit-LSN to logical replication worker errcontext
Date: 2022-03-02 05:39:54
Message-ID: CAD21AoCXgnMmyCmRQDw4B=RZodTxkQHVuFCoLookBijkNY8zGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 2, 2022 at 11:55 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Mon, Feb 28, 2022 at 5:46 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> >
> > I've attached two patches: the first one changes
> > apply_error_callback() so that it uses complete sentences with if-else
> > blocks in order to have a translation work,
> >
>
> This is an improvement over what we have now but I think this is still
> not completely correct as per message translation rules:
> + else
> + errcontext("processing remote data during \"%s\" in transaction %u at %s",
> + logicalrep_message_type(errarg->command),
> + errarg->remote_xid,
> + (errarg->ts != 0) ? timestamptz_to_str(errarg->ts) : "(not-set)");
>
> As per guidelines [1][2], we don't prefer to construct messages at
> run-time aka we can do better for the following part: + (errarg->ts
> != 0) ? timestamptz_to_str(errarg->ts) : "(not-set)". I think we need
> to use if-else here to split it further. If you agree, then the same
> needs to be dealt with in other parts of the patch as well.

I intended to use "(not-set)" as a value rather than a word in the
sentence so I think it doesn't violate the guidelines. We can split it
further as you suggested but we will end up having more if-else
branches.

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-03-02 06:11:49 Re: Use "WAL segment" instead of "log segment" consistently in user-facing messages
Previous Message Chris Bandy 2022-03-02 05:30:25 Re: Allow root ownership of client certificate key