mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-26 01:02:25 +08:00
Check if innodb_lock_wait_timeout exists, don't crash.
This commit is contained in:
@@ -5030,7 +5030,11 @@ sub main {
|
|||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
my (undef, $curr_lwt) = $dbh->selectrow_array($sql);
|
my (undef, $curr_lwt) = $dbh->selectrow_array($sql);
|
||||||
PTDEBUG && _d('innodb_lock_wait_timeout on server:', $curr_lwt);
|
PTDEBUG && _d('innodb_lock_wait_timeout on server:', $curr_lwt);
|
||||||
if ( $curr_lwt > $lock_wait_timeout ) {
|
if ( !defined $curr_lwt ) {
|
||||||
|
PTDEBUG && _d('innodb_lock_wait_timeout does not exist;',
|
||||||
|
'InnoDB is probably disabled');
|
||||||
|
}
|
||||||
|
elsif ( $curr_lwt > $lock_wait_timeout ) {
|
||||||
warn "Failed to $set_lwt: $EVAL_ERROR\n"
|
warn "Failed to $set_lwt: $EVAL_ERROR\n"
|
||||||
. "The current innodb_lock_wait_timeout value "
|
. "The current innodb_lock_wait_timeout value "
|
||||||
. "$curr_lwt is greater than the --lock-wait-timeout "
|
. "$curr_lwt is greater than the --lock-wait-timeout "
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
|
||||||
|
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
|
||||||
|
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
|
||||||
|
};
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings FATAL => 'all';
|
||||||
|
use English qw(-no_match_vars);
|
||||||
|
use Test::More;
|
||||||
|
|
||||||
|
use PerconaTest;
|
||||||
|
use Sandbox;
|
||||||
|
require "$trunk/bin/pt-online-schema-change";
|
||||||
|
|
||||||
|
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
||||||
|
diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
|
||||||
|
|
||||||
|
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||||
|
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
|
||||||
|
my $master_dbh = $sb->get_dbh_for('master1');
|
||||||
|
|
||||||
|
if ( !$master_dbh ) {
|
||||||
|
plan skip_all => 'Cannot connect to sandbox master 12348';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
plan tests => 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $master_dsn = 'h=127.1,P=12348,u=msandbox,p=msandbox';
|
||||||
|
my @args = (qw(--lock-wait-timeout 3), '--max-load', '');
|
||||||
|
my $output;
|
||||||
|
my $retval;
|
||||||
|
|
||||||
|
$output = output(
|
||||||
|
sub { $retval = pt_online_schema_change::main(@args,
|
||||||
|
"$master_dsn,D=mysql,t=user", "--alter", "add column (foo int)",
|
||||||
|
qw(--dry-run)) },
|
||||||
|
stderr => 1,
|
||||||
|
);
|
||||||
|
|
||||||
|
like(
|
||||||
|
$output,
|
||||||
|
qr/`mysql`.`user`/,
|
||||||
|
"Ran without InnoDB (bug 994010)"
|
||||||
|
);
|
||||||
|
|
||||||
|
is(
|
||||||
|
$retval,
|
||||||
|
0,
|
||||||
|
"0 exit status (bug 994010)"
|
||||||
|
);
|
||||||
|
|
||||||
|
# #############################################################################
|
||||||
|
# Done.
|
||||||
|
# #############################################################################
|
||||||
|
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
||||||
|
exit;
|
||||||
@@ -55,13 +55,13 @@ $output = output(
|
|||||||
like(
|
like(
|
||||||
$output,
|
$output,
|
||||||
qr/mysql/,
|
qr/mysql/,
|
||||||
"Ran without InnoDB (bug 994010)"
|
"Ran without InnoDB (bug 996110)"
|
||||||
);
|
);
|
||||||
|
|
||||||
is(
|
is(
|
||||||
$retval,
|
$retval,
|
||||||
0,
|
0,
|
||||||
"0 exit status (bug 994010)"
|
"0 exit status (bug 996110)"
|
||||||
);
|
);
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user