Re: logicalrep_message_type throws an error

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: "Masahiko Sawada" <sawada(dot)mshk(at)gmail(dot)com>
Subject: Re: logicalrep_message_type throws an error
Date: 2023-07-03 13:01:31
Message-ID: 6304a4d0-f16f-4e7c-a73e-81c8040fdb86@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 3, 2023, at 7:30 AM, Ashutosh Bapat wrote:
> logicalrep_message_type() is used to convert logical message type code
> into name while prepared error context or details. Thus when this
> function is called probably an ERROR is already raised. If
> logicalrep_message_type() gets an unknown message type, it will throw
> an error, which will suppress the error for which we are building
> context or details. That's not useful. I think instead
> logicalrep_message_type() should return "unknown" when it encounters
> an unknown message type and let the original error message be thrown
> as is.

Hmm. Good catch. The current behavior is:

ERROR: invalid logical replication message type "X"
LOG: background worker "logical replication worker" (PID 71800) exited with exit code 1

... that hides the details. After providing a default message type:

ERROR: invalid logical replication message type "X"
CONTEXT: processing remote data for replication origin "pg_16638" during message type "???" in transaction 796, finished at 0/16266F8

Masahiko, since abc0910e2e0 is your patch maybe you want to take a look at it.

--
Euler Taveira
EDB https://www.enterprisedb.com/

Attachment Content-Type Size
0001-uncover-logical-change-details.patch text/x-patch 2.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-07-03 13:18:17 Re: Flush SLRU counters in checkpointer process
Previous Message Daniel Gustafsson 2023-07-03 12:59:41 Re: Creation of an empty table is not fsync'd at checkpoint