mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-02-27 02:00:57 +08:00
PT-204 Added tests
This commit is contained in:
@@ -577,6 +577,25 @@ sub do_as_root {
|
||||
return $ok;
|
||||
}
|
||||
|
||||
sub has_engine {
|
||||
my ( $self, $host, $want_engine ) = @_;
|
||||
|
||||
# Get the current checksums on the host.
|
||||
my $dbh = $self->get_dbh_for($host);
|
||||
my $sql = "SHOW ENGINES";
|
||||
my @engines = @{$dbh->selectall_arrayref($sql, {Slice => {} })};
|
||||
|
||||
# Diff the two sets of checksums: host to master (ref).
|
||||
my $has_engine=0;
|
||||
foreach my $engine ( @engines ) {
|
||||
if ( $engine->{engine} =~ m/$want_engine/i ) {
|
||||
$has_engine=1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
return $has_engine;
|
||||
}
|
||||
|
||||
sub _d {
|
||||
my ($package, undef, $line) = caller 0;
|
||||
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }
|
||||
|
||||
Reference in New Issue
Block a user