~percona-dev/percona-server/release-5.1.52-12-rnt

102.1.1 by kinoyasu
add header and rule, as the first step of the reordering patch for separate release
1
# name       : innodb_admin_command_base.patch
2
# introduced : 11 or before
3
# maintainer : Yasufumi
4
#
5
#!!! notice !!!
6
# Any small change to this file in the main branch
7
# should be done or reviewed by the maintainer!
106 by kinoyasu
Port Yasufumi maintaining patches to 5.1.50:
8
diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
9
--- a/storage/innodb_plugin/handler/ha_innodb.cc	2010-08-27 16:27:30.222410116 +0900
10
+++ b/storage/innodb_plugin/handler/ha_innodb.cc	2010-08-27 16:27:44.073104773 +0900
133 by kinoyasu
port maintainer-Yasufumi patches for 5.1.52
11
@@ -11507,6 +11507,7 @@
1 by kinoyasu
merge, reorder and port patches based on mysql 5.1.46 innodb 1.0.7
12
 i_s_innodb_cmpmem_reset,
13
 i_s_innodb_table_stats,
14
 i_s_innodb_index_stats,
15
+i_s_innodb_admin_command,
16
 i_s_innodb_patches
17
 mysql_declare_plugin_end;
18
 
106 by kinoyasu
Port Yasufumi maintaining patches to 5.1.50:
19
diff -ruN a/storage/innodb_plugin/handler/i_s.cc b/storage/innodb_plugin/handler/i_s.cc
20
--- a/storage/innodb_plugin/handler/i_s.cc	2010-08-27 16:22:04.261021936 +0900
21
+++ b/storage/innodb_plugin/handler/i_s.cc	2010-08-27 16:27:44.077058655 +0900
133 by kinoyasu
port maintainer-Yasufumi patches for 5.1.52
22
@@ -2948,3 +2948,139 @@
1 by kinoyasu
merge, reorder and port patches based on mysql 5.1.46 innodb 1.0.7
23
 	STRUCT_FLD(system_vars, NULL),
24
 	STRUCT_FLD(__reserved1, NULL)
25
 };
