The XLogFindNextRecord() routine find incorrect record start point after a long continuation record

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2019-11-06T02:40:48Z
Lists: pgsql-bugs

Attachments

I found this in our multimaster project on PostgreSQL 11.5. It is 
difficult to reproduce this error, but I will try to do it if necessary.

The rest of a continuation WAL-record can exactly match the block size. 
In this case, we need to switch targetPagePtr to the next block before 
calculating the starting point of the next WAL-record.
See the patch in attachment for the bug fix.

-- 
Andrey Lepikhov
Postgres Professional
https://postgrespro.com
The Russian Postgres Company

Commits

  1. Fix assertion failure when running pgbench -s.

  2. Fix pg_xlogdump so that it handles cross-page XLP_FIRST_IS_CONTRECORD record.