pt-table-checksum index check is case-sensitive

Bug #925855 reported by Zach Carlson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Fix Released
Medium
Daniel Nichter

Bug Description

When using pt-table-checksum to verify replication between a master and slave, I found that there were certain tables that were not being checksummed with the following message:

Aborting <table> because <index> cannot be nibbled safely.

Curiously, this table did have a UNIQUE index (in fact, the one in use here), but it was still being skipped. I output a trace and ran pt-table-checksum again to see which index was failing, and it turned out to have been the right one:

Aborting <table> because <index> cannot be nibbled safely.ID ne id

So it seems that when an EXPLAIN is run on a query, it grabs the index in whatever case it's in, but at some point during the initialization/execution of the nibble iterator, the index is lowercased. Then, when verifying the next nibble, the string comparison done is case-sensitive, so "ID" does not match "id" even though (a) it's the same index and (b) MySQL indexes are case-insensitive anyway.

There was another point later on that would verify the right index was used that had the same issue; I patched that as well.

The enclosed patch fixes the issue for me.

Revision history for this message
Zach Carlson (zcarlson) wrote :
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Thanks for reporting this and providing a patch. I'll write a test case and fix the code.

tags: added: case-sensitivity
removed: aborting case chunk chunking chunks explain index indexes indexing insensitive insensitivity nibbled safely sensitive sensitivity
Changed in percona-toolkit:
importance: Undecided → Medium
assignee: nobody → Daniel Nichter (daniel-nichter)
milestone: none → 2.0.3
status: New → In Progress
summary: - pt-table-checksum aborts chunking on incorrect case
+ pt-table-checksum index check is case-sensitive
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Reproduced (and made the error message more clear):

02-03T11:19:33 Aborting table ALL_UC.T at chunk 1 because it is not safe to chunk. Chunking should use the id index, but MySQL EXPLAIN reports that the ID index will be used.

Changed in percona-toolkit:
status: In Progress → Fix Committed
Revision history for this message
Baron Schwartz (baron-xaprb) wrote : Re: [Bug 925855] pt-table-checksum index check is case-sensitive

You'll still fix it to be case-insensitive, right?

Revision history for this message
Zach Carlson (zcarlson) wrote :

It appears the original patch, as submitted, was incomplete; apparently there are times when the nibble iterator's index is *also* upper-case (at least with PRIMARY), and the original patch would incorrectly cause those tables to be skipped.

The attached patch (which should be applied to the original script, NOT the script with my patch already applied!) fixes that issue as well.

Changed in percona-toolkit:
status: Fix Committed → In Progress
status: In Progress → Fix Committed
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

Fixing this bug introduce another one, that is now fixed: https://bugs.launchpad.net/percona-toolkit/+bug/927771

Changed in percona-toolkit:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-461

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.