1
diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
2
--- a/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 14:35:00.000000000 +0900
3
+++ b/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 14:36:22.000000000 +0900
4
@@ -11259,6 +11259,7 @@
5
i_s_innodb_cmpmem_reset,
6
i_s_innodb_table_stats,
7
i_s_innodb_index_stats,
8
+i_s_innodb_admin_command,
10
mysql_declare_plugin_end;
12
diff -ruN a/storage/innodb_plugin/handler/i_s.cc b/storage/innodb_plugin/handler/i_s.cc
13
--- a/storage/innodb_plugin/handler/i_s.cc 2010-04-30 10:49:58.000000000 +0900
14
+++ b/storage/innodb_plugin/handler/i_s.cc 2010-04-30 14:36:22.000000000 +0900
15
@@ -2997,3 +2997,140 @@
16
STRUCT_FLD(system_vars, NULL),
17
STRUCT_FLD(__reserved1, NULL)
20
+/***********************************************************************
22
+static ST_FIELD_INFO i_s_innodb_admin_command_info[] =
24
+ {STRUCT_FLD(field_name, "result_message"),
25
+ STRUCT_FLD(field_length, 1024),
26
+ STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
27
+ STRUCT_FLD(value, 0),
28
+ STRUCT_FLD(field_flags, 0),
29
+ STRUCT_FLD(old_name, ""),
30
+ STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
32
+ END_OF_ST_FIELD_INFO
35
+#ifndef INNODB_COMPATIBILITY_HOOKS
36
+#error InnoDB needs MySQL to be built with #define INNODB_COMPATIBILITY_HOOKS
40
+char **thd_query(MYSQL_THD thd);
45
+i_s_innodb_admin_command_fill(
46
+/*==========================*/
51
+ TABLE* i_s_table = (TABLE *) tables->table;
52
+ CHARSET_INFO *cs= system_charset_info;
56
+ char* command_head = "XTRA_";
58
+ DBUG_ENTER("i_s_innodb_admin_command_fill");
60
+ /* deny access to non-superusers */
61
+ if (check_global_access(thd, PROCESS_ACL)) {
65
+ if(thd_sql_command(thd) != SQLCOM_SELECT) {
66
+ field_store_string(i_s_table->field[0],
67
+ "SELECT command is only accepted.");
71
+ query_str = thd_query(thd);
74
+ for (; *ptr; ptr++) {
75
+ if (*ptr == quote) {
78
+ } else if (*ptr == '`' || *ptr == '"') {
82
+ for (i = 0; command_head[i]; i++) {
83
+ if (toupper((int)(unsigned char)(ptr[i]))
84
+ != toupper((int)(unsigned char)
85
+ (command_head[i]))) {
96
+ field_store_string(i_s_table->field[0],
97
+ "No XTRA_* command in the SQL statement."
98
+ " Please add /*!XTRA_xxxx*/ to the SQL.");
102
+ if (!strncasecmp("XTRA_HELLO", ptr, 10)) {
103
+ /* This is example command XTRA_HELLO */
105
+ ut_print_timestamp(stderr);
106
+ fprintf(stderr, " InnoDB: administration command test for XtraDB"
107
+ " 'XTRA_HELLO' was detected.\n");
109
+ field_store_string(i_s_table->field[0],
114
+ field_store_string(i_s_table->field[0],
115
+ "Undefined XTRA_* command.");
119
+ if (schema_table_store_record(thd, i_s_table)) {
128
+i_s_innodb_admin_command_init(
129
+/*==========================*/
132
+ DBUG_ENTER("i_s_innodb_admin_command_init");
133
+ ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
135
+ schema->fields_info = i_s_innodb_admin_command_info;
136
+ schema->fill_table = i_s_innodb_admin_command_fill;
141
+UNIV_INTERN struct st_mysql_plugin i_s_innodb_admin_command =
143
+ STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
144
+ STRUCT_FLD(info, &i_s_info),
145
+ STRUCT_FLD(name, "XTRADB_ADMIN_COMMAND"),
146
+ STRUCT_FLD(author, plugin_author),
147
+ STRUCT_FLD(descr, "XtraDB specific command acceptor"),
148
+ STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
149
+ STRUCT_FLD(init, i_s_innodb_admin_command_init),
150
+ STRUCT_FLD(deinit, i_s_common_deinit),
151
+ STRUCT_FLD(version, 0x0100 /* 1.0 */),
152
+ STRUCT_FLD(status_vars, NULL),
153
+ STRUCT_FLD(system_vars, NULL),
154
+ STRUCT_FLD(__reserved1, NULL)
156
diff -ruN a/storage/innodb_plugin/handler/i_s.h b/storage/innodb_plugin/handler/i_s.h
157
--- a/storage/innodb_plugin/handler/i_s.h 2010-04-30 10:49:58.000000000 +0900
158
+++ b/storage/innodb_plugin/handler/i_s.h 2010-04-30 14:36:22.000000000 +0900
160
extern struct st_mysql_plugin i_s_innodb_rseg;
161
extern struct st_mysql_plugin i_s_innodb_table_stats;
162
extern struct st_mysql_plugin i_s_innodb_index_stats;
163
+extern struct st_mysql_plugin i_s_innodb_admin_command;
166
diff -ruN a/storage/innodb_plugin/handler/innodb_patch_info.h b/storage/innodb_plugin/handler/innodb_patch_info.h
167
--- a/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 14:35:00.000000000 +0900
168
+++ b/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 14:36:22.000000000 +0900
170
{"innodb_stats","Additional features about InnoDB statistics/optimizer","","http://www.percona.com/docs/wiki/percona-xtradb"},
171
{"innodb_recovery_patches","Bugfixes and adjustments about recovery process","","http://www.percona.com/docs/wiki/percona-xtradb"},
172
{"innodb_purge_thread","Enable to use purge devoted thread","","http://www.percona.com/docs/wiki/percona-xtradb"},
173
+{"innodb_admin_command_base","XtraDB specific command interface through i_s","","http://www.percona.com/docs/wiki/percona-xtradb"},
174
{NULL, NULL, NULL, NULL}