@@ -40,6 +40,7 @@ typedef struct XLogDumpPrivate
40
40
typedef struct XLogDumpConfig
41
41
{
42
42
/* display options */
43
+ bool quiet ;
43
44
bool bkp_details ;
44
45
int stop_after_records ;
45
46
int already_displayed_records ;
@@ -720,6 +721,7 @@ usage(void)
720
721
printf (_ (" -p, --path=PATH directory in which to find log segment files or a\n"
721
722
" directory with a ./pg_wal that contains such files\n"
722
723
" (default: current directory, ./pg_wal, $PGDATA/pg_wal)\n" ));
724
+ printf (_ (" -q, --quiet do not print any output, except for errors\n" ));
723
725
printf (_ (" -r, --rmgr=RMGR only show records generated by resource manager RMGR;\n"
724
726
" use --rmgr=list to list valid resource manager names\n" ));
725
727
printf (_ (" -s, --start=RECPTR start reading at WAL location RECPTR\n" ));
@@ -755,6 +757,7 @@ main(int argc, char **argv)
755
757
{"help" , no_argument , NULL , '?' },
756
758
{"limit" , required_argument , NULL , 'n' },
757
759
{"path" , required_argument , NULL , 'p' },
760
+ {"quiet" , no_argument , NULL , 'q' },
758
761
{"rmgr" , required_argument , NULL , 'r' },
759
762
{"start" , required_argument , NULL , 's' },
760
763
{"timeline" , required_argument , NULL , 't' },
@@ -794,6 +797,7 @@ main(int argc, char **argv)
794
797
private .endptr = InvalidXLogRecPtr ;
795
798
private .endptr_reached = false;
796
799
800
+ config .quiet = false;
797
801
config .bkp_details = false;
798
802
config .stop_after_records = -1 ;
799
803
config .already_displayed_records = 0 ;
@@ -810,7 +814,7 @@ main(int argc, char **argv)
810
814
goto bad_argument ;
811
815
}
812
816
813
- while ((option = getopt_long (argc , argv , "be:fn:p:r :s:t:x:z" ,
817
+ while ((option = getopt_long (argc , argv , "be:fn:p:qr :s:t:x:z" ,
814
818
long_options , & optindex )) != -1 )
815
819
{
816
820
switch (option )
@@ -840,6 +844,9 @@ main(int argc, char **argv)
840
844
case 'p' :
841
845
waldir = pg_strdup (optarg );
842
846
break ;
847
+ case 'q' :
848
+ config .quiet = true;
849
+ break ;
843
850
case 'r' :
844
851
{
845
852
int i ;
@@ -1075,11 +1082,14 @@ main(int argc, char **argv)
1075
1082
config .filter_by_xid != record -> xl_xid )
1076
1083
continue ;
1077
1084
1078
- /* process the record */
1079
- if (config .stats == true)
1080
- XLogDumpCountRecord (& config , & stats , xlogreader_state );
1081
- else
1082
- XLogDumpDisplayRecord (& config , xlogreader_state );
1085
+ /* perform any per-record work */
1086
+ if (!config .quiet )
1087
+ {
1088
+ if (config .stats == true)
1089
+ XLogDumpCountRecord (& config , & stats , xlogreader_state );
1090
+ else
1091
+ XLogDumpDisplayRecord (& config , xlogreader_state );
1092
+ }
1083
1093
1084
1094
/* check whether we printed enough */
1085
1095
config .already_displayed_records ++ ;
0 commit comments