Skip to content

Commit e6214d8

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 f3438a8 commit e6214d8

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

contrib/pg_arman/backup.c

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

80-
elog(INFO, "database backup start");
80+
elog(LOG, "database backup start");
8181

8282
/* Initialize size summary */
8383
current.data_bytes = 0;
@@ -447,6 +447,12 @@ wait_for_archive(pgBackup *backup, const char *sql)
447447
XLogSegNo targetSegNo;
448448

449449
reconnect();
450+
451+
/* Remove annoying NOTICE messages generated by backend */
452+
res = execute("SET client_min_messages = warning;", 0, NULL);
453+
PQclear(res);
454+
455+
/* And execute the query wanted */
450456
res = execute(sql, 0, NULL);
451457

452458
/* Get LSN from execution result */

contrib/pg_arman/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

contrib/pg_arman/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)