summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-02-14 16:53:53 +0100
committerSergei Golubchik <serg@mariadb.org>2020-03-10 19:24:23 +0100
commitcea187e349f8a129ef8ae0a8b49bb0a138de8978 (patch)
treec35f565c2fb945ce40c993b036f251a3c5bef5f7
parent7ce517c95132037e8e6e2512d4191ed4e254a54e (diff)
downloadmariadb-git-cea187e349f8a129ef8ae0a8b49bb0a138de8978.tar.gz
perfschema sysvar instrumentation related changes
incomplete. locking issues
-rw-r--r--sql/set_var.cc25
-rw-r--r--sql/set_var.h2
-rw-r--r--sql/sql_class.h4
3 files changed, 31 insertions, 0 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index eadbfd4ba7d..c195312a096 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -43,6 +43,7 @@
static HASH system_variable_hash;
static PolyLock_mutex PLock_global_system_variables(&LOCK_global_system_variables);
+static ulonglong system_variable_hash_version= 0;
/**
Return variable name and length for hashing of variables.
@@ -584,6 +585,8 @@ int mysql_add_sys_var_chain(sys_var *first)
goto error;
}
}
+ /* Update system_variable_hash version. */
+ system_variable_hash_version++;
return 0;
error:
@@ -614,6 +617,8 @@ int mysql_del_sys_var_chain(sys_var *first)
result|= my_hash_delete(&system_variable_hash, (uchar*) var);
mysql_prlock_unlock(&LOCK_system_variables_hash);
+ /* Update system_variable_hash version. */
+ system_variable_hash_version++;
return result;
}
@@ -624,6 +629,16 @@ static int show_cmp(SHOW_VAR *a, SHOW_VAR *b)
}
+/*
+ Number of records in the system_variable_hash.
+ Requires lock on LOCK_system_variables_hash.
+*/
+ulong get_system_variable_hash_records(void)
+{
+ return system_variable_hash.records;
+}
+
+
/**
Constructs an array of system variables for display to the user.
@@ -1504,3 +1519,13 @@ pretty_print_engine_list(THD *thd, plugin_ref *list)
*pos= '\0';
return buf;
}
+
+/*
+ Current version of the system_variable_hash.
+ Requires lock on LOCK_system_variables_hash.
+*/
+ulonglong get_system_variable_hash_version(void)
+{
+ return system_variable_hash_version;
+}
+
diff --git a/sql/set_var.h b/sql/set_var.h
index c4a29968818..075339c4f38 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -404,6 +404,8 @@ extern SHOW_COMP_OPTION have_openssl;
/*
Prototypes for helper functions
*/
+ulong get_system_variable_hash_records(void);
+ulonglong get_system_variable_hash_version(void);
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted, enum enum_var_type type);
int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5df7560fd46..d0facea8bdf 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -960,6 +960,10 @@ typedef struct system_status_var
#define last_system_status_var questions
#define last_cleared_system_status_var local_memory_used
+/* Number of contiguous global status variables. */
+const int COUNT_GLOBAL_STATUS_VARS= (offsetof(STATUS_VAR, last_system_status_var) /
+ sizeof(ulong)) + 1;
+
/*
Global status variables
*/