LOG: invalid record length at : wanted 24, got 0 - Mailing list pgsql-hackers

From Harinath Kanchu
Subject LOG: invalid record length at : wanted 24, got 0
Date
Msg-id 47509690-AC33-4C8D-8566-D1B9BF662B34@apple.com
Whole thread Raw
Responses Re: LOG: invalid record length at : wanted 24, got 0  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
Hello,

We are seeing an interesting STANDBY behavior, that’s happening once in 3-4 days.

The standby suddenly disconnects from the primary, and it throws the error “LOG: invalid record length at <LSN>: wanted
24,got0”. 

And then it tries to restore the WAL file from the archive. Due to low write activity on primary, the WAL file will be
switchedand archived only after 1 hr. 

So, it stuck in a loop of switching the WAL sources from STREAM and ARCHIVE without replicating the primary.

Due to this there will be write outage as the standby is synchronous standby.

We are using “wal_sync_method” as “fsync” assuming WAL file not getting flushed correctly.

But this is happening even after making it as “fsync” instead of “fdatasync”.

Restarting the STANDBY sometimes fixes this problem, but detecting this automatically is a big problem as the postgres
standbyprocess will be still running fine, but WAL RECEIVER process is up and down continuously due to switching of WAL
sources.


How can we fix this ? Any suggestions regarding this will be appreciated.


Postgres Version: 13.6
OS: RHEL Linux


Thank you,


Best,
Harinath.


pgsql-hackers by date:

Previous
From: Zheng Li
Date:
Subject: Re: Support logical replication of global object commands
Next
From: Masahiko Sawada
Date:
Subject: Re: Time delayed LR (WAS Re: logical replication restrictions)