pt-show-grants --include-unused-roles doesn't work as intended
General
Escalation
General
Escalation
Description
I tried using pt-show-grants with --include-unused-roles, but it appears the flag isn't affecting the output one way or another. Took a glance at the perl script where the option takes effect:
The call is passing the list of mysql users into the second argument, so the function then attaches the list of users in the role query's WHERE clause and filters on that list, which would never be able to retrieve unused roles.
The resulting role-retrieval query is:
Environment
None
Smart Checklist
Activity
Show:
Lalit Choudhary January 11, 2021 at 3:13 PM
Hi
Thank you for the report.
Verified as described.
Use of --include-unused-roles , --no-include-unused-roles option not working.{{}}
I tried using
pt-show-grants
with--include-unused-roles
, but it appears the flag isn't affecting the output one way or another. Took a glance at the perl script where the option takes effect:https://github.com/percona/percona-toolkit/blob/ff6b05b3811c8da01417444a8158c846d6240bc6/bin/pt-show-grants#L1962
Line 1962 looks like it works as it should (checking "active") however, the problem seems to lie with line 1956:
https://github.com/percona/percona-toolkit/blob/ff6b05b3811c8da01417444a8158c846d6240bc6/bin/pt-show-grants#L1956
The call is passing the list of mysql users into the second argument, so the function then attaches the list of users in the role query's
WHERE
clause and filters on that list, which would never be able to retrieve unused roles.The resulting role-retrieval query is: