@@ -36,7 +36,7 @@ static int64 blocks = 0;
36
36
static int64 badblocks = 0 ;
37
37
static ControlFileData * ControlFile ;
38
38
39
- static char * only_relfilenode = NULL ;
39
+ static char * only_filenode = NULL ;
40
40
static bool do_sync = true;
41
41
static bool verbose = false;
42
42
static bool showprogress = false;
@@ -76,16 +76,16 @@ usage(void)
76
76
printf (_ ("Usage:\n" ));
77
77
printf (_ (" %s [OPTION]... [DATADIR]\n" ), progname );
78
78
printf (_ ("\nOptions:\n" ));
79
- printf (_ (" [-D, --pgdata=]DATADIR data directory\n" ));
80
- printf (_ (" -c, --check check data checksums (default)\n" ));
81
- printf (_ (" -d, --disable disable data checksums\n" ));
82
- printf (_ (" -e, --enable enable data checksums\n" ));
83
- printf (_ (" -N , --no-sync do not wait for changes to be written safely to disk \n" ));
84
- printf (_ (" -P , --progress show progress information \n" ));
85
- printf (_ (" -v , --verbose output verbose messages \n" ));
86
- printf (_ (" -r RELFILENODE check only relation with specified relfilenode \n" ));
87
- printf (_ (" -V, --version output version information, then exit\n" ));
88
- printf (_ (" -?, --help show this help, then exit\n" ));
79
+ printf (_ (" [-D, --pgdata=]DATADIR data directory\n" ));
80
+ printf (_ (" -c, --check check data checksums (default)\n" ));
81
+ printf (_ (" -d, --disable disable data checksums\n" ));
82
+ printf (_ (" -e, --enable enable data checksums\n" ));
83
+ printf (_ (" -f , --filenode=FILENODE check only relation with specified filenode \n" ));
84
+ printf (_ (" -N , --no-sync do not wait for changes to be written safely to disk \n" ));
85
+ printf (_ (" -P , --progress show progress information \n" ));
86
+ printf (_ (" -v, --verbose output verbose messages \n" ));
87
+ printf (_ (" -V, --version output version information, then exit\n" ));
88
+ printf (_ (" -?, --help show this help, then exit\n" ));
89
89
printf (_ ("\nIf no data directory (DATADIR) is specified, "
90
90
"the environment variable PGDATA\nis used.\n\n" ));
91
91
printf (_ ("Report bugs to <pgsql-bugs@lists.postgresql.org>.\n" ));
@@ -318,7 +318,7 @@ scan_directory(const char *basedir, const char *subdir, bool sizeonly)
318
318
/*
319
319
* Cut off at the segment boundary (".") to get the segment number
320
320
* in order to mix it into the checksum. Then also cut off at the
321
- * fork boundary, to get the relfilenode the file belongs to for
321
+ * fork boundary, to get the filenode the file belongs to for
322
322
* filtering.
323
323
*/
324
324
strlcpy (fnonly , de -> d_name , sizeof (fnonly ));
@@ -339,8 +339,8 @@ scan_directory(const char *basedir, const char *subdir, bool sizeonly)
339
339
if (forkpath != NULL )
340
340
* forkpath ++ = '\0' ;
341
341
342
- if (only_relfilenode && strcmp (only_relfilenode , fnonly ) != 0 )
343
- /* Relfilenode not to be included */
342
+ if (only_filenode && strcmp (only_filenode , fnonly ) != 0 )
343
+ /* filenode not to be included */
344
344
continue ;
345
345
346
346
dirsize += st .st_size ;
@@ -371,6 +371,7 @@ main(int argc, char *argv[])
371
371
{"pgdata" , required_argument , NULL , 'D' },
372
372
{"disable" , no_argument , NULL , 'd' },
373
373
{"enable" , no_argument , NULL , 'e' },
374
+ {"filenode" , required_argument , NULL , 'f' },
374
375
{"no-sync" , no_argument , NULL , 'N' },
375
376
{"progress" , no_argument , NULL , 'P' },
376
377
{"verbose" , no_argument , NULL , 'v' },
@@ -400,7 +401,7 @@ main(int argc, char *argv[])
400
401
}
401
402
}
402
403
403
- while ((c = getopt_long (argc , argv , "cD:deNPr :v" , long_options , & option_index )) != -1 )
404
+ while ((c = getopt_long (argc , argv , "cD:deNPf :v" , long_options , & option_index )) != -1 )
404
405
{
405
406
switch (c )
406
407
{
@@ -413,6 +414,14 @@ main(int argc, char *argv[])
413
414
case 'e' :
414
415
mode = PG_MODE_ENABLE ;
415
416
break ;
417
+ case 'f' :
418
+ if (atoi (optarg ) == 0 )
419
+ {
420
+ pg_log_error ("invalid filenode specification, must be numeric: %s" , optarg );
421
+ exit (1 );
422
+ }
423
+ only_filenode = pstrdup (optarg );
424
+ break ;
416
425
case 'N' :
417
426
do_sync = false;
418
427
break ;
@@ -422,14 +431,6 @@ main(int argc, char *argv[])
422
431
case 'D' :
423
432
DataDir = optarg ;
424
433
break ;
425
- case 'r' :
426
- if (atoi (optarg ) == 0 )
427
- {
428
- pg_log_error ("invalid relfilenode specification, must be numeric: %s" , optarg );
429
- exit (1 );
430
- }
431
- only_relfilenode = pstrdup (optarg );
432
- break ;
433
434
case 'P' :
434
435
showprogress = true;
435
436
break ;
@@ -465,10 +466,10 @@ main(int argc, char *argv[])
465
466
exit (1 );
466
467
}
467
468
468
- /* Relfilenode checking only works in --check mode */
469
- if (mode != PG_MODE_CHECK && only_relfilenode )
469
+ /* filenode checking only works in --check mode */
470
+ if (mode != PG_MODE_CHECK && only_filenode )
470
471
{
471
- pg_log_error ("relfilenode option only possible with --check" );
472
+ pg_log_error ("--filenode option only possible with --check" );
472
473
fprintf (stderr , _ ("Try \"%s --help\" for more information.\n" ),
473
474
progname );
474
475
exit (1 );
0 commit comments