diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c index 7c7a75c..07e6fb6 100644 --- a/src/bin/pg_checksums/pg_checksums.c +++ b/src/bin/pg_checksums/pg_checksums.c @@ -475,7 +475,7 @@ main(int argc, char *argv[]) exit(1); } - /* Check if cluster is running */ + /* Read the control file and check CRC and incompatibility */ ControlFile = get_controlfile(DataDir, &crc_ok); if (!crc_ok) { @@ -497,6 +497,11 @@ main(int argc, char *argv[]) exit(1); } + /* + * Check if cluster is running. The reason why we require a clean shutdown + * is that we may get checksum failures because of torn pages. Note that + * it does not protect someone starting the cluster concurrently. + */ if (ControlFile->state != DB_SHUTDOWNED && ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY) {