mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-21 10:17:18 +00:00
MasterSlave: Drop dependency on VersionParser
This commit is contained in:
@@ -273,16 +273,9 @@ sub _find_slaves_by_hosts {
|
|||||||
sub get_connected_slaves {
|
sub get_connected_slaves {
|
||||||
my ( $self, $dbh ) = @_;
|
my ( $self, $dbh ) = @_;
|
||||||
|
|
||||||
# Check for the PROCESS privilege. SHOW GRANTS operates differently
|
# Check for the PROCESS privilege.
|
||||||
# before 4.1.2: it requires "FROM ..." and it's not until 4.0.6 that
|
|
||||||
# CURRENT_USER() is available. So for versions <4.1.2 we get current
|
|
||||||
# user with USER(), quote it, and then add it to statement.
|
|
||||||
my $show = "SHOW GRANTS FOR ";
|
my $show = "SHOW GRANTS FOR ";
|
||||||
my $user = 'CURRENT_USER()';
|
my $user = 'CURRENT_USER()';
|
||||||
if ( VersionParser->new($dbh) < '4.1.2' ) {
|
|
||||||
$user = $dbh->selectrow_arrayref('SELECT USER()')->[0];
|
|
||||||
$user =~ s/([^@]+)@(.+)/'$1'\@'$2'/;
|
|
||||||
}
|
|
||||||
my $sql = $show . $user;
|
my $sql = $show . $user;
|
||||||
PTDEBUG && _d($dbh, $sql);
|
PTDEBUG && _d($dbh, $sql);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user