Currently, when a key_buffer_size=0 is applied, MySQLTuner sets pct_key_buffer_used=0 but still shows it as "[!!]" (bad), recommending to adjust key_buffer_size to "~ 0". The idea surely was show it neither as good or bad in this case, but as debugprint, which is currently never used since pct_key_buffer_used is always defined.
This commit changes the condition to check whether pct_key_buffer_used is larger then zero, to decide whether to show good/bad (with recommendation) or a debug info without recommendation.
Signed-off-by: MichaIng <micha@dietpi.com>
Currently thread pool metrics are shown whenever the "thread_pool_size" variable is set. At least on MariaDB this variable is however set even when the thread pool is disabled. This commit changes the check for whether a thread pool is used for client connection handling or not by comparing the "thread_handling" variable value against "pool-of-threads" (MariaDB) or "loaded-dynamically" (MySQL):
- https://mariadb.com/kb/en/thread-pool-system-status-variables/#thread_handling
- https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_thread_handling
The check for whether to show the thread cache metrics is now based on the same derived internal "have_threadpool" variable, effectively skipping thread cache metrics as well on MySQL when the thread pool is not enabled with "thread_handling = loaded-dynamically". The code comment link to Percona about whether the thread cache is used with thread pool enabled has been pinned to v5.7, the latest version which contains the quoted statement. The statement is however still true for MariaDB and MySQL:
- https://mariadb.com/kb/en/server-system-variables/#thread_cache_size
Signed-off-by: MichaIng <micha@dietpi.com>
The "Key buffer used" row showed 131072 bytes as 131K while it should be shown as 128K, so that it matches the multi-byte units key buffer size in the "Key buffer size / total MyISAM indexes" row below.
Furthermore, instead of calculating the used bytes from the previously calculated percentage, doing a round trip which involves rounding errors, calculate the used bytes from the variables directly which does not involve any diversion and hence no possible rounding errors.
Signed-off-by: MichaIng <micha@dietpi.com>