Whilst going through WAL definitions and headers, I noticed
XLP_BKP_REMOVABLE, which doesn't have any users in the PG repo. It is
still being written into WAL page headers, but never accessed or acted
on, and has been present since before the big WAL record revamp in
2014 (2c03216d83).

Is this flag actually useful and used in the more recent versions of
PostgreSQL? If not, let's remove it.

Even back in 2011 (when XLP_BKP_REMOVABLE was introduced in its
current form) there were questions about the practical uses of this
flag [0].
Back then, the pg_lesslog tool (iiuc, a tool for archiving WAL, with
deep WAL introspection/reparsing for reduced storage needs) was the
only mention of a tool that uses it, but 15 years later I'm not sure
there are any tools left which use that flag - pg_lesslog seems to
have had its last release in 2010, and seems to have died a quiet
death.

In 2025, Noah sent a mail to -hackers [1] showing a race condition
that could get this flag to be set on incorrect WAL pages, which could
cause issues for software that relied on this flag's indicated value.

Finally, I (and Michael in 2018 [2]) also couldn't find any code in
any of release branches >= 9.2 that used this flag, I couldn't find
any user in Debian Code Search, nor did I find any code on Github that
would indicate any real usage of that flag: There are some WAL
decoding tools that display its presence on the page, or which copy
the definition into their respective project in their language of
choice, but never any that have material logic that utilizes whatever
this flag means for more than displaying the WAL page state.

/cc Noah Misch and Michael Paquier, you both suggested at some point
to remove the flag.


Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)

[0] https://postgr.es/m/flat/18626.1323703037%40sss.pgh.pa.us
[1] https://postgr.es/m/[email protected]
[2] https://postgr.es/m/20180330235757.GA1394%40paquier.xyz

Attachment: v1-0001-Remove-XLP_BKP_REMOVABLE.patch
Description: Binary data

Reply via email to