Commit cea187e3 authored by Sergei Golubchik's avatar Sergei Golubchik

perfschema sysvar instrumentation related changes

incomplete. locking issues
parent 7ce517c9
......@@ -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;
}
......@@ -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);
......
......@@ -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
*/
......
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