Bug #59334 partition_key_cache.test is broken
Submitted: 6 Jan 2011 15:33 Modified: 7 Jan 2011 12:30
Reporter: Sergei Golubchik Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: Mattias Jonsson CPU Architecture:Any

[6 Jan 2011 15:33] Sergei Golubchik
Description:
It contains the following piece

--echo # Actual test of key caches
--echo # Verifing that reads/writes use the key cache correctly
SELECT @org_key_cache_buffer_size:= @@global.default.key_buffer_size;
--echo # Minimize default key cache (almost disabled).
SET @@global.default.key_buffer_size = 4096;

but if you look in the debugger, init_key_cache() contains the following:

  keycache->key_cache_mem_size= use_mem;
  keycache->key_cache_block_size= key_cache_block_size;
  DBUG_PRINT("info", ("key_cache_block_size: %u",
		      key_cache_block_size));

  blocks= (ulong) (use_mem / (sizeof(BLOCK_LINK) + 2 * sizeof(HASH_LINK) +
                              sizeof(HASH_LINK*) * 5/4 + key_cache_block_size));
  /* It doesn't make sense to have too few blocks (less than 8) */
  if (blocks >= 8)
  ...

use_mem is 4096, key_cache_block_size is 1024, blocks is < 8, and key cache is disabled. So the test fails to achieve its goal.

How to repeat:
.
[6 Jan 2011 17:07] Valeriy Kravchuk
Verified by code review of current mysql-5.5.
[7 Jan 2011 12:30] Mattias Jonsson
This is not a bug, but maybe not that clear comment:
# Minimize default key cache (almost disabled).
Should probably be: disable key cache.

The following tests are to verify that it works without the key cache (i.e. verifying that the actual read/writes are the same as the requests).

On row 72 the key cache is enabled with the size of 1M and the test verifies the effect of the key cache by checking that actual read/writes are not the same as number of requests when the keys are cached.