diff --git a/lib/MySQLProtocolParser.pm b/lib/MySQLProtocolParser.pm index 8136d07e..64867bce 100644 --- a/lib/MySQLProtocolParser.pm +++ b/lib/MySQLProtocolParser.pm @@ -42,7 +42,7 @@ use English qw(-no_match_vars); use constant PTDEBUG => $ENV{PTDEBUG} || 0; eval { - require IO::Uncompress::Inflate; + require IO::Uncompress::Inflate; # yum: perl-IO-Compress-Zlib IO::Uncompress::Inflate->import(qw(inflate $InflateError)); }; diff --git a/lib/ProtocolParser.pm b/lib/ProtocolParser.pm index 363ca006..d8aaa544 100644 --- a/lib/ProtocolParser.pm +++ b/lib/ProtocolParser.pm @@ -28,7 +28,7 @@ use English qw(-no_match_vars); use constant PTDEBUG => $ENV{PTDEBUG} || 0; eval { - require IO::Uncompress::Inflate; + require IO::Uncompress::Inflate; # yum: perl-IO-Compress-Zlib IO::Uncompress::Inflate->import(qw(inflate $InflateError)); }; diff --git a/lib/Sandbox.pm b/lib/Sandbox.pm index 6a567ad3..d653b98d 100644 --- a/lib/Sandbox.pm +++ b/lib/Sandbox.pm @@ -158,6 +158,14 @@ sub _check_server { sub wipe_clean { my ( $self, $dbh ) = @_; + # If any other connections to the server are holding metadata locks, then + # the DROP commands will just hang forever. + my @cxns = @{$dbh->selectall_arrayref('SHOW FULL PROCESSLIST', {Slice => {}})}; + foreach my $cxn ( @cxns ) { + if ( $cxn->{user} eq 'msandbox' && $cxn->{command} eq 'Sleep' ) { + $dbh->do("KILL $cxn->{id}"); + } + } foreach my $db ( @{$dbh->selectcol_arrayref('SHOW DATABASES')} ) { next if $db eq 'mysql'; next if $db eq 'information_schema'; diff --git a/sandbox/start-sandbox b/sandbox/start-sandbox index 0a4ad49b..c1e81711 100755 --- a/sandbox/start-sandbox +++ b/sandbox/start-sandbox @@ -11,10 +11,8 @@ die() { make_sandbox() { # Make the sandbox dir and extract the base files. - mkdir /tmp/$port - if [ $? -ne 0 ]; then - die "mkdir /tmp/$port failed" - fi + rm -rf /tmp/$port || die "can't rm /tmp/$port" + mkdir /tmp/$port || die "mkdir /tmp/$port failed" cp $PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/my.sandbox.cnf /tmp/$port tar xzf $PERCONA_TOOLKIT_BRANCH/sandbox/servers/$version/data.tar.gz -C /tmp/$port diff --git a/t/lib/MasterSlave.t b/t/lib/MasterSlave.t index 41f389a8..334a400b 100644 --- a/t/lib/MasterSlave.t +++ b/t/lib/MasterSlave.t @@ -337,7 +337,7 @@ ok($res->{result} >= 0, 'Wait was successful'); $ms->stop_slave($slaves[0]); $dbh->do('drop database if exists test'); # Any stmt will do -diag(`(sleep 1; echo "start slave" | /tmp/$port_for{slave0}/use)&`); +diag(`(sleep 3; echo "start slave" | /tmp/$port_for{slave0}/use)&`); eval { $res = $ms->wait_for_master( master_status => $ms->get_master_status($dbh), diff --git a/t/lib/MockSyncStream.t b/t/lib/MockSyncStream.t index 2615a5bc..02b943b5 100644 --- a/t/lib/MockSyncStream.t +++ b/t/lib/MockSyncStream.t @@ -78,9 +78,11 @@ is_deeply( # Test online stuff, e.g. get_cols_and_struct(). # ############################################################################# use DSNParser; +use VersionParser; use Sandbox; my $dp = new DSNParser(opts=>$dsn_opts); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $vp = new VersionParser; my $dbh = $sb->get_dbh_for('master'); SKIP: { @@ -170,7 +172,7 @@ SKIP: { id => undef, i => undef, f => undef, - d => undef, + d => ($vp->version_ge($dbh, '5.5.1') ? '(7)' : undef), dt => undef, ts => undef, c => '(1)', diff --git a/t/lib/SchemaIterator.t b/t/lib/SchemaIterator.t index 76450f53..f16f9771 100644 --- a/t/lib/SchemaIterator.t +++ b/t/lib/SchemaIterator.t @@ -130,8 +130,9 @@ SKIP: { # Test simple, unfiltered get_db_itr(). # ######################################################################## test_so( - result => $sandbox_version ge '5.1' ? "$out/all-dbs-tbls.txt" - : "$out/all-dbs-tbls-5.0.txt", + result => $sandbox_version ge '5.5' ? "$out/all-dbs-tbls.txt" + : $sandbox_version ge '5.1' ? "$out/all-dbs-tbls-5.1.txt" + : "$out/all-dbs-tbls-5.0.txt", test_name => "Iterate all schema objects with dbh", ); @@ -190,7 +191,7 @@ SKIP: { # Filter by engines. This also tests that --engines is case-insensitive test_so( filters => ['-d', 'd1,d2,d3', '--engines', 'INNODB'], - result => "d1.t2 ", + result => ($sandbox_version ge '5.5' ? 'd1.t2 d2.t1 ' : "d1.t2 "), test_name => '--engines', ); diff --git a/t/lib/samples/SchemaIterator/all-dbs-tbls.txt b/t/lib/samples/SchemaIterator/all-dbs-tbls-5.1.txt similarity index 100% rename from t/lib/samples/SchemaIterator/all-dbs-tbls.txt rename to t/lib/samples/SchemaIterator/all-dbs-tbls-5.1.txt diff --git a/t/lib/samples/SchemaIterator/mysql-user-ddl.txt b/t/lib/samples/SchemaIterator/mysql-user-ddl.txt index d5f73afa..7f833482 100644 --- a/t/lib/samples/SchemaIterator/mysql-user-ddl.txt +++ b/t/lib/samples/SchemaIterator/mysql-user-ddl.txt @@ -31,6 +31,7 @@ CREATE TABLE `user` ( `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', `ssl_cipher` blob NOT NULL, `x509_issuer` blob NOT NULL, @@ -39,6 +40,8 @@ CREATE TABLE `user` ( `max_updates` int(11) unsigned NOT NULL DEFAULT '0', `max_connections` int(11) unsigned NOT NULL DEFAULT '0', `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0', + `plugin` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `authentication_string` text COLLATE utf8_bin NOT NULL, PRIMARY KEY (`Host`,`User`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges' diff --git a/t/pt-log-player/issue_799.t b/t/pt-log-player/issue_799.t index 7eea4c29..2485e7ee 100644 --- a/t/pt-log-player/issue_799.t +++ b/t/pt-log-player/issue_799.t @@ -23,7 +23,7 @@ if ( !$dbh ) { plan skip_all => 'Cannot connect to sandbox master'; } else { - plan tests => 4; + plan tests => 3; } # ############################################################################# diff --git a/t/pt-log-player/play.t b/t/pt-log-player/play.t index 9010646e..b2f4e5d1 100644 --- a/t/pt-log-player/play.t +++ b/t/pt-log-player/play.t @@ -23,7 +23,7 @@ if ( !$dbh ) { plan skip_all => 'Cannot connect to sandbox master'; } else { - plan tests => 21; + plan tests => 20; } my $output; diff --git a/t/pt-table-sync/samples/issue_22.sql b/t/pt-table-sync/samples/issue_22.sql index cdee3bb7..7d3e5cca 100644 --- a/t/pt-table-sync/samples/issue_22.sql +++ b/t/pt-table-sync/samples/issue_22.sql @@ -11,4 +11,4 @@ CREATE TABLE `messages` ( PRIMARY KEY (`MID`), UNIQUE KEY `ID` (`MID`), KEY `TID` (`TID`) -) TYPE=MyISAM; +) ENGINE=MyISAM;