corrected index choosing bug in NibbleHandler

This commit is contained in:
frank-cizmich
2016-04-29 07:23:42 -03:00
parent fcb3191aec
commit 47cc4225d8
3 changed files with 43 additions and 18 deletions

View File

@@ -23,7 +23,7 @@ if ( !$dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
}
else {
plan tests => 15;
plan tests => 14;
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
@@ -83,14 +83,24 @@ ok(
# when --where is given but no explicit --chunk-index|column is given.
# Given the --where clause, MySQL will prefer the idx_fk_country_id index.
ok(
no_diff(
sub { pt_table_checksum::main(@args, "--where", "country_id > 100",
qw(-t sakila.city)) },
"$out/chunkidx004.txt",
),
"Auto-chosen --chunk-index for --where (issue 378)"
);
# UPDATE: I think the order of preference for the tool should be:
# (user chosen idx) > (mysql chosen idx IF it's unique) >
# (any unique idx) > (non unique idx with highest cardinality)
# Test below assumes tool should choose mysql chosen idx even if unique idx
# is available, so I'm commenting it out.
# TODO: A test that checks that tool prefers non unique mysql chosen idx
# from other non unique idx.
#ok(
# no_diff(
# sub { pt_table_checksum::main(@args, "--where", "country_id > 100",
# qw(-t sakila.city)) },
# "$out/chunkidx004.txt",
# keep_output => 1
# ),
# "Auto-chosen --chunk-index for --where (issue 378)"
#);
# If user specifies --chunk-index, then ignore the index MySQL wants to
# use (idx_fk_country_id in this case) and use the user's index.
@@ -245,7 +255,6 @@ cmp_ok(
"Initial key_len reflects --chunk-index-columns"
) or diag($output);
# #############################################################################
# Done.
# #############################################################################