Enable data checksums by default
Greg Sabino Mullane <htamfids@gmail.com>
From: Greg Sabino Mullane <htamfids@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-08-06T22:46:52Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Avoid BufferGetLSNAtomic() calls during nbtree scans.
- e6eed40e4441 18.0 cited
-
doc PG 18 relnotes: Add incompatibility note about checksums now default
- 48814415d5aa 18.0 landed
-
Fix pg_upgrade's cross-version tests when old < 18
- 38c18710b37a 18.0 landed
-
initdb: Change default to using data checksums.
- 04bec894a04c 18.0 landed
-
Allow TAP tests to force checksums off when calling init()
- e7d0cf42b1ac 18.0 landed
-
initdb: Add new option "--no-data-checksums"
- 983a588e0b86 18.0 landed
-
Tweak docs to reduce possible impact of data checksums
- efd72a3d422b 18.0 landed
Attachments
- 0001-Make-initdb-enable-data-checksums-by-default.patch (application/x-patch) patch 0001
Please find attached a patch to enable data checksums by default. Currently, initdb only enables data checksums if passed the --data-checksums or -k argument. There was some hesitation years ago when this feature was first added, leading to the current situation where the default is off. However, many years later, there is wide consensus that this is an extraordinarily safe, desirable setting. Indeed, most (if not all) of the major commercial and open source Postgres systems currently turn this on by default. I posit you would be hard-pressed to find many systems these days in which it has NOT been turned on. So basically we have a de-facto standard, and I think it's time we flipped the switch to make it on by default. The patch is simple enough: literally flipping the boolean inside of initdb.c, and adding a new argument '--no-data-checksums' for those instances that truly want the old behavior. One place that still needs the old behavior is our internal tests for pg_checksums and pg_amcheck, so I added a new argument to init() in PostgreSQL/Test/Cluster.pm to allow those to still pass their tests. This is just the default - people are still more than welcome to turn it off with the new flag. The pg_checksums program is another option that actually argues for having the default "on", as switching to "off" once initdb has been run is trivial. Yes, I am aware of the previous discussions on this, but the world moves fast - wal compression is better than in the past, vacuum is better now, and data-checksums being on is such a complete default in the wild, it feels weird and a disservice that we are not running all our tests like that. Cheers, Greg