Comment 7 for bug 905334

Michael Widenius (monty) wrote :

Some more information (Just got a new crash):

The assert buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE fails for me because:
buf_block_get_state(block) = BUF_BLOCK_REMOVE_HASH

one likely reason is that in the caller buf_page_get_gen() we do just before:

mutex_lock(block->mutex);
call buf_LRU_free_block();
  mutex_unlock(block->mutex);
  ....
  mutex_lock(block->mutex);

What probably happens is that some other threads reuses the buffer during the mutex_unlock/mutex_lock in
buf_LRU_free_block().

Suggestions:
- Add test that if block changed during call of in buf_LRU_free_block() we don't call buf_flush_page_try()
- Remove the optimization of buf_pool->LRU_list_mutex as it's not safe.

The above code doesn't exist in Innobase and it's probably because of that we don't see this issue with InnoDB.