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

Started by Andrey Borodinabout 5 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t44592
psql -h localhost -U postgres

Built from patchset v3 (message #3), July 27, 2026 at 03:51 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t44592_3 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t44592_3 && git checkout t44592_3

Patchset v3 (message #3) is on t44592_3

Jump to latest
#1Andrey Borodin
amborodin@acm.org

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().

Thank you!

Best regards, Andrey Borodin.

Attachments:

0001-Improve-error-reporting-of-ReadPageInternal.patchapplication/octet-stream; name=0001-Improve-error-reporting-of-ReadPageInternal.patch; x-unix-mode=0644Download+24-1
#2Mihail Nikalayeu
mihailnikalayeu@gmail.com
In reply to: Andrey Borodin (#1)
Re: Logical replication error "no record found" /* shouldn't happen */

Hello.

I saw this error multiple times trying to replicate the 2-3 TB server
(version 11 to version 12). I was unable to find any explanation for
this error.

Thanks,
Michail.

#3Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Andrey Borodin (#1)
Re: Logical replication error "no record found" /* shouldn't happen */

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)

Attachments:

t44592_3
errormsg.patchtext/x-diff; charset=utf-8Download+22-2