A few miscellaneous changes, including a fix for metadata locking and wipe_clean in Sandbox.pm

This commit is contained in:
Baron Schwartz
2012-06-03 17:20:12 -04:00
parent f995a59eb4
commit 6cc17a73c2
5 changed files with 12 additions and 4 deletions

View File

@@ -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));
};

View File

@@ -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));
};

View File

@@ -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';