1 diff -r 327ce7a34c91 mysql-test/r/information_schema.result
2 --- a/mysql-test/r/information_schema.result Fri Nov 07 15:44:23 2008 -0800
3 +++ b/mysql-test/r/information_schema.result Fri Nov 07 15:52:53 2008 -0800
13 CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
14 CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
20 select table_schema,table_name, column_name from
22 table_schema table_name column_name
23 information_schema COLUMNS COLUMN_DEFAULT
24 information_schema COLUMNS COLUMN_TYPE
25 +information_schema PROCESSLIST INFO
26 information_schema ROUTINES ROUTINE_DEFINITION
27 information_schema ROUTINES SQL_MODE
28 information_schema TRIGGERS ACTION_CONDITION
31 SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
33 -information_schema 21
34 +information_schema 22
36 create table t1 (i int, j int);
37 create trigger trg1 before insert on t1 for each row
39 COLUMN_PRIVILEGES TABLE_SCHEMA
40 INDEX_STATISTICS TABLE_SCHEMA
41 KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
44 ROUTINES ROUTINE_SCHEMA
47 COLUMN_PRIVILEGES TABLE_SCHEMA
48 INDEX_STATISTICS TABLE_SCHEMA
49 KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
52 ROUTINES ROUTINE_SCHEMA
55 COLUMN_PRIVILEGES information_schema.COLUMN_PRIVILEGES 1
56 INDEX_STATISTICS information_schema.INDEX_STATISTICS 1
57 KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
58 +PROCESSLIST information_schema.PROCESSLIST 1
59 PROFILING information_schema.PROFILING 1
60 ROUTINES information_schema.ROUTINES 1
61 SCHEMATA information_schema.SCHEMATA 1
62 diff -r 327ce7a34c91 mysql-test/r/information_schema_db.result
63 --- a/mysql-test/r/information_schema_db.result Fri Nov 07 15:44:23 2008 -0800
64 +++ b/mysql-test/r/information_schema_db.result Fri Nov 07 15:52:53 2008 -0800
73 diff -r 327ce7a34c91 mysql-test/r/mysqlshow.result
74 --- a/mysql-test/r/mysqlshow.result Fri Nov 07 15:44:23 2008 -0800
75 +++ b/mysql-test/r/mysqlshow.result Fri Nov 07 15:52:53 2008 -0800
92 diff -r 327ce7a34c91 sql/mysql_priv.h
93 --- a/sql/mysql_priv.h Fri Nov 07 15:44:23 2008 -0800
94 +++ b/sql/mysql_priv.h Fri Nov 07 15:52:53 2008 -0800
97 /* Characters shown for the command in 'show processlist' */
98 #define PROCESS_LIST_WIDTH 100
99 +/* Characters shown for the command in 'information_schema.processlist' */
100 +#define PROCESS_LIST_INFO_WIDTH 65535
102 #define PRECISION_FOR_DOUBLE 53
103 #define PRECISION_FOR_FLOAT 24
104 diff -r 327ce7a34c91 sql/sql_show.cc
105 --- a/sql/sql_show.cc Fri Nov 07 15:44:23 2008 -0800
106 +++ b/sql/sql_show.cc Fri Nov 07 15:52:53 2008 -0800
107 @@ -1466,6 +1466,120 @@
113 +int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
115 + TABLE *table= tables->table;
116 + CHARSET_INFO *cs= system_charset_info;
118 + ulonglong current_timer= my_timer(¤t_timer, frequency);
119 + DBUG_ENTER("fill_process_list");
121 + user= thd->security_ctx->master_access & PROCESS_ACL ?
122 + NullS : thd->security_ctx->priv_user;
124 + VOID(pthread_mutex_lock(&LOCK_thread_count));
128 + I_List_iterator<THD> it(threads);
131 + while ((tmp= it++))
133 + Security_context *tmp_sctx= tmp->security_ctx;
134 + struct st_my_thread_var *mysys_var;
137 + if ((!tmp->vio_ok() && !tmp->system_thread) ||
138 + (user && (!tmp_sctx->user || strcmp(tmp_sctx->user, user))))
141 + restore_record(table, s->default_values);
143 + table->field[0]->store((longlong) tmp->thread_id, TRUE);
145 + val= tmp_sctx->user ? tmp_sctx->user :
146 + (tmp->system_thread ? "system user" : "unauthenticated user");
147 + table->field[1]->store(val, strlen(val), cs);
149 + if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&
150 + thd->security_ctx->host_or_ip[0])
152 + char host[LIST_PROCESS_HOST_LEN + 1];
153 + my_snprintf(host, LIST_PROCESS_HOST_LEN, "%s:%u",
154 + tmp_sctx->host_or_ip, tmp->peer_port);
155 + table->field[2]->store(host, strlen(host), cs);
158 + table->field[2]->store(tmp_sctx->host_or_ip,
159 + strlen(tmp_sctx->host_or_ip), cs);
163 + table->field[3]->store(tmp->db, strlen(tmp->db), cs);
164 + table->field[3]->set_notnull();
167 + if ((mysys_var= tmp->mysys_var))
168 + pthread_mutex_lock(&mysys_var->mutex);
170 + if ((val= (char *) (tmp->killed == THD::KILL_CONNECTION? "Killed" : 0)))
171 + table->field[4]->store(val, strlen(val), cs);
173 + table->field[4]->store(command_name[tmp->command],
174 + strlen(command_name[tmp->command]), cs);
176 + const ulonglong utime= tmp->start_timer ? current_timer - tmp->start_timer : 0;
177 + table->field[5]->store(utime / 1000000, TRUE);
179 +#ifndef EMBEDDED_LIBRARY
180 + val= (char*) (tmp->locked ? "Locked" :
181 + tmp->net.reading_or_writing ?
182 + (tmp->net.reading_or_writing == 2 ?
184 + tmp->command == COM_SLEEP ? "" :
185 + "Reading from net") :
186 + tmp->proc_info ? tmp->proc_info :
188 + tmp->mysys_var->current_cond ?
189 + "Waiting on cond" : NullS);
191 + val= (char *) "Writing to net";
195 + table->field[6]->store(val, strlen(val), cs);
196 + table->field[6]->set_notnull();
200 + pthread_mutex_unlock(&mysys_var->mutex);
205 + table->field[7]->store(tmp->query,
206 + min(PROCESS_LIST_INFO_WIDTH,
207 + tmp->query_length), cs);
208 + table->field[7]->set_notnull();
212 + table->field[8]->store((double)(utime / 1000.0));
214 + if (schema_table_store_record(thd, table))
216 + VOID(pthread_mutex_unlock(&LOCK_thread_count));
223 + VOID(pthread_mutex_unlock(&LOCK_thread_count));
227 /*****************************************************************************
228 @@ -4821,6 +4941,22 @@
229 {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
232 +ST_FIELD_INFO processlist_fields_info[]=
234 + {"ID", 4, MYSQL_TYPE_LONG, 0, 0, "Id"},
235 + {"USER", 16, MYSQL_TYPE_STRING, 0, 0, "User"},
236 + {"HOST", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Host"},
237 + {"DB", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Db"},
238 + {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command"},
239 + {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time"},
240 + {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State"},
241 + {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info"},
242 + {"TIME_MS", 100 * (MY_INT64_NUM_DECIMAL_DIGITS + 1) + 3, MYSQL_TYPE_DECIMAL,
244 + {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
249 Description of ST_FIELD_INFO in table.h
251 @@ -4845,6 +4981,8 @@
252 get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0},
253 {"OPEN_TABLES", open_tables_fields_info, create_schema_table,
254 fill_open_tables, make_old_format, 0, -1, -1, 1},
255 + {"PROCESSLIST", processlist_fields_info, create_schema_table,
256 + fill_schema_processlist, make_old_format, 0, -1, -1, 0},
257 {"PROFILING", query_profile_statistics_info, create_schema_table,
258 fill_query_profile_statistics_info, make_profile_table_for_show,
259 NULL, -1, -1, false},
260 diff -r 327ce7a34c91 sql/table.h
261 --- a/sql/table.h Fri Nov 07 15:44:23 2008 -0800
262 +++ b/sql/table.h Fri Nov 07 15:52:53 2008 -0800
265 SCH_KEY_COLUMN_USAGE,
271 diff -ruN mysql-5.0.67_highperf/patch_info/microsec_process.info mysql-5.0.67_highperf_tmp/patch_info/microsec_process.info
272 --- /dev/null 1970-01-01 09:00:00.000000000 +0900
273 +++ mysql-5.0.67_highperf_tmp/patch_info/microsec_process.info 2008-11-12 09:27:52.000000000 +0900
275 +File=microsec_process.patch
276 +Name=Adds INFOMATION_SCHEMA.PROCESSLIST with TIME_MS column
278 +Author=Percona <info@percona.com>