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

Method free_query_internal

sql/sql_cache.cc:2933–2988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2931*/
2932
2933void Query_cache::free_query_internal(Query_cache_block *query_block)
2934{
2935 DBUG_ENTER("Query_cache::free_query_internal");
2936 DBUG_PRINT("qcache", ("free query %p %zu bytes result",
2937 query_block,
2938 query_block->query()->length() ));
2939
2940 queries_in_cache--;
2941
2942 Query_cache_query *query= query_block->query();
2943
2944 if (query->writer() != 0)
2945 {
2946 /* Tell MySQL that this query should not be cached anymore */
2947 query->writer()->first_query_block= NULL;
2948 query->writer(0);
2949 }
2950 double_linked_list_exclude(query_block, &queries_blocks);
2951 Query_cache_block_table *table= query_block->table(0);
2952
2953 for (TABLE_COUNTER_TYPE i= 0; i < query_block->n_tables; i++)
2954 unlink_table(table++);
2955 Query_cache_block *result_block= query->result();
2956
2957 /*
2958 The following is true when query destruction was called and no results
2959 in query . (query just registered and then abort/pack/flush called)
2960 */
2961 if (result_block != 0)
2962 {
2963 if (result_block->type != Query_cache_block::RESULT)
2964 {
2965 // removing unfinished query
2966 refused++;
2967 inserts--;
2968 }
2969 Query_cache_block *block= result_block;
2970 do
2971 {
2972 Query_cache_block *current= block;
2973 block= block->next;
2974 free_memory_block(current);
2975 } while (block != result_block);
2976 }
2977 else
2978 {
2979 // removing unfinished query
2980 refused++;
2981 inserts--;
2982 }
2983
2984 query->unlock_n_destroy();
2985 free_memory_block(query_block);
2986
2987 DBUG_VOID_RETURN;
2988}
2989
2990

Callers

nothing calls this directly

Calls 6

writerMethod · 0.80
unlock_n_destroyMethod · 0.80
lengthMethod · 0.45
queryMethod · 0.45
tableMethod · 0.45
resultMethod · 0.45

Tested by

no test coverage detected