Bug #55607 Bad values with Key_blocks_used or Key_blocks_unused
Submitted: 28 Jul 2010 15:36 Modified: 29 Jul 2010 19:40
Reporter: Cyril SCETBON Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.41 OS:Linux (ubuntu)
Assigned to: CPU Architecture:Any
Tags: mysql status key_buffer

[28 Jul 2010 15:36] Cyril SCETBON
Description:
When I check key buffer variables and status, MySQL server seems to return bad values.
The variables/status values I collected are below :

mysql> show global status like '%key_block%';
+------------------------+----------------------+
| Variable_name          | Value                |
+------------------------+----------------------+
| Key_blocks_not_flushed | 18446744073709535910 |
| Key_blocks_unused      | 0                    |
| Key_blocks_used        | 214342               |

mysql> show global variables like '%key%';
+--------------------------+----------------------+
| Variable_name            | Value                |
+--------------------------+----------------------+
| key_buffer_size          | 268435456            |
| key_cache_age_threshold  | 300                  |
| key_cache_block_size     | 1024                 |
| key_cache_division_limit | 100                  |

As it's said in the documentation, the fraction of the key buffer in use can be determined using the formula :

1 - ((Key_blocks_unused * key_cache_block_size) / key_buffer_size)
so, in my case 0.

However, if I check the total memory used based on Key_blocks_used (a high-water mark) I get as a maximum value :
Key_blocks_used * key_cache_block_size=219486208 which is less than 268435456 ! 

How is it possible that this value is less than the key_buffer_size and that the first formula says that the key_buffer is full ?

How to repeat:
none

Suggested fix:
none
[29 Jul 2010 8:32] Cyril SCETBON
Do you really think the system needs 46.7MB ((268435456-219486208)/(1024*1024)) for administrational information as discussed on http://bugs.mysql.com/bug.php?id=2715
If yes, it's ~20% of the key cache !
[29 Jul 2010 19:40] Sveta Smirnova
Thank you for the report.

We have verified feature request about very same problem. This is bug #24843. So I mark this report as duplicate of bug #24843