summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2014-08-11 05:45:45 +0400
committerAlexander Barkov <bar@mariadb.org>2014-08-11 05:45:45 +0400
commit22a64047d14d1199ced885f63bcccd39459681d6 (patch)
tree8087b8b89fe8602f43355f88ce91c8ce1e34b55b /plugin
parent4105cbf4a230c82ea7dee31d4d2262b798fad9f4 (diff)
downloadmariadb-git-22a64047d14d1199ced885f63bcccd39459681d6.tar.gz
MDEV-6274 Collation usage statistics
Adding collation usage statistics into the feedback plugin I_S table.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/feedback/feedback.cc3
-rw-r--r--plugin/feedback/feedback.h1
-rw-r--r--plugin/feedback/utils.cc19
3 files changed, 22 insertions, 1 deletions
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index 54459ae6f17..f644bd597d9 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -217,7 +217,8 @@ int fill_feedback(THD *thd, TABLE_LIST *tables, COND *unused)
tables->schema_table= i_s_feedback;
res= res || fill_plugin_version(thd, tables)
|| fill_misc_data(thd, tables)
- || fill_linux_info(thd, tables);
+ || fill_linux_info(thd, tables)
+ || fill_collation_statistics(thd, tables);
return res;
}
diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h
index c5acbb5ef72..c2091afdedc 100644
--- a/plugin/feedback/feedback.h
+++ b/plugin/feedback/feedback.h
@@ -22,6 +22,7 @@ int fill_feedback(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_plugin_version(THD *thd, TABLE_LIST *tables);
int fill_misc_data(THD *thd, TABLE_LIST *tables);
int fill_linux_info(THD *thd, TABLE_LIST *tables);
+int fill_collation_statistics(THD *thd, TABLE_LIST *tables);
static const int SERVER_UID_SIZE= 29;
extern char server_uid_buf[SERVER_UID_SIZE+1], *user_info;
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc
index 0510140aee9..b83b69be0ce 100644
--- a/plugin/feedback/utils.cc
+++ b/plugin/feedback/utils.cc
@@ -383,6 +383,25 @@ int fill_misc_data(THD *thd, TABLE_LIST *tables)
return 0;
}
+int fill_collation_statistics(THD *thd, TABLE_LIST *tables)
+{
+ TABLE *table= tables->table;
+ for (uint id= 1; id < MY_ALL_CHARSETS_SIZE; id++)
+ {
+ ulonglong count;
+ if (my_collation_is_known_id(id) &&
+ (count= my_collation_statistics_get_use_count(id)))
+ {
+ char name[MY_CS_NAME_SIZE + 32];
+ size_t namelen= my_snprintf(name, sizeof(name),
+ "Collation used %s",
+ get_charset_name(id));
+ INSERT2(name, namelen, (count, UNSIGNED));
+ }
+ }
+ return 0;
+};
+
/**
calculates the server unique identifier