Commit 6e827f34 authored by Sergei Golubchik's avatar Sergei Golubchik

mdev-224 plugin usage statistics in the feedback reports

parent 415507d3
...@@ -5,7 +5,8 @@ ACTIVE ...@@ -5,7 +5,8 @@ ACTIVE
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK 1.1 FEEDBACK used 1
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60 FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post FEEDBACK_URL http://mariadb.org/feedback_plugin/post
......
...@@ -4,7 +4,8 @@ ACTIVE ...@@ -4,7 +4,8 @@ ACTIVE
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK 1.1 FEEDBACK used 1
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60 FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post FEEDBACK_URL http://mariadb.org/feedback_plugin/post
......
...@@ -4,7 +4,8 @@ ACTIVE ...@@ -4,7 +4,8 @@ ACTIVE
select * from information_schema.feedback where variable_name like 'feed%' select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid'; and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
FEEDBACK 1.1 FEEDBACK used 2
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60 FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60 FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post FEEDBACK_URL http://mariadb.org/feedback_plugin/post
......
...@@ -152,26 +152,36 @@ namespace feedback { ...@@ -152,26 +152,36 @@ namespace feedback {
static const bool UNSIGNED= true; ///< used below when inserting integers static const bool UNSIGNED= true; ///< used below when inserting integers
/** /**
callback for fill_plugin_version() - insert a plugin name and its version callback for fill_plugins()
*/ */
static my_bool show_plugins(THD *thd, plugin_ref plugin, void *arg) static my_bool show_plugins(THD *thd, plugin_ref plugin, void *arg)
{ {
TABLE *table= (TABLE*) arg; TABLE *table= (TABLE*) arg;
char name[NAME_LEN*2];
size_t name_len;
char version[20]; char version[20];
size_t version_len; size_t version_len;
name_len= my_snprintf(name, sizeof(name), "%s version",
plugin_name(plugin)->str);
version_len= my_snprintf(version, sizeof(version), "%d.%d", version_len= my_snprintf(version, sizeof(version), "%d.%d",
(plugin_decl(plugin)->version) >> 8, (plugin_decl(plugin)->version) >> 8,
(plugin_decl(plugin)->version) & 0xff); (plugin_decl(plugin)->version) & 0xff);
INSERT2(plugin_name(plugin)->str, plugin_name(plugin)->length, INSERT2(name, name_len,
(version, version_len, system_charset_info)); (version, version_len, system_charset_info));
name_len= my_snprintf(name, sizeof(name), "%s used",
plugin_name(plugin)->str);
INSERT2(name, name_len, (plugin_ref_to_int(plugin)->locks_total, UNSIGNED));
return 0; return 0;
} }
/** /**
inserts all plugins and their versions into I_S.FEEDBACK inserts all plugins, their versions, and usage counters
*/ */
int fill_plugin_version(THD *thd, TABLE_LIST *tables) int fill_plugin_version(THD *thd, TABLE_LIST *tables)
{ {
......
...@@ -980,9 +980,13 @@ plugin_ref plugin_lock(THD *thd, plugin_ref ptr) ...@@ -980,9 +980,13 @@ plugin_ref plugin_lock(THD *thd, plugin_ref ptr)
without a mutex. without a mutex.
*/ */
if (! plugin_dlib(ptr)) if (! plugin_dlib(ptr))
{
plugin_ref_to_int(ptr)->locks_total++;
DBUG_RETURN(ptr); DBUG_RETURN(ptr);
}
#endif #endif
mysql_mutex_lock(&LOCK_plugin); mysql_mutex_lock(&LOCK_plugin);
plugin_ref_to_int(ptr)->locks_total++;
rc= my_intern_plugin_lock_ci(lex, ptr); rc= my_intern_plugin_lock_ci(lex, ptr);
mysql_mutex_unlock(&LOCK_plugin); mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(rc); DBUG_RETURN(rc);
......
...@@ -99,6 +99,7 @@ struct st_plugin_int ...@@ -99,6 +99,7 @@ struct st_plugin_int
struct st_plugin_dl *plugin_dl; struct st_plugin_dl *plugin_dl;
uint state; uint state;
uint ref_count; /* number of threads using the plugin */ uint ref_count; /* number of threads using the plugin */
uint locks_total; /* how many times the plugin was locked */
void *data; /* plugin type specific, e.g. handlerton */ void *data; /* plugin type specific, e.g. handlerton */
MEM_ROOT mem_root; /* memory for dynamic plugin structures */ MEM_ROOT mem_root; /* memory for dynamic plugin structures */
sys_var *system_vars; /* server variables for this plugin */ sys_var *system_vars; /* server variables for this plugin */
......
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