WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts - Mailing list pgsql-hackers

From Matthias van de Meent
Subject WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts
Date
Msg-id CAEze2WgNjODiAiTU18E06_BrRK0nqwJ1kdS_bN61c2_DpFDSnQ@mail.gmail.com
Whole thread Raw
Responses Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts
List pgsql-hackers
Hi,

My collegue Konstantin Knizhnik pointed out that we fail to mark pages
with a non-standard page layout with page_std=false in
RelationCopyStorageUsingBuffer when we WAL-log them. This causes us to
interpret the registered buffer as a standard buffer, and omit the
hole in the page, which for FSM/VM pages covers the whole page.

The immediate effect of this bug is that replicas and primaries in a
physical replication system won't have the same data in their VM- and
FSM-forks until the first VACUUM on the new database has WAL-logged
these pages again. Whilst not actively harmful for the VM/FSM
subsystems, it's definitely suboptimal.
Secondary unwanted effects are that AMs that use the buffercache- but
which don't use or update the pageheader- also won't see the main data
logged in WAL, thus potentially losing user data in the physical
replication stream or with a system crash. I've not looked for any
such AMs and am unaware of any that would have this issue, but it's
better to fix this.


PFA a patch that fixes this issue, by assuming that all pages in the
source database utilize a non-standard page layout.

Kind regards,

Matthias van de Meent
Neon (https://neon.tech)

Attachment

pgsql-hackers by date:

Previous
From: Dagfinn Ilmari Mannsåker
Date:
Subject: Re: Allowing additional commas between columns, and at the end of the SELECT clause
Next
From: Robert Haas
Date:
Subject: Re: cataloguing NOT NULL constraints