Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql_info doesn't list empty DBs #65727

Closed
jirib opened this issue Dec 11, 2019 · 4 comments · Fixed by #65755
Closed

mysql_info doesn't list empty DBs #65727

jirib opened this issue Dec 11, 2019 · 4 comments · Fixed by #65755
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. database Database category has_pr This issue has an associated PR. module This issue/PR relates to a module. mysql performance python3 support:community This issue/PR relates to code supported by the Ansible community.

Comments

@jirib
Copy link

jirib commented Dec 11, 2019

SUMMARY

mysql_info module doesn't show empty DBs. It uses following query in the code:

MariaDB [(none)]> SELECT table_schema AS 'name', SUM(data_length + index_length) AS "size" FROM information_schema.TABLES GROUP BY table_schema;
+--------------------+-----------+
| name               | size      |
+--------------------+-----------+
| d106953_tm         | 470728704 |
| information_schema |    212992 |
| mysql              |   6038300 |
| performance_schema |         0 |
+--------------------+-----------+
4 rows in set (0,005 sec)

But show databases show something else;

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| d106953_tm         |
| information_schema |
| innodb             |
| mysql              |
| performance_schema |
| testovic           |
| tm_web             |
| ttttt              |
+--------------------+
8 rows in set (0,001 sec)
ISSUE TYPE
  • Bug Report
COMPONENT NAME

mysql_info modules

ANSIBLE VERSION
ansible 2.9.1
  config file = /home/jiri/.ansible.cfg
  configured module search path = ['/home/jiri/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jiri/stow/ansible/venv/lib/python3.6/site-packages/ansible
  executable location = /home/jiri/stow/ansible/venv/bin/ansible
  python version = 3.6.9 (default, Nov  7 2019, 10:44:02) [GCC 8.3.0]

OS / ENVIRONMENT

Amazon Linux 2
rh-mariadb103-3.3-5.el7.x86_64

STEPS TO REPRODUCE
  • create empty via eg. via mysql_db module
  • query via mysql_info what databases where found
EXPECTED RESULTS

should list even empty DBs

ACTUAL RESULTS

it seems only populated DBs are listed

@jirib
Copy link
Author

jirib commented Dec 11, 2019

It's OK if it should not list empty DBs by default but it would be handy to list even empty DBs with a new option.

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. database Database category module This issue/PR relates to a module. mysql needs_triage Needs a first human triage before being processed. performance python3 support:community This issue/PR relates to code supported by the Ansible community. labels Dec 11, 2019
@Andersson007
Copy link
Contributor

@jirib , thanks for reporting this! will see

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Dec 12, 2019
@Andersson007
Copy link
Contributor

resolved_by_pr: #65755

i tried it manyally and added CI tests for the case
@jirib if the solution is ok for you, add shipit to a comment in the suggested PR (in separate line), please, or i'd be grateful for any feedback! thanks

@ansibot ansibot added the has_pr This issue has an associated PR. label Dec 12, 2019
@ansible ansible locked and limited conversation to collaborators Jan 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. database Database category has_pr This issue has an associated PR. module This issue/PR relates to a module. mysql performance python3 support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants