mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
Compare lc(index) everywhere.
This commit is contained in:
@@ -3778,7 +3778,7 @@ sub set_nibble_number {
|
|||||||
|
|
||||||
sub nibble_index {
|
sub nibble_index {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
return $self->{index};
|
return lc($self->{index});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub statements {
|
sub statements {
|
||||||
@@ -6399,12 +6399,19 @@ sub main {
|
|||||||
sth => $sth->{explain_upper_boundary},
|
sth => $sth->{explain_upper_boundary},
|
||||||
vals => [ @{$boundary->{lower}}, $nibble_iter->chunk_size() ],
|
vals => [ @{$boundary->{lower}}, $nibble_iter->chunk_size() ],
|
||||||
);
|
);
|
||||||
if ( ($expl->{key} || '') ne $nibble_iter->nibble_index() ) {
|
if ( lc($expl->{key} || '') ne $nibble_iter->nibble_index() ) {
|
||||||
PTDEBUG && _d('Cannot nibble next chunk, aborting table');
|
PTDEBUG && _d('Cannot nibble next chunk, aborting table');
|
||||||
if ( $o->get('quiet') < 2 ) {
|
if ( $o->get('quiet') < 2 ) {
|
||||||
warn ts("Aborting $tbl->{db}.$tbl->{tbl} because "
|
my $msg
|
||||||
|
= "Aborting table $tbl->{db}.$tbl->{tbl} at chunk "
|
||||||
. ($nibble_iter->nibble_number() + 1)
|
. ($nibble_iter->nibble_number() + 1)
|
||||||
. " cannot be nibbled safely.\n");
|
. " because it is not safe to chunk. Chunking should "
|
||||||
|
. "use the "
|
||||||
|
. ($nibble_iter->nibble_index() || '?')
|
||||||
|
. " index, but MySQL EXPLAIN reports that "
|
||||||
|
. ($expl->{key} ? "the $expl->{key}" : "no")
|
||||||
|
. " index will be used.\n";
|
||||||
|
warn ts($msg);
|
||||||
}
|
}
|
||||||
$tbl->{checksum_results}->{errors}++;
|
$tbl->{checksum_results}->{errors}++;
|
||||||
return 0; # stop nibbling table
|
return 0; # stop nibbling table
|
||||||
@@ -6460,7 +6467,7 @@ sub main {
|
|||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
# Ensure that MySQL is using the chunk index.
|
# Ensure that MySQL is using the chunk index.
|
||||||
if ( ($expl->{key} || '') ne $nibble_iter->nibble_index() ) {
|
if ( lc($expl->{key} || '') ne $nibble_iter->nibble_index() ) {
|
||||||
PTDEBUG && _d('Chunk', $args{nibbleno}, 'of table',
|
PTDEBUG && _d('Chunk', $args{nibbleno}, 'of table',
|
||||||
"$tbl->{db}.$tbl->{tbl} not using chunk index, skipping");
|
"$tbl->{db}.$tbl->{tbl} not using chunk index, skipping");
|
||||||
return 0; # next boundary
|
return 0; # next boundary
|
||||||
@@ -7260,15 +7267,13 @@ sub have_more_chunks {
|
|||||||
# The previous chunk index must match the current chunk index,
|
# The previous chunk index must match the current chunk index,
|
||||||
# else we don't know what to do.
|
# else we don't know what to do.
|
||||||
my $chunk_index = $nibble_iter->nibble_index() || '';
|
my $chunk_index = $nibble_iter->nibble_index() || '';
|
||||||
if ( ($last_chunk->{chunk_index} || '')
|
if (lc($last_chunk->{chunk_index} || '') ne $chunk_index) {
|
||||||
ne ($nibble_iter->nibble_index() || '') ) {
|
|
||||||
warn ts("Cannot resume from table $tbl->{db}.$tbl->{tbl} chunk "
|
warn ts("Cannot resume from table $tbl->{db}.$tbl->{tbl} chunk "
|
||||||
. "$last_chunk->{chunk} because the chunk indexes are different: "
|
. "$last_chunk->{chunk} because the chunk indexes are different: "
|
||||||
. ($last_chunk->{chunk_index} ? $last_chunk->{chunk_index}
|
. ($last_chunk->{chunk_index} ? $last_chunk->{chunk_index}
|
||||||
: "no index")
|
: "no index")
|
||||||
. " was used originally but "
|
. " was used originally but "
|
||||||
. ($nibble_iter->nibble_index() ? $nibble_iter->nibble_index()
|
. ($chunk_index ? $chunk_index : "no index")
|
||||||
: "no index")
|
|
||||||
. " is used now. If the table has not changed significantly, "
|
. " is used now. If the table has not changed significantly, "
|
||||||
. "this may be caused by running the tool with different command "
|
. "this may be caused by running the tool with different command "
|
||||||
. "line options. This table will be skipped and checksumming "
|
. "line options. This table will be skipped and checksumming "
|
||||||
|
@@ -347,7 +347,7 @@ sub set_nibble_number {
|
|||||||
|
|
||||||
sub nibble_index {
|
sub nibble_index {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
return $self->{index};
|
return lc($self->{index});
|
||||||
}
|
}
|
||||||
|
|
||||||
sub statements {
|
sub statements {
|
||||||
|
@@ -25,7 +25,7 @@ if ( !$dbh ) {
|
|||||||
plan skip_all => 'Cannot connect to sandbox master';
|
plan skip_all => 'Cannot connect to sandbox master';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plan tests => 6;
|
plan tests => 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||||
@@ -104,6 +104,43 @@ ok(
|
|||||||
"Explicit --chunk-index overrides MySQL's index for --where"
|
"Explicit --chunk-index overrides MySQL's index for --where"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# Bug 925855: pt-table-checksum index check is case-sensitive
|
||||||
|
# #############################################################################
|
||||||
|
$sb->load_file('master', "t/pt-table-checksum/samples/all-uc-table.sql");
|
||||||
|
my $exit_status = 0;
|
||||||
|
$output = output(sub {
|
||||||
|
$exit_status = pt_table_checksum::main(
|
||||||
|
$master_dsn, '--max-load', '',
|
||||||
|
qw(--lock-wait-timeout 3 --chunk-size 5 -t ALL_UC.T)
|
||||||
|
) },
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
$exit_status,
|
||||||
|
0,
|
||||||
|
"Zero exit status (bug 925855)"
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
PerconaTest::count_checksum_results($output, 'skipped'),
|
||||||
|
0,
|
||||||
|
"0 skipped (bug 925855)"
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
PerconaTest::count_checksum_results($output, 'errors'),
|
||||||
|
0,
|
||||||
|
"0 errors (bug 925855)"
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
PerconaTest::count_checksum_results($output, 'rows'),
|
||||||
|
13,
|
||||||
|
"14 rows checksummed (bug 925855)"
|
||||||
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
22
t/pt-table-checksum/samples/all-uc-table.sql
Normal file
22
t/pt-table-checksum/samples/all-uc-table.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
DROP DATABASE IF EXISTS ALL_UC;
|
||||||
|
CREATE DATABASE ALL_UC;
|
||||||
|
USE ALL_UC;
|
||||||
|
CREATE TABLE T (
|
||||||
|
ID INT NOT NULL,
|
||||||
|
C VARCHAR(8) NOT NULL,
|
||||||
|
UNIQUE INDEX (ID)
|
||||||
|
) ENGINE=INNODB;
|
||||||
|
INSERT INTO T VALUES
|
||||||
|
(1, 'AAA'),
|
||||||
|
(2, 'BBB'),
|
||||||
|
(3, 'CCC'),
|
||||||
|
(4, 'DDD'),
|
||||||
|
(5, 'EEE'),
|
||||||
|
(6, 'FFF'),
|
||||||
|
(7, 'GGG'),
|
||||||
|
(8, 'HHH'),
|
||||||
|
(9, 'III'),
|
||||||
|
(10,'JJJ'),
|
||||||
|
(11,'KKK'),
|
||||||
|
(12,'LLL'),
|
||||||
|
(13,'MMM');
|
@@ -1,10 +1,10 @@
|
|||||||
Differences on h=127.0.0.1,P=12346
|
Differences on h=127.0.0.1,P=12346
|
||||||
TABLE CHUNK CNT_DIFF CRC_DIFF CHUNK_INDEX LOWER_BOUNDARY UPPER_BOUNDARY
|
TABLE CHUNK CNT_DIFF CRC_DIFF CHUNK_INDEX LOWER_BOUNDARY UPPER_BOUNDARY
|
||||||
sakila.city 1 0 1 PRIMARY 1 100
|
sakila.city 1 0 1 primary 1 100
|
||||||
sakila.city 6 0 1 PRIMARY 501 600
|
sakila.city 6 0 1 primary 501 600
|
||||||
|
|
||||||
Differences on h=127.0.0.1,P=12347
|
Differences on h=127.0.0.1,P=12347
|
||||||
TABLE CHUNK CNT_DIFF CRC_DIFF CHUNK_INDEX LOWER_BOUNDARY UPPER_BOUNDARY
|
TABLE CHUNK CNT_DIFF CRC_DIFF CHUNK_INDEX LOWER_BOUNDARY UPPER_BOUNDARY
|
||||||
sakila.city 1 0 1 PRIMARY 1 100
|
sakila.city 1 0 1 primary 1 100
|
||||||
sakila.city 6 0 1 PRIMARY 501 600
|
sakila.city 6 0 1 primary 501 600
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user