mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-02-27 02:00:57 +08:00
Merge pull request #1065 from percona/PT-2215_pt-table-sync_does_not_recognize_the_privileges_in_roles_for_MariaDB
Pt 2215 pt table sync does not recognize the privileges in roles for maria db
This commit is contained in:
@@ -381,9 +381,7 @@ sub get_connected_replicas {
|
||||
my ( $self, $dbh ) = @_;
|
||||
|
||||
# Check for the PROCESS privilege.
|
||||
my $show = "SHOW GRANTS FOR ";
|
||||
my $user = 'CURRENT_USER()';
|
||||
my $sql = $show . $user;
|
||||
my $sql = "SHOW GRANTS";
|
||||
PTDEBUG && _d($dbh, $sql);
|
||||
|
||||
my $proc;
|
||||
@@ -392,26 +390,9 @@ sub get_connected_replicas {
|
||||
m/ALL PRIVILEGES.*?\*\.\*|PROCESS/
|
||||
} @{$dbh->selectcol_arrayref($sql)};
|
||||
};
|
||||
if ( $EVAL_ERROR ) {
|
||||
|
||||
if ( $EVAL_ERROR =~ m/no such grant defined for user/ ) {
|
||||
# Try again without a host.
|
||||
PTDEBUG && _d('Retrying SHOW GRANTS without host; error:',
|
||||
$EVAL_ERROR);
|
||||
($user) = split('@', $user);
|
||||
$sql = $show . $user;
|
||||
PTDEBUG && _d($sql);
|
||||
eval {
|
||||
$proc = grep {
|
||||
m/ALL PRIVILEGES.*?\*\.\*|PROCESS/
|
||||
} @{$dbh->selectcol_arrayref($sql)};
|
||||
};
|
||||
}
|
||||
|
||||
# The 2nd try above might have cleared $EVAL_ERROR.
|
||||
# If not, die now.
|
||||
die "Failed to $sql: $EVAL_ERROR" if $EVAL_ERROR;
|
||||
}
|
||||
|
||||
die "Failed to $sql: $EVAL_ERROR" if $EVAL_ERROR;
|
||||
|
||||
if ( !$proc ) {
|
||||
die "You do not have the PROCESS privilege";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user