pt-table-checksum ignores --lock-wait-timeout

Bug #946776 reported by Jaime Sicam
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

Line 5940-5949:

$sql = 'SHOW SESSION VARIABLES LIKE "innodb_lock_wait_timeout"';
      PTDEBUG && _d($dbh, $sql);
      my (undef, $lock_wait_timeout) = $dbh->selectrow_array($sql);
      PTDEBUG && _d('innodb_lock_wait_timeout', $lock_wait_timeout);
      if ( ($lock_wait_timeout || 0) > $o->get('lock-wait-timeout') ) {
         $sql = 'SET SESSION innodb_lock_wait_timeout=1';
         eval {
            PTDEBUG && _d($dbh, $sql);
            $dbh->do($sql);
         };

So if you set, --lock-wait-timeout to a value less than the current innodb_lock_wait_timeout, then the session variable innodb_lock_wait_timeout will be set to 1

If you want to use the existing innodb_lock_wait_timeout value, you need to set --lock-wait-timeout to value that is equal or greater than the existing innodb_lock_wait_timeout

Related branches

Revision history for this message
Baron Schwartz (baron-xaprb) wrote :

This code is very surprising to me. It should set the value of lock_wait_timeout to the value of the option regardless of the option's value, instead of using a hard-coded constant. It should also not do any greater-than comparison before the attempt to set the value. Instead, the greater-than comparison should be done in the error-handling code in case the attempt to set the value causes an error. The error should be displayed only if the value fails to be set and as a result is greater than what the user specified.

Furthermore, we need to get rid of the double-quotes in the SQL.

Finally, we need to document the error-if-failure-and-timeout-is-undesirably-large behavior.

Changed in percona-toolkit:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → Daniel Nichter (daniel-nichter)
milestone: none → 2.0.4
Revision history for this message
Baron Schwartz (baron-xaprb) wrote :

Daniel, this is serious enough (and I think simple enough to fix) that I'm targeting it to the current release if you can fit it in. Otherwise you can retarget.

tags: added: pt-table-checksum
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

This code and the hard-coded value 1 are related to:

17a: The tool should set innodb_lock_wait_timeout=1 automatically to avoid blocking other queries if it is blocked itself. (https://blueprints.launchpad.net/percona-toolkit/+spec/redesign-pt-table-checkum)

Iirc, the original ideas was to always set lock_wait_timeout=1 regardless of the server, but I snuck in the --lock-wait-timeout option and this code to make it configurable primarily because this var is only dynamic with the InnoDB plugin and I needed to change it for testing (to avoid warnings), but it looks like I implemented the option too specifically for my own needs. Therefore, yes, I'll fix it to make it sane for the user.

summary: - pt-table-checksum v 2.0.3 ignores --lock-wait-timeout parameter
+ pt-table-checksum ignores --lock-wait-timeout
Changed in percona-toolkit:
status: Confirmed → In Progress
Changed in percona-toolkit:
status: In Progress → Fix Committed
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-493

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.