summaryrefslogtreecommitdiff
path: root/sql/sql_expression_cache.h
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2015-07-01 20:03:29 +0300
committerSergei Petrunia <psergey@askmonty.org>2015-07-01 20:03:29 +0300
commit9d2aa2b3093e315f02e42943589f47447c67bbd8 (patch)
treef2f73397e7d6b26e76971e702fbd6a6a01b95521 /sql/sql_expression_cache.h
parentc6aee27b73232fc6ba3e8b55adbb0abba4f0171b (diff)
downloadmariadb-git-9d2aa2b3093e315f02e42943589f47447c67bbd8.tar.gz
MDEV-7811: EXPLAIN/ANALYZE FORMAT=JSON should show subquery cache
Fixes over the original patch: - Fix variable/class/other names - Fix the JSON output to be in line with the output of other JSON constructs we produce
Diffstat (limited to 'sql/sql_expression_cache.h')
-rw-r--r--sql/sql_expression_cache.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/sql/sql_expression_cache.h b/sql/sql_expression_cache.h
index 33c67f8eaca..87be6ddb4f4 100644
--- a/sql/sql_expression_cache.h
+++ b/sql/sql_expression_cache.h
@@ -65,9 +65,9 @@ public:
virtual void init()= 0;
/**
- Save this object's statistics into Expression_cache_stat object
+ Save this object's statistics into Expression_cache_tracker object
*/
- virtual void flush_stat()= 0;
+ virtual void update_tracker()= 0;
};
struct st_table_ref;
@@ -75,11 +75,11 @@ struct st_join_table;
class Item_field;
-class Expression_cache_stat :public Sql_alloc
+class Expression_cache_tracker :public Sql_alloc
{
public:
enum expr_cache_state {UNINITED, STOPPED, OK};
- Expression_cache_stat(Expression_cache *c) :
+ Expression_cache_tracker(Expression_cache *c) :
cache(c), hit(0), miss(0), state(UNINITED)
{}
@@ -91,10 +91,10 @@ public:
void set(ulong h, ulong m, enum expr_cache_state s)
{hit= h; miss= m; state= s;}
- void flush_stat()
+ void fetch_current_stats()
{
if (cache)
- cache->flush_stat();
+ cache->update_tracker();
}
};
@@ -115,18 +115,20 @@ public:
bool is_inited() { return inited; };
void init();
- void set_stat(Expression_cache_stat *st)
+ void set_tracker(Expression_cache_tracker *st)
{
- stat= st;
- flush_stat();
+ tracker= st;
+ update_tracker();
}
- virtual void flush_stat()
+ virtual void update_tracker()
{
- if (stat)
- stat->set(hit, miss, (inited ? (cache_table ?
- Expression_cache_stat::OK :
- Expression_cache_stat::STOPPED) :
- Expression_cache_stat::UNINITED));
+ if (tracker)
+ {
+ tracker->set(hit, miss, (inited ? (cache_table ?
+ Expression_cache_tracker::OK :
+ Expression_cache_tracker::STOPPED) :
+ Expression_cache_tracker::UNINITED));
+ }
}
private:
@@ -139,7 +141,7 @@ private:
/* Thread handle for the temporary table */
THD *table_thd;
/* EXPALIN/ANALYZE statistics */
- Expression_cache_stat *stat;
+ Expression_cache_tracker *tracker;
/* TABLE_REF for index lookup */
struct st_table_ref ref;
/* Cached result */