mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 05:00:45 +00:00
Add check_pod_links to check-tool and fix tools that have POD links in literal blocks.
This commit is contained in:
@@ -7281,12 +7281,12 @@ The three basic algorithms in descending order of preference are CHECKSUM,
|
||||
BIT_XOR and ACCUM. CHECKSUM cannot be used if any one of these criteria
|
||||
is true:
|
||||
|
||||
* L<"--where"> is used.
|
||||
* L<"--since"> is used.
|
||||
* L<"--chunk-size"> is used.
|
||||
* L<"--replicate"> is used.
|
||||
* L<"--count"> is used.
|
||||
* MySQL version less than 4.1.1.
|
||||
* --where is used
|
||||
* --since is used
|
||||
* --chunk-size is used
|
||||
* --replicate is used
|
||||
* --count is used
|
||||
* MySQL version less than 4.1.1
|
||||
|
||||
The BIT_XOR algorithm also requires MySQL version 4.1.1 or later.
|
||||
|
||||
|
@@ -9196,11 +9196,11 @@ sanity checks to be performed. You must specify other options that tell
|
||||
pt-table-sync how to resolve conflicts for same but differing rows.
|
||||
These options are:
|
||||
|
||||
* L<"--conflict-column">
|
||||
* L<"--conflict-comparison">
|
||||
* L<"--conflict-value">
|
||||
* L<"--conflict-threshold">
|
||||
* L<"--conflict-error"> (optional)
|
||||
* --conflict-column
|
||||
* --conflict-comparison
|
||||
* --conflict-value
|
||||
* --conflict-threshold
|
||||
* --conflict-error"> (optional)
|
||||
|
||||
Use L<"--print"> to test this option before L<"--execute">. The printed
|
||||
SQL statements will have comments saying on which host the statement
|
||||
@@ -9411,13 +9411,13 @@ rows are compared. Possible comparisons are one of these MAGIC_comparisons:
|
||||
|
||||
COMPARISON CHOOSES ROW WITH
|
||||
========== =========================================================
|
||||
newest Newest temporal L<"--conflict-column"> value
|
||||
oldest Oldest temporal L<"--conflict-column"> value
|
||||
greatest Greatest numerical L<"--conflict-column"> value
|
||||
least Least numerical L<"--conflict-column"> value
|
||||
equals L<"--conflict-column"> value equal to L<"--conflict-value">
|
||||
matches L<"--conflict-column"> value matching Perl regex pattern
|
||||
L<"--conflict-value">
|
||||
newest Newest temporal --conflict-column value
|
||||
oldest Oldest temporal --conflict-column value
|
||||
greatest Greatest numerical "--conflict-column value
|
||||
least Least numerical --conflict-column value
|
||||
equals --conflict-column value equal to --conflict-value
|
||||
matches --conflict-column value matching Perl regex pattern
|
||||
--conflict-value
|
||||
|
||||
This option only works with L<"--bidirectional">.
|
||||
See L<"BIDIRECTIONAL SYNCING"> for more information.
|
||||
|
@@ -2871,10 +2871,10 @@ Set output format.
|
||||
|
||||
The default is a terse pretty-printed tree. The valid values are:
|
||||
|
||||
value meaning
|
||||
===== =======
|
||||
Value Meaning
|
||||
===== ================================================
|
||||
tree Pretty-printed terse tree.
|
||||
dump Data::Dumper output (see L<Data::Dumper> for more).
|
||||
dump Data::Dumper output (see Data::Dumper for more).
|
||||
|
||||
=item --help
|
||||
|
||||
|
@@ -27,6 +27,7 @@ my @check_subs = (qw(
|
||||
check_pod_header_order
|
||||
check_pod_formatting
|
||||
check_option_usage
|
||||
check_pod_links
|
||||
));
|
||||
|
||||
TOOL:
|
||||
@@ -40,8 +41,13 @@ while ( defined($tool_file = shift @ARGV) ) {
|
||||
warn "Cannot open $tool_file: $OS_ERROR";
|
||||
next TOOL;
|
||||
}
|
||||
|
||||
($tool_name) = $tool_file =~ m{/([a-z-]+)$};
|
||||
|
||||
# This make `bin/$ ../util/check-tool *' if . isn't in PATH.
|
||||
if ( $tool_file !~ m{/} ) {
|
||||
$tool_file = "./$tool_file";
|
||||
}
|
||||
|
||||
($tool_name) = $tool_file =~ m/([a-z-]+)$/;
|
||||
if ( !$tool_name ) {
|
||||
$exit_status = 1;
|
||||
warn "Cannot parse tool name from $tool_file";
|
||||
@@ -55,6 +61,7 @@ while ( defined($tool_file = shift @ARGV) ) {
|
||||
$tool_type = 'perl';
|
||||
}
|
||||
|
||||
print '# ', ('#' x (70 - length $tool_name)), " $tool_name\n";
|
||||
foreach my $check_sub ( @check_subs ) {
|
||||
seek $fh, 0, 0;
|
||||
print "# $check_sub ", ('#' x (70 - length $check_sub)), "\n";
|
||||
@@ -67,6 +74,7 @@ while ( defined($tool_file = shift @ARGV) ) {
|
||||
warn "Error while checking $tool_name: $EVAL_ERROR";
|
||||
}
|
||||
}
|
||||
print "\n\n";
|
||||
}
|
||||
|
||||
exit $exit_status;
|
||||
@@ -466,3 +474,24 @@ sub check_option_usage {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub check_pod_links {
|
||||
my $offset = `cat $tool_file | grep '^=head1 NAME' --byte-offset | cut -d ':' -f 1`;
|
||||
if ( !$offset ) {
|
||||
warn "Cannot find '^=head1 NAME' in $tool_file";
|
||||
return;
|
||||
}
|
||||
chomp $offset;
|
||||
my $pod = `tail -c +$offset $tool_file`;
|
||||
if ( !$pod ) {
|
||||
warn "Failed to parse POD from $tool_file";
|
||||
return;
|
||||
}
|
||||
my @links_in_lit = $pod =~ m/^([ ]+.*L<.+)$/mg;
|
||||
if ( @links_in_lit ) {
|
||||
print "$tool_name has POD links in literal blocks:\n";
|
||||
foreach my $line ( @links_in_lit ) {
|
||||
print "$line\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user