PT-196 pt-onine-schema-change is pausing because {some_status_variable}=0

Description here
This commit is contained in:
Carlos Salguero
2017-08-30 14:54:47 -03:00
parent d8723716c7
commit 7e59feb8dd
7 changed files with 86 additions and 5 deletions

View File

@@ -5238,7 +5238,7 @@ sub wait {
die "$var=$val exceeds its critical threshold "
. "$self->{critical_val_for}->{$var}\n";
}
if ( !$val || $val >= $self->{max_val_for}->{$var} ) {
if ( $val >= $self->{max_val_for}->{$var} ) {
$vals_too_high{$var} = $val;
}
else {

View File

@@ -8683,7 +8683,7 @@ sub wait {
die "$var=$val exceeds its critical threshold "
. "$self->{critical_val_for}->{$var}\n";
}
if ( !$val || $val >= $self->{max_val_for}->{$var} ) {
if ( $val >= $self->{max_val_for}->{$var} ) {
$vals_too_high{$var} = $val;
}
else {

View File

@@ -175,7 +175,7 @@ sub wait {
die "$var=$val exceeds its critical threshold "
. "$self->{critical_val_for}->{$var}\n";
}
if ( !$val || $val >= $self->{max_val_for}->{$var} ) {
if ( $val >= $self->{max_val_for}->{$var} ) {
$vals_too_high{$var} = $val;
}
else {

View File

@@ -0,0 +1,67 @@
#!/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 threads;
use English qw(-no_match_vars);
use Test::More;
use Data::Dumper;
use PerconaTest;
use Sandbox;
use SqlModes;
use File::Temp qw/ tempdir /;
plan tests => 2;
require "$trunk/bin/pt-online-schema-change";
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $master_dbh = $sb->get_dbh_for('master');
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
if ( !$master_dbh ) {
plan skip_all => 'Cannot connect to sandbox master';
}
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the
# tool will die.
my @args = (qw(--set-vars innodb_lock_wait_timeout=3));
my $output;
my $exit_status;
my $sample = "t/pt-online-schema-change/samples/";
$sb->load_file('master', "$sample/pt-196.sql");
($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=test",
'--execute', '--alter', 'DROP COLUMN test', '--max-load',
'THREADPOOL_IDLE_THREADS=1'
),
},
);
is(
$exit_status,
0,
"--alter rename columns with uppercase names -> exit status 0",
);
$master_dbh->do("DROP DATABASE IF EXISTS test");
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($master_dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
done_testing;

View File

@@ -0,0 +1,10 @@
DROP SCHEMA IF EXISTS test;
CREATE SCHEMA test;
USE test;
CREATE TABLE test(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
test INT
);
INSERT INTO test (test) VALUES(1),(2),(3);

View File

@@ -4,12 +4,13 @@ ERRORS DIFFS ROWS SKIPPED TABLE
0 0 2 0 mysql.engine_cost
0 0 0 0 mysql.event
0 0 0 0 mysql.func
0 0 0 0 mysql.gtid_executed
0 0 40 0 mysql.help_category
0 0 682 0 mysql.help_keyword
0 0 1340 0 mysql.help_relation
0 0 637 0 mysql.help_topic
0 0 0 0 mysql.ndb_binlog_index
0 0 0 0 mysql.plugin
0 0 0 0 mysql.proc
0 0 0 0 mysql.procs_priv
0 0 0 0 mysql.proxies_priv
0 0 6 0 mysql.server_cost
@@ -40,3 +41,4 @@ ERRORS DIFFS ROWS SKIPPED TABLE
0 0 16044 0 sakila.rental
0 0 2 0 sakila.staff
0 0 2 0 sakila.store
0 0 6 0 sys.sys_config

View File

@@ -4,12 +4,13 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
0 0 2 1 0 mysql.engine_cost
0 0 0 1 0 mysql.event
0 0 0 1 0 mysql.func
0 0 0 1 0 mysql.gtid_executed
0 0 40 1 0 mysql.help_category
0 0 682 1 0 mysql.help_keyword
0 0 1340 1 0 mysql.help_relation
0 0 637 1 0 mysql.help_topic
0 0 0 1 0 mysql.ndb_binlog_index
0 0 0 1 0 mysql.plugin
0 0 0 1 0 mysql.proc
0 0 0 1 0 mysql.procs_priv
0 0 0 1 0 mysql.proxies_priv
0 0 6 1 0 mysql.server_cost
@@ -40,3 +41,4 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
0 0 16044 19 0 sakila.rental
0 0 2 1 0 sakila.staff
0 0 2 1 0 sakila.store
0 0 6 1 0 sys.sys_config