summaryrefslogtreecommitdiff
path: root/sql/sql_class.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-03-07 01:33:51 +0100
committerSergei Golubchik <serg@mariadb.org>2021-03-08 14:54:05 +0100
commitdc6667805dd4567693fcc01666da7d1277050097 (patch)
treeb1a3742e96820467a6921e47d09dfa26c48312e8 /sql/sql_class.h
parent2c0b3141f354be245881d7d112dd57bd6f061ee1 (diff)
downloadmariadb-git-dc6667805dd4567693fcc01666da7d1277050097.tar.gz
Correct the value of global memory_used
As a special hack global memory_used isn't SHOW_LONG_STATUS but still relies on calc_sum_of_all_status() being called. followup for 63f91927870
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r--sql/sql_class.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index fe920270542..c47ea9c9020 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -865,11 +865,24 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
+uint calc_sum_of_all_status(STATUS_VAR *to);
+static inline void calc_sum_of_all_status_if_needed(STATUS_VAR *to)
+{
+ if (to->local_memory_used == 0)
+ {
+ mysql_mutex_lock(&LOCK_status);
+ *to= global_status_var;
+ mysql_mutex_unlock(&LOCK_status);
+ calc_sum_of_all_status(to);
+ DBUG_ASSERT(to->local_memory_used);
+ }
+}
+
/*
Update global_memory_used. We have to do this with atomic_add as the
global value can change outside of LOCK_status.
*/
-inline void update_global_memory_status(int64 size)
+static inline void update_global_memory_status(int64 size)
{
DBUG_PRINT("info", ("global memory_used: %lld size: %lld",
(longlong) global_status_var.global_memory_used,
@@ -887,7 +900,7 @@ inline void update_global_memory_status(int64 size)
@retval NULL on error
@retval Pointter to CHARSET_INFO with the given name on success
*/
-inline CHARSET_INFO *
+static inline CHARSET_INFO *
mysqld_collation_get_by_name(const char *name,
CHARSET_INFO *name_cs= system_charset_info)
{
@@ -906,7 +919,7 @@ mysqld_collation_get_by_name(const char *name,
return cs;
}
-inline bool is_supported_parser_charset(CHARSET_INFO *cs)
+static inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{
return MY_TEST(cs->mbminlen == 1);
}