Commit b463146a authored by unknown's avatar unknown

new status variable (number of queries deleted because of low memory)


mysql-test/r/query_cache.result:
  test of new status variable
mysql-test/t/query_cache.test:
  test of new status variable
parent 4b9c5888
......@@ -320,6 +320,9 @@ insert into t1 select * from t2;
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
show status like "Qcache_lowmem_prunes";
Variable_name Value
Qcache_lowmem_prunes 0
select a as a1, a as a2 from t1;
select a as a2, a as a3 from t1;
select a as a3, a as a4 from t1;
......@@ -330,6 +333,9 @@ Qcache_hits 4
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
show status like "Qcache_lowmem_prunes";
Variable_name Value
Qcache_lowmem_prunes 2
reset query cache;
insert into t2 select * from t1;
insert into t1 select * from t2;
......
......@@ -206,6 +206,7 @@ insert into t2 select * from t1; # 2584
insert into t1 select * from t2; # 4181
show status like "Qcache_hits";
show status like "Qcache_lowmem_prunes";
disable_result_log;
select a as a1, a as a2 from t1;
select a as a2, a as a3 from t1;
......@@ -215,6 +216,7 @@ select a as a1, a as a2 from t1;
enable_result_log;
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
show status like "Qcache_lowmem_prunes";
reset query cache;
#
# Query bigger then query_cache_limit
......
......@@ -3793,6 +3793,7 @@ struct show_var_st status_vars[]= {
{"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache, SHOW_LONG_CONST},
{"Qcache_inserts", (char*) &query_cache.inserts, SHOW_LONG},
{"Qcache_hits", (char*) &query_cache.hits, SHOW_LONG},
{"Qcache_lowmem_prunes", (char*) &query_cache.lowmem_prunes, SHOW_LONG},
{"Qcache_not_cached", (char*) &query_cache.refused, SHOW_LONG},
{"Qcache_free_memory", (char*) &query_cache.free_memory,
SHOW_LONG_CONST},
......
......@@ -708,7 +708,7 @@ Query_cache::Query_cache(ulong query_cache_limit_arg,
:query_cache_size(0),
query_cache_limit(query_cache_limit_arg),
queries_in_cache(0), hits(0), inserts(0), refused(0),
total_blocks(0),
total_blocks(0), lowmem_prunes(0),
min_allocation_unit(ALIGN_SIZE(min_allocation_unit_arg)),
min_result_data_size(ALIGN_SIZE(min_result_data_size_arg)),
def_query_hash_size(ALIGN_SIZE(def_query_hash_size_arg)),
......@@ -1512,6 +1512,7 @@ my_bool Query_cache::free_old_query()
if (query_block != 0)
{
free_query(query_block);
lowmem_prunes++;
DBUG_RETURN(0);
}
}
......
......@@ -219,7 +219,7 @@ public:
ulong query_cache_size, query_cache_limit;
/* statistics */
ulong free_memory, queries_in_cache, hits, inserts, refused,
free_memory_blocks, total_blocks;
free_memory_blocks, total_blocks, lowmem_prunes;
protected:
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment