| 3617 | |
| 3618 | |
| 3619 | void Query_cache::unlink_table(Query_cache_block_table *node) |
| 3620 | { |
| 3621 | DBUG_ENTER("Query_cache::unlink_table"); |
| 3622 | node->prev->next= node->next; |
| 3623 | node->next->prev= node->prev; |
| 3624 | Query_cache_block_table *neighbour= node->next; |
| 3625 | Query_cache_table *table_block_data= node->parent; |
| 3626 | table_block_data->m_cached_query_count--; |
| 3627 | |
| 3628 | DBUG_ASSERT(table_block_data->m_cached_query_count >= 0); |
| 3629 | |
| 3630 | if (neighbour->next == neighbour) |
| 3631 | { |
| 3632 | DBUG_ASSERT(table_block_data->m_cached_query_count == 0); |
| 3633 | /* |
| 3634 | If neighbor is root of list, the list is empty. |
| 3635 | The root of the list is always a table-type block |
| 3636 | which contain exactly one Query_cache_block_table |
| 3637 | node object, thus we can use the block() method |
| 3638 | to calculate the Query_cache_block address. |
| 3639 | */ |
| 3640 | Query_cache_block *table_block= neighbour->block(); |
| 3641 | double_linked_list_exclude(table_block, |
| 3642 | &tables_blocks); |
| 3643 | Query_cache_table *header= table_block->table(); |
| 3644 | if (header->is_hashed()) |
| 3645 | my_hash_delete(&tables,(uchar *) table_block); |
| 3646 | free_memory_block(table_block); |
| 3647 | } |
| 3648 | DBUG_VOID_RETURN; |
| 3649 | } |
| 3650 | |
| 3651 | /***************************************************************************** |
| 3652 | Free memory management |
nothing calls this directly
no test coverage detected