Skip to content

Commit 558d4a3

Browse files
committed
Remove noisy NOTICE messages when calling pg_stop_backup
Those per se are not that annoying, but the random messages generated by the backend while pg_arman is waiting for segments to be archived are annoying. This commit gets rid of them by using client_min_messages set to warning on the connection used. Report by Yury Zhuravlev.
1 parent 06bd035 commit 558d4a3

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

backup.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
9494
if (pg_is_standby())
9595
elog(ERROR, "Backup cannot run on a standby.");
9696

97-
elog(INFO, "database backup start");
97+
elog(LOG, "database backup start");
9898

9999
/* Initialize size summary */
100100
current.data_bytes = 0;
@@ -563,6 +563,12 @@ wait_for_archive(pgBackup *backup, const char *sql)
563563
XLogSegNo targetSegNo;
564564

565565
reconnect();
566+
567+
/* Remove annoying NOTICE messages generated by backend */
568+
res = execute("SET client_min_messages = warning;", 0, NULL);
569+
PQclear(res);
570+
571+
/* And execute the query wanted */
566572
res = execute(sql, 0, NULL);
567573

568574
/* Get LSN from execution result */

expected/delete.out

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
\! bash sql/delete.sh
22
###### DELETE COMMAND TEST-0001 ######
33
###### delete full backups ######
4-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
5-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
6-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
74
try to delete the oldest backup
85
2
96
1
107
Number of deleted backups should be 1, is it so?: 1
118
###### DELETE COMMAND TEST-0002 ######
129
###### keep backups which are necessary for recovery ######
13-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
14-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
15-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
16-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
1710
try to delete before third backup
1811
3
1912
1

expected/show.out

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
\! bash sql/show.sh
22
###### SHOW COMMAND TEST-0001 ######
33
###### Status DONE and OK ######
4-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
54
0
65
OK: DONE status is shown properly.
76
0
@@ -10,22 +9,18 @@ OK: OK status is shown properly.
109
###### SHOW COMMAND TEST-0002 ######
1110
###### Status RUNNING ######
1211
OK: RUNNING status is shown properly.
13-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
1412

1513
###### SHOW COMMAND TEST-0003 ######
1614
###### Status CORRUPT ######
17-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
1815
0
1916
remove a file from backup intentionally
2017
0
2118
OK: CORRUPT status is shown properly.
2219

2320
###### SHOW COMMAND TEST-0004 ######
2421
###### Status DELETED ######
25-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
2622
0
2723
0
28-
NOTICE: pg_stop_backup complete, all required WAL segments have been archived
2924
0
3025
0
3126
0

0 commit comments

Comments
 (0)