Re: Logical replication error "no record found" /* shouldn't happen */

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical replication error "no record found" /* shouldn't happen */
Date: 2021-12-12 23:57:00
Message-ID: 202112122357.v4wfhuvu2b7s@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Jul-23, Andrey Borodin wrote:

> Hi!
>
> From time to time I observe $subj on clusters using logical replication.
> I most of cases there are a lot of other errors. Probably $subj condition should be kind of impossible without other problems.
> I propose to enhance error logging of XLogReadRecord() in ReadPageInternal().

Hmm.

A small problem in this patch is that XLogReaderValidatePageHeader
already sets errormsg_buf; you're overwriting that. I suggest to leave
that untouched. There are other two cases where the problem occurs in
page_read() callback; ReadPageInternal explicitly documents that it
doesn't set the error in that case. We have two options to deal with
that:

1. change all existing callbacks to set the errormsg_buf depending on
what actually fails, and then if they return failure without an error
message, add something like your proposed message.
2. throw error directly in the callback rather than returning. I don't
think this strategy actually works

I attach a cut-down patch that doesn't deal with the page_read callbacks
issue, just added stub comments in xlog.c where something should be
done.

--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/
"I am amazed at [the pgsql-sql] mailing list for the wonderful support, and
lack of hesitasion in answering a lost soul's question, I just wished the rest
of the mailing list could be like this." (Fotis)
(http://archives.postgresql.org/pgsql-sql/2006-06/msg00265.php)

Attachment Content-Type Size
errormsg.patch text/x-diff 2.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2021-12-13 00:18:18 Re: Atomic rename feature for Windows.
Previous Message Andres Freund 2021-12-12 23:41:13 Re: [PATCH] pg_stat_toast