pt-table-checksum --chunk-index better use case insensitive comparison
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
An index that is specified with --chunk-index is ignored.
pt-table-checksum --no-check-
Some relevant PTDEBUG output:
# NibbleIterator:6444 7459 User wants to use index metric8f6073210
# NibbleIterator:6446 7459 Cannot use user index because it does not exist
# NibbleIterator:6469 7459 Auto-selecting best index
# TableParser:4399 7459 Indexes sorted best-first: metric42294eae0
As you can see pt-tc rejects index metric8f6073210
$ pt-table-checksum --version
pt-table-checksum 2.2.5
MySQL version on the master and a slave - 5.5.33-31.1-log.
12-09T09:13:08 Skipping chunk 1 of <db>.<table> because it is oversized. The current chunk size limit is 2000 rows (chunk size=1000 * chunk size limit=2.0), but MySQL estimates that there are 69172 rows in the chunk.
12-09T09:13:08 Error checksumming table <db>.<table>: Possible infinite loop detected! The lower boundary for chunk 1 is <1, 1> and the lower boundary for chunk 2 is also <1, 1>. This usually happens when using a non-unique single column index. The current chunk index for table <db>.<table> is metric42294eae0
I have verified that the error was due to case sensitive comparison on the index name. When specify --chunk-index with index name that is of the same case as defined in the database, the tool does use it. Same behavior in 2.2.5 and latest 2.2.11. Since index name is not case sensitive on any platform, I think pt-table-checksum should use case-insensitive comparison to check index name.
Below is the detail of the test: ------- ------- ------- ------- ------- ------- e93c043fb083b10 49e4fcbed9d7_ idx (col1), 07640471f0856e0 99e06401589f_ idx (col3), 2034046720ab810 22c12e7c6cbf_ idx (col2)
-------
create table ptc_i_test
(col1 int,
col2 varchar(10),
col3 int,
key metric42294eae0
key metric8a56a17b0
key metric8f6073210
) engine = innodb;
PTDEBUG=1 ./pt-table-checksum --no-check- binlog- format --chunk-index metric8f6073210 2034046720ab810 22c12e7c6cbf_ idx --tables test.ptc_i_test --recursion-method dsn=D=percona, t=dsns h=127.0. 0.1,P=13000, u=msandbox, p=msandbox >ptc.out 2>ptc.err
# NibbleIterator:6444 28172 User wants to use index metric8f6073210 2034046720ab810 22c12e7c6cbf_ idx 02034046720ab81 022c12e7c6cbf_ idx' 2034046720ab810 22c12e7c6cbf_ idx cardinality: 4 2034046720ab810 22c12e7c6cbf_ idx
# NibbleIterator:6464 28172 Wanted index is a possible index
# NibbleIterator:6482 28172 No PRIMARY or unique indexes; will use index with highest cardinality
# NibbleIterator:6513 28172 SHOW INDEXES FROM `test`.`ptc_i_test` WHERE Key_name = 'metric8f607321
# NibbleIterator:6523 28172 Index metric8f6073210
# NibbleIterator:6502 28172 Best index: metric8f6073210