26
+
27
+/***********************************************************************
28
+*/
29
+static ST_FIELD_INFO	i_s_innodb_admin_command_info[] =
30
+{
31
+	{STRUCT_FLD(field_name,		"result_message"),
32
+	 STRUCT_FLD(field_length,	1024),
33
+	 STRUCT_FLD(field_type,		MYSQL_TYPE_STRING),
34
+	 STRUCT_FLD(value,		0),
35
+	 STRUCT_FLD(field_flags,	0),
36
+	 STRUCT_FLD(old_name,		""),
37
+	 STRUCT_FLD(open_method,	SKIP_OPEN_TABLE)},
38
+
39
+	END_OF_ST_FIELD_INFO
40
+};
41
+
42
+#ifndef INNODB_COMPATIBILITY_HOOKS
43
+#error InnoDB needs MySQL to be built with #define INNODB_COMPATIBILITY_HOOKS
44
+#endif
45
+
46
+extern "C" {
47
+char **thd_query(MYSQL_THD thd);
48
+}
49
+
50
+static
51
+int
52
+i_s_innodb_admin_command_fill(
53
+/*==========================*/
54
+	THD*		thd,
55
+	TABLE_LIST*	tables,
56
+	COND*		cond)
57
+{
58
+	TABLE*	i_s_table	= (TABLE *) tables->table;
59
+	char**	query_str;
60
+	char*	ptr;
61
+	char	quote	= '\0';
83.2.3 by kinoyasu
adjust not to cause warnings with -Wall
62
+	const char*	command_head = "XTRA_";
1 by kinoyasu
merge, reorder and port patches based on mysql 5.1.46 innodb 1.0.7
63
+
64
+	DBUG_ENTER("i_s_innodb_admin_command_fill");
65
+
66
+	/* deny access to non-superusers */
67
+	if (check_global_access(thd, PROCESS_ACL)) {
68
+		DBUG_RETURN(0);
69
+	}
70
+
71
+	if(thd_sql_command(thd) != SQLCOM_SELECT) {
72
+		field_store_string(i_s_table->field[0],
73
+			"SELECT command is only accepted.");
74
+		goto end_func;
75
+	}
76
+
77
+	query_str = thd_query(thd);
78
+	ptr = *query_str;
79
+	
80
+	for (; *ptr; ptr++) {
81
+		if (*ptr == quote) {
82
+			quote = '\0';
83
+		} else if (quote) {
84
+		} else if (*ptr == '`' || *ptr == '"') {
85
+			quote = *ptr;
86
+		} else {
87
+			long	i;
88
+			for (i = 0; command_head[i]; i++) {
89
+				if (toupper((int)(unsigned char)(ptr[i]))
90
+				    != toupper((int)(unsigned char)
91
+				      (command_head[i]))) {
92
+					goto nomatch;
93
+				}
94
+			}
95
+			break;
96
+nomatch:
97
+			;
98
+		}
99
+	}
100
+
101
+	if (!*ptr) {
102
+		field_store_string(i_s_table->field[0],
103
+			"No XTRA_* command in the SQL statement."
104
+			" Please add /*!XTRA_xxxx*/ to the SQL.");
105
+		goto end_func;
106
+	}
107
+
108
+	if (!strncasecmp("XTRA_HELLO", ptr, 10)) {
109
+		/* This is example command XTRA_HELLO */
110
+
111
+		ut_print_timestamp(stderr);
112
+		fprintf(stderr, " InnoDB: administration command test for XtraDB"
113
+				" 'XTRA_HELLO' was detected.\n");
114
+
115
+		field_store_string(i_s_table->field[0],
116
+			"Hello!");
117
+		goto end_func;
118
+	}
119
+
120
+	field_store_string(i_s_table->field[0],
121
+		"Undefined XTRA_* command.");
122
+	goto end_func;
123
+
124
+end_func:
125
+	if (schema_table_store_record(thd, i_s_table)) {
126
+		DBUG_RETURN(1);
127
+	} else {
128
+		DBUG_RETURN(0);
129
+	}
130
+}
131
+
132
+static
133
+int
134
+i_s_innodb_admin_command_init(
135
+/*==========================*/
136
+	void*	p)
137
+{
138
+	DBUG_ENTER("i_s_innodb_admin_command_init");
139
+	ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
140
+
141
+	schema->fields_info = i_s_innodb_admin_command_info;
142
+	schema->fill_table = i_s_innodb_admin_command_fill;
143
+
144
+	DBUG_RETURN(0);
145
+}
146
+
147
+UNIV_INTERN struct st_mysql_plugin	i_s_innodb_admin_command =
148
+{
149
+	STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
150
+	STRUCT_FLD(info, &i_s_info),
151
+	STRUCT_FLD(name, "XTRADB_ADMIN_COMMAND"),
152
+	STRUCT_FLD(author, plugin_author),
153
+	STRUCT_FLD(descr, "XtraDB specific command acceptor"),
154
+	STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
155
+	STRUCT_FLD(init, i_s_innodb_admin_command_init),
156
+	STRUCT_FLD(deinit, i_s_common_deinit),
157
+	STRUCT_FLD(version, 0x0100 /* 1.0 */),
158
+	STRUCT_FLD(status_vars, NULL),
159
+	STRUCT_FLD(system_vars, NULL),
160
+	STRUCT_FLD(__reserved1, NULL)
161
+};
106 by kinoyasu
Port Yasufumi maintaining patches to 5.1.50:
162
diff -ruN a/storage/innodb_plugin/handler/i_s.h b/storage/innodb_plugin/handler/i_s.h
163
--- a/storage/innodb_plugin/handler/i_s.h	2010-08-27 16:22:04.261987654 +0900
164
+++ b/storage/innodb_plugin/handler/i_s.h	2010-08-27 16:27:44.079059299 +0900
1 by kinoyasu
merge, reorder and port patches based on mysql 5.1.46 innodb 1.0.7
165
@@ -40,5 +40,6 @@
166
 extern struct st_mysql_plugin	i_s_innodb_rseg;
167
 extern struct st_mysql_plugin	i_s_innodb_table_stats;
168
 extern struct st_mysql_plugin	i_s_innodb_index_stats;
169
+extern struct st_mysql_plugin	i_s_innodb_admin_command;
170
 
171
 #endif /* i_s_h */
106 by kinoyasu
Port Yasufumi maintaining patches to 5.1.50:
172
diff -ruN a/storage/innodb_plugin/handler/innodb_patch_info.h b/storage/innodb_plugin/handler/innodb_patch_info.h
173
--- a/storage/innodb_plugin/handler/innodb_patch_info.h	2010-08-27 16:27:30.223001821 +0900
174
+++ b/storage/innodb_plugin/handler/innodb_patch_info.h	2010-08-27 16:27:44.074104321 +0900
175
@@ -38,5 +38,6 @@
176
 {"innodb_stats","Additional features about InnoDB statistics/optimizer","","http://www.percona.com/docs/wiki/percona-xtradb"},
177
 {"innodb_recovery_patches","Bugfixes and adjustments about recovery process","","http://www.percona.com/docs/wiki/percona-xtradb"},
178
 {"innodb_purge_thread","Enable to use purge devoted thread","","http://www.percona.com/docs/wiki/percona-xtradb"},
179
+{"innodb_admin_command_base","XtraDB specific command interface through i_s","","http://www.percona.com/docs/wiki/percona-xtradb"},
180
 {NULL, NULL, NULL, NULL}
181
 };