1
0
mirror of https://github.com/postgres/postgres.git synced 2026-01-05 23:38:41 +03:00

Optimize pg_checksums --enable where checksum is already set

This commit prevents pg_checksums to do a rewrite of a block if it has
no need to, in the case where the computed checksum matches with what's
already stored in the block read.  This is helpful to accelerate
successive runs of the tool when the previous ones got interrupted, for
example.

The number of blocks and files written is tracked and reported by the
tool once finished.  Note that the final flush of the data folder
happens even if no blocks are written, as it could be possible that a
previous interrupted run got stopped while doing a flush.

Author: Greg Sabino Mullane
Reviewed-by: Paquier Michael, Julien Rouhaud
Discussion: https://postgr.es/m/CAKAnmmL+k6goxmVzQJB+0bAR0PN1sgo6GDUXJhyhUmVMze1QAw@mail.gmail.com
This commit is contained in:
Michael Paquier
2021-06-30 09:58:59 +09:00
parent 178ec460db
commit 4c9f50d116
2 changed files with 32 additions and 7 deletions

View File

@@ -47,7 +47,8 @@ PostgreSQL documentation
<para>
When verifying checksums, every file in the cluster is scanned. When
enabling checksums, every file in the cluster is rewritten in-place.
enabling checksums, each relation file block with a changed checksum is
rewritten in-place.
Disabling checksums only updates the file <filename>pg_control</filename>.
</para>
</refsect1>