Description:
There's a variable which allows you to configure the maximum mmap() memory size for mmaped compressed MyISAM tables, yet as far as I know there's no way to see what the current usage is.
The variable for the size configuration is also static rather than dynamic.
How to repeat:
mysql> show global status like '%mmap%';
Empty set (0.00 sec)
mysql> show global variables like 'myisam_mmap_size';
+------------------+----------------------+
| Variable_name | Value |
+------------------+----------------------+
| myisam_mmap_size | 18446744073709551615 |
+------------------+----------------------+
1 row in set (0.01 sec)
mysql> set global myisam_mmap_size = 50000;
ERROR 1238 (HY000): Variable 'myisam_mmap_size' is a read only variable
mysql>
Suggested fix:
On a server with a large number of such mmap'd tables it would be useful to be able to see the setting myisam_mmap_used.
So please expose this setting via SHOW GLOBAL STATUS so it can be seen.
myisam_mmap_size is a static setting which means that any desire to change this is impossible without shutting down MySQL. In busy environments this is inconvenient and making the variable dynamic would allow for a change to be made without restarting the server. That is good.
If necessary, and to simplify the implementation only make the change succeed if the new myisam_mmap_size > myisam_mmap_used, as this only requires a variable's value to be changed, and the DBA can FLUSH TABLES to free up the currently used size if needed to bring the size down to 0.