pg_basebackup exit codes

From: John Donath <John(dot)Donath(at)detron(dot)nl>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: pg_basebackup exit codes
Date: 2019-08-19 10:18:30
Message-ID: AM6PR05MB5334667E909FED67412747D6E5A80@AM6PR05MB5334.eurprd05.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I was unpleasantly surprised to see that pg_basebackup will return a zero (Success) exit code even when it has actually failed like below:

pg_basebackup: could not write to compressed file "/var/lib/pgsql/10/inst1/backup/cust-pg02_inst1_Fri_20190816/base.tar.gz": No space left on device
pg_basebackup: removing data directory "/var/lib/pgsql/10/inst1/backup/cust-pg02_inst1_Fri_20190816"

A reliable exit code is of great importance in backup scripts using a statement like below:

pg_basebackup -D ${backup_dest} -Ft -z 2>&1 | tee -a ${log_file}; rv=$?
[ $rv -eq 0 ] || error "pg_basebackup failed with rcode $rv; also see ${log_file}"

Pg_basebackup version: (PostgreSQL) 10.10

Anybody else encountering this problem?

Regards, John

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shiwangini Shishulkar 2019-08-19 10:40:34 postmaster utilization
Previous Message Peter Eisentraut 2019-08-19 07:30:06 Re: question about zeroes in the wal file names