Releem / mysqlconfigurer

Releem is a simple MySQL tuning tool to improve database performance and reduce servers costs.
https://releem.com
GNU General Public License v3.0
254 stars 26 forks source link

Releem Agent couldn't collect metrics #174

Closed drupaladmin closed 11 months ago

drupaladmin commented 1 year ago

dbMetrics.go:103: sql: Scan error on column index 1, name "SUM(DATA_LENGTH+INDEX_LENGTH)": converting NULL to string is unsupported

The result of the query

SELECT ENGINE, SUM(DATA_LENGTH+INDEX_LENGTH), COUNT(ENGINE), SUM(DATA_LENGTH), SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'mysql') AND ENGINE IS NOT NULL  GROUP BY ENGINE ORDER BY ENGINE ASC;

+--------+-------------------------------+---------------+------------------+-------------------+ | ENGINE | SUM(DATA_LENGTH+INDEX_LENGTH) | COUNT(ENGINE) | SUM(DATA_LENGTH) | SUM(INDEX_LENGTH) | +--------+-------------------------------+---------------+------------------+-------------------+ | InnoDB | 2242969600 | 135 | 1653850112 | 589119488 | | MyISAM | 4163439298 | 919 | 3405895362 | 757543936 | | SPHINX | NULL | 6 | NULL | NULL | +--------+-------------------------------+---------------+------------------+-------------------+

drupaladmin commented 1 year ago

The root cause of the issue is a bug in the agent - unexpected SPHINX with Null, we’ll fix the issue ASAP and release the new version. We’re planning tomorrow.

kochetovd commented 1 year ago

Fixed by adding an ifnull check

https://github.com/Releem/mysqlconfigurer/commit/f8cf22f42155796e2927ab9444685eb0ac8814f2