Skip to content

Commit aefb5db

Browse files
committed
[PBCKP-129] change logging levels verbosity for other commands
1 parent 274c325 commit aefb5db

File tree

9 files changed

+78
-82
lines changed

9 files changed

+78
-82
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ env:
3434
- PG_VERSION=10 PG_BRANCH=REL_10_STABLE
3535
- PG_VERSION=9.6 PG_BRANCH=REL9_6_STABLE
3636
- PG_VERSION=9.5 PG_BRANCH=REL9_5_STABLE
37-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=archive
38-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
37+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=archive
38+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=backup
3939
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=catchup
4040
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=compression
4141
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=delta
4242
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=locking
43-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=merge
43+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=merge
4444
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=page
4545
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=ptrack
4646
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=replica
4747
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=off MODE=retention
48-
# - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=restore
48+
- PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=restore
4949

5050
jobs:
5151
allow_failures:

src/archive.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* archive.c: - pg_probackup specific archive commands for archive backups.
44
*
55
*
6-
* Portions Copyright (c) 2018-2021, Postgres Professional
6+
* Portions Copyright (c) 2018-2022, Postgres Professional
77
*
88
*-------------------------------------------------------------------------
99
*/
@@ -361,7 +361,7 @@ push_file(WALSegno *xlogfile, const char *archive_status_dir,
361361
canonicalize_path(wal_file_ready);
362362
canonicalize_path(wal_file_done);
363363
/* It is ok to rename status file in archive_status directory */
364-
elog(VERBOSE, "Rename \"%s\" to \"%s\"", wal_file_ready, wal_file_done);
364+
elog(LOG, "Rename \"%s\" to \"%s\"", wal_file_ready, wal_file_done);
365365

366366
/* do not error out, if rename failed */
367367
if (fio_rename(wal_file_ready, wal_file_done, FIO_DB_HOST) < 0)
@@ -505,7 +505,7 @@ push_file_internal_uncompressed(const char *wal_file_name, const char *pg_xlog_d
505505
}
506506

507507
part_opened:
508-
elog(VERBOSE, "Temp WAL file successfully created: \"%s\"", to_fullpath_part);
508+
elog(LOG, "Temp WAL file successfully created: \"%s\"", to_fullpath_part);
509509
/* Check if possible to skip copying */
510510
if (fileExists(to_fullpath, FIO_BACKUP_HOST))
511511
{
@@ -595,7 +595,7 @@ push_file_internal_uncompressed(const char *wal_file_name, const char *pg_xlog_d
595595
to_fullpath_part, strerror(errno));
596596
}
597597

598-
elog(VERBOSE, "Rename \"%s\" to \"%s\"", to_fullpath_part, to_fullpath);
598+
elog(LOG, "Rename \"%s\" to \"%s\"", to_fullpath_part, to_fullpath);
599599

600600
//copy_file_attributes(from_path, FIO_DB_HOST, to_path_temp, FIO_BACKUP_HOST, true);
601601

@@ -752,7 +752,7 @@ push_file_internal_gz(const char *wal_file_name, const char *pg_xlog_dir,
752752
}
753753

754754
part_opened:
755-
elog(VERBOSE, "Temp WAL file successfully created: \"%s\"", to_fullpath_gz_part);
755+
elog(LOG, "Temp WAL file successfully created: \"%s\"", to_fullpath_gz_part);
756756
/* Check if possible to skip copying,
757757
*/
758758
if (fileExists(to_fullpath_gz, FIO_BACKUP_HOST))
@@ -844,7 +844,7 @@ push_file_internal_gz(const char *wal_file_name, const char *pg_xlog_dir,
844844
to_fullpath_gz_part, strerror(errno));
845845
}
846846

847-
elog(VERBOSE, "Rename \"%s\" to \"%s\"",
847+
elog(LOG, "Rename \"%s\" to \"%s\"",
848848
to_fullpath_gz_part, to_fullpath_gz);
849849

850850
//copy_file_attributes(from_path, FIO_DB_HOST, to_path_temp, FIO_BACKUP_HOST, true);
@@ -1155,7 +1155,7 @@ do_archive_get(InstanceState *instanceState, InstanceConfig *instance, const cha
11551155
if (get_wal_file(wal_file_name, backup_wal_file_path, absolute_wal_file_path, false))
11561156
{
11571157
fail_count = 0;
1158-
elog(INFO, "pg_probackup archive-get copied WAL file %s", wal_file_name);
1158+
elog(LOG, "pg_probackup archive-get copied WAL file %s", wal_file_name);
11591159
n_fetched++;
11601160
break;
11611161
}
@@ -1511,7 +1511,7 @@ get_wal_file_internal(const char *from_path, const char *to_path, FILE *out,
15111511
char *buf = pgut_malloc(OUT_BUF_SIZE); /* 1MB buffer */
15121512
int exit_code = 0;
15131513

1514-
elog(VERBOSE, "Attempting to %s WAL file '%s'",
1514+
elog(LOG, "Attempting to %s WAL file '%s'",
15151515
is_decompress ? "open compressed" : "open", from_path);
15161516

15171517
/* open source file for read */

src/backup.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* backup.c: backup DB cluster, archived WAL
44
*
55
* Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6-
* Portions Copyright (c) 2015-2019, Postgres Professional
6+
* Portions Copyright (c) 2015-2022, Postgres Professional
77
*
88
*-------------------------------------------------------------------------
99
*/
@@ -116,7 +116,7 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
116116
char pretty_time[20];
117117
char pretty_bytes[20];
118118

119-
elog(LOG, "Database backup start");
119+
elog(INFO, "Database backup start");
120120
if(current.external_dir_str)
121121
{
122122
external_dirs = make_external_directory_list(current.external_dir_str,
@@ -336,11 +336,11 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
336336
/* Extract information about files in backup_list parsing their names:*/
337337
parse_filelist_filenames(backup_files_list, instance_config.pgdata);
338338

339-
elog(LOG, "Current Start LSN: %X/%X, TLI: %X",
339+
elog(INFO, "Current Start LSN: %X/%X, TLI: %X",
340340
(uint32) (current.start_lsn >> 32), (uint32) (current.start_lsn),
341341
current.tli);
342342
if (current.backup_mode != BACKUP_MODE_FULL)
343-
elog(LOG, "Parent Start LSN: %X/%X, TLI: %X",
343+
elog(INFO, "Parent Start LSN: %X/%X, TLI: %X",
344344
(uint32) (prev_backup->start_lsn >> 32), (uint32) (prev_backup->start_lsn),
345345
prev_backup->tli);
346346

@@ -412,7 +412,7 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn,
412412
else
413413
join_path_components(dirpath, current.database_dir, file->rel_path);
414414

415-
elog(VERBOSE, "Create directory '%s'", dirpath);
415+
elog(LOG, "Create directory '%s'", dirpath);
416416
fio_mkdir(dirpath, DIR_PERMISSION, FIO_BACKUP_HOST);
417417
}
418418

@@ -673,7 +673,7 @@ pgdata_basic_setup(ConnectionOptions conn_opt, PGNodeInfo *nodeInfo)
673673
nodeInfo->checksum_version = current.checksum_version;
674674

675675
if (current.checksum_version)
676-
elog(LOG, "This PostgreSQL instance was initialized with data block checksums. "
676+
elog(INFO, "This PostgreSQL instance was initialized with data block checksums. "
677677
"Data block corruption will be detected");
678678
else
679679
elog(WARNING, "This PostgreSQL instance was initialized without data block checksums. "
@@ -1513,7 +1513,7 @@ wait_wal_and_calculate_stop_lsn(const char *xlog_path, XLogRecPtr stop_lsn, pgBa
15131513
stop_lsn_exists = true;
15141514
}
15151515

1516-
elog(LOG, "stop_lsn: %X/%X",
1516+
elog(INFO, "stop_lsn: %X/%X",
15171517
(uint32) (stop_lsn >> 32), (uint32) (stop_lsn));
15181518

15191519
/*
@@ -1902,15 +1902,15 @@ pg_stop_backup(InstanceState *instanceState, pgBackup *backup, PGconn *pg_startb
19021902

19031903
backup->recovery_xid = stop_backup_result.snapshot_xid;
19041904

1905-
elog(LOG, "Getting the Recovery Time from WAL");
1905+
elog(INFO, "Getting the Recovery Time from WAL");
19061906

19071907
/* iterate over WAL from stop_backup lsn to start_backup lsn */
19081908
if (!read_recovery_info(xlog_path, backup->tli,
19091909
instance_config.xlog_seg_size,
19101910
backup->start_lsn, backup->stop_lsn,
19111911
&backup->recovery_time))
19121912
{
1913-
elog(LOG, "Failed to find Recovery Time in WAL, forced to trust current_timestamp");
1913+
elog(INFO, "Failed to find Recovery Time in WAL, forced to trust current_timestamp");
19141914
backup->recovery_time = stop_backup_result.invocation_time;
19151915
}
19161916

@@ -1992,9 +1992,8 @@ backup_files(void *arg)
19921992
if (interrupted || thread_interrupted)
19931993
elog(ERROR, "interrupted during backup");
19941994

1995-
if (progress)
1996-
elog(INFO, "Progress: (%d/%d). Process file \"%s\"",
1997-
i + 1, n_backup_files_list, file->rel_path);
1995+
elog(progress ? INFO : LOG, "Progress: (%d/%d). Process file \"%s\"",
1996+
i + 1, n_backup_files_list, file->rel_path);
19981997

19991998
/* Handle zero sized files */
20001999
if (file->size == 0)
@@ -2064,11 +2063,11 @@ backup_files(void *arg)
20642063

20652064
if (file->write_size == BYTES_INVALID)
20662065
{
2067-
elog(VERBOSE, "Skipping the unchanged file: \"%s\"", from_fullpath);
2066+
elog(LOG, "Skipping the unchanged file: \"%s\"", from_fullpath);
20682067
continue;
20692068
}
20702069

2071-
elog(VERBOSE, "File \"%s\". Copied "INT64_FORMAT " bytes",
2070+
elog(LOG, "File \"%s\". Copied "INT64_FORMAT " bytes",
20722071
from_fullpath, file->write_size);
20732072
}
20742073

@@ -2186,26 +2185,26 @@ set_cfs_datafiles(parray *files, const char *root, char *relative, size_t i)
21862185
elog(ERROR, "Out of memory");
21872186
len = strlen("/pg_compression");
21882187
cfs_tblspc_path[strlen(cfs_tblspc_path) - len] = 0;
2189-
elog(VERBOSE, "CFS DIRECTORY %s, pg_compression path: %s", cfs_tblspc_path, relative);
2188+
elog(LOG, "CFS DIRECTORY %s, pg_compression path: %s", cfs_tblspc_path, relative);
21902189

21912190
for (p = (int) i; p >= 0; p--)
21922191
{
21932192
prev_file = (pgFile *) parray_get(files, (size_t) p);
21942193

2195-
elog(VERBOSE, "Checking file in cfs tablespace %s", prev_file->rel_path);
2194+
elog(LOG, "Checking file in cfs tablespace %s", prev_file->rel_path);
21962195

21972196
if (strstr(prev_file->rel_path, cfs_tblspc_path) != NULL)
21982197
{
21992198
if (S_ISREG(prev_file->mode) && prev_file->is_datafile)
22002199
{
2201-
elog(VERBOSE, "Setting 'is_cfs' on file %s, name %s",
2200+
elog(LOG, "Setting 'is_cfs' on file %s, name %s",
22022201
prev_file->rel_path, prev_file->name);
22032202
prev_file->is_cfs = true;
22042203
}
22052204
}
22062205
else
22072206
{
2208-
elog(VERBOSE, "Breaking on %s", prev_file->rel_path);
2207+
elog(LOG, "Breaking on %s", prev_file->rel_path);
22092208
break;
22102209
}
22112210
}

src/catchup.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,8 @@ catchup_thread_runner(void *arg)
398398
if (interrupted || thread_interrupted)
399399
elog(ERROR, "Interrupted during catchup");
400400

401-
if (progress)
402-
elog(INFO, "Progress: (%d/%d). Process file \"%s\"",
403-
i + 1, n_files, file->rel_path);
401+
elog(progress ? INFO : LOG, "Progress: (%d/%d). Process file \"%s\"",
402+
i + 1, n_files, file->rel_path);
404403

405404
/* construct destination filepath */
406405
Assert(file->external_dir_num == 0);

src/data.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ backup_non_data_file(pgFile *file, pgFile *prev_file,
793793
}
794794

795795
/*
796-
* If nonedata file exists in previous backup
796+
* If non-data file exists in previous backup
797797
* and its mtime is less than parent backup start time ... */
798798
if ((pg_strcasecmp(file->name, RELMAPPER_FILENAME) != 0) &&
799799
(prev_file && file->exists_in_prev &&
@@ -1195,7 +1195,7 @@ restore_data_file_internal(FILE *in, FILE *out, pgFile *file, uint32 backup_vers
11951195
datapagemap_add(map, blknum);
11961196
}
11971197

1198-
elog(VERBOSE, "Copied file \"%s\": %lu bytes", from_fullpath, write_len);
1198+
elog(LOG, "Copied file \"%s\": %lu bytes", from_fullpath, write_len);
11991199
return write_len;
12001200
}
12011201

@@ -1218,7 +1218,7 @@ restore_non_data_file_internal(FILE *in, FILE *out, pgFile *file,
12181218

12191219
/* check for interrupt */
12201220
if (interrupted || thread_interrupted)
1221-
elog(ERROR, "Interrupted during nonedata file restore");
1221+
elog(ERROR, "Interrupted during non-data file restore");
12221222

12231223
read_len = fread(buf, 1, STDIO_BUFSIZE, in);
12241224

@@ -1239,7 +1239,7 @@ restore_non_data_file_internal(FILE *in, FILE *out, pgFile *file,
12391239

12401240
pg_free(buf);
12411241

1242-
elog(VERBOSE, "Copied file \"%s\": %lu bytes", from_fullpath, file->write_size);
1242+
elog(LOG, "Copied file \"%s\": %lu bytes", from_fullpath, file->write_size);
12431243
}
12441244

12451245
size_t
@@ -1284,7 +1284,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
12841284
*/
12851285
if (!tmp_file)
12861286
{
1287-
elog(ERROR, "Failed to locate nonedata file \"%s\" in backup %s",
1287+
elog(ERROR, "Failed to locate non-data file \"%s\" in backup %s",
12881288
dest_file->rel_path, base36enc(tmp_backup->start_time));
12891289
continue;
12901290
}
@@ -1309,14 +1309,14 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
13091309

13101310
/* sanity */
13111311
if (!tmp_backup)
1312-
elog(ERROR, "Failed to locate a backup containing full copy of nonedata file \"%s\"",
1312+
elog(ERROR, "Failed to locate a backup containing full copy of non-data file \"%s\"",
13131313
to_fullpath);
13141314

13151315
if (!tmp_file)
1316-
elog(ERROR, "Failed to locate a full copy of nonedata file \"%s\"", to_fullpath);
1316+
elog(ERROR, "Failed to locate a full copy of non-data file \"%s\"", to_fullpath);
13171317

13181318
if (tmp_file->write_size <= 0)
1319-
elog(ERROR, "Full copy of nonedata file has invalid size: %li. "
1319+
elog(ERROR, "Full copy of non-data file has invalid size: %li. "
13201320
"Metadata corruption in backup %s in file: \"%s\"",
13211321
tmp_file->write_size, base36enc(tmp_backup->start_time),
13221322
to_fullpath);
@@ -1329,7 +1329,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
13291329

13301330
if (file_crc == tmp_file->crc)
13311331
{
1332-
elog(VERBOSE, "Already existing nonedata file \"%s\" has the same checksum, skip restore",
1332+
elog(LOG, "Already existing non-data file \"%s\" has the same checksum, skip restore",
13331333
to_fullpath);
13341334
return 0;
13351335
}
@@ -1357,7 +1357,7 @@ restore_non_data_file(parray *parent_chain, pgBackup *dest_backup,
13571357
elog(ERROR, "Cannot open backup file \"%s\": %s", from_fullpath,
13581358
strerror(errno));
13591359

1360-
/* disable stdio buffering for nonedata files */
1360+
/* disable stdio buffering for non-data files */
13611361
setvbuf(in, NULL, _IONBF, BUFSIZ);
13621362

13631363
/* do actual work */
@@ -1681,7 +1681,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn,
16811681
int n_hdr = -1;
16821682
off_t cur_pos_in = 0;
16831683

1684-
elog(VERBOSE, "Validate relation blocks for file \"%s\"", fullpath);
1684+
elog(LOG, "Validate relation blocks for file \"%s\"", fullpath);
16851685

16861686
/* should not be possible */
16871687
Assert(!(backup_version >= 20400 && file->n_headers <= 0));
@@ -1740,7 +1740,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn,
17401740
elog(ERROR, "Cannot seek block %u of \"%s\": %s",
17411741
blknum, fullpath, strerror(errno));
17421742
else
1743-
elog(INFO, "Seek to %u", headers[n_hdr].pos);
1743+
elog(VERBOSE, "Seek to %u", headers[n_hdr].pos);
17441744

17451745
cur_pos_in = headers[n_hdr].pos;
17461746
}
@@ -1764,7 +1764,7 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn,
17641764
/* backward compatibility kludge TODO: remove in 3.0 */
17651765
if (compressed_size == PageIsTruncated)
17661766
{
1767-
elog(INFO, "Block %u of \"%s\" is truncated",
1767+
elog(VERBOSE, "Block %u of \"%s\" is truncated",
17681768
blknum, fullpath);
17691769
continue;
17701770
}
@@ -1835,10 +1835,10 @@ validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn,
18351835
switch (rc)
18361836
{
18371837
case PAGE_IS_NOT_FOUND:
1838-
elog(LOG, "File \"%s\", block %u, page is NULL", file->rel_path, blknum);
1838+
elog(VERBOSE, "File \"%s\", block %u, page is NULL", file->rel_path, blknum);
18391839
break;
18401840
case PAGE_IS_ZEROED:
1841-
elog(LOG, "File: %s blknum %u, empty zeroed page", file->rel_path, blknum);
1841+
elog(VERBOSE, "File: %s blknum %u, empty zeroed page", file->rel_path, blknum);
18421842
break;
18431843
case PAGE_HEADER_IS_INVALID:
18441844
elog(WARNING, "Page header is looking insane: %s, block %i", file->rel_path, blknum);

src/dir.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* dir.c: directory operation utility.
44
*
55
* Portions Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
6-
* Portions Copyright (c) 2015-2019, Postgres Professional
6+
* Portions Copyright (c) 2015-2022, Postgres Professional
77
*
88
*-------------------------------------------------------------------------
99
*/
@@ -1134,7 +1134,7 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
11341134

11351135
join_path_components(to_path, data_dir, dir->rel_path);
11361136

1137-
elog(VERBOSE, "Create directory \"%s\" and symbolic link \"%s\"",
1137+
elog(LOG, "Create directory \"%s\" and symbolic link \"%s\"",
11381138
linked_path, to_path);
11391139

11401140
/* create tablespace directory */
@@ -1151,7 +1151,7 @@ create_data_directories(parray *dest_files, const char *data_dir, const char *ba
11511151
}
11521152

11531153
/* This is not symlink, create directory */
1154-
elog(VERBOSE, "Create directory \"%s\"", dir->rel_path);
1154+
elog(LOG, "Create directory \"%s\"", dir->rel_path);
11551155

11561156
join_path_components(to_path, data_dir, dir->rel_path);
11571157

@@ -1889,7 +1889,7 @@ cleanup_tablespace(const char *path)
18891889
join_path_components(fullpath, path, file->rel_path);
18901890

18911891
fio_delete(file->mode, fullpath, FIO_DB_HOST);
1892-
elog(VERBOSE, "Deleted file \"%s\"", fullpath);
1892+
elog(LOG, "Deleted file \"%s\"", fullpath);
18931893
}
18941894

18951895
parray_walk(files, pgFileFree);

0 commit comments

Comments
 (0)