Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e1950a

Browse files
authored
[PBCKP-129] change catchup logging levels (#473)
* [PBCKP-129] change catchup logging level verbosity:INFO – common informationLOG – same as INFO + info about filesVERBOSE – same as LOG + info about block and SQL queries
1 parenta2811ef commit2e1950a

File tree

8 files changed

+93
-96
lines changed

8 files changed

+93
-96
lines changed

‎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
intexit_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
charpretty_time[20];
117117
charpretty_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: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* catchup.c: sync DB cluster
44
*
5-
* Copyright (c) 2022, Postgres Professional
5+
* Copyright (c)2021-2022, Postgres Professional
66
*
77
*-------------------------------------------------------------------------
88
*/
@@ -203,7 +203,7 @@ catchup_preflight_checks(PGNodeInfo *source_node_info, PGconn *source_conn,
203203

204204
/* fill dest_redo.lsn and dest_redo.tli */
205205
get_redo(dest_pgdata,FIO_LOCAL_HOST,&dest_redo);
206-
elog(VERBOSE,"source.tli = %X, dest_redo.lsn = %X/%X, dest_redo.tli = %X",
206+
elog(LOG,"source.tli = %X, dest_redo.lsn = %X/%X, dest_redo.tli = %X",
207207
current.tli, (uint32) (dest_redo.lsn >>32), (uint32)dest_redo.lsn,dest_redo.tli);
208208

209209
if (current.tli!=1)
@@ -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);
@@ -447,12 +446,12 @@ catchup_thread_runner(void *arg)
447446

448447
if (file->write_size==BYTES_INVALID)
449448
{
450-
elog(VERBOSE,"Skipping the unchanged file: \"%s\", read %li bytes",from_fullpath,file->read_size);
449+
elog(LOG,"Skipping the unchanged file: \"%s\", read %li bytes",from_fullpath,file->read_size);
451450
continue;
452451
}
453452

454453
arguments->transfered_bytes+=file->write_size;
455-
elog(VERBOSE,"File \"%s\". Copied "INT64_FORMAT" bytes",
454+
elog(LOG,"File \"%s\". Copied "INT64_FORMAT" bytes",
456455
from_fullpath,file->write_size);
457456
}
458457

@@ -607,7 +606,7 @@ filter_filelist(parray *filelist, const char *pgdata,
607606
&&parray_bsearch(exclude_relative_paths_list,file->rel_path,pgPrefixCompareString)!=NULL)
608607
)
609608
{
610-
elog(LOG,"%s file \"%s\" excluded with --exclude-path option",logging_string,full_path);
609+
elog(INFO,"%s file \"%s\" excluded with --exclude-path option",logging_string,full_path);
611610
file->excluded= true;
612611
}
613612
}
@@ -650,7 +649,7 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
650649
if (exclude_relative_paths_list!=NULL)
651650
parray_qsort(exclude_relative_paths_list,pgCompareString);
652651

653-
elog(LOG,"Database catchup start");
652+
elog(INFO,"Database catchup start");
654653

655654
if (current.backup_mode!=BACKUP_MODE_FULL)
656655
{
@@ -697,7 +696,7 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
697696

698697
/* Call pg_start_backup function in PostgreSQL connect */
699698
pg_start_backup(label,smooth_checkpoint,&current,&source_node_info,source_conn);
700-
elog(LOG,"pg_start_backup START LSN %X/%X", (uint32) (current.start_lsn >>32), (uint32) (current.start_lsn));
699+
elog(INFO,"pg_start_backup START LSN %X/%X", (uint32) (current.start_lsn >>32), (uint32) (current.start_lsn));
701700
}
702701

703702
/* Sanity: source cluster must be "in future" relatively to dest cluster */
@@ -772,11 +771,11 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
772771
elog(INFO,"Source PGDATA size: %s (excluded %s)",pretty_source_bytes,pretty_bytes);
773772
}
774773

775-
elog(LOG,"Start LSN (source): %X/%X, TLI: %X",
774+
elog(INFO,"Start LSN (source): %X/%X, TLI: %X",
776775
(uint32) (current.start_lsn >>32), (uint32) (current.start_lsn),
777776
current.tli);
778777
if (current.backup_mode!=BACKUP_MODE_FULL)
779-
elog(LOG,"LSN in destination: %X/%X, TLI: %X",
778+
elog(INFO,"LSN in destination: %X/%X, TLI: %X",
780779
(uint32) (dest_redo.lsn >>32), (uint32) (dest_redo.lsn),
781780
dest_redo.tli);
782781

@@ -829,7 +828,8 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
829828
chardirpath[MAXPGPATH];
830829

831830
join_path_components(dirpath,dest_pgdata,file->rel_path);
832-
elog(VERBOSE,"Create directory '%s'",dirpath);
831+
832+
elog(LOG,"Create directory '%s'",dirpath);
833833
if (!dry_run)
834834
fio_mkdir(dirpath,DIR_PERMISSION,FIO_LOCAL_HOST);
835835
}
@@ -859,7 +859,7 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
859859

860860
join_path_components(to_path,dest_pgdata,file->rel_path);
861861

862-
elog(VERBOSE,"Create directory \"%s\" and symbolic link \"%s\"",
862+
elog(INFO,"Create directory \"%s\" and symbolic link \"%s\"",
863863
linked_path,to_path);
864864

865865
if (!dry_run)
@@ -946,7 +946,7 @@ do_catchup(const char *source_pgdata, const char *dest_pgdata, int num_threads,
946946
{
947947
fio_delete(file->mode,fullpath,FIO_LOCAL_HOST);
948948
}
949-
elog(VERBOSE,"Deleted file \"%s\"",fullpath);
949+
elog(LOG,"Deleted file \"%s\"",fullpath);
950950

951951
/* shrink dest pgdata list */
952952
pgFileFree(file);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp