MCPcopy Create free account
hub / github.com/MariaDB/server / free_cache

Method free_cache

sql/sql_cache.cc:2801–2839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2799*/
2800
2801void Query_cache::free_cache()
2802{
2803 DBUG_ENTER("Query_cache::free_cache");
2804
2805 DBUG_ASSERT(m_cache_lock_status == LOCKED_NO_WAIT ||
2806 m_cache_status == DISABLE_REQUEST);
2807
2808 /* Destroy locks */
2809 Query_cache_block *block= queries_blocks;
2810 if (block)
2811 {
2812 do
2813 {
2814 Query_cache_query *query= block->query();
2815 /*
2816 There will not be new requests but some maybe not finished yet,
2817 so wait for them by trying lock/unlock
2818 */
2819 BLOCK_LOCK_WR(block);
2820 BLOCK_UNLOCK_WR(block);
2821
2822 mysql_rwlock_destroy(&query->lock);
2823 block= block->next;
2824 } while (block != queries_blocks);
2825 }
2826
2827#if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP)
2828 if (madvise(cache, query_cache_size+additional_data_size, MADV_DODUMP))
2829 {
2830 DBUG_PRINT("warning", ("coudn't mark query cache memory as " DODUMP_STR ": %s",
2831 strerror(errno)));
2832 }
2833#endif
2834 my_free(cache);
2835 make_disabled();
2836 my_hash_free(&queries);
2837 my_hash_free(&tables);
2838 DBUG_VOID_RETURN;
2839}
2840
2841/*****************************************************************************
2842 Free block data

Callers

nothing calls this directly

Calls 3

my_freeFunction · 0.85
my_hash_freeFunction · 0.85
queryMethod · 0.45

Tested by

no test coverage detected