put status variables in the proper pluginname_ scope
(but support the scopeless mysql style too). always output status/system variables in the correct lettercase
This commit is contained in:
parent
c7eead7a96
commit
775e82638b
@ -44,7 +44,7 @@ set global example_ulong_var=500;
|
|||||||
set global example_enum_var= e1;
|
set global example_enum_var= e1;
|
||||||
show status like 'example%';
|
show status like 'example%';
|
||||||
Variable_name Value
|
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%';
|
show variables like 'example%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
example_enum_var e1
|
example_enum_var e1
|
||||||
|
@ -9,8 +9,8 @@ ERROR 42S22: Unknown column 'foobar' in 'field list'
|
|||||||
show status like 'audit_null%';
|
show status like 'audit_null%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Audit_null_called 9
|
Audit_null_called 9
|
||||||
Audit_null_general_error 1
|
|
||||||
Audit_null_general_log 3
|
Audit_null_general_log 3
|
||||||
|
Audit_null_general_error 1
|
||||||
Audit_null_general_result 2
|
Audit_null_general_result 2
|
||||||
create procedure au1(x char(16)) select concat("test1", x);
|
create procedure au1(x char(16)) select concat("test1", x);
|
||||||
call au1("-12");
|
call au1("-12");
|
||||||
@ -19,8 +19,8 @@ test1-12
|
|||||||
show status like 'audit_null%';
|
show status like 'audit_null%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
Audit_null_called 19
|
Audit_null_called 19
|
||||||
Audit_null_general_error 1
|
|
||||||
Audit_null_general_log 7
|
Audit_null_general_log 7
|
||||||
|
Audit_null_general_error 1
|
||||||
Audit_null_general_result 5
|
Audit_null_general_result 5
|
||||||
uninstall plugin audit_null;
|
uninstall plugin audit_null;
|
||||||
Warnings:
|
Warnings:
|
||||||
|
@ -127,12 +127,10 @@ static struct st_mysql_audit audit_null_descriptor=
|
|||||||
|
|
||||||
static struct st_mysql_show_var simple_status[]=
|
static struct st_mysql_show_var simple_status[]=
|
||||||
{
|
{
|
||||||
{ "Audit_null_called", (char *) &number_of_calls, SHOW_INT },
|
{ "called", (char *) &number_of_calls, SHOW_INT },
|
||||||
{ "Audit_null_general_log", (char *) &number_of_calls_general_log, SHOW_INT },
|
{ "general_log", (char *) &number_of_calls_general_log, SHOW_INT },
|
||||||
{ "Audit_null_general_error", (char *) &number_of_calls_general_error,
|
{ "general_error", (char *) &number_of_calls_general_error, SHOW_INT },
|
||||||
SHOW_INT },
|
{ "general_result", (char *) &number_of_calls_general_result, SHOW_INT },
|
||||||
{ "Audit_null_general_result", (char *) &number_of_calls_general_result,
|
|
||||||
SHOW_INT },
|
|
||||||
{ 0, 0, 0}
|
{ 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,23 +85,6 @@ static struct st_mysql_auth socket_auth_handler=
|
|||||||
socket_auth
|
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)
|
maria_declare_plugin(socket_auth)
|
||||||
{
|
{
|
||||||
MYSQL_AUTHENTICATION_PLUGIN,
|
MYSQL_AUTHENTICATION_PLUGIN,
|
||||||
|
@ -188,23 +188,6 @@ struct st_mysql_daemon daemon_example_plugin=
|
|||||||
Plugin library descriptor
|
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)
|
maria_declare_plugin(daemon_example)
|
||||||
{
|
{
|
||||||
MYSQL_DAEMON_PLUGIN,
|
MYSQL_DAEMON_PLUGIN,
|
||||||
|
@ -254,24 +254,6 @@ static struct st_mysql_sys_var* simple_system_variables[]= {
|
|||||||
Plugin library descriptor
|
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)
|
maria_declare_plugin(ftexample)
|
||||||
{
|
{
|
||||||
MYSQL_FTPARSER_PLUGIN, /* type */
|
MYSQL_FTPARSER_PLUGIN, /* type */
|
||||||
|
@ -144,24 +144,6 @@ static struct st_mysql_audit descriptor =
|
|||||||
{ MYSQL_AUDIT_GENERAL_CLASSMASK }
|
{ 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)
|
maria_declare_plugin(sql_errlog)
|
||||||
{
|
{
|
||||||
MYSQL_AUDIT_PLUGIN,
|
MYSQL_AUDIT_PLUGIN,
|
||||||
|
@ -1133,22 +1133,21 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
|
|||||||
|
|
||||||
if (plugin->plugin->status_vars)
|
if (plugin->plugin->status_vars)
|
||||||
{
|
{
|
||||||
#ifdef FIX_LATER
|
/*
|
||||||
/**
|
historical ndb behavior caused MySQL plugins to specify
|
||||||
@todo
|
status var names in full, with the plugin name prefix.
|
||||||
unfortunately, status variables were introduced without a
|
this was never fixed in MySQL.
|
||||||
pluginname_ namespace, that is pluginname_ was not added automatically
|
MariaDB fixes that but support MySQL style too.
|
||||||
to status variable names. It should be fixed together with the next
|
|
||||||
incompatible API change.
|
|
||||||
*/
|
*/
|
||||||
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},
|
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
|
||||||
{0, 0, SHOW_UNDEF}
|
{0, 0, SHOW_UNDEF}
|
||||||
};
|
};
|
||||||
remove_status_vars(array);
|
if (strncasecmp(show_vars->name, plugin->name.str, plugin->name.length))
|
||||||
#else
|
show_vars= tmp_array;
|
||||||
remove_status_vars(plugin->plugin->status_vars);
|
|
||||||
#endif /* FIX_LATER */
|
remove_status_vars(show_vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin_type_deinitialize[plugin->plugin->type])
|
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)
|
if (plugin->plugin->status_vars)
|
||||||
{
|
{
|
||||||
#ifdef FIX_LATER
|
|
||||||
/*
|
/*
|
||||||
We have a problem right now where we can not prepend without
|
historical ndb behavior caused MySQL plugins to specify
|
||||||
breaking backwards compatibility. We will fix this shortly so
|
status var names in full, with the plugin name prefix.
|
||||||
that engines have "use names" and we wil use those for
|
this was never fixed in MySQL.
|
||||||
CREATE TABLE, and use the plugin name then for adding automatic
|
MariaDB fixes that, but supports MySQL style too.
|
||||||
variable names.
|
|
||||||
*/
|
*/
|
||||||
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},
|
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
|
||||||
{0, 0, SHOW_UNDEF}
|
{0, 0, SHOW_UNDEF}
|
||||||
};
|
};
|
||||||
if (add_status_vars(array)) // add_status_vars makes a copy
|
if (strncasecmp(show_vars->name, plugin->name.str, plugin->name.length))
|
||||||
|
show_vars= tmp_array;
|
||||||
|
|
||||||
|
if (add_status_vars(show_vars))
|
||||||
goto err;
|
goto err;
|
||||||
#else
|
|
||||||
if (add_status_vars(plugin->plugin->status_vars))
|
|
||||||
goto err;
|
|
||||||
#endif /* FIX_LATER */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2626,7 +2626,7 @@ static bool status_vars_inited= 0;
|
|||||||
C_MODE_START
|
C_MODE_START
|
||||||
static int show_var_cmp(const void *var1, const void *var2)
|
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
|
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 */
|
name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
|
||||||
if (ucase_names)
|
if (ucase_names)
|
||||||
my_caseup_str(system_charset_info, name_buffer);
|
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);
|
restore_record(table, s->default_values);
|
||||||
table->field[0]->store(name_buffer, strlen(name_buffer),
|
table->field[0]->store(name_buffer, strlen(name_buffer),
|
||||||
|
@ -2568,21 +2568,21 @@ struct st_mysql_storage_engine cassandra_storage_engine=
|
|||||||
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
|
||||||
|
|
||||||
static SHOW_VAR cassandra_status_variables[]= {
|
static SHOW_VAR cassandra_status_variables[]= {
|
||||||
{"Cassandra_row_inserts",
|
{"row_inserts",
|
||||||
(char*) &cassandra_counters.row_inserts, SHOW_LONG},
|
(char*) &cassandra_counters.row_inserts, SHOW_LONG},
|
||||||
{"Cassandra_row_insert_batches",
|
{"row_insert_batches",
|
||||||
(char*) &cassandra_counters.row_insert_batches, SHOW_LONG},
|
(char*) &cassandra_counters.row_insert_batches, SHOW_LONG},
|
||||||
|
|
||||||
{"Cassandra_multiget_keys_scanned",
|
{"multiget_keys_scanned",
|
||||||
(char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG},
|
(char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG},
|
||||||
{"Cassandra_multiget_reads",
|
{"multiget_reads",
|
||||||
(char*) &cassandra_counters.multiget_reads, SHOW_LONG},
|
(char*) &cassandra_counters.multiget_reads, SHOW_LONG},
|
||||||
{"Cassandra_multiget_rows_read",
|
{"multiget_rows_read",
|
||||||
(char*) &cassandra_counters.multiget_rows_read, SHOW_LONG},
|
(char*) &cassandra_counters.multiget_rows_read, SHOW_LONG},
|
||||||
|
|
||||||
{"Cassandra_timeout_exceptions",
|
{"timeout_exceptions",
|
||||||
(char*) &cassandra_counters.timeout_exceptions, SHOW_LONG},
|
(char*) &cassandra_counters.timeout_exceptions, SHOW_LONG},
|
||||||
{"Cassandra_unavailable_exceptions",
|
{"unavailable_exceptions",
|
||||||
(char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG},
|
(char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG},
|
||||||
{NullS, NullS, SHOW_LONG}
|
{NullS, NullS, SHOW_LONG}
|
||||||
};
|
};
|
||||||
|
@ -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[]=
|
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}
|
{0,0,SHOW_UNDEF}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3753,11 +3753,6 @@ SHOW_VAR status_variables[]= {
|
|||||||
{NullS, NullS, SHOW_LONG}
|
{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
|
* Maria MRR implementation: use DS-MRR
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -3832,7 +3827,7 @@ maria_declare_plugin(aria)
|
|||||||
ha_maria_init, /* Plugin Init */
|
ha_maria_init, /* Plugin Init */
|
||||||
NULL, /* Plugin Deinit */
|
NULL, /* Plugin Deinit */
|
||||||
0x0105, /* 1.5 */
|
0x0105, /* 1.5 */
|
||||||
aria_status_variables, /* status variables */
|
status_variables, /* status variables */
|
||||||
system_variables, /* system variables */
|
system_variables, /* system variables */
|
||||||
"1.5", /* string version */
|
"1.5", /* string version */
|
||||||
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user