1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

perfschema sysvar instrumentation related changes

incomplete. locking issues
This commit is contained in:
Sergei Golubchik
2020-02-14 16:53:53 +01:00
parent 7ce517c951
commit cea187e349
3 changed files with 31 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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
*/