Skip to content

Commit 84d4de9

Browse files
committed
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
1 parent 77b68e3 commit 84d4de9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/bin/pg_checksums/pg_checksums.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ main(int argc, char *argv[])
475475
exit(1);
476476
}
477477

478-
/* Check if cluster is running */
478+
/* Read the control file and check compatibility */
479479
ControlFile = get_controlfile(DataDir, &crc_ok);
480480
if (!crc_ok)
481481
{
@@ -497,6 +497,11 @@ main(int argc, char *argv[])
497497
exit(1);
498498
}
499499

500+
/*
501+
* Check if cluster is running. A clean shutdown is required to avoid
502+
* random checksum failures caused by torn pages. Note that this doesn't
503+
* guard against someone starting the cluster concurrently.
504+
*/
500505
if (ControlFile->state != DB_SHUTDOWNED &&
501506
ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY)
502507
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy