Commit 7ce517c9 authored by Sergei Golubchik's avatar Sergei Golubchik

perfschema status vars instrumentation related changes

parent d4605bc9
...@@ -3307,8 +3307,9 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) ...@@ -3307,8 +3307,9 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
Status functions Status functions
*****************************************************************************/ *****************************************************************************/
static DYNAMIC_ARRAY all_status_vars; DYNAMIC_ARRAY all_status_vars;
static bool status_vars_inited= 0; static bool status_vars_inited= 0;
ulonglong status_var_array_version= 0;
C_MODE_START C_MODE_START
static int show_var_cmp(const void *var1, const void *var2) static int show_var_cmp(const void *var1, const void *var2)
...@@ -3336,6 +3337,7 @@ static void shrink_var_array(DYNAMIC_ARRAY *array) ...@@ -3336,6 +3337,7 @@ static void shrink_var_array(DYNAMIC_ARRAY *array)
} }
else // array is completely empty - delete it else // array is completely empty - delete it
delete_dynamic(array); delete_dynamic(array);
status_var_array_version++;
} }
/* /*
...@@ -3375,6 +3377,7 @@ int add_status_vars(SHOW_VAR *list) ...@@ -3375,6 +3377,7 @@ int add_status_vars(SHOW_VAR *list)
all_status_vars.elements--; // but next insert_dynamic should overwite it all_status_vars.elements--; // but next insert_dynamic should overwite it
if (status_vars_inited) if (status_vars_inited)
sort_dynamic(&all_status_vars, show_var_cmp); sort_dynamic(&all_status_vars, show_var_cmp);
status_var_array_version++;
err: err:
if (status_vars_inited) if (status_vars_inited)
mysql_rwlock_unlock(&LOCK_all_status_vars); mysql_rwlock_unlock(&LOCK_all_status_vars);
...@@ -3393,6 +3396,7 @@ void init_status_vars() ...@@ -3393,6 +3396,7 @@ void init_status_vars()
{ {
status_vars_inited=1; status_vars_inited=1;
sort_dynamic(&all_status_vars, show_var_cmp); sort_dynamic(&all_status_vars, show_var_cmp);
status_var_array_version++;
} }
void reset_status_vars() void reset_status_vars()
...@@ -3419,6 +3423,7 @@ void reset_status_vars() ...@@ -3419,6 +3423,7 @@ void reset_status_vars()
void free_status_vars() void free_status_vars()
{ {
delete_dynamic(&all_status_vars); delete_dynamic(&all_status_vars);
status_var_array_version++;
} }
/* /*
...@@ -3480,6 +3485,11 @@ void remove_status_vars(SHOW_VAR *list) ...@@ -3480,6 +3485,11 @@ void remove_status_vars(SHOW_VAR *list)
} }
} }
/* Current version of the all_status_vars. */
ulonglong get_status_vars_version(void)
{
return status_var_array_version;
}
/** /**
@brief Returns the value of a system or a status variable. @brief Returns the value of a system or a status variable.
......
...@@ -119,6 +119,7 @@ bool append_definer(THD *thd, String *buffer, const LEX_CSTRING *definer_user, ...@@ -119,6 +119,7 @@ bool append_definer(THD *thd, String *buffer, const LEX_CSTRING *definer_user,
const LEX_CSTRING *definer_host); const LEX_CSTRING *definer_host);
int add_status_vars(SHOW_VAR *list); int add_status_vars(SHOW_VAR *list);
void remove_status_vars(SHOW_VAR *list); void remove_status_vars(SHOW_VAR *list);
ulonglong get_status_vars_version(void);
void init_status_vars(); void init_status_vars();
void free_status_vars(); void free_status_vars();
void reset_status_vars(); void reset_status_vars();
......
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