On Mon, Aug 17, 2026 at 05:32:09PM +0300, Nazir Bilal Yavuz wrote: > I was reading the related thread [1] and I think you are right, it is > an oversight. Your analysis and fix look correct to me.
Fun one. On corruption I feel that it would be unlikely to see only 1
failure after a large scan. That's still wrong. :)
if (checksum_failures > 1)
- {
ereport(WARNING,
(errmsg_plural("file \"%s\" has a total of %d checksum
verification failure",
"file \"%s\" has a total of %d checksum
verification failures",
checksum_failures,
readfilename, checksum_failures)));
+ if (checksum_failures > 0)
+ {
pgstat_prepare_report_checksum_failure(dboid);
pgstat_report_checksum_failures_in_db(dboid, checksum_failures);
}
While the report is right, the resulting patch looks incorrect to me.
It seems to me that we should also report the warning if we have
checksum_failures == 1. errmsg_plural() would use the non-plural
message in this case. So it looks like we should just switch
"checksum_failures > 1" to "checksum_failures > 0".
Adding a test case seems like a good idea. Your proposal is cheap.
Cheap is good.
--
Michael
signature.asc
Description: PGP signature
