Offline data checksum changes with pg_checksums are local to one node, but replay adopted the data checksum state carried by checkpoint record unconditionally. After enabling checksums offline on only the primary, a standby thus started verifying checksums it does not have. After an offline change on a standby, the next replayed checkpoint silently reverted the state. To fix, make the control file track this node's state alone, and have replay cross-check the replayed state against it instead of adopting it, warning once per divergent value and reporting when the states agree again. pg_control gains a watermark, normally the end LSN of the newest XLOG2_CHECKSUMS record the node has written or applied, and a flag marking that the state was last written by pg_checksums. Recovery must never overwrite this state with a replayed one. The control file is updated when all pages are flushed. This requires a PG_CONTROL_VERSION bump. Recovery from a base backup may be an exception to not adopting: its control file was copied at an arbitrary moment, so the state carried by the starting checkpoint is the one the WAL from there on was Also document the offline procedure for replication setups. Author: Zsolt Parragi <zsolt.parragi@percona.com> Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reported-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/anwm6UPxoVS41QA2@bdtpg Backpatch-through: 19
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.