Bugs ---- * 20260406: d771b0a907e: Handle checksumworker startup wait race Handle the race condition that data checksums are fully enabled and the worker finishes before the launcher starts waiting for it. * 20260430: 25b922ec582: Fix invalid checksum state transition in checkpoints There was a race condition around updating the controlfile leading to a backend starting at exactly the wrong time reading the previous state. A related issue was if multiple checksum state changes happened between a backend initializing procsignals and finishing XLOG startup. Somewhat hard to hit since it requires a backend magnitudes slower than other background workers in the same cluster. * 20260430: 8fb8ded8895: Handle data_checksum state changes during launcher_exit Silly bug, the state transition for reverting from inprogress-on to off via inprogress-off in one error path was missing the state machince allowed state table. * 20260430: b120358c612: Prevent pg_enable/disable_data_checksums() on standby The SQL functions for disabling and enabling checksums could be executed on a hot standby. * 20260506: 9a39056c418: Apply data-checksum worker throttling parameters The API for for cost parameters had changed between when I wrote the code (years ago) and now and I had missed that, so the cost settings were not properly applied. * 20260529: 5fee7cab1b8: Fix checksum state transition during promotion When a primary crashed during checksum enabling, the standby didn't emit the procsignalbarrier during promotion to revert the cluster state to off. * 20260804: 01805b7d16b: Do not reuse rd_smgr in fork loop when enabling data checksums The worker incorrectly accessed rd_smgr which can be set to NULL at a relcache invalidation. * 20260817: 3a18526e8d6: Make data checksums launcher cancel its worker at SIGINT The launcher waited for the worker to complete before terminating at SIGINT which cause pointless work and can take some time. Fix to make it faster by having the launcher terminate and worker at SIGINT and then exit itself. * 20260430: 1df361e3d82: Improve database detection logic in datachecksumsworker * 20260804: 343d98c3601: Don't skip invalid databases when enabling data checksums Commit 1df361e3d82 attempted to improve the logic for handling invalid databases, later fixed in 343d98c3601 to handle databases which have had a DROP DATABASE operation crash. * 20260828: e469e4784ea: Handle invalid and dropped databases during checksum enable Detect invalid databases earlier, and also detect when a database is dropped while checksums are being enabled in that very database, previously this case resulted in a process error with the state rolled back to off. * 20260818: 0907112d388: basebackup: do not verify checksums on pages from before enabling A base backup which started before a checksum state transition, or when checksums are disabled and re-enabled while the backup is running, would produce false negatives. Improvements and Optimizations ------------------------------ * 20260430: bf25e5571b3: Improve handling of concurrent checksum requests Made the logic for handling concurrent invocations of enabling or disabling checksums not require creating a new launcher for detection, which reduce cluster process usage. * 20260506: 2018bd61679: Skip WAL for unlogged main fork during online checksum enable Pages for unlogged relations were not exempt from processing which caused needless WAL traffic. All pages were still properly checksummed, it "just" generated too much WAL traffic. * 20260818: 397f0fd06ed: Add data_page_checksum_version to pg_control_checkpoint pg_controldata shows the checksum version from the checkpoint but system view pg_control_checkpoint omitted it. Minor Source Code changes ------------------------- * 20260406: b3a37ffbc5b: Use PG_DATA_CHECKSUM_OFF instead of hardcoded value Replace 0 with the PG_DATA_CHECKSUM_OFF label in the code. Readability improvement over using the hardcoded zero which has been used since forever. * 20260529: 0ca1b301059: Use correct datatype for PID Use pid_t instead of int. * 20260817: abac86c7a27: Reorder function prototypes to match definition order Clearly not required, but there was an ask to do it in HEAD and backpatching seemed a cheap insurance against backpatching conflicts. Pre-existing bugs ----------------- * 20260818: aaf8b9989f7: Record initial state of data checksums in controlfile Fixes a longstanding bug in offline checksums where pg_control_init is defined to list the initial cluster state, but pg_checksums just overwrites and effectively made it show the current state. Test Stabilization ------------------- * 20260406: 07009121c23: Test stabilization for online checksums * 20260901: 5313fc415d9: Wait for checksum state transition in test Documentation, Error messages and Code comments etc --------------------------------------------------- * 20260408: b364828f825: doc: Fix data_checksums data type * 20260430: 381d19da153: Typo and spelling fixups for online checksums * 20260529: cd857dec0e0: Improve comments in online checksums code * 20260529: 5ab239c9a90: Constistent naming for datacheckusms processes * 20260605: 4ae3e98c02c: doc: Mention online checksum enabling in pg_checksums docs * 20260605: e5e1f6dc795: Reword activity message to avoid truncation * 20260618: 8d22f523245: Fix comments on data checksum cost settings * 20260716: e3a27cad462: doc: Fix link text for data checksums * 20260801: 602f19c84ca: doc: Fix glossary entry for data checksums workers