Merge ~percona-toolkit-dev/percona-toolkit/explain-checksum-chunks.

This commit is contained in:
Daniel Nichter
2012-06-10 13:25:44 -04:00
8 changed files with 582 additions and 193 deletions

View File

@@ -25,7 +25,7 @@ if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
}
else {
plan tests => 12;
plan tests => 14;
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
@@ -156,6 +156,50 @@ ok(
"Smarter chunk index selection (bug 978432)"
);
# #############################################################################
# PK but bad explain plan.
# https://bugs.launchpad.net/percona-toolkit/+bug/1010232
# #############################################################################
$sb->load_file('master', "t/pt-table-checksum/samples/bad-plan-bug-1010232.sql");
PerconaTest::wait_for_table($dbh, "bad_plan.t", "(c1,c2,c3,c4)=(1,1,2,100)");
$output = output(sub {
$exit_status = pt_table_checksum::main(
$master_dsn, '--max-load', '',
qw(--lock-wait-timeout 3 --chunk-size 10 -t bad_plan.t)
) },
stderr => 1,
);
is(
$exit_status,
0,
"Bad key_len chunks are not errors"
);
cmp_ok(
PerconaTest::count_checksum_results($output, 'skipped'),
'>',
1,
"Skipped bad key_len chunks"
);
# Use --chunk-index:3 to use only the first 3 left-most columns of the index.
# Can't use bad_plan.t, however, because its row are almost all identical,
# so using 3 of 4 pk cols creates an infinite loop.
ok(
no_diff(
sub {
pt_table_checksum::main(
$master_dsn, '--max-load', '',
qw(--lock-wait-timeout 3 --chunk-size 5000 -t sakila.rental),
qw(--chunk-index rental_date:2 --explain --explain));
},
"t/pt-table-checksum/samples/n-chunk-index-cols.txt",
),
"--chunk-index index:n"
);
# #############################################################################
# Done.
# #############################################################################