Thread: pgsql: Optimize pg_checksums --enable where checksum is already set

pgsql: Optimize pg_checksums --enable where checksum is already set

From
Michael Paquier
Date:
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4c9f50d116461617848601e97dbc6f122b0a6f14

Modified Files
--------------
doc/src/sgml/ref/pg_checksums.sgml  |  3 ++-
src/bin/pg_checksums/pg_checksums.c | 36 ++++++++++++++++++++++++++++++------
2 files changed, 32 insertions(+), 7 deletions(-)