summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_install.result3
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_load.result3
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_send.result3
-rw-r--r--plugin/feedback/utils.cc16
-rw-r--r--sql/sql_plugin.cc4
-rw-r--r--sql/sql_plugin.h1
6 files changed, 24 insertions, 6 deletions
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_install.result b/mysql-test/suite/plugins/r/feedback_plugin_install.result
index b1b35072a08..37d26b48501 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_install.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_install.result
@@ -5,7 +5,8 @@ ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE
-FEEDBACK 1.1
+FEEDBACK used 1
+FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index d434d1282c5..443b91bf0cc 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -4,7 +4,8 @@ ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE
-FEEDBACK 1.1
+FEEDBACK used 1
+FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index db622cb3f97..2852240ca5b 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -4,7 +4,8 @@ ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE
-FEEDBACK 1.1
+FEEDBACK used 2
+FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc
index 48bbd72d530..f81fde2ab8f 100644
--- a/plugin/feedback/utils.cc
+++ b/plugin/feedback/utils.cc
@@ -152,26 +152,36 @@ namespace feedback {
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)
{
TABLE *table= (TABLE*) arg;
+ char name[NAME_LEN*2];
+ size_t name_len;
char version[20];
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",
(plugin_decl(plugin)->version) >> 8,
(plugin_decl(plugin)->version) & 0xff);
- INSERT2(plugin_name(plugin)->str, plugin_name(plugin)->length,
+ INSERT2(name, name_len,
(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;
}
/**
- 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)
{
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 33bc60f2336..a7d7f464fca 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -980,9 +980,13 @@ plugin_ref plugin_lock(THD *thd, plugin_ref ptr)
without a mutex.
*/
if (! plugin_dlib(ptr))
+ {
+ plugin_ref_to_int(ptr)->locks_total++;
DBUG_RETURN(ptr);
+ }
#endif
mysql_mutex_lock(&LOCK_plugin);
+ plugin_ref_to_int(ptr)->locks_total++;
rc= my_intern_plugin_lock_ci(lex, ptr);
mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(rc);
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h
index fc059142e24..eaa368f3515 100644
--- a/sql/sql_plugin.h
+++ b/sql/sql_plugin.h
@@ -99,6 +99,7 @@ struct st_plugin_int
struct st_plugin_dl *plugin_dl;
uint state;
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 */
MEM_ROOT mem_root; /* memory for dynamic plugin structures */
sys_var *system_vars; /* server variables for this plugin */