Change --chunk-size to type size. Make TIME column %.3f. Make OptionParser report invalid sizes.

This commit is contained in:
Daniel Nichter
2011-09-14 10:40:42 -06:00
parent 676a7aa20f
commit d881fa0b35
3 changed files with 6 additions and 6 deletions

View File

@@ -5229,7 +5229,7 @@ sub exec_nibble {
{
my $print_header = 1;
my $line_fmt = "%6s %6s %7s %7s %7s %6s %-s\n";
my $line_fmt = "%6s %6s %7s %7s %7s %7s %-s\n";
sub print_checksum_results {
my (%args) = @_;
@@ -5251,7 +5251,7 @@ sub print_checksum_results {
$res->{n_rows} || 0,
$res->{n_chunks} || 0,
$res->{skipped} || 0,
int(time - ($res->{start_time} || 0)),
sprintf('%.3f', time - ($res->{start_time} || 0)),
"$tbl->{db}.$tbl->{tbl}";
return;
@@ -5928,7 +5928,7 @@ checksumming only a single table, not an entire server.
=item --chunk-size
type: string; default: 1000
type: size; default: 1000
Approximate number of rows or size of data to checksum at a time. Allowable
suffixes are k, M, G.

View File

@@ -1263,7 +1263,7 @@ sub _parse_size {
$opt->{value} = ($pre || '') . $num;
}
else {
$self->save_error("Invalid size for --$opt->{long}");
$self->save_error("Invalid size for --$opt->{long}: $val");
}
return;
}

View File

@@ -1138,7 +1138,7 @@ is_deeply(
$o->get_opts();
is_deeply(
$o->errors(),
['Invalid size for --size'],
['Invalid size for --size: 5z'],
'Bad size argument sets an error',
);
@@ -1958,7 +1958,7 @@ $o = new OptionParser(
description => 'OptionParser.t parses command line options.',
usage => "$PROGRAM_NAME <options>"
);
$o->get_specs("$trunk/bin/pt-table-checksum");
$o->get_specs("$trunk/bin/pt-fifo-split");
@ARGV = ();
$o->get_opts();
is(