Re: Offline enabling/disabling of data checksums
Fabien COELHO <coelho@cri.ensmp.fr>
From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Michael Paquier <michael@paquier.xyz>
Cc: Michael Banck <michael.banck@credativ.de>, Sergei Kornilov <sk@zsrv.org>,
PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2019-03-13T09:44:03Z
Lists: pgsql-hackers
>> I do not think it is a good thing that two commands can write to the data >> directory at the same time, really. > > We don't prevent either a pg_resetwal and a pg_basebackup to run in > parallel. That would be... Interesting. Yep, I'm trying again to suggest that this kind of thing should be prevented. It seems that I'm pretty unconvincing. >> About fsync-ing: ISTM that it is possible that the control file is written >> to disk while data are still not written, so a failure in between would >> leave the cluster with an inconsistent state. I think that it should fsync >> the data *then* update the control file and fsync again on that one. > > if --enable is used, we fsync the whole data directory after writing > all the blocks and updating the control file at the end. [...] > It could be possible to reach a state where the control file has > checksums enabled and some blocks are not correctly synced, still you > would notice rather quickly if the server is in an incorrect state at > the follow-up startup. Yep. That is the issue I think is preventable by fsyncing updated data *then* writing & syncing the control file, and that should be done by pg_checksums. -- Fabien.
Commits
-
Reorganize Notes section in documentation of pg_checksums
- a7cc52370b2b 12.0 landed
-
Add option -N/--no-sync to pg_checksums
- e0090c869008 12.0 landed
-
Add options to enable and disable checksums in pg_checksums
- ed308d783790 12.0 landed
-
Refactor more code logic to update the control file
- 8b938d36f744 12.0 landed
-
Rename pg_verify_checksums to pg_checksums
- 6dd263cfaa84 12.0 landed
-
Fix cross-version compatibility checks of pg_verify_checksums
- 501f58359b59 11.3 landed
- c9ae7f704c67 12.0 landed
-
Add routine able to update the control file to src/common/
- ce6afc6823fb 12.0 landed