pt-table-checksum fails when table is empty

Reported by Rob Smith on 2013-05-20
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona Toolkit
Undecided
Daniel Nichter

Bug Description

Maybe related to #1020997

Error message:
05-20T02:27:49 Error checksumming table database.table: I need a vals argument at /usr/bin/pt-table-checksum line 8620.

Daniel Nichter (daniel-nichter) wrote :

Which version of pt-table-checksum? And what's the SHOW CREATE of the table?

Bug 987393 is the same, but tested and fixed. So something is different about this case.

Changed in percona-toolkit:
milestone: none → 2.2.4
status: New → Triaged
Changed in percona-toolkit:
importance: Undecided → Medium
Rob Smith (kormoc) wrote :

Version 2.2.2 and sadly, I can't provide the show create table, as the table was removed.

Daniel Nichter (daniel-nichter) wrote :

This is the same as bug 1020997. The root problem is IndexLength::index_length() which is used for --check-plan. So the workaround is: --no-check-plan.

I'm going to un-target this from 2.24 because this will require more work to fix in pt-table-checksum. For pt-osc, we could simply not copy any rows, but ptc needs to work on empty tables.

The problem, as described in bug 1020997, arises when the table had lots of rows that were deleted but the InnoDB stats were not updated. The tool sees that the table has 500k rows, for example, so it decides to nibble/chunk it. For --check-plan, the tool checks that MySQL is using the full nibble index. Doing this requires a row, so IndexLength::length() calls IndexLength::_get_first_values() which returns $vals = undef because there are no rows, but it doesn't check this, it simply passes it to IndexLength::_make_range_query() which expects a defined $vals arg, hence the error.

For ptc, we need to detect this and revert from nibble the table to single-chunking it. Problem is: the current code doesn't make this possible. The IndexLength calls happen after the tool decides whether or not to nibble, so there's no simple way yet to re-do the table or revert to single-chunking. The other consideration is: we plan to do away with single chunking altogether.

We'll fix this, but it will take some time. In the meantime, using --no-check-plan will avoid this, but be careful when disabling this safety.

Changed in percona-toolkit:
status: Triaged → Confirmed
importance: Medium → Undecided
milestone: 2.2.4 → none
tags: added: chunking nibbler
Changed in percona-toolkit:
assignee: nobody → Daniel Nichter (daniel-nichter)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers