Skip to content

Commit e61b112

Browse files
committed
function pg_checksums: the logic of processing the test result has been changed
fixed "ERROR: pg_checksums: data checksums validation - Failed" /usr/lib/postgresql/10/bin/pg_checksums -c -D /tmp/rst/apdb-cluster-test Checksum operation completed Files scanned: 1776 Blocks scanned: 1160697 Blocks skipped: 83 Bad checksums: 0 Data checksum version: 1 postgres@smh-backuper:~$ echo $? 1 There are no errors, but the return code is 1. At the same time, the return code is 0 for version 13: /usr/lib/postgresql/13/bin/pg_checksums -c -D /tmp/rst/shdb-cluster-test Checksum operation completed Files scanned: 3220 Blocks scanned: 236147 Bad checksums: 0 Data checksum version: 1 postgres@smh-backuper:~$ echo $? 0 Now we do not rely on the return code, but explicitly check for the presence of "Bad checksums: 0" as a result of executing the pg_checksums command.
1 parent 7569281 commit e61b112

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pgbackrest_auto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,10 @@ function dummy_dump(){
522522
function pg_checksums(){
523523
if pgisready 1> /dev/null; then pg_stop cycle_simple pg_stop_check; fi
524524
info "pg_checksums: starting data checksums validation"
525-
if ! /usr/lib/postgresql/"${PGVER}"/bin/pg_checksums -c -D "${TO}" 1> /dev/null
525+
pg_checksums_result=$(/usr/lib/postgresql/"${PGVER}"/bin/pg_checksums -c -D "${TO}" | grep "Bad checksums")
526+
if [[ $pg_checksums_result != "Bad checksums: 0" ]]
526527
then
528+
warnmsg "pg_checksums: data checksums validation result: $pg_checksums_result"
527529
error "pg_checksums: data checksums validation - Failed"
528530
else
529531
info "pg_checksums: data checksums validation - Successful"

0 commit comments

Comments
 (0)