diff options
author | Michael Paquier <michael@paquier.xyz> | 2019-06-07 20:48:39 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2019-06-07 20:48:39 +0900 |
commit | 84d4de97e8d14469974eb488730a13f942aa787a (patch) | |
tree | ece4771f8cde5bd7a542465446696480c994fd5b /src | |
parent | 77b68e3a4f854d95350a3366ecfc8b3b506ebaa7 (diff) | |
download | postgresql-84d4de97e8d14469974eb488730a13f942aa787a.tar.gz postgresql-84d4de97e8d14469974eb488730a13f942aa787a.zip |
Improve some comments in pg_checksums about the needed clean shutdown
It was not clear from the code why it is necessary. And we need a clean
shutdown to avoid random checksum failures caused by torn pages.
Author: Masahiko Sawada
Discussion: https://postgr.es/m/CAD21AoDum5MbAb7F=pa9dOD1W2tukuDMPzWT7NjZceNoWB_6Qw@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_checksums/pg_checksums.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bin/pg_checksums/pg_checksums.c b/src/bin/pg_checksums/pg_checksums.c index 7c7a75cdcd6..b8e7c32dba7 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 compatibility */ 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. A clean shutdown is required to avoid + * random checksum failures caused by torn pages. Note that this doesn't + * guard against someone starting the cluster concurrently. + */ if (ControlFile->state != DB_SHUTDOWNED && ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY) { |