@@ -825,25 +825,25 @@ usage(void)
825
825
printf (_ (" %s [OPTION]... [STARTSEG [ENDSEG]]\n" ), progname );
826
826
printf (_ ("\nOptions:\n" ));
827
827
printf (_ (" -b, --bkp-details output detailed information about backup blocks\n" ));
828
+ printf (_ (" -B, --block=N with --relation, only show records that modify block N\n" ));
828
829
printf (_ (" -e, --end=RECPTR stop reading at WAL location RECPTR\n" ));
829
830
printf (_ (" -f, --follow keep retrying after reaching end of WAL\n" ));
830
- printf (_ (" -k, --block=N with --relation, only show records matching this block\n" ));
831
- printf (_ (" -F, --fork=N only show records matching a specific fork number\n"
832
- " (defaults to showing all)\n" ));
833
- printf (_ (" -l, --relation=N/N/N only show records that affect a specific relation\n" ));
831
+ printf (_ (" -F, --fork=FORK only show records that modify blocks in fork FORK;\n"
832
+ " valid names are main, fsm, vm, init\n" ));
834
833
printf (_ (" -n, --limit=N number of records to display\n" ));
835
834
printf (_ (" -p, --path=PATH directory in which to find log segment files or a\n"
836
835
" directory with a ./pg_wal that contains such files\n"
837
836
" (default: current directory, ./pg_wal, $PGDATA/pg_wal)\n" ));
838
837
printf (_ (" -q, --quiet do not print any output, except for errors\n" ));
839
838
printf (_ (" -r, --rmgr=RMGR only show records generated by resource manager RMGR;\n"
840
839
" use --rmgr=list to list valid resource manager names\n" ));
840
+ printf (_ (" -R, --relation=T/D/R only show records that modify blocks in relation T/D/R\n" ));
841
841
printf (_ (" -s, --start=RECPTR start reading at WAL location RECPTR\n" ));
842
842
printf (_ (" -t, --timeline=TLI timeline from which to read log records\n"
843
843
" (default: 1 or the value used in STARTSEG)\n" ));
844
844
printf (_ (" -V, --version output version information, then exit\n" ));
845
- printf (_ (" -x, --xid=XID only show records with transaction ID XID\n" ));
846
845
printf (_ (" -w, --fullpage only show records with a full page write\n" ));
846
+ printf (_ (" -x, --xid=XID only show records with transaction ID XID\n" ));
847
847
printf (_ (" -z, --stats[=record] show statistics instead of records\n"
848
848
" (optionally, show per-record statistics)\n" ));
849
849
printf (_ (" -?, --help show this help, then exit\n" ));
@@ -867,7 +867,7 @@ main(int argc, char **argv)
867
867
868
868
static struct option long_options [] = {
869
869
{"bkp-details" , no_argument , NULL , 'b' },
870
- {"block" , required_argument , NULL , 'k ' },
870
+ {"block" , required_argument , NULL , 'B ' },
871
871
{"end" , required_argument , NULL , 'e' },
872
872
{"follow" , no_argument , NULL , 'f' },
873
873
{"fork" , required_argument , NULL , 'F' },
@@ -876,7 +876,7 @@ main(int argc, char **argv)
876
876
{"limit" , required_argument , NULL , 'n' },
877
877
{"path" , required_argument , NULL , 'p' },
878
878
{"quiet" , no_argument , NULL , 'q' },
879
- {"relation" , required_argument , NULL , 'l ' },
879
+ {"relation" , required_argument , NULL , 'R ' },
880
880
{"rmgr" , required_argument , NULL , 'r' },
881
881
{"start" , required_argument , NULL , 's' },
882
882
{"timeline" , required_argument , NULL , 't' },
@@ -946,14 +946,24 @@ main(int argc, char **argv)
946
946
goto bad_argument ;
947
947
}
948
948
949
- while ((option = getopt_long (argc , argv , "be: fF:k:l: n:p:qr:s:t:wx:z" ,
949
+ while ((option = getopt_long (argc , argv , "bB:e: fF:n:p:qr:R :s:t:wx:z" ,
950
950
long_options , & optindex )) != -1 )
951
951
{
952
952
switch (option )
953
953
{
954
954
case 'b' :
955
955
config .bkp_details = true;
956
956
break ;
957
+ case 'B' :
958
+ if (sscanf (optarg , "%u" , & config .filter_by_relation_block ) != 1 ||
959
+ !BlockNumberIsValid (config .filter_by_relation_block ))
960
+ {
961
+ pg_log_error ("could not parse valid block number \"%s\"" , optarg );
962
+ goto bad_argument ;
963
+ }
964
+ config .filter_by_relation_block_enabled = true;
965
+ config .filter_by_extended = true;
966
+ break ;
957
967
case 'e' :
958
968
if (sscanf (optarg , "%X/%X" , & xlogid , & xrecoff ) != 2 )
959
969
{
@@ -967,44 +977,12 @@ main(int argc, char **argv)
967
977
config .follow = true;
968
978
break ;
969
979
case 'F' :
980
+ config .filter_by_relation_forknum = forkname_to_number (optarg );
981
+ if (config .filter_by_relation_forknum == InvalidForkNumber )
970
982
{
971
- unsigned int forknum ;
972
-
973
- if (sscanf (optarg , "%u" , & forknum ) != 1 ||
974
- forknum > MAX_FORKNUM )
975
- {
976
- pg_log_error ("could not parse valid fork number (0..%d) \"%s\"" ,
977
- MAX_FORKNUM , optarg );
978
- goto bad_argument ;
979
- }
980
- config .filter_by_relation_forknum = (ForkNumber ) forknum ;
981
- config .filter_by_extended = true;
982
- }
983
- break ;
984
- case 'k' :
985
- if (sscanf (optarg , "%u" , & config .filter_by_relation_block ) != 1 ||
986
- !BlockNumberIsValid (config .filter_by_relation_block ))
987
- {
988
- pg_log_error ("could not parse valid block number \"%s\"" , optarg );
989
- goto bad_argument ;
990
- }
991
- config .filter_by_relation_block_enabled = true;
992
- config .filter_by_extended = true;
993
- break ;
994
- case 'l' :
995
- if (sscanf (optarg , "%u/%u/%u" ,
996
- & config .filter_by_relation .spcNode ,
997
- & config .filter_by_relation .dbNode ,
998
- & config .filter_by_relation .relNode ) != 3 ||
999
- !OidIsValid (config .filter_by_relation .spcNode ) ||
1000
- !OidIsValid (config .filter_by_relation .relNode ))
1001
- {
1002
- pg_log_error ("could not parse valid relation from \"%s\""
1003
- " (expecting \"tablespace OID/database OID/"
1004
- "relation filenode\")" , optarg );
983
+ pg_log_error ("could not parse fork \"%s\"" , optarg );
1005
984
goto bad_argument ;
1006
985
}
1007
- config .filter_by_relation_enabled = true;
1008
986
config .filter_by_extended = true;
1009
987
break ;
1010
988
case 'n' :
@@ -1047,6 +1025,22 @@ main(int argc, char **argv)
1047
1025
}
1048
1026
}
1049
1027
break ;
1028
+ case 'R' :
1029
+ if (sscanf (optarg , "%u/%u/%u" ,
1030
+ & config .filter_by_relation .spcNode ,
1031
+ & config .filter_by_relation .dbNode ,
1032
+ & config .filter_by_relation .relNode ) != 3 ||
1033
+ !OidIsValid (config .filter_by_relation .spcNode ) ||
1034
+ !OidIsValid (config .filter_by_relation .relNode ))
1035
+ {
1036
+ pg_log_error ("could not parse valid relation from \"%s\""
1037
+ " (expecting \"tablespace OID/database OID/"
1038
+ "relation filenode\")" , optarg );
1039
+ goto bad_argument ;
1040
+ }
1041
+ config .filter_by_relation_enabled = true;
1042
+ config .filter_by_extended = true;
1043
+ break ;
1050
1044
case 's' :
1051
1045
if (sscanf (optarg , "%X/%X" , & xlogid , & xrecoff ) != 2 )
1052
1046
{
0 commit comments