Merge lp:~percona-toolkit-dev/percona-toolkit/check-for-option-typos.

This commit is contained in:
Daniel Nichter
2012-02-16 11:57:17 -07:00
5 changed files with 24 additions and 7 deletions

View File

@@ -4085,7 +4085,7 @@ Print DROP KEY statement for each duplicate key. By default an ALTER TABLE
DROP KEY statement is printed below each duplicate key so that, if you want to DROP KEY statement is printed below each duplicate key so that, if you want to
remove the duplicate key, you can copy-paste the statement into MySQL. remove the duplicate key, you can copy-paste the statement into MySQL.
To disable printing these statements, specify --nosql. To disable printing these statements, specify C<--no-sql>.
=item --[no]summary =item --[no]summary

View File

@@ -3066,7 +3066,7 @@ L<"--base-dir">. These session files are played with L<"--play">.
pt-log-player will L<"--play"> session files in parallel using N number of pt-log-player will L<"--play"> session files in parallel using N number of
L<"--threads">. (They're not technically threads, but we call them that L<"--threads">. (They're not technically threads, but we call them that
anyway.) Each thread will play all the sessions in its given session files. anyway.) Each thread will play all the sessions in its given session files.
The sessions are played as fast as possible--there are no delays--because the The sessions are played as fast as possible (there are no delays) because the
goal is to stress-test and load-test the server. So be careful using this goal is to stress-test and load-test the server. So be careful using this
script on a production server! script on a production server!

View File

@@ -14530,7 +14530,7 @@ and see also L<"FINGERPRINTS">.
A report is printed for each L<"--group-by"> value (unless C<--no-report> is A report is printed for each L<"--group-by"> value (unless C<--no-report> is
given). Therefore, C<--group-by user,db> means "report on queries with the given). Therefore, C<--group-by user,db> means "report on queries with the
same user and report on queries with the same db"--it does not mean "report same user and report on queries with the same db"; it does not mean "report
on queries with the same user and db." See also L<"OUTPUT">. on queries with the same user and db." See also L<"OUTPUT">.
Every value must have a corresponding value in the same position in Every value must have a corresponding value in the same position in
@@ -15236,7 +15236,7 @@ The MySQL time expression is wrapped inside a query like
valid inside this query. For example, do not use UNIX_TIMESTAMP() because valid inside this query. For example, do not use UNIX_TIMESTAMP() because
UNIX_TIMESTAMP(UNIX_TIMESTAMP()) returns 0. UNIX_TIMESTAMP(UNIX_TIMESTAMP()) returns 0.
Events are assumed to be in chronological--older events at the beginning of Events are assumed to be in chronological: older events at the beginning of
the log and newer events at the end of the log. L<"--since"> is strict: it the log and newer events at the end of the log. L<"--since"> is strict: it
ignores all queries until one is found that is new enough. Therefore, if ignores all queries until one is found that is new enough. Therefore, if
the query events are not consistently timestamped, some may be ignored which the query events are not consistently timestamped, some may be ignored which

View File

@@ -1477,7 +1477,7 @@ L<"--variable"> column matches the L<"--match"> option. For example, to trigger
when more than 10 processes are in the "statistics" state, use the following when more than 10 processes are in the "statistics" state, use the following
options: options:
--trigger processlist --variable State \ --function processlist --variable State \
--match statistics --threshold 10 --match statistics --threshold 10
=back =back

View File

@@ -23,11 +23,12 @@ my $tool_type; # perl or bash
my @check_subs = (qw( my @check_subs = (qw(
check_alpha_order check_alpha_order
check_module_usage check_module_usage
check_option_types
check_pod_header_order check_pod_header_order
check_pod_formatting check_pod_formatting
check_option_usage
check_pod_links check_pod_links
check_option_usage
check_option_types
check_option_typos
)); ));
TOOL: TOOL:
@@ -471,6 +472,22 @@ sub check_option_usage {
return; return;
} }
sub check_option_typos {
my ($fh) = @_;
my %ops = map { $_=>1 } split /\n/, `awk '/^=item --/ {print \$2}' $tool_file`;
my $len = `wc -l $tool_file`;
my $doc = `grep '^=pod' -A $len`;
while ( $doc =~ m/(--[a-z]+[a-z-]+)/sg ) {
my $op = $1;
my $nop = $op;
$nop =~ s/^--no-/--[no]/;
if ( !$ops{$op} && !$ops{$nop} ) {
print "Unknown option in documentation: $op\n"
}
}
}
sub check_pod_links { sub check_pod_links {
my $offset = `cat $tool_file | grep '^=head1 NAME' --byte-offset | cut -d ':' -f 1`; my $offset = `cat $tool_file | grep '^=head1 NAME' --byte-offset | cut -d ':' -f 1`;
if ( !$offset ) { if ( !$offset ) {