server
server copied to clipboard
mytop - fix specifying filters in .mytop
- [ ] The Jira issue number for this PR is: MDEV-______
Description
The mytop utility supports defining filters in .mytop, but this functionality is currently broken.
Specifying filters (filter_status, filter_user, etc) in the mytop config won't work, because any filter specified here is added to the config hash as a literal string. This change fixes that - if filter_* is defined in the config and matches an existing filter_* key, then run the value through StringOrRegex() and assign the result to the config hash.
Release Notes
Update mytop utility to fix parsing of filter_* entries in .mytop config.
How can this PR be tested?
I don't know that the test suite will actually test this script.
That being said, a manual test will work as follows:
- Add a filter_ entry to the .mytop config, eg: filter_state=/data/
- Run mytop, and see if any queries with state 'Sending data' appear.
- Alternatively, hit capital D in mytop to dump %config hash to screen and look for the filter you added.
- If it appears as 'filter_state' => qr/data/, the change worked.
- If it appears as 'filter_state' => '/data/', the config entry is being interpreted as a string, and will never match as a regex.
Basing the PR against the correct MariaDB version
- [ ] This is a new feature and the PR is based against the latest MariaDB development branch.
- [ ] This is a bug fix and the PR is based against the earliest maintained branch in which the bug can be reproduced.
- [x] This is a bug fix for a util which was originally from a third party and predates MariaDB, and as such all MariaDB branches contain this bug.
PR quality check
- [X] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
- [X] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.