summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-04-09 23:27:33 +0200
committerSergei Golubchik <sergii@pisem.net>2013-04-09 23:27:33 +0200
commit775e82638b825747a2a8b7cf7d6d29c872693422 (patch)
tree7cb178d1273c5d993544b881a6bb93a33f75cfac
parentc7eead7a965b33fbad5099c927d2bb0723725bf3 (diff)
downloadmariadb-git-775e82638b825747a2a8b7cf7d6d29c872693422.tar.gz
put status variables in the proper pluginname_ scope
(but support the scopeless mysql style too). always output status/system variables in the correct lettercase
-rw-r--r--mysql-test/r/plugin.result2
-rw-r--r--mysql-test/suite/plugins/r/audit_null.result4
-rw-r--r--plugin/audit_null/audit_null.c10
-rw-r--r--plugin/auth_socket/auth_socket.c17
-rw-r--r--plugin/daemon_example/daemon_example.cc17
-rw-r--r--plugin/fulltext/plugin_example.c18
-rw-r--r--plugin/sql_errlog/sql_errlog.c18
-rw-r--r--sql/sql_plugin.cc45
-rw-r--r--sql/sql_show.cc13
-rw-r--r--storage/cassandra/ha_cassandra.cc14
-rw-r--r--storage/example/ha_example.cc2
-rw-r--r--storage/maria/ha_maria.cc7
12 files changed, 49 insertions, 118 deletions
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index 06e343a0886..0eb49584c4a 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -44,7 +44,7 @@ set global example_ulong_var=500;
set global example_enum_var= e1;
show status like 'example%';
Variable_name Value
-example_func_example enum_var is 0, ulong_var is 500, really
+Example_func_example enum_var is 0, ulong_var is 500, really
show variables like 'example%';
Variable_name Value
example_enum_var e1
diff --git a/mysql-test/suite/plugins/r/audit_null.result b/mysql-test/suite/plugins/r/audit_null.result
index 4cf648510e6..2b1b64a9d85 100644
--- a/mysql-test/suite/plugins/r/audit_null.result
+++ b/mysql-test/suite/plugins/r/audit_null.result
@@ -9,8 +9,8 @@ ERROR 42S22: Unknown column 'foobar' in 'field list'
show status like 'audit_null%';
Variable_name Value
Audit_null_called 9
-Audit_null_general_error 1
Audit_null_general_log 3
+Audit_null_general_error 1
Audit_null_general_result 2
create procedure au1(x char(16)) select concat("test1", x);
call au1("-12");
@@ -19,8 +19,8 @@ test1-12
show status like 'audit_null%';
Variable_name Value
Audit_null_called 19
-Audit_null_general_error 1
Audit_null_general_log 7
+Audit_null_general_error 1
Audit_null_general_result 5
uninstall plugin audit_null;
Warnings:
diff --git a/plugin/audit_null/audit_null.c b/plugin/audit_null/audit_null.c
index be0c70fbd35..0616f192f20 100644
--- a/plugin/audit_null/audit_null.c
+++ b/plugin/audit_null/audit_null.c
@@ -127,12 +127,10 @@ static struct st_mysql_audit audit_null_descriptor=
static struct st_mysql_show_var simple_status[]=
{
- { "Audit_null_called", (char *) &number_of_calls, SHOW_INT },
- { "Audit_null_general_log", (char *) &number_of_calls_general_log, SHOW_INT },
- { "Audit_null_general_error", (char *) &number_of_calls_general_error,
- SHOW_INT },
- { "Audit_null_general_result", (char *) &number_of_calls_general_result,
- SHOW_INT },
+ { "called", (char *) &number_of_calls, SHOW_INT },
+ { "general_log", (char *) &number_of_calls_general_log, SHOW_INT },
+ { "general_error", (char *) &number_of_calls_general_error, SHOW_INT },
+ { "general_result", (char *) &number_of_calls_general_result, SHOW_INT },
{ 0, 0, 0}
};
diff --git a/plugin/auth_socket/auth_socket.c b/plugin/auth_socket/auth_socket.c
index 41cb1039fd2..78d7e769f7b 100644
--- a/plugin/auth_socket/auth_socket.c
+++ b/plugin/auth_socket/auth_socket.c
@@ -85,23 +85,6 @@ static struct st_mysql_auth socket_auth_handler=
socket_auth
};
-mysql_declare_plugin(socket_auth)
-{
- MYSQL_AUTHENTICATION_PLUGIN,
- &socket_auth_handler,
- "unix_socket",
- "Sergei Golubchik",
- "Unix Socket based authentication",
- PLUGIN_LICENSE_GPL,
- NULL,
- NULL,
- 0x0100,
- NULL,
- NULL,
- NULL,
- 0,
-}
-mysql_declare_plugin_end;
maria_declare_plugin(socket_auth)
{
MYSQL_AUTHENTICATION_PLUGIN,
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc
index ec2979de3c3..7d047b2eaf7 100644
--- a/plugin/daemon_example/daemon_example.cc
+++ b/plugin/daemon_example/daemon_example.cc
@@ -188,23 +188,6 @@ struct st_mysql_daemon daemon_example_plugin=
Plugin library descriptor
*/
-mysql_declare_plugin(daemon_example)
-{
- MYSQL_DAEMON_PLUGIN,
- &daemon_example_plugin,
- "daemon_example",
- "Brian Aker",
- "Daemon example, creates a heartbeat beat file in mysql-heartbeat.log",
- PLUGIN_LICENSE_GPL,
- daemon_example_plugin_init, /* Plugin Init */
- daemon_example_plugin_deinit, /* Plugin Deinit */
- 0x0100 /* 1.0 */,
- NULL, /* status variables */
- NULL, /* system variables */
- NULL, /* config options */
- 0, /* flags */
-}
-mysql_declare_plugin_end;
maria_declare_plugin(daemon_example)
{
MYSQL_DAEMON_PLUGIN,
diff --git a/plugin/fulltext/plugin_example.c b/plugin/fulltext/plugin_example.c
index 981335bddd6..2af3555393c 100644
--- a/plugin/fulltext/plugin_example.c
+++ b/plugin/fulltext/plugin_example.c
@@ -254,24 +254,6 @@ static struct st_mysql_sys_var* simple_system_variables[]= {
Plugin library descriptor
*/
-mysql_declare_plugin(ftexample)
-{
- MYSQL_FTPARSER_PLUGIN, /* type */
- &simple_parser_descriptor, /* descriptor */
- "simple_parser", /* name */
- "Sergei Golubchik", /* author */
- "Simple Full-Text Parser", /* description */
- PLUGIN_LICENSE_GPL,
- simple_parser_plugin_init, /* init function (when loaded) */
- simple_parser_plugin_deinit,/* deinit function (when unloaded) */
- 0x0001, /* version */
- simple_status, /* status variables */
- simple_system_variables, /* system variables */
- NULL,
- 0,
-}
-mysql_declare_plugin_end;
-
maria_declare_plugin(ftexample)
{
MYSQL_FTPARSER_PLUGIN, /* type */
diff --git a/plugin/sql_errlog/sql_errlog.c b/plugin/sql_errlog/sql_errlog.c
index ce383916621..f84af963aca 100644
--- a/plugin/sql_errlog/sql_errlog.c
+++ b/plugin/sql_errlog/sql_errlog.c
@@ -144,24 +144,6 @@ static struct st_mysql_audit descriptor =
{ MYSQL_AUDIT_GENERAL_CLASSMASK }
};
-mysql_declare_plugin(sql_errlog)
-{
- MYSQL_AUDIT_PLUGIN,
- &descriptor,
- "SQL_ERROR_LOG",
- "Alexey Botchkov",
- "Log SQL level errors to a file with rotation",
- PLUGIN_LICENSE_GPL,
- sql_error_log_init,
- sql_error_log_deinit,
- 0x0100,
- NULL,
- vars,
- NULL,
- 0
-}
-mysql_declare_plugin_end;
-
maria_declare_plugin(sql_errlog)
{
MYSQL_AUDIT_PLUGIN,
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 8d2379d7738..e04a6f7c1eb 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1133,22 +1133,21 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
if (plugin->plugin->status_vars)
{
-#ifdef FIX_LATER
- /**
- @todo
- unfortunately, status variables were introduced without a
- pluginname_ namespace, that is pluginname_ was not added automatically
- to status variable names. It should be fixed together with the next
- incompatible API change.
+ /*
+ historical ndb behavior caused MySQL plugins to specify
+ status var names in full, with the plugin name prefix.
+ this was never fixed in MySQL.
+ MariaDB fixes that but support MySQL style too.
*/
- SHOW_VAR array[2]= {
+ SHOW_VAR *show_vars= plugin->plugin->status_vars;
+ SHOW_VAR tmp_array[2]= {
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
{0, 0, SHOW_UNDEF}
};
- remove_status_vars(array);
-#else
- remove_status_vars(plugin->plugin->status_vars);
-#endif /* FIX_LATER */
+ if (strncasecmp(show_vars->name, plugin->name.str, plugin->name.length))
+ show_vars= tmp_array;
+
+ remove_status_vars(show_vars);
}
if (plugin_type_deinitialize[plugin->plugin->type])
@@ -1358,24 +1357,22 @@ static int plugin_initialize(struct st_plugin_int *plugin)
if (plugin->plugin->status_vars)
{
-#ifdef FIX_LATER
/*
- We have a problem right now where we can not prepend without
- breaking backwards compatibility. We will fix this shortly so
- that engines have "use names" and we wil use those for
- CREATE TABLE, and use the plugin name then for adding automatic
- variable names.
+ historical ndb behavior caused MySQL plugins to specify
+ status var names in full, with the plugin name prefix.
+ this was never fixed in MySQL.
+ MariaDB fixes that, but supports MySQL style too.
*/
- SHOW_VAR array[2]= {
+ SHOW_VAR *show_vars= plugin->plugin->status_vars;
+ SHOW_VAR tmp_array[2]= {
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
{0, 0, SHOW_UNDEF}
};
- if (add_status_vars(array)) // add_status_vars makes a copy
- goto err;
-#else
- if (add_status_vars(plugin->plugin->status_vars))
+ if (strncasecmp(show_vars->name, plugin->name.str, plugin->name.length))
+ show_vars= tmp_array;
+
+ if (add_status_vars(show_vars))
goto err;
-#endif /* FIX_LATER */
}
/*
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index eea1289015a..ac71837def4 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2626,7 +2626,7 @@ static bool status_vars_inited= 0;
C_MODE_START
static int show_var_cmp(const void *var1, const void *var2)
{
- return strcmp(((SHOW_VAR*)var1)->name, ((SHOW_VAR*)var2)->name);
+ return strcasecmp(((SHOW_VAR*)var1)->name, ((SHOW_VAR*)var2)->name);
}
C_MODE_END
@@ -2831,6 +2831,17 @@ static bool show_status_array(THD *thd, const char *wild,
name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
if (ucase_names)
my_caseup_str(system_charset_info, name_buffer);
+ else
+ {
+ my_casedn_str(system_charset_info, name_buffer);
+ DBUG_ASSERT(name_buffer[0] >= 'a');
+ DBUG_ASSERT(name_buffer[0] <= 'z');
+
+ /* traditionally status variables have a first letter uppercased */
+ if (status_var)
+ name_buffer[0]-= 'a' - 'A';
+ }
+
restore_record(table, s->default_values);
table->field[0]->store(name_buffer, strlen(name_buffer),
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc
index 968d23c94b5..1ab64dcb697 100644
--- a/storage/cassandra/ha_cassandra.cc
+++ b/storage/cassandra/ha_cassandra.cc
@@ -2568,21 +2568,21 @@ struct st_mysql_storage_engine cassandra_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
static SHOW_VAR cassandra_status_variables[]= {
- {"Cassandra_row_inserts",
+ {"row_inserts",
(char*) &cassandra_counters.row_inserts, SHOW_LONG},
- {"Cassandra_row_insert_batches",
+ {"row_insert_batches",
(char*) &cassandra_counters.row_insert_batches, SHOW_LONG},
- {"Cassandra_multiget_keys_scanned",
+ {"multiget_keys_scanned",
(char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG},
- {"Cassandra_multiget_reads",
+ {"multiget_reads",
(char*) &cassandra_counters.multiget_reads, SHOW_LONG},
- {"Cassandra_multiget_rows_read",
+ {"multiget_rows_read",
(char*) &cassandra_counters.multiget_rows_read, SHOW_LONG},
- {"Cassandra_timeout_exceptions",
+ {"timeout_exceptions",
(char*) &cassandra_counters.timeout_exceptions, SHOW_LONG},
- {"Cassandra_unavailable_exceptions",
+ {"unavailable_exceptions",
(char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index bcf934b6b1c..0dc8e27fe61 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -1117,7 +1117,7 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
static struct st_mysql_show_var func_status[]=
{
- {"example_func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC},
+ {"func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC},
{0,0,SHOW_UNDEF}
};
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 6ea1dccc40b..1a11bdd6050 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -3753,11 +3753,6 @@ SHOW_VAR status_variables[]= {
{NullS, NullS, SHOW_LONG}
};
-static struct st_mysql_show_var aria_status_variables[]= {
- {"Aria", (char*) &status_variables, SHOW_ARRAY},
- {NullS, NullS, SHOW_LONG}
-};
-
/****************************************************************************
* Maria MRR implementation: use DS-MRR
***************************************************************************/
@@ -3832,7 +3827,7 @@ maria_declare_plugin(aria)
ha_maria_init, /* Plugin Init */
NULL, /* Plugin Deinit */
0x0105, /* 1.5 */
- aria_status_variables, /* status variables */
+ status_variables, /* status variables */
system_variables, /* system variables */
"1.5", /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */