Merge lp:~tsarev/percona-server/5.1_fix_bug_924872 into lp:percona-server/5.1
- 5.1_fix_bug_924872
- Merge into 5.1
Status: | Work in progress |
---|---|
Proposed branch: | lp:~tsarev/percona-server/5.1_fix_bug_924872 |
Merge into: | lp:percona-server/5.1 |
Diff against target: |
6527 lines (+4423/-975) 35 files modified
Percona-Server/mysql-test/include/show_stats.inc (+78/-0) Percona-Server/mysql-test/include/show_table_index_stats.inc (+20/-0) Percona-Server/mysql-test/r/access_denied.result (+330/-0) Percona-Server/mysql-test/r/show_stats.result (+1735/-0) Percona-Server/mysql-test/r/user_stats.result (+90/-0) Percona-Server/mysql-test/r/userstat_bug602047.result (+2/-0) Percona-Server/mysql-test/t/access_denied.test (+559/-0) Percona-Server/mysql-test/t/show_stats.test (+484/-0) Percona-Server/mysql-test/t/user_stats.test (+135/-0) Percona-Server/mysql-test/t/userstat_bug602047.test (+2/-0) Percona-Server/sql/handler.cc (+112/-64) Percona-Server/sql/handler.h (+7/-4) Percona-Server/sql/item.cc (+1/-0) Percona-Server/sql/mysql_priv.h (+1/-1) Percona-Server/sql/mysqld.cc (+0/-3) Percona-Server/sql/set_var.cc (+3/-0) Percona-Server/sql/sp_head.cc (+1/-0) Percona-Server/sql/sql_acl.cc (+5/-0) Percona-Server/sql/sql_base.cc (+1/-0) Percona-Server/sql/sql_class.cc (+102/-76) Percona-Server/sql/sql_class.h (+20/-35) Percona-Server/sql/sql_connect.cc (+473/-524) Percona-Server/sql/sql_db.cc (+1/-0) Percona-Server/sql/sql_delete.cc (+2/-2) Percona-Server/sql/sql_insert.cc (+2/-2) Percona-Server/sql/sql_parse.cc (+30/-21) Percona-Server/sql/sql_prepare.cc (+6/-6) Percona-Server/sql/sql_show.cc (+134/-97) Percona-Server/sql/sql_trigger.cc (+1/-0) Percona-Server/sql/sql_update.cc (+2/-2) Percona-Server/sql/sql_view.cc (+3/-0) Percona-Server/sql/sql_yacc.yy (+5/-5) Percona-Server/sql/structs.h (+49/-133) Percona-Server/sql/table.cc (+1/-0) Percona-Server/storage/myisam/ha_myisam.cc (+26/-0) |
To merge this branch: | bzr merge lp:~tsarev/percona-server/5.1_fix_bug_924872 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Needs Fixing | ||
Review via email: mp+91205@code.launchpad.net |
This proposal supersedes a proposal from 2012-02-02.
Commit message
Description of the change
Changes related to userstat feature
Jenkins (no fails related to feature):
http://
Tests:
1) I fixed test userstats_bug602047 (incorrect behavior on --repeat run).
2) I ported following tests from http://
* access_denied
* user_stats
* show_stats
3) sql_connect.cc - added Debug Variable signal_
Alternative way - SHOW PROCESSLIST works worse: affected to collected statistics.
Disable statistics while wait of close connection is worse too, I need catch changes in statistics related to close of connection.
4) user_stats.tests:
- I moved all queries to check statistics to include/
- I now check all columns of statistics tables.
- I checked SHOW *_STATISTICS and SELECT * FROM INFORMATION_
- I checked WHERE and LIKE condition both on SHOW and SELECT syntax
- I checked results on every combination - SHOW/SELECT, LIKE/WHERE
- I added checks to THREAD_STATISTICS (this is Percona-specific extension, originally Google patch didn't have it)
- I fixed sporadic tests fails related to thread concurrency (not completed connection) by wait Debug Signal end_connection
- I removed sleep from test
- I added backup of mysql.user before test run (need for correct check of test case).
The bug #924872 and bug #728082 confirmed by this tests.
Code:
1) Removed unnecessary sent_row_count_2: (sql/sql_class.h: class THD). Now uses sent_row_count instead of it.
2) Avoid copy-paste between THREAD_STATS and USER_STATS: moved counter to STATS structure, use it in USER_STATS and THREAD_STATS (sql/structs.h).
3) Replaced bunch of counters diff_* by STATS struct (sql/sql_class.h: class THD, also many small changes in different files).
4) Added increment of access_denied counter (different files, is related to incompleted port from Google patch).
5) Removed unnecessary LOCK_stats mutex (is related to incorrect port from Google patch).
6) Fixed incorrect kind of query detection (is related to incompleted port from Google patch):
* sql/sql_yacc.yy: SQLCOM_
* sql/sql_parse.cc: assign CF_STATUS_COMMAND flag for SHOW [CLIENT|
Without this changes code in the THD::update_stats incorrect works.
7) Fixed comment for THD::get_
8) Removed ugly init_user_stats / init_thread_stats function (rudimentary used). Now I use direct memset(..., 0, ...) initialisation.
9) Renamed function update_
10) Avoid copy-paste between update_
11) Add set_connections function (related to incomplete port from Google patch) and add call to send_user_stats and send_thread_stats (bug #728082, bug #924872). Without this call statistcs from separated thread didn't aggregated to global_
12) Add counters cleanup to sql_parse.cc: mysql_reset_
13) Add wild-card processing to:
* send_user_stats
* send_thread_stats
* fill_schema_
* fill_schema_
Without this changes LIKE and WHERE works incorrectly (related to incompleted port from Google patch).
14) Removed unnecessary engine_type from TABLE STATS (changes related to changes from Percona).
15) Removed unnecessary add_thead_stats / add_user_stats functions.
16) Added DBUG_ENTER/
17) Fixed code policy / added comments to function for all related code.
18) Added EXTENDED_
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
Unmerged revisions
- 424. By Oleg Tsarev
-
1) Removed unnecessary sent_row_count_2: (sql/sql_class.h: class THD). Now uses sent_row_count instead of it.
2) Avoid copy-paste between THREAD_STATS and USER_STATS: moved counter to STATS structure, use it in USER_STATS and THREAD_STATS (sql/structs.h).
3) Replaced bunch of counters diff_* by STATS struct (sql/sql_class.h: class THD, also many small changes in different files).
4) Added increment of access_denied counter (different files, is related to incompleted port from Google patch).
5) Removed unnecessary LOCK_stats mutex (is related to incorrect port from Google patch).
6) Fixed incorrect kind of query detection (is related to incompleted port from Google patch):
* sql/sql_yacc.yy: SQLCOM_SHOW_[CLIENT| USER|THREAD| TABLE|INDEX] _STATS instead of SQLCOM_SELECT
* sql/sql_parse.cc: assign CF_STATUS_COMMAND flag for SHOW [CLIENT|USER|THREAD| TABLE|INDEX] _STATS commands
Without this changes code in the THD::update_stats incorrect works.
7) Fixed comment for THD::get_client_ host_port (incorrect moved in one of previous porting)
8) Removed ugly init_user_stats / init_thread_stats function (rudimentary used). Now I use direct memset(..., 0, ...) initialisation.
9) Renamed function update_global_ user_stats to update_global_stats (because not only user_stats updated, thread_stats too)
10) Avoid copy-paste between update_global_ user_stats_ with_user and update_ global_ user_stats_ with_thread by single function update_stats
11) Add set_connections function (related to incomplete port from Google patch) and add call to send_user_stats and send_thread_stats (bug #728082, bug #924872). Without this call statistcs from separated thread didn't aggregated to global_[client| thread| user]_stats.
12) Add counters cleanup to sql_parse.cc: mysql_reset_thd_for_ next_command (related to incompleted port from Google patch)
13) Add wild-card processing to:
* send_user_stats
* send_thread_stats
* fill_schema_table_stats
* fill_schema_index_stats
Without this changes LIKE and WHERE works incorrectly (related to incompleted port from Google patch).
14) Removed unnecessary engine_type from TABLE STATS (changes related to changes from Percona).
15) Removed unnecessary add_thead_stats / add_user_stats functions.
16) Added DBUG_ENTER/DBUG_RETURN/ DBUG_VOID_ RETURN information to related functions.
17) Fixed code policy / added comments to function for all related code.
18) Added EXTENDED_FOR_USERSTAT macros to storage/ myisam/ ha_myisam. cc - 423. By Oleg Tsarev
-
1) I fixed test userstats_bug602047 (incorrect behavior on --repeat run).
2) I ported following tests from http://code.google. com/p/google- mysql-tools/:
* access_denied
* user_stats
* show_stats
3) sql_connect.cc - added Debug Variable signal_end_connection for activate Debug Signal end_connection after connection close and before end of thread to the handle_ one_connection function (required for catch closed connection).
Alternative way - SHOW PROCESSLIST works worse: affected to collected statistics.
Disable statistics while wait of close connection is worse too, I need catch changes in statistics related to close of connection.
4) user_stats.tests:
- I moved all queries to check statistics to include/show_stats. inc
- I now check all columns of statistics tables.
- I checked SHOW *_STATISTICS and SELECT * FROM INFORMATION_SCHEMA. *_STATISTICS (originally test checked just SHOW syntax)
- I checked WHERE and LIKE condition both on SHOW and SELECT syntax
- I checked results on every combination - SHOW/SELECT, LIKE/WHERE
- I added checks to THREAD_STATISTICS (this is Percona-specific extension, originally Google patch didn't have it)
- I fixed sporadic tests fails related to thread concurrency (not completed connection) by wait Debug Signal end_connection
- I removed sleep from test
- I added backup of mysql.user before test run (need for correct check of test case).
The bug #924872 and bug #728082 confirmed by this tests.
Preview Diff
1 | === added file 'Percona-Server/mysql-test/include/show_stats.inc' | |||
2 | --- Percona-Server/mysql-test/include/show_stats.inc 1970-01-01 00:00:00 +0000 | |||
3 | +++ Percona-Server/mysql-test/include/show_stats.inc 2012-02-02 06:11:26 +0000 | |||
4 | @@ -0,0 +1,78 @@ | |||
5 | 1 | --disable_query_log | ||
6 | 2 | |||
7 | 3 | set global userstat_running=OFF; | ||
8 | 4 | set global thread_statistics=OFF; | ||
9 | 5 | |||
10 | 6 | --let found=`select count(*) from information_schema.processlist where user='$user'` | ||
11 | 7 | |||
12 | 8 | if ($found) | ||
13 | 9 | { | ||
14 | 10 | |||
15 | 11 | --let host=`select Host from information_schema.processlist where user='$user'` | ||
16 | 12 | --let thread=`select Id from information_schema.processlist where user='$user'` | ||
17 | 13 | |||
18 | 14 | eval select count(*) as Host from information_schema.client_statistics where client='$host'; | ||
19 | 15 | eval select count(*) as Thread from information_schema.thread_statistics where thread_id='$thread'; | ||
20 | 16 | eval select count(*) as User from information_schema.user_statistics where user='$user'; | ||
21 | 17 | } | ||
22 | 18 | |||
23 | 19 | # 3 - client_statistics | ||
24 | 20 | # 2 - thread_statistics | ||
25 | 21 | # 1 - user_statistics | ||
26 | 22 | # 0 - complete loop | ||
27 | 23 | |||
28 | 24 | --let i=3 | ||
29 | 25 | |||
30 | 26 | while($i) | ||
31 | 27 | { | ||
32 | 28 | |||
33 | 29 | --let client_query=show client_statistics like '$host' | ||
34 | 30 | --let thread_query=show thread_statistics like '$thread' | ||
35 | 31 | --let user_query=show user_statistics like '$user' | ||
36 | 32 | --let show_like_query=`SELECT CASE $i WHEN 3 THEN "$client_query" WHEN 2 THEN "$thread_query" WHEN 1 THEN "$user_query" END` | ||
37 | 33 | |||
38 | 34 | --let client_query=show client_statistics where Client='$host' | ||
39 | 35 | --let thread_query=show thread_statistics where Thread_id='$thread' | ||
40 | 36 | --let user_query=show user_statistics where User='$user' | ||
41 | 37 | --let show_where_query=`SELECT CASE $i WHEN 3 THEN "$client_query" WHEN 2 THEN "$thread_query" WHEN 1 THEN "$user_query" END` | ||
42 | 38 | |||
43 | 39 | --let client_query=select * from information_schema.client_statistics where Client like '$host' | ||
44 | 40 | --let thread_query=select * from information_schema.thread_statistics where Thread_id like '$thread' | ||
45 | 41 | --let user_query=select * from information_schema.user_statistics where User like '$user' | ||
46 | 42 | --let select_like_query=`SELECT CASE $i WHEN 3 THEN "$client_query" WHEN 2 THEN "$thread_query" WHEN 1 THEN "$user_query" END` | ||
47 | 43 | |||
48 | 44 | --let client_query=select * from information_schema.client_statistics where Client='$host' | ||
49 | 45 | --let thread_query=select * from information_schema.thread_statistics where Thread_id='$thread' | ||
50 | 46 | --let user_query=select * from information_schema.user_statistics where User='$user' | ||
51 | 47 | --let select_where_query=`SELECT CASE $i WHEN 3 THEN "$client_query" WHEN 2 THEN "$thread_query" WHEN 1 THEN "$user_query" END` | ||
52 | 48 | |||
53 | 49 | --let name=`SELECT CASE $i WHEN 3 THEN "Client" WHEN 2 THEN "Thread" WHEN 1 THEN "User" END` | ||
54 | 50 | |||
55 | 51 | --echo # | ||
56 | 52 | --echo # $name statistics | ||
57 | 53 | --echo # | ||
58 | 54 | |||
59 | 55 | --echo # SHOW | LIKE | ||
60 | 56 | --replace_column 1 X 4 X 5 X 6 X 7 X 8 X 9 X | ||
61 | 57 | eval $show_like_query; | ||
62 | 58 | |||
63 | 59 | --echo # SHOW | WHERE | ||
64 | 60 | --replace_column 1 X 4 X 5 X 6 X 7 X 8 X 9 X | ||
65 | 61 | eval $show_where_query; | ||
66 | 62 | |||
67 | 63 | --echo # SELECT | LIKE | ||
68 | 64 | --replace_column 1 X 4 X 5 X 6 X 7 X 8 X 9 X | ||
69 | 65 | eval $select_like_query; | ||
70 | 66 | |||
71 | 67 | --echo # SELECT | WHERE | ||
72 | 68 | --replace_column 1 X 4 X 5 X 6 X 7 X 8 X 9 X | ||
73 | 69 | eval $select_where_query; | ||
74 | 70 | |||
75 | 71 | dec $i; | ||
76 | 72 | |||
77 | 73 | } | ||
78 | 74 | |||
79 | 75 | set global userstat_running=ON; | ||
80 | 76 | set global thread_statistics=ON; | ||
81 | 77 | |||
82 | 78 | --enable_query_log | ||
83 | 0 | 79 | ||
84 | === added file 'Percona-Server/mysql-test/include/show_table_index_stats.inc' | |||
85 | --- Percona-Server/mysql-test/include/show_table_index_stats.inc 1970-01-01 00:00:00 +0000 | |||
86 | +++ Percona-Server/mysql-test/include/show_table_index_stats.inc 2012-02-02 06:11:26 +0000 | |||
87 | @@ -0,0 +1,20 @@ | |||
88 | 1 | if ($schema) | ||
89 | 2 | { | ||
90 | 3 | if ($table) | ||
91 | 4 | { | ||
92 | 5 | |||
93 | 6 | eval show table_statistics like '$schema.$table'; | ||
94 | 7 | eval show table_statistics where Table_schema='$schema' and Table_name='$table'; | ||
95 | 8 | eval select * from information_schema.table_statistics where Table_schema like '$schema' and Table_name like '$table'; | ||
96 | 9 | eval select * from information_schema.table_statistics where Table_schema='$schema' and Table_name='$table'; | ||
97 | 10 | |||
98 | 11 | if ($index) | ||
99 | 12 | { | ||
100 | 13 | eval show index_statistics like '$schema.$table.$index'; | ||
101 | 14 | eval show index_statistics where Table_schema='$schema' and Table_name='$table' and Index_name='$index'; | ||
102 | 15 | eval select * from information_schema.index_statistics where Table_schema like '$schema' and Table_name like '$table' and Index_name like '$index'; | ||
103 | 16 | eval select * from information_schema.index_statistics where Table_schema='$schema' and Table_name='$table' and Index_name='$index'; | ||
104 | 17 | } | ||
105 | 18 | |||
106 | 19 | } | ||
107 | 20 | } | ||
108 | 0 | 21 | ||
109 | === added file 'Percona-Server/mysql-test/r/access_denied.result' | |||
110 | --- Percona-Server/mysql-test/r/access_denied.result 1970-01-01 00:00:00 +0000 | |||
111 | +++ Percona-Server/mysql-test/r/access_denied.result 2012-02-02 06:11:26 +0000 | |||
112 | @@ -0,0 +1,330 @@ | |||
113 | 1 | create table mysql.user_bak like mysql.user; | ||
114 | 2 | insert into mysql.user_bak select * from mysql.user; | ||
115 | 3 | set global userstat_running=ON; | ||
116 | 4 | grant create user on *.* to mysqltest_1@localhost; | ||
117 | 5 | grant create user on *.* to mysqltest_2@localhost; | ||
118 | 6 | drop table if exists t1; | ||
119 | 7 | drop database if exists mysqltest; | ||
120 | 8 | flush user_statistics; | ||
121 | 9 | create database mysqltest; | ||
122 | 10 | show create database mysqltest; | ||
123 | 11 | Database Create Database | ||
124 | 12 | mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ | ||
125 | 13 | create table mysqltest.t1(a int); | ||
126 | 14 | create table mysqltest.empty(a int); | ||
127 | 15 | insert into mysqltest.t1 values(1); | ||
128 | 16 | grant select on `mysqltest`.* to mysqltest_1@localhost; | ||
129 | 17 | select current_user(); | ||
130 | 18 | current_user() | ||
131 | 19 | mysqltest_1@localhost | ||
132 | 20 | select * from mysqltest.empty; | ||
133 | 21 | a | ||
134 | 22 | drop database mysqltest; | ||
135 | 23 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' | ||
136 | 24 | create database mysqltest_db; | ||
137 | 25 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest_db' | ||
138 | 26 | show create database mysqltest_db; | ||
139 | 27 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest_db' | ||
140 | 28 | grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; | ||
141 | 29 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my\_1' | ||
142 | 30 | grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; | ||
143 | 31 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%' | ||
144 | 32 | show grants for root@localhost; | ||
145 | 33 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' | ||
146 | 34 | grant select on `my\_1`.* to mysqltest_2@localhost; | ||
147 | 35 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my\_1' | ||
148 | 36 | mysqltest_1 access_denied=7 | ||
149 | 37 | show user_statistics like 'mysqltest_%'; | ||
150 | 38 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
151 | 39 | mysqltest_1 X X X X X X X X X X X X X X X X X X 7 X | ||
152 | 40 | select current_user(); | ||
153 | 41 | current_user() | ||
154 | 42 | root@localhost | ||
155 | 43 | create database information_schema; | ||
156 | 44 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
157 | 45 | alter database information_schema upgrade data directory name; | ||
158 | 46 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
159 | 47 | drop database information_schema; | ||
160 | 48 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
161 | 49 | drop table information_schema.tables; | ||
162 | 50 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
163 | 51 | alter table information_schema.tables; | ||
164 | 52 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
165 | 53 | revoke select on `mysqltest`.* from mysqltest_1@localhost; | ||
166 | 54 | use information_schema; | ||
167 | 55 | create temporary table schemata(f1 char(10)); | ||
168 | 56 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
169 | 57 | grant all on information_schema.* to 'user1'@'localhost'; | ||
170 | 58 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
171 | 59 | grant select on information_schema.* to 'user1'@'localhost'; | ||
172 | 60 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
173 | 61 | root access_denied=8 | ||
174 | 62 | show user_statistics like 'root'; | ||
175 | 63 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
176 | 64 | root X X X X X X X X X X X X X X X X X X 8 X | ||
177 | 65 | drop user mysqltest_1@localhost; | ||
178 | 66 | drop database mysqltest; | ||
179 | 67 | show tables; | ||
180 | 68 | Tables_in_test | ||
181 | 69 | connect(localhost,root,z,test2,MASTER_PORT,MASTER_SOCKET); | ||
182 | 70 | ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES) | ||
183 | 71 | connect(localhost,root,z,test,MASTER_PORT,MASTER_SOCKET); | ||
184 | 72 | ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES) | ||
185 | 73 | root access_denied=10 | ||
186 | 74 | show user_statistics like 'root%'; | ||
187 | 75 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
188 | 76 | root 2 X X X X X X X X X X X X X X X X X 10 X | ||
189 | 77 | grant ALL on *.* to test@localhost identified by "gambling"; | ||
190 | 78 | grant ALL on *.* to test@127.0.0.1 identified by "gambling"; | ||
191 | 79 | show tables; | ||
192 | 80 | Tables_in_test | ||
193 | 81 | connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET); | ||
194 | 82 | ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO) | ||
195 | 83 | connect(localhost,test,,test,MASTER_PORT,MASTER_SOCKET); | ||
196 | 84 | ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO) | ||
197 | 85 | connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET); | ||
198 | 86 | ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) | ||
199 | 87 | connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); | ||
200 | 88 | ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) | ||
201 | 89 | test access_denied=4 | ||
202 | 90 | show user_statistics like 'test'; | ||
203 | 91 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
204 | 92 | test 1 X X X X X X X X X X X X X X X X X 4 X | ||
205 | 93 | drop user test@localhost; | ||
206 | 94 | drop user test@127.0.0.1; | ||
207 | 95 | flush privileges; | ||
208 | 96 | SET NAMES binary; | ||
209 | 97 | create database mysqltest_1; | ||
210 | 98 | create database mysqltest_2; | ||
211 | 99 | create table mysqltest_1.t1 select 1 a, 2 q; | ||
212 | 100 | create table mysqltest_1.t2 select 1 b, 2 r; | ||
213 | 101 | create table mysqltest_2.t1 select 1 c, 2 s; | ||
214 | 102 | create table mysqltest_2.t2 select 1 d, 2 t; | ||
215 | 103 | grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; | ||
216 | 104 | grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; | ||
217 | 105 | grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; | ||
218 | 106 | grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; | ||
219 | 107 | SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES | ||
220 | 108 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
221 | 109 | ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE; | ||
222 | 110 | GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE | ||
223 | 111 | 'mysqltest_3'@'localhost' NULL mysqltest_1 t1 a UPDATE NO | ||
224 | 112 | 'mysqltest_3'@'localhost' NULL mysqltest_2 t1 c SELECT NO | ||
225 | 113 | 'mysqltest_3'@'localhost' NULL mysqltest_1 t2 b SELECT NO | ||
226 | 114 | 'mysqltest_3'@'localhost' NULL mysqltest_2 t2 d UPDATE NO | ||
227 | 115 | SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES | ||
228 | 116 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
229 | 117 | ORDER BY TABLE_NAME,PRIVILEGE_TYPE; | ||
230 | 118 | GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE | ||
231 | 119 | SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES | ||
232 | 120 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
233 | 121 | ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE; | ||
234 | 122 | GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE | ||
235 | 123 | SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES | ||
236 | 124 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
237 | 125 | ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE; | ||
238 | 126 | GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE | ||
239 | 127 | 'mysqltest_3'@'localhost' NULL USAGE NO | ||
240 | 128 | mysqltest_3 access_denied=0 | ||
241 | 129 | show user_statistics like 'mysqltest_3'; | ||
242 | 130 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
243 | 131 | mysqltest_3 X X X X X X X X X X X X X X X X X X 0 X | ||
244 | 132 | update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1; | ||
245 | 133 | ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1' | ||
246 | 134 | update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1; | ||
247 | 135 | ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2' | ||
248 | 136 | update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; | ||
249 | 137 | ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1' | ||
250 | 138 | update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; | ||
251 | 139 | ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' | ||
252 | 140 | update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; | ||
253 | 141 | ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1' | ||
254 | 142 | mysqltest_3 access_denied=5 | ||
255 | 143 | show user_statistics like 'mysqltest_3'; | ||
256 | 144 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
257 | 145 | mysqltest_3 X X X X X X X X X X X X X X X X X X 5 X | ||
258 | 146 | update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; | ||
259 | 147 | update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20; | ||
260 | 148 | select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; | ||
261 | 149 | a q b r | ||
262 | 150 | 10 2 1 2 | ||
263 | 151 | select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; | ||
264 | 152 | c s d t | ||
265 | 153 | 1 2 10 2 | ||
266 | 154 | revoke all on mysqltest_1.t1 from mysqltest_3@localhost; | ||
267 | 155 | revoke all on mysqltest_1.t2 from mysqltest_3@localhost; | ||
268 | 156 | revoke all on mysqltest_2.t1 from mysqltest_3@localhost; | ||
269 | 157 | revoke all on mysqltest_2.t2 from mysqltest_3@localhost; | ||
270 | 158 | grant all on mysqltest_2.* to mysqltest_3@localhost; | ||
271 | 159 | grant select on *.* to mysqltest_3@localhost; | ||
272 | 160 | grant select on mysqltest_2.t1 to mysqltest_3@localhost; | ||
273 | 161 | flush privileges; | ||
274 | 162 | use mysqltest_1; | ||
275 | 163 | update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; | ||
276 | 164 | update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; | ||
277 | 165 | ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' | ||
278 | 166 | use mysqltest_2; | ||
279 | 167 | update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; | ||
280 | 168 | ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' | ||
281 | 169 | update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; | ||
282 | 170 | ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't2' | ||
283 | 171 | update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; | ||
284 | 172 | ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1' | ||
285 | 173 | mysqltest_3 access_denied=9 | ||
286 | 174 | show user_statistics like 'mysqltest_3'; | ||
287 | 175 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
288 | 176 | mysqltest_3 2 X X X X X X X X X X X X X X X X X 9 X | ||
289 | 177 | select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; | ||
290 | 178 | a q b r | ||
291 | 179 | 10 2 1 2 | ||
292 | 180 | select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; | ||
293 | 181 | c s d t | ||
294 | 182 | 500 2 600 2 | ||
295 | 183 | delete from mysql.user where user='mysqltest_3'; | ||
296 | 184 | delete from mysql.db where user="mysqltest_3"; | ||
297 | 185 | delete from mysql.tables_priv where user="mysqltest_3"; | ||
298 | 186 | delete from mysql.columns_priv where user="mysqltest_3"; | ||
299 | 187 | flush privileges; | ||
300 | 188 | drop database mysqltest_1; | ||
301 | 189 | drop database mysqltest_2; | ||
302 | 190 | create database mysqltest_2; | ||
303 | 191 | grant select, insert, update on `mysqltest\_2`.* to mysqltest_1@localhost; | ||
304 | 192 | set sql_log_off = 1; | ||
305 | 193 | ERROR 42000: Access denied; you need the SUPER privilege for this operation | ||
306 | 194 | set sql_log_bin = 0; | ||
307 | 195 | ERROR 42000: Access denied; you need the SUPER privilege for this operation | ||
308 | 196 | mysqltest_2 access_denied=2 | ||
309 | 197 | show user_statistics like 'mysqltest_2'; | ||
310 | 198 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
311 | 199 | mysqltest_2 X X X X X X X X X X X X X X X X X X 2 X | ||
312 | 200 | revoke select, insert, update on `mysqltest\_2`.* from mysqltest_1@localhost; | ||
313 | 201 | delete from mysql.user where user like 'mysqltest\_2'; | ||
314 | 202 | delete from mysql.db where user like 'mysqltest\_2'; | ||
315 | 203 | drop database mysqltest_2; | ||
316 | 204 | flush privileges; | ||
317 | 205 | drop database if exists db2; | ||
318 | 206 | create database db2; | ||
319 | 207 | use db2; | ||
320 | 208 | create table t2 (s1 int); | ||
321 | 209 | insert into t2 values (0); | ||
322 | 210 | grant usage on db2.* to user1@localhost; | ||
323 | 211 | grant select on db2.* to user1@localhost; | ||
324 | 212 | grant usage on db2.* to user2@localhost; | ||
325 | 213 | grant select,insert,update,delete,create routine on db2.* to user2@localhost; | ||
326 | 214 | grant create routine on db2.* to user1@localhost; | ||
327 | 215 | flush privileges; | ||
328 | 216 | use db2; | ||
329 | 217 | create procedure p () insert into t2 values (1); | ||
330 | 218 | use db2; | ||
331 | 219 | call p(); | ||
332 | 220 | ERROR 42000: execute command denied to user 'user2'@'localhost' for routine 'db2.p' | ||
333 | 221 | show user_statistics like 'user%'; | ||
334 | 222 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
335 | 223 | user2 X X X X X X X X X X X X X X X X X X 1 X | ||
336 | 224 | user1 X X X X X X X X X X X X X X X X X X 0 X | ||
337 | 225 | create procedure q () insert into t2 values (2); | ||
338 | 226 | grant usage on procedure db2.q to user2@localhost with grant option; | ||
339 | 227 | grant execute on procedure db2.q to user1@localhost; | ||
340 | 228 | use db2; | ||
341 | 229 | alter procedure p modifies sql data; | ||
342 | 230 | drop procedure p; | ||
343 | 231 | alter procedure q modifies sql data; | ||
344 | 232 | ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db2.q' | ||
345 | 233 | drop procedure q; | ||
346 | 234 | ERROR 42000: alter routine command denied to user 'user1'@'localhost' for routine 'db2.q' | ||
347 | 235 | user1 access_denied=2, user2 access_denied=1 | ||
348 | 236 | show user_statistics like 'user%'; | ||
349 | 237 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
350 | 238 | user2 X X X X X X X X X X X X X X X X X X 1 X | ||
351 | 239 | user1 X X X X X X X X X X X X X X X X X X 2 X | ||
352 | 240 | use db2; | ||
353 | 241 | alter procedure q modifies sql data; | ||
354 | 242 | drop procedure q; | ||
355 | 243 | revoke all on db2.* from user1@localhost; | ||
356 | 244 | revoke all on db2.* from user2@localhost; | ||
357 | 245 | flush privileges; | ||
358 | 246 | use test; | ||
359 | 247 | select type,db,name from mysql.proc; | ||
360 | 248 | type db name | ||
361 | 249 | PROCEDURE mtr add_suppression | ||
362 | 250 | PROCEDURE mtr check_testcase | ||
363 | 251 | PROCEDURE mtr check_warnings | ||
364 | 252 | PROCEDURE mtr force_restart | ||
365 | 253 | drop database db2; | ||
366 | 254 | select type,db,name from mysql.proc; | ||
367 | 255 | type db name | ||
368 | 256 | PROCEDURE mtr add_suppression | ||
369 | 257 | PROCEDURE mtr check_testcase | ||
370 | 258 | PROCEDURE mtr check_warnings | ||
371 | 259 | PROCEDURE mtr force_restart | ||
372 | 260 | delete from mysql.user where user='user1' or user='user2'; | ||
373 | 261 | delete from mysql.user where user='' and host='%'; | ||
374 | 262 | delete from mysql.procs_priv where user='user1' or user='user2'; | ||
375 | 263 | delete from mysql.procs_priv where user='' and host='%'; | ||
376 | 264 | delete from mysql.db where user='user2'; | ||
377 | 265 | flush privileges; | ||
378 | 266 | grant usage on *.* to usera@localhost; | ||
379 | 267 | grant usage on *.* to userb@localhost; | ||
380 | 268 | grant usage on *.* to userc@localhost; | ||
381 | 269 | create database sptest; | ||
382 | 270 | create table t1 ( u varchar(64), i int ); | ||
383 | 271 | create procedure sptest.p1(i int) insert into test.t1 values (user(), i); | ||
384 | 272 | grant insert on t1 to usera@localhost; | ||
385 | 273 | grant execute on procedure sptest.p1 to usera@localhost; | ||
386 | 274 | show grants for usera@localhost; | ||
387 | 275 | Grants for usera@localhost | ||
388 | 276 | GRANT USAGE ON *.* TO 'usera'@'localhost' | ||
389 | 277 | GRANT INSERT ON `test`.`t1` TO 'usera'@'localhost' | ||
390 | 278 | GRANT EXECUTE ON PROCEDURE `sptest`.`p1` TO 'usera'@'localhost' | ||
391 | 279 | grant execute on procedure sptest.p1 to userc@localhost with grant option; | ||
392 | 280 | show grants for userc@localhost; | ||
393 | 281 | Grants for userc@localhost | ||
394 | 282 | GRANT USAGE ON *.* TO 'userc'@'localhost' | ||
395 | 283 | GRANT EXECUTE ON PROCEDURE `sptest`.`p1` TO 'userc'@'localhost' WITH GRANT OPTION | ||
396 | 284 | call sptest.p1(1); | ||
397 | 285 | grant execute on procedure sptest.p1 to userb@localhost; | ||
398 | 286 | ERROR 42000: grant command denied to user 'usera'@'localhost' for routine 'sptest.p1' | ||
399 | 287 | drop procedure sptest.p1; | ||
400 | 288 | ERROR 42000: alter routine command denied to user 'usera'@'localhost' for routine 'sptest.p1' | ||
401 | 289 | usera access_denied=2 | ||
402 | 290 | show user_statistics like 'usera%'; | ||
403 | 291 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
404 | 292 | usera X X X X X X X X X X X X X X X X X X 2 X | ||
405 | 293 | call sptest.p1(2); | ||
406 | 294 | ERROR 42000: execute command denied to user 'userb'@'localhost' for routine 'sptest.p1' | ||
407 | 295 | grant execute on procedure sptest.p1 to userb@localhost; | ||
408 | 296 | ERROR 42000: execute command denied to user 'userb'@'localhost' for routine 'sptest.p1' | ||
409 | 297 | drop procedure sptest.p1; | ||
410 | 298 | ERROR 42000: alter routine command denied to user 'userb'@'localhost' for routine 'sptest.p1' | ||
411 | 299 | userb access_denied=3 | ||
412 | 300 | show user_statistics like 'userb'; | ||
413 | 301 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
414 | 302 | userb X X X X X X X X X X X X X X X X X X 3 X | ||
415 | 303 | call sptest.p1(3); | ||
416 | 304 | grant execute on procedure sptest.p1 to userb@localhost; | ||
417 | 305 | drop procedure sptest.p1; | ||
418 | 306 | ERROR 42000: alter routine command denied to user 'userc'@'localhost' for routine 'sptest.p1' | ||
419 | 307 | userc access_denied=1 | ||
420 | 308 | show user_statistics like 'userc'; | ||
421 | 309 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
422 | 310 | userc X X X X X X X X X X X X X X X X X X 1 X | ||
423 | 311 | call sptest.p1(4); | ||
424 | 312 | grant execute on procedure sptest.p1 to userb@localhost; | ||
425 | 313 | ERROR 42000: grant command denied to user 'userb'@'localhost' for routine 'sptest.p1' | ||
426 | 314 | drop procedure sptest.p1; | ||
427 | 315 | ERROR 42000: alter routine command denied to user 'userb'@'localhost' for routine 'sptest.p1' | ||
428 | 316 | userb access_denied=5 | ||
429 | 317 | show user_statistics like 'userb'; | ||
430 | 318 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
431 | 319 | userb X X X X X X X X X X X X X X X X X X 5 X | ||
432 | 320 | use test; | ||
433 | 321 | drop database sptest; | ||
434 | 322 | delete from mysql.user where user='usera' or user='userb' or user='userc'; | ||
435 | 323 | delete from mysql.procs_priv where user='usera' or user='userb' or user='userc'; | ||
436 | 324 | delete from mysql.tables_priv where user='usera'; | ||
437 | 325 | flush privileges; | ||
438 | 326 | drop table t1; | ||
439 | 327 | set global userstat_running=default; | ||
440 | 328 | delete from mysql.user; | ||
441 | 329 | insert into mysql.user select * from mysql.user_bak; | ||
442 | 330 | drop table mysql.user_bak; | ||
443 | 0 | 331 | ||
444 | === added file 'Percona-Server/mysql-test/r/show_stats.result' | |||
445 | --- Percona-Server/mysql-test/r/show_stats.result 1970-01-01 00:00:00 +0000 | |||
446 | +++ Percona-Server/mysql-test/r/show_stats.result 2012-02-02 06:11:26 +0000 | |||
447 | @@ -0,0 +1,1735 @@ | |||
448 | 1 | drop table if exists t1; | ||
449 | 2 | update mysql.db set User = 'hide' where User = ''; | ||
450 | 3 | create table mysql.user_bak like mysql.user; | ||
451 | 4 | insert into mysql.user_bak select * from mysql.user where length(User) = 0; | ||
452 | 5 | delete from mysql.user where length(User) = 0; | ||
453 | 6 | flush privileges; | ||
454 | 7 | SET GLOBAL DEBUG='+d,signal_end_connection'; | ||
455 | 8 | create table t2 (a int not null primary key, b int not null) engine=innodb; | ||
456 | 9 | create table t3 (a int not null primary key, b int not null, index bx(b)) engine=myisam; | ||
457 | 10 | set global userstat_running=ON; | ||
458 | 11 | set global thread_statistics=ON; | ||
459 | 12 | flush client_statistics; | ||
460 | 13 | flush thread_statistics; | ||
461 | 14 | flush user_statistics; | ||
462 | 15 | Host | ||
463 | 16 | 1 | ||
464 | 17 | Thread | ||
465 | 18 | 1 | ||
466 | 19 | User | ||
467 | 20 | 1 | ||
468 | 21 | # | ||
469 | 22 | # Client statistics | ||
470 | 23 | # | ||
471 | 24 | # SHOW | LIKE | ||
472 | 25 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
473 | 26 | X 1 1 X X X X X X 0 0 0 0 0 2 0 0 0 0 0 0 | ||
474 | 27 | # SHOW | WHERE | ||
475 | 28 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
476 | 29 | X 1 1 X X X X X X 0 0 0 0 0 2 0 0 0 0 0 0 | ||
477 | 30 | # SELECT | LIKE | ||
478 | 31 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
479 | 32 | X 1 1 X X X X X X 0 0 0 0 0 2 0 0 0 0 0 0 | ||
480 | 33 | # SELECT | WHERE | ||
481 | 34 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
482 | 35 | X 1 1 X X X X X X 0 0 0 0 0 2 0 0 0 0 0 0 | ||
483 | 36 | # | ||
484 | 37 | # Thread statistics | ||
485 | 38 | # | ||
486 | 39 | # SHOW | LIKE | ||
487 | 40 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
488 | 41 | X 1 0 X X X X X X 0 0 0 0 0 1 0 0 0 0 0 0 | ||
489 | 42 | # SHOW | WHERE | ||
490 | 43 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
491 | 44 | X 1 0 X X X X X X 0 0 0 0 0 1 0 0 0 0 0 0 | ||
492 | 45 | # SELECT | LIKE | ||
493 | 46 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
494 | 47 | X 1 0 X X X X X X 0 0 0 0 0 1 0 0 0 0 0 0 | ||
495 | 48 | # SELECT | WHERE | ||
496 | 49 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
497 | 50 | X 1 0 X X X X X X 0 0 0 0 0 1 0 0 0 0 0 0 | ||
498 | 51 | # | ||
499 | 52 | # User statistics | ||
500 | 53 | # | ||
501 | 54 | # SHOW | LIKE | ||
502 | 55 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
503 | 56 | X 1 1 X X X X X X 0 0 0 0 0 0 0 0 0 0 0 0 | ||
504 | 57 | # SHOW | WHERE | ||
505 | 58 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
506 | 59 | X 1 1 X X X X X X 0 0 0 0 0 0 0 0 0 0 0 0 | ||
507 | 60 | # SELECT | LIKE | ||
508 | 61 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
509 | 62 | X 1 1 X X X X X X 0 0 0 0 0 0 0 0 0 0 0 0 | ||
510 | 63 | # SELECT | WHERE | ||
511 | 64 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
512 | 65 | X 1 1 X X X X X X 0 0 0 0 0 0 0 0 0 0 0 0 | ||
513 | 66 | flush client_statistics; | ||
514 | 67 | flush thread_statistics; | ||
515 | 68 | flush user_statistics; | ||
516 | 69 | create table t1 (a int not null primary key, b int not null) engine=innodb; | ||
517 | 70 | Host | ||
518 | 71 | 1 | ||
519 | 72 | Thread | ||
520 | 73 | 1 | ||
521 | 74 | User | ||
522 | 75 | 1 | ||
523 | 76 | # | ||
524 | 77 | # Client statistics | ||
525 | 78 | # | ||
526 | 79 | # SHOW | LIKE | ||
527 | 80 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
528 | 81 | X 1 1 X X X X X X 0 0 0 0 1 2 0 0 0 0 0 0 | ||
529 | 82 | # SHOW | WHERE | ||
530 | 83 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
531 | 84 | X 1 1 X X X X X X 0 0 0 0 1 2 0 0 0 0 0 0 | ||
532 | 85 | # SELECT | LIKE | ||
533 | 86 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
534 | 87 | X 1 1 X X X X X X 0 0 0 0 1 2 0 0 0 0 0 0 | ||
535 | 88 | # SELECT | WHERE | ||
536 | 89 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
537 | 90 | X 1 1 X X X X X X 0 0 0 0 1 2 0 0 0 0 0 0 | ||
538 | 91 | # | ||
539 | 92 | # Thread statistics | ||
540 | 93 | # | ||
541 | 94 | # SHOW | LIKE | ||
542 | 95 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
543 | 96 | X 1 0 X X X X X X 0 0 0 0 1 1 0 0 0 0 0 0 | ||
544 | 97 | # SHOW | WHERE | ||
545 | 98 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
546 | 99 | X 1 0 X X X X X X 0 0 0 0 1 1 0 0 0 0 0 0 | ||
547 | 100 | # SELECT | LIKE | ||
548 | 101 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
549 | 102 | X 1 0 X X X X X X 0 0 0 0 1 1 0 0 0 0 0 0 | ||
550 | 103 | # SELECT | WHERE | ||
551 | 104 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
552 | 105 | X 1 0 X X X X X X 0 0 0 0 1 1 0 0 0 0 0 0 | ||
553 | 106 | # | ||
554 | 107 | # User statistics | ||
555 | 108 | # | ||
556 | 109 | # SHOW | LIKE | ||
557 | 110 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
558 | 111 | X 1 1 X X X X X X 0 0 0 0 1 0 0 0 0 0 0 0 | ||
559 | 112 | # SHOW | WHERE | ||
560 | 113 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
561 | 114 | X 1 1 X X X X X X 0 0 0 0 1 0 0 0 0 0 0 0 | ||
562 | 115 | # SELECT | LIKE | ||
563 | 116 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
564 | 117 | X 1 1 X X X X X X 0 0 0 0 1 0 0 0 0 0 0 0 | ||
565 | 118 | # SELECT | WHERE | ||
566 | 119 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
567 | 120 | X 1 1 X X X X X X 0 0 0 0 1 0 0 0 0 0 0 0 | ||
568 | 121 | flush client_statistics; | ||
569 | 122 | flush thread_statistics; | ||
570 | 123 | flush user_statistics; | ||
571 | 124 | flush table_statistics; | ||
572 | 125 | flush index_statistics; | ||
573 | 126 | insert into t1 values (1,1), (2,2); | ||
574 | 127 | Host | ||
575 | 128 | 1 | ||
576 | 129 | Thread | ||
577 | 130 | 1 | ||
578 | 131 | User | ||
579 | 132 | 1 | ||
580 | 133 | # | ||
581 | 134 | # Client statistics | ||
582 | 135 | # | ||
583 | 136 | # SHOW | LIKE | ||
584 | 137 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
585 | 138 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
586 | 139 | # SHOW | WHERE | ||
587 | 140 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
588 | 141 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
589 | 142 | # SELECT | LIKE | ||
590 | 143 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
591 | 144 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
592 | 145 | # SELECT | WHERE | ||
593 | 146 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
594 | 147 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
595 | 148 | # | ||
596 | 149 | # Thread statistics | ||
597 | 150 | # | ||
598 | 151 | # SHOW | LIKE | ||
599 | 152 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
600 | 153 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
601 | 154 | # SHOW | WHERE | ||
602 | 155 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
603 | 156 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
604 | 157 | # SELECT | LIKE | ||
605 | 158 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
606 | 159 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
607 | 160 | # SELECT | WHERE | ||
608 | 161 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
609 | 162 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
610 | 163 | # | ||
611 | 164 | # User statistics | ||
612 | 165 | # | ||
613 | 166 | # SHOW | LIKE | ||
614 | 167 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
615 | 168 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
616 | 169 | # SHOW | WHERE | ||
617 | 170 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
618 | 171 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
619 | 172 | # SELECT | LIKE | ||
620 | 173 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
621 | 174 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
622 | 175 | # SELECT | WHERE | ||
623 | 176 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
624 | 177 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
625 | 178 | show table_statistics like 'test.t1'; | ||
626 | 179 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
627 | 180 | test t1 0 2 2 | ||
628 | 181 | show table_statistics where Table_schema='test' and Table_name='t1'; | ||
629 | 182 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
630 | 183 | test t1 0 2 2 | ||
631 | 184 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't1'; | ||
632 | 185 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
633 | 186 | test t1 0 2 2 | ||
634 | 187 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t1'; | ||
635 | 188 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
636 | 189 | test t1 0 2 2 | ||
637 | 190 | create table test.tmy(i int) engine=myisam; | ||
638 | 191 | insert into test.tmy values (1); | ||
639 | 192 | show table_statistics like 'test.tmy'; | ||
640 | 193 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
641 | 194 | test tmy 0 1 1 | ||
642 | 195 | show table_statistics where Table_schema='test' and Table_name='tmy'; | ||
643 | 196 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
644 | 197 | test tmy 0 1 1 | ||
645 | 198 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 'tmy'; | ||
646 | 199 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
647 | 200 | test tmy 0 1 1 | ||
648 | 201 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='tmy'; | ||
649 | 202 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
650 | 203 | test tmy 0 1 1 | ||
651 | 204 | drop table test.tmy; | ||
652 | 205 | show table_statistics like 'test.t1'; | ||
653 | 206 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
654 | 207 | test t1 0 2 2 | ||
655 | 208 | show table_statistics where Table_schema='test' and Table_name='t1'; | ||
656 | 209 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
657 | 210 | test t1 0 2 2 | ||
658 | 211 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't1'; | ||
659 | 212 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
660 | 213 | test t1 0 2 2 | ||
661 | 214 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t1'; | ||
662 | 215 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
663 | 216 | test t1 0 2 2 | ||
664 | 217 | "" | ||
665 | 218 | Test insert select | ||
666 | 219 | "" | ||
667 | 220 | flush client_statistics; | ||
668 | 221 | flush thread_statistics; | ||
669 | 222 | flush user_statistics; | ||
670 | 223 | flush table_statistics; | ||
671 | 224 | flush index_statistics; | ||
672 | 225 | insert into t2 select * from t1; | ||
673 | 226 | Host | ||
674 | 227 | 1 | ||
675 | 228 | Thread | ||
676 | 229 | 1 | ||
677 | 230 | User | ||
678 | 231 | 1 | ||
679 | 232 | # | ||
680 | 233 | # Client statistics | ||
681 | 234 | # | ||
682 | 235 | # SHOW | LIKE | ||
683 | 236 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
684 | 237 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
685 | 238 | # SHOW | WHERE | ||
686 | 239 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
687 | 240 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
688 | 241 | # SELECT | LIKE | ||
689 | 242 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
690 | 243 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
691 | 244 | # SELECT | WHERE | ||
692 | 245 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
693 | 246 | X 1 1 X X X X X X 0 2 0 0 1 4 0 0 0 0 0 0 | ||
694 | 247 | # | ||
695 | 248 | # Thread statistics | ||
696 | 249 | # | ||
697 | 250 | # SHOW | LIKE | ||
698 | 251 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
699 | 252 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
700 | 253 | # SHOW | WHERE | ||
701 | 254 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
702 | 255 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
703 | 256 | # SELECT | LIKE | ||
704 | 257 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
705 | 258 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
706 | 259 | # SELECT | WHERE | ||
707 | 260 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
708 | 261 | X 1 0 X X X X X X 0 2 0 0 1 3 0 0 0 0 0 0 | ||
709 | 262 | # | ||
710 | 263 | # User statistics | ||
711 | 264 | # | ||
712 | 265 | # SHOW | LIKE | ||
713 | 266 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
714 | 267 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
715 | 268 | # SHOW | WHERE | ||
716 | 269 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
717 | 270 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
718 | 271 | # SELECT | LIKE | ||
719 | 272 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
720 | 273 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
721 | 274 | # SELECT | WHERE | ||
722 | 275 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
723 | 276 | X 1 1 X X X X X X 0 2 0 0 1 2 0 0 0 0 0 0 | ||
724 | 277 | show table_statistics like 'test.t1'; | ||
725 | 278 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
726 | 279 | test t1 2 0 0 | ||
727 | 280 | show table_statistics where Table_schema='test' and Table_name='t1'; | ||
728 | 281 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
729 | 282 | test t1 2 0 0 | ||
730 | 283 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't1'; | ||
731 | 284 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
732 | 285 | test t1 2 0 0 | ||
733 | 286 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t1'; | ||
734 | 287 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
735 | 288 | test t1 2 0 0 | ||
736 | 289 | show index_statistics like 'test.t1.PRIMARY'; | ||
737 | 290 | Table_schema Table_name Index_name Rows_read | ||
738 | 291 | test t1 PRIMARY 2 | ||
739 | 292 | show index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
740 | 293 | Table_schema Table_name Index_name Rows_read | ||
741 | 294 | test t1 PRIMARY 2 | ||
742 | 295 | select * from information_schema.index_statistics where Table_schema like 'test' and Table_name like 't1' and Index_name like 'PRIMARY'; | ||
743 | 296 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
744 | 297 | test t1 PRIMARY 2 | ||
745 | 298 | select * from information_schema.index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
746 | 299 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
747 | 300 | test t1 PRIMARY 2 | ||
748 | 301 | show table_statistics like 'test.t2'; | ||
749 | 302 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
750 | 303 | test t2 0 2 2 | ||
751 | 304 | show table_statistics where Table_schema='test' and Table_name='t2'; | ||
752 | 305 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
753 | 306 | test t2 0 2 2 | ||
754 | 307 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't2'; | ||
755 | 308 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
756 | 309 | test t2 0 2 2 | ||
757 | 310 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t2'; | ||
758 | 311 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
759 | 312 | test t2 0 2 2 | ||
760 | 313 | "" | ||
761 | 314 | Test update with PK scans | ||
762 | 315 | "" | ||
763 | 316 | insert into t1 values (0,0); | ||
764 | 317 | select count(*) from t1; | ||
765 | 318 | count(*) | ||
766 | 319 | 3 | ||
767 | 320 | flush client_statistics; | ||
768 | 321 | flush thread_statistics; | ||
769 | 322 | flush user_statistics; | ||
770 | 323 | flush table_statistics; | ||
771 | 324 | flush index_statistics; | ||
772 | 325 | update t1 set a = 3 where a = 1; | ||
773 | 326 | Host | ||
774 | 327 | 1 | ||
775 | 328 | Thread | ||
776 | 329 | 1 | ||
777 | 330 | User | ||
778 | 331 | 1 | ||
779 | 332 | # | ||
780 | 333 | # Client statistics | ||
781 | 334 | # | ||
782 | 335 | # SHOW | LIKE | ||
783 | 336 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
784 | 337 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
785 | 338 | # SHOW | WHERE | ||
786 | 339 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
787 | 340 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
788 | 341 | # SELECT | LIKE | ||
789 | 342 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
790 | 343 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
791 | 344 | # SELECT | WHERE | ||
792 | 345 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
793 | 346 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
794 | 347 | # | ||
795 | 348 | # Thread statistics | ||
796 | 349 | # | ||
797 | 350 | # SHOW | LIKE | ||
798 | 351 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
799 | 352 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
800 | 353 | # SHOW | WHERE | ||
801 | 354 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
802 | 355 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
803 | 356 | # SELECT | LIKE | ||
804 | 357 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
805 | 358 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
806 | 359 | # SELECT | WHERE | ||
807 | 360 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
808 | 361 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
809 | 362 | # | ||
810 | 363 | # User statistics | ||
811 | 364 | # | ||
812 | 365 | # SHOW | LIKE | ||
813 | 366 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
814 | 367 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
815 | 368 | # SHOW | WHERE | ||
816 | 369 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
817 | 370 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
818 | 371 | # SELECT | LIKE | ||
819 | 372 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
820 | 373 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
821 | 374 | # SELECT | WHERE | ||
822 | 375 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
823 | 376 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
824 | 377 | update t1 set a = 4 where b = 2; | ||
825 | 378 | Host | ||
826 | 379 | 1 | ||
827 | 380 | Thread | ||
828 | 381 | 1 | ||
829 | 382 | User | ||
830 | 383 | 1 | ||
831 | 384 | # | ||
832 | 385 | # Client statistics | ||
833 | 386 | # | ||
834 | 387 | # SHOW | LIKE | ||
835 | 388 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
836 | 389 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
837 | 390 | # SHOW | WHERE | ||
838 | 391 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
839 | 392 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
840 | 393 | # SELECT | LIKE | ||
841 | 394 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
842 | 395 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
843 | 396 | # SELECT | WHERE | ||
844 | 397 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
845 | 398 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
846 | 399 | # | ||
847 | 400 | # Thread statistics | ||
848 | 401 | # | ||
849 | 402 | # SHOW | LIKE | ||
850 | 403 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
851 | 404 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
852 | 405 | # SHOW | WHERE | ||
853 | 406 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
854 | 407 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
855 | 408 | # SELECT | LIKE | ||
856 | 409 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
857 | 410 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
858 | 411 | # SELECT | WHERE | ||
859 | 412 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
860 | 413 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
861 | 414 | # | ||
862 | 415 | # User statistics | ||
863 | 416 | # | ||
864 | 417 | # SHOW | LIKE | ||
865 | 418 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
866 | 419 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
867 | 420 | # SHOW | WHERE | ||
868 | 421 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
869 | 422 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
870 | 423 | # SELECT | LIKE | ||
871 | 424 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
872 | 425 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
873 | 426 | # SELECT | WHERE | ||
874 | 427 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
875 | 428 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
876 | 429 | show table_statistics like 'test.t1'; | ||
877 | 430 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
878 | 431 | test t1 5 2 2 | ||
879 | 432 | show table_statistics where Table_schema='test' and Table_name='t1'; | ||
880 | 433 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
881 | 434 | test t1 5 2 2 | ||
882 | 435 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't1'; | ||
883 | 436 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
884 | 437 | test t1 5 2 2 | ||
885 | 438 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t1'; | ||
886 | 439 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
887 | 440 | test t1 5 2 2 | ||
888 | 441 | show index_statistics like 'test.t1.PRIMARY'; | ||
889 | 442 | Table_schema Table_name Index_name Rows_read | ||
890 | 443 | test t1 PRIMARY 5 | ||
891 | 444 | show index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
892 | 445 | Table_schema Table_name Index_name Rows_read | ||
893 | 446 | test t1 PRIMARY 5 | ||
894 | 447 | select * from information_schema.index_statistics where Table_schema like 'test' and Table_name like 't1' and Index_name like 'PRIMARY'; | ||
895 | 448 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
896 | 449 | test t1 PRIMARY 5 | ||
897 | 450 | select * from information_schema.index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
898 | 451 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
899 | 452 | test t1 PRIMARY 5 | ||
900 | 453 | update t1 set a = 4 where b < 0; | ||
901 | 454 | Host | ||
902 | 455 | 1 | ||
903 | 456 | Thread | ||
904 | 457 | 1 | ||
905 | 458 | User | ||
906 | 459 | 1 | ||
907 | 460 | # | ||
908 | 461 | # Client statistics | ||
909 | 462 | # | ||
910 | 463 | # SHOW | LIKE | ||
911 | 464 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
912 | 465 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
913 | 466 | # SHOW | WHERE | ||
914 | 467 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
915 | 468 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
916 | 469 | # SELECT | LIKE | ||
917 | 470 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
918 | 471 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
919 | 472 | # SELECT | WHERE | ||
920 | 473 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
921 | 474 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
922 | 475 | # | ||
923 | 476 | # Thread statistics | ||
924 | 477 | # | ||
925 | 478 | # SHOW | LIKE | ||
926 | 479 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
927 | 480 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
928 | 481 | # SHOW | WHERE | ||
929 | 482 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
930 | 483 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
931 | 484 | # SELECT | LIKE | ||
932 | 485 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
933 | 486 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
934 | 487 | # SELECT | WHERE | ||
935 | 488 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
936 | 489 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
937 | 490 | # | ||
938 | 491 | # User statistics | ||
939 | 492 | # | ||
940 | 493 | # SHOW | LIKE | ||
941 | 494 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
942 | 495 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
943 | 496 | # SHOW | WHERE | ||
944 | 497 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
945 | 498 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
946 | 499 | # SELECT | LIKE | ||
947 | 500 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
948 | 501 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
949 | 502 | # SELECT | WHERE | ||
950 | 503 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
951 | 504 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
952 | 505 | "" | ||
953 | 506 | Test update with secondary index scans and MyISAM | ||
954 | 507 | "" | ||
955 | 508 | insert into t3 values (0,0); | ||
956 | 509 | insert into t3 values (1,1); | ||
957 | 510 | insert into t3 values (2,2); | ||
958 | 511 | flush client_statistics; | ||
959 | 512 | flush thread_statistics; | ||
960 | 513 | flush user_statistics; | ||
961 | 514 | flush table_statistics; | ||
962 | 515 | flush index_statistics; | ||
963 | 516 | update t3 set a = 4 where b = 1; | ||
964 | 517 | Host | ||
965 | 518 | 1 | ||
966 | 519 | Thread | ||
967 | 520 | 1 | ||
968 | 521 | User | ||
969 | 522 | 1 | ||
970 | 523 | # | ||
971 | 524 | # Client statistics | ||
972 | 525 | # | ||
973 | 526 | # SHOW | LIKE | ||
974 | 527 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
975 | 528 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
976 | 529 | # SHOW | WHERE | ||
977 | 530 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
978 | 531 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
979 | 532 | # SELECT | LIKE | ||
980 | 533 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
981 | 534 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
982 | 535 | # SELECT | WHERE | ||
983 | 536 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
984 | 537 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
985 | 538 | # | ||
986 | 539 | # Thread statistics | ||
987 | 540 | # | ||
988 | 541 | # SHOW | LIKE | ||
989 | 542 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
990 | 543 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
991 | 544 | # SHOW | WHERE | ||
992 | 545 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
993 | 546 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
994 | 547 | # SELECT | LIKE | ||
995 | 548 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
996 | 549 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
997 | 550 | # SELECT | WHERE | ||
998 | 551 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
999 | 552 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1000 | 553 | # | ||
1001 | 554 | # User statistics | ||
1002 | 555 | # | ||
1003 | 556 | # SHOW | LIKE | ||
1004 | 557 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1005 | 558 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1006 | 559 | # SHOW | WHERE | ||
1007 | 560 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1008 | 561 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1009 | 562 | # SELECT | LIKE | ||
1010 | 563 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1011 | 564 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1012 | 565 | # SELECT | WHERE | ||
1013 | 566 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1014 | 567 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1015 | 568 | show table_statistics like 'test.t3'; | ||
1016 | 569 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1017 | 570 | test t3 1 1 2 | ||
1018 | 571 | show table_statistics where Table_schema='test' and Table_name='t3'; | ||
1019 | 572 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1020 | 573 | test t3 1 1 2 | ||
1021 | 574 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't3'; | ||
1022 | 575 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1023 | 576 | test t3 1 1 2 | ||
1024 | 577 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t3'; | ||
1025 | 578 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1026 | 579 | test t3 1 1 2 | ||
1027 | 580 | show index_statistics like 'test.t3.bx'; | ||
1028 | 581 | Table_schema Table_name Index_name Rows_read | ||
1029 | 582 | test t3 bx 1 | ||
1030 | 583 | show index_statistics where Table_schema='test' and Table_name='t3' and Index_name='bx'; | ||
1031 | 584 | Table_schema Table_name Index_name Rows_read | ||
1032 | 585 | test t3 bx 1 | ||
1033 | 586 | select * from information_schema.index_statistics where Table_schema like 'test' and Table_name like 't3' and Index_name like 'bx'; | ||
1034 | 587 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1035 | 588 | test t3 bx 1 | ||
1036 | 589 | select * from information_schema.index_statistics where Table_schema='test' and Table_name='t3' and Index_name='bx'; | ||
1037 | 590 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1038 | 591 | test t3 bx 1 | ||
1039 | 592 | "" | ||
1040 | 593 | Test delete with PK scans | ||
1041 | 594 | "" | ||
1042 | 595 | flush client_statistics; | ||
1043 | 596 | flush thread_statistics; | ||
1044 | 597 | flush user_statistics; | ||
1045 | 598 | flush table_statistics; | ||
1046 | 599 | flush index_statistics; | ||
1047 | 600 | delete from t1 where a = 3; | ||
1048 | 601 | Host | ||
1049 | 602 | 1 | ||
1050 | 603 | Thread | ||
1051 | 604 | 1 | ||
1052 | 605 | User | ||
1053 | 606 | 1 | ||
1054 | 607 | # | ||
1055 | 608 | # Client statistics | ||
1056 | 609 | # | ||
1057 | 610 | # SHOW | LIKE | ||
1058 | 611 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1059 | 612 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1060 | 613 | # SHOW | WHERE | ||
1061 | 614 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1062 | 615 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1063 | 616 | # SELECT | LIKE | ||
1064 | 617 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1065 | 618 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1066 | 619 | # SELECT | WHERE | ||
1067 | 620 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1068 | 621 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1069 | 622 | # | ||
1070 | 623 | # Thread statistics | ||
1071 | 624 | # | ||
1072 | 625 | # SHOW | LIKE | ||
1073 | 626 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1074 | 627 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1075 | 628 | # SHOW | WHERE | ||
1076 | 629 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1077 | 630 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1078 | 631 | # SELECT | LIKE | ||
1079 | 632 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1080 | 633 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1081 | 634 | # SELECT | WHERE | ||
1082 | 635 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1083 | 636 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1084 | 637 | # | ||
1085 | 638 | # User statistics | ||
1086 | 639 | # | ||
1087 | 640 | # SHOW | LIKE | ||
1088 | 641 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1089 | 642 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1090 | 643 | # SHOW | WHERE | ||
1091 | 644 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1092 | 645 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1093 | 646 | # SELECT | LIKE | ||
1094 | 647 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1095 | 648 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1096 | 649 | # SELECT | WHERE | ||
1097 | 650 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1098 | 651 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1099 | 652 | delete from t1 where b = 2; | ||
1100 | 653 | Host | ||
1101 | 654 | 1 | ||
1102 | 655 | Thread | ||
1103 | 656 | 1 | ||
1104 | 657 | User | ||
1105 | 658 | 1 | ||
1106 | 659 | # | ||
1107 | 660 | # Client statistics | ||
1108 | 661 | # | ||
1109 | 662 | # SHOW | LIKE | ||
1110 | 663 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1111 | 664 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
1112 | 665 | # SHOW | WHERE | ||
1113 | 666 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1114 | 667 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
1115 | 668 | # SELECT | LIKE | ||
1116 | 669 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1117 | 670 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
1118 | 671 | # SELECT | WHERE | ||
1119 | 672 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1120 | 673 | X 1 1 X X X X X X 0 2 0 0 2 6 0 0 0 0 0 0 | ||
1121 | 674 | # | ||
1122 | 675 | # Thread statistics | ||
1123 | 676 | # | ||
1124 | 677 | # SHOW | LIKE | ||
1125 | 678 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1126 | 679 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1127 | 680 | # SHOW | WHERE | ||
1128 | 681 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1129 | 682 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1130 | 683 | # SELECT | LIKE | ||
1131 | 684 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1132 | 685 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1133 | 686 | # SELECT | WHERE | ||
1134 | 687 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1135 | 688 | X 1 0 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1136 | 689 | # | ||
1137 | 690 | # User statistics | ||
1138 | 691 | # | ||
1139 | 692 | # SHOW | LIKE | ||
1140 | 693 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1141 | 694 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1142 | 695 | # SHOW | WHERE | ||
1143 | 696 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1144 | 697 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1145 | 698 | # SELECT | LIKE | ||
1146 | 699 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1147 | 700 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1148 | 701 | # SELECT | WHERE | ||
1149 | 702 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1150 | 703 | X 1 1 X X X X X X 0 2 0 0 2 4 0 0 0 0 0 0 | ||
1151 | 704 | show table_statistics like 'test.t1'; | ||
1152 | 705 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1153 | 706 | test t1 3 2 2 | ||
1154 | 707 | show table_statistics where Table_schema='test' and Table_name='t1'; | ||
1155 | 708 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1156 | 709 | test t1 3 2 2 | ||
1157 | 710 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't1'; | ||
1158 | 711 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1159 | 712 | test t1 3 2 2 | ||
1160 | 713 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t1'; | ||
1161 | 714 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1162 | 715 | test t1 3 2 2 | ||
1163 | 716 | show index_statistics like 'test.t1.PRIMARY'; | ||
1164 | 717 | Table_schema Table_name Index_name Rows_read | ||
1165 | 718 | test t1 PRIMARY 3 | ||
1166 | 719 | show index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
1167 | 720 | Table_schema Table_name Index_name Rows_read | ||
1168 | 721 | test t1 PRIMARY 3 | ||
1169 | 722 | select * from information_schema.index_statistics where Table_schema like 'test' and Table_name like 't1' and Index_name like 'PRIMARY'; | ||
1170 | 723 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1171 | 724 | test t1 PRIMARY 3 | ||
1172 | 725 | select * from information_schema.index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
1173 | 726 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1174 | 727 | test t1 PRIMARY 3 | ||
1175 | 728 | delete from t1 where b < 0; | ||
1176 | 729 | Host | ||
1177 | 730 | 1 | ||
1178 | 731 | Thread | ||
1179 | 732 | 1 | ||
1180 | 733 | User | ||
1181 | 734 | 1 | ||
1182 | 735 | # | ||
1183 | 736 | # Client statistics | ||
1184 | 737 | # | ||
1185 | 738 | # SHOW | LIKE | ||
1186 | 739 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1187 | 740 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
1188 | 741 | # SHOW | WHERE | ||
1189 | 742 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1190 | 743 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
1191 | 744 | # SELECT | LIKE | ||
1192 | 745 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1193 | 746 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
1194 | 747 | # SELECT | WHERE | ||
1195 | 748 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1196 | 749 | X 1 1 X X X X X X 4 2 0 4 3 12 0 0 0 0 0 0 | ||
1197 | 750 | # | ||
1198 | 751 | # Thread statistics | ||
1199 | 752 | # | ||
1200 | 753 | # SHOW | LIKE | ||
1201 | 754 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1202 | 755 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
1203 | 756 | # SHOW | WHERE | ||
1204 | 757 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1205 | 758 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
1206 | 759 | # SELECT | LIKE | ||
1207 | 760 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1208 | 761 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
1209 | 762 | # SELECT | WHERE | ||
1210 | 763 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1211 | 764 | X 1 0 X X X X X X 4 2 0 4 3 9 0 0 0 0 0 0 | ||
1212 | 765 | # | ||
1213 | 766 | # User statistics | ||
1214 | 767 | # | ||
1215 | 768 | # SHOW | LIKE | ||
1216 | 769 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1217 | 770 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
1218 | 771 | # SHOW | WHERE | ||
1219 | 772 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1220 | 773 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
1221 | 774 | # SELECT | LIKE | ||
1222 | 775 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1223 | 776 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
1224 | 777 | # SELECT | WHERE | ||
1225 | 778 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1226 | 779 | X 1 1 X X X X X X 4 2 0 4 3 10 0 0 0 0 0 0 | ||
1227 | 780 | "" | ||
1228 | 781 | Test delete with secondary index scans | ||
1229 | 782 | "" | ||
1230 | 783 | flush client_statistics; | ||
1231 | 784 | flush thread_statistics; | ||
1232 | 785 | flush user_statistics; | ||
1233 | 786 | flush table_statistics; | ||
1234 | 787 | flush index_statistics; | ||
1235 | 788 | delete from t3 where b = 1; | ||
1236 | 789 | Host | ||
1237 | 790 | 1 | ||
1238 | 791 | Thread | ||
1239 | 792 | 1 | ||
1240 | 793 | User | ||
1241 | 794 | 1 | ||
1242 | 795 | # | ||
1243 | 796 | # Client statistics | ||
1244 | 797 | # | ||
1245 | 798 | # SHOW | LIKE | ||
1246 | 799 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1247 | 800 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1248 | 801 | # SHOW | WHERE | ||
1249 | 802 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1250 | 803 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1251 | 804 | # SELECT | LIKE | ||
1252 | 805 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1253 | 806 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1254 | 807 | # SELECT | WHERE | ||
1255 | 808 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1256 | 809 | X 1 1 X X X X X X 0 1 0 0 1 4 0 0 0 0 0 0 | ||
1257 | 810 | # | ||
1258 | 811 | # Thread statistics | ||
1259 | 812 | # | ||
1260 | 813 | # SHOW | LIKE | ||
1261 | 814 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1262 | 815 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1263 | 816 | # SHOW | WHERE | ||
1264 | 817 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1265 | 818 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1266 | 819 | # SELECT | LIKE | ||
1267 | 820 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1268 | 821 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1269 | 822 | # SELECT | WHERE | ||
1270 | 823 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1271 | 824 | X 1 0 X X X X X X 0 1 0 0 1 3 0 0 0 0 0 0 | ||
1272 | 825 | # | ||
1273 | 826 | # User statistics | ||
1274 | 827 | # | ||
1275 | 828 | # SHOW | LIKE | ||
1276 | 829 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1277 | 830 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1278 | 831 | # SHOW | WHERE | ||
1279 | 832 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1280 | 833 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1281 | 834 | # SELECT | LIKE | ||
1282 | 835 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1283 | 836 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1284 | 837 | # SELECT | WHERE | ||
1285 | 838 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1286 | 839 | X 1 1 X X X X X X 0 1 0 0 1 2 0 0 0 0 0 0 | ||
1287 | 840 | show table_statistics like 'test.t3'; | ||
1288 | 841 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1289 | 842 | test t3 1 1 2 | ||
1290 | 843 | show table_statistics where Table_schema='test' and Table_name='t3'; | ||
1291 | 844 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1292 | 845 | test t3 1 1 2 | ||
1293 | 846 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't3'; | ||
1294 | 847 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1295 | 848 | test t3 1 1 2 | ||
1296 | 849 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t3'; | ||
1297 | 850 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1298 | 851 | test t3 1 1 2 | ||
1299 | 852 | show index_statistics like 'test.t3.bx'; | ||
1300 | 853 | Table_schema Table_name Index_name Rows_read | ||
1301 | 854 | test t3 bx 1 | ||
1302 | 855 | show index_statistics where Table_schema='test' and Table_name='t3' and Index_name='bx'; | ||
1303 | 856 | Table_schema Table_name Index_name Rows_read | ||
1304 | 857 | test t3 bx 1 | ||
1305 | 858 | select * from information_schema.index_statistics where Table_schema like 'test' and Table_name like 't3' and Index_name like 'bx'; | ||
1306 | 859 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1307 | 860 | test t3 bx 1 | ||
1308 | 861 | select * from information_schema.index_statistics where Table_schema='test' and Table_name='t3' and Index_name='bx'; | ||
1309 | 862 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1310 | 863 | test t3 bx 1 | ||
1311 | 864 | delete from t3 where b < 0; | ||
1312 | 865 | Host | ||
1313 | 866 | 1 | ||
1314 | 867 | Thread | ||
1315 | 868 | 1 | ||
1316 | 869 | User | ||
1317 | 870 | 1 | ||
1318 | 871 | # | ||
1319 | 872 | # Client statistics | ||
1320 | 873 | # | ||
1321 | 874 | # SHOW | LIKE | ||
1322 | 875 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1323 | 876 | X 1 1 X X X X X X 4 1 0 4 2 10 0 0 0 0 0 0 | ||
1324 | 877 | # SHOW | WHERE | ||
1325 | 878 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1326 | 879 | X 1 1 X X X X X X 4 1 0 4 2 10 0 0 0 0 0 0 | ||
1327 | 880 | # SELECT | LIKE | ||
1328 | 881 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1329 | 882 | X 1 1 X X X X X X 4 1 0 4 2 10 0 0 0 0 0 0 | ||
1330 | 883 | # SELECT | WHERE | ||
1331 | 884 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1332 | 885 | X 1 1 X X X X X X 4 1 0 4 2 10 0 0 0 0 0 0 | ||
1333 | 886 | # | ||
1334 | 887 | # Thread statistics | ||
1335 | 888 | # | ||
1336 | 889 | # SHOW | LIKE | ||
1337 | 890 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1338 | 891 | X 1 0 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1339 | 892 | # SHOW | WHERE | ||
1340 | 893 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1341 | 894 | X 1 0 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1342 | 895 | # SELECT | LIKE | ||
1343 | 896 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1344 | 897 | X 1 0 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1345 | 898 | # SELECT | WHERE | ||
1346 | 899 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1347 | 900 | X 1 0 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1348 | 901 | # | ||
1349 | 902 | # User statistics | ||
1350 | 903 | # | ||
1351 | 904 | # SHOW | LIKE | ||
1352 | 905 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1353 | 906 | X 1 1 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1354 | 907 | # SHOW | WHERE | ||
1355 | 908 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1356 | 909 | X 1 1 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1357 | 910 | # SELECT | LIKE | ||
1358 | 911 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1359 | 912 | X 1 1 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1360 | 913 | # SELECT | WHERE | ||
1361 | 914 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1362 | 915 | X 1 1 X X X X X X 4 1 0 4 2 8 0 0 0 0 0 0 | ||
1363 | 916 | "" | ||
1364 | 917 | Test select with PK scans | ||
1365 | 918 | "" | ||
1366 | 919 | insert into t1 values (1,1), (2,2); | ||
1367 | 920 | flush client_statistics; | ||
1368 | 921 | flush thread_statistics; | ||
1369 | 922 | flush user_statistics; | ||
1370 | 923 | flush table_statistics; | ||
1371 | 924 | flush index_statistics; | ||
1372 | 925 | select count(*) from t1 where a = 1; | ||
1373 | 926 | count(*) | ||
1374 | 927 | 1 | ||
1375 | 928 | Host | ||
1376 | 929 | 1 | ||
1377 | 930 | Thread | ||
1378 | 931 | 1 | ||
1379 | 932 | User | ||
1380 | 933 | 1 | ||
1381 | 934 | # | ||
1382 | 935 | # Client statistics | ||
1383 | 936 | # | ||
1384 | 937 | # SHOW | LIKE | ||
1385 | 938 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1386 | 939 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1387 | 940 | # SHOW | WHERE | ||
1388 | 941 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1389 | 942 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1390 | 943 | # SELECT | LIKE | ||
1391 | 944 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1392 | 945 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1393 | 946 | # SELECT | WHERE | ||
1394 | 947 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1395 | 948 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1396 | 949 | # | ||
1397 | 950 | # Thread statistics | ||
1398 | 951 | # | ||
1399 | 952 | # SHOW | LIKE | ||
1400 | 953 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1401 | 954 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1402 | 955 | # SHOW | WHERE | ||
1403 | 956 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1404 | 957 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1405 | 958 | # SELECT | LIKE | ||
1406 | 959 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1407 | 960 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1408 | 961 | # SELECT | WHERE | ||
1409 | 962 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1410 | 963 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1411 | 964 | # | ||
1412 | 965 | # User statistics | ||
1413 | 966 | # | ||
1414 | 967 | # SHOW | LIKE | ||
1415 | 968 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1416 | 969 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1417 | 970 | # SHOW | WHERE | ||
1418 | 971 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1419 | 972 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1420 | 973 | # SELECT | LIKE | ||
1421 | 974 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1422 | 975 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1423 | 976 | # SELECT | WHERE | ||
1424 | 977 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1425 | 978 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1426 | 979 | select count(*) from t1 where b < 0; | ||
1427 | 980 | count(*) | ||
1428 | 981 | 0 | ||
1429 | 982 | Host | ||
1430 | 983 | 1 | ||
1431 | 984 | Thread | ||
1432 | 985 | 1 | ||
1433 | 986 | User | ||
1434 | 987 | 1 | ||
1435 | 988 | # | ||
1436 | 989 | # Client statistics | ||
1437 | 990 | # | ||
1438 | 991 | # SHOW | LIKE | ||
1439 | 992 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1440 | 993 | X 1 1 X X X X X X 2 0 0 2 0 6 0 0 0 0 0 0 | ||
1441 | 994 | # SHOW | WHERE | ||
1442 | 995 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1443 | 996 | X 1 1 X X X X X X 2 0 0 2 0 6 0 0 0 0 0 0 | ||
1444 | 997 | # SELECT | LIKE | ||
1445 | 998 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1446 | 999 | X 1 1 X X X X X X 2 0 0 2 0 6 0 0 0 0 0 0 | ||
1447 | 1000 | # SELECT | WHERE | ||
1448 | 1001 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1449 | 1002 | X 1 1 X X X X X X 2 0 0 2 0 6 0 0 0 0 0 0 | ||
1450 | 1003 | # | ||
1451 | 1004 | # Thread statistics | ||
1452 | 1005 | # | ||
1453 | 1006 | # SHOW | LIKE | ||
1454 | 1007 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1455 | 1008 | X 1 0 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1456 | 1009 | # SHOW | WHERE | ||
1457 | 1010 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1458 | 1011 | X 1 0 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1459 | 1012 | # SELECT | LIKE | ||
1460 | 1013 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1461 | 1014 | X 1 0 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1462 | 1015 | # SELECT | WHERE | ||
1463 | 1016 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1464 | 1017 | X 1 0 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1465 | 1018 | # | ||
1466 | 1019 | # User statistics | ||
1467 | 1020 | # | ||
1468 | 1021 | # SHOW | LIKE | ||
1469 | 1022 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1470 | 1023 | X 1 1 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1471 | 1024 | # SHOW | WHERE | ||
1472 | 1025 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1473 | 1026 | X 1 1 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1474 | 1027 | # SELECT | LIKE | ||
1475 | 1028 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1476 | 1029 | X 1 1 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1477 | 1030 | # SELECT | WHERE | ||
1478 | 1031 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1479 | 1032 | X 1 1 X X X X X X 2 0 0 2 0 4 0 0 0 0 0 0 | ||
1480 | 1033 | show table_statistics like 'test.t1'; | ||
1481 | 1034 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1482 | 1035 | test t1 4 0 0 | ||
1483 | 1036 | show table_statistics where Table_schema='test' and Table_name='t1'; | ||
1484 | 1037 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1485 | 1038 | test t1 4 0 0 | ||
1486 | 1039 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't1'; | ||
1487 | 1040 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1488 | 1041 | test t1 4 0 0 | ||
1489 | 1042 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t1'; | ||
1490 | 1043 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1491 | 1044 | test t1 4 0 0 | ||
1492 | 1045 | show index_statistics like 'test.t1.PRIMARY'; | ||
1493 | 1046 | Table_schema Table_name Index_name Rows_read | ||
1494 | 1047 | test t1 PRIMARY 4 | ||
1495 | 1048 | show index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
1496 | 1049 | Table_schema Table_name Index_name Rows_read | ||
1497 | 1050 | test t1 PRIMARY 4 | ||
1498 | 1051 | select * from information_schema.index_statistics where Table_schema like 'test' and Table_name like 't1' and Index_name like 'PRIMARY'; | ||
1499 | 1052 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1500 | 1053 | test t1 PRIMARY 4 | ||
1501 | 1054 | select * from information_schema.index_statistics where Table_schema='test' and Table_name='t1' and Index_name='PRIMARY'; | ||
1502 | 1055 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1503 | 1056 | test t1 PRIMARY 4 | ||
1504 | 1057 | "" | ||
1505 | 1058 | Test select with secondary scans | ||
1506 | 1059 | "" | ||
1507 | 1060 | insert into t3 values (1,1); | ||
1508 | 1061 | analyze table t3; | ||
1509 | 1062 | Table Op Msg_type Msg_text | ||
1510 | 1063 | test.t3 analyze status OK | ||
1511 | 1064 | explain select * from t3 where b < 0; | ||
1512 | 1065 | id select_type table type possible_keys key key_len ref rows Extra | ||
1513 | 1066 | 1 SIMPLE t3 range bx bx 4 NULL 1 Using where | ||
1514 | 1067 | flush client_statistics; | ||
1515 | 1068 | flush thread_statistics; | ||
1516 | 1069 | flush user_statistics; | ||
1517 | 1070 | flush table_statistics; | ||
1518 | 1071 | flush index_statistics; | ||
1519 | 1072 | select * from t3 where b = 1; | ||
1520 | 1073 | a b | ||
1521 | 1074 | 1 1 | ||
1522 | 1075 | Host | ||
1523 | 1076 | 1 | ||
1524 | 1077 | Thread | ||
1525 | 1078 | 1 | ||
1526 | 1079 | User | ||
1527 | 1080 | 1 | ||
1528 | 1081 | # | ||
1529 | 1082 | # Client statistics | ||
1530 | 1083 | # | ||
1531 | 1084 | # SHOW | LIKE | ||
1532 | 1085 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1533 | 1086 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1534 | 1087 | # SHOW | WHERE | ||
1535 | 1088 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1536 | 1089 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1537 | 1090 | # SELECT | LIKE | ||
1538 | 1091 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1539 | 1092 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1540 | 1093 | # SELECT | WHERE | ||
1541 | 1094 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1542 | 1095 | X 1 1 X X X X X X 1 0 0 1 0 4 0 0 0 0 0 0 | ||
1543 | 1096 | # | ||
1544 | 1097 | # Thread statistics | ||
1545 | 1098 | # | ||
1546 | 1099 | # SHOW | LIKE | ||
1547 | 1100 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1548 | 1101 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1549 | 1102 | # SHOW | WHERE | ||
1550 | 1103 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1551 | 1104 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1552 | 1105 | # SELECT | LIKE | ||
1553 | 1106 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1554 | 1107 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1555 | 1108 | # SELECT | WHERE | ||
1556 | 1109 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1557 | 1110 | X 1 0 X X X X X X 1 0 0 1 0 3 0 0 0 0 0 0 | ||
1558 | 1111 | # | ||
1559 | 1112 | # User statistics | ||
1560 | 1113 | # | ||
1561 | 1114 | # SHOW | LIKE | ||
1562 | 1115 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1563 | 1116 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1564 | 1117 | # SHOW | WHERE | ||
1565 | 1118 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1566 | 1119 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1567 | 1120 | # SELECT | LIKE | ||
1568 | 1121 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1569 | 1122 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1570 | 1123 | # SELECT | WHERE | ||
1571 | 1124 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1572 | 1125 | X 1 1 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1573 | 1126 | select * from t3 where b < 0; | ||
1574 | 1127 | a b | ||
1575 | 1128 | Host | ||
1576 | 1129 | 1 | ||
1577 | 1130 | Thread | ||
1578 | 1131 | 1 | ||
1579 | 1132 | User | ||
1580 | 1133 | 1 | ||
1581 | 1134 | # | ||
1582 | 1135 | # Client statistics | ||
1583 | 1136 | # | ||
1584 | 1137 | # SHOW | LIKE | ||
1585 | 1138 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1586 | 1139 | X 1 1 X X X X X X 1 0 0 2 0 6 0 0 0 0 0 1 | ||
1587 | 1140 | # SHOW | WHERE | ||
1588 | 1141 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1589 | 1142 | X 1 1 X X X X X X 1 0 0 2 0 6 0 0 0 0 0 1 | ||
1590 | 1143 | # SELECT | LIKE | ||
1591 | 1144 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1592 | 1145 | X 1 1 X X X X X X 1 0 0 2 0 6 0 0 0 0 0 1 | ||
1593 | 1146 | # SELECT | WHERE | ||
1594 | 1147 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1595 | 1148 | X 1 1 X X X X X X 1 0 0 2 0 6 0 0 0 0 0 1 | ||
1596 | 1149 | # | ||
1597 | 1150 | # Thread statistics | ||
1598 | 1151 | # | ||
1599 | 1152 | # SHOW | LIKE | ||
1600 | 1153 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1601 | 1154 | X 1 0 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1602 | 1155 | # SHOW | WHERE | ||
1603 | 1156 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1604 | 1157 | X 1 0 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1605 | 1158 | # SELECT | LIKE | ||
1606 | 1159 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1607 | 1160 | X 1 0 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1608 | 1161 | # SELECT | WHERE | ||
1609 | 1162 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1610 | 1163 | X 1 0 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1611 | 1164 | # | ||
1612 | 1165 | # User statistics | ||
1613 | 1166 | # | ||
1614 | 1167 | # SHOW | LIKE | ||
1615 | 1168 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1616 | 1169 | X 1 1 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1617 | 1170 | # SHOW | WHERE | ||
1618 | 1171 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1619 | 1172 | X 1 1 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1620 | 1173 | # SELECT | LIKE | ||
1621 | 1174 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1622 | 1175 | X 1 1 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1623 | 1176 | # SELECT | WHERE | ||
1624 | 1177 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1625 | 1178 | X 1 1 X X X X X X 1 0 0 2 0 4 0 0 0 0 0 1 | ||
1626 | 1179 | show table_statistics like 'test.t3'; | ||
1627 | 1180 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1628 | 1181 | test t3 2 0 0 | ||
1629 | 1182 | show table_statistics where Table_schema='test' and Table_name='t3'; | ||
1630 | 1183 | Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes | ||
1631 | 1184 | test t3 2 0 0 | ||
1632 | 1185 | select * from information_schema.table_statistics where Table_schema like 'test' and Table_name like 't3'; | ||
1633 | 1186 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1634 | 1187 | test t3 2 0 0 | ||
1635 | 1188 | select * from information_schema.table_statistics where Table_schema='test' and Table_name='t3'; | ||
1636 | 1189 | TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES | ||
1637 | 1190 | test t3 2 0 0 | ||
1638 | 1191 | show index_statistics like 'test.t3.bx'; | ||
1639 | 1192 | Table_schema Table_name Index_name Rows_read | ||
1640 | 1193 | test t3 bx 2 | ||
1641 | 1194 | show index_statistics where Table_schema='test' and Table_name='t3' and Index_name='bx'; | ||
1642 | 1195 | Table_schema Table_name Index_name Rows_read | ||
1643 | 1196 | test t3 bx 2 | ||
1644 | 1197 | select * from information_schema.index_statistics where Table_schema like 'test' and Table_name like 't3' and Index_name like 'bx'; | ||
1645 | 1198 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1646 | 1199 | test t3 bx 2 | ||
1647 | 1200 | select * from information_schema.index_statistics where Table_schema='test' and Table_name='t3' and Index_name='bx'; | ||
1648 | 1201 | TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ | ||
1649 | 1202 | test t3 bx 2 | ||
1650 | 1203 | "" | ||
1651 | 1204 | Test denied connections | ||
1652 | 1205 | "" | ||
1653 | 1206 | create user foo@localhost identified by 'bar'; | ||
1654 | 1207 | grant all on test.t1 to foo@localhost with max_user_connections 2; | ||
1655 | 1208 | flush client_statistics; | ||
1656 | 1209 | flush thread_statistics; | ||
1657 | 1210 | flush user_statistics; | ||
1658 | 1211 | select current_user(); | ||
1659 | 1212 | current_user() | ||
1660 | 1213 | foo@localhost | ||
1661 | 1214 | Host | ||
1662 | 1215 | 1 | ||
1663 | 1216 | Thread | ||
1664 | 1217 | 1 | ||
1665 | 1218 | User | ||
1666 | 1219 | 1 | ||
1667 | 1220 | # | ||
1668 | 1221 | # Client statistics | ||
1669 | 1222 | # | ||
1670 | 1223 | # SHOW | LIKE | ||
1671 | 1224 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1672 | 1225 | X 2 2 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1673 | 1226 | # SHOW | WHERE | ||
1674 | 1227 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1675 | 1228 | X 2 2 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1676 | 1229 | # SELECT | LIKE | ||
1677 | 1230 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1678 | 1231 | X 2 2 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1679 | 1232 | # SELECT | WHERE | ||
1680 | 1233 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1681 | 1234 | X 2 2 X X X X X X 1 0 0 1 0 2 0 0 0 0 0 0 | ||
1682 | 1235 | # | ||
1683 | 1236 | # Thread statistics | ||
1684 | 1237 | # | ||
1685 | 1238 | # SHOW | LIKE | ||
1686 | 1239 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1687 | 1240 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1688 | 1241 | # SHOW | WHERE | ||
1689 | 1242 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1690 | 1243 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1691 | 1244 | # SELECT | LIKE | ||
1692 | 1245 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1693 | 1246 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1694 | 1247 | # SELECT | WHERE | ||
1695 | 1248 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1696 | 1249 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1697 | 1250 | # | ||
1698 | 1251 | # User statistics | ||
1699 | 1252 | # | ||
1700 | 1253 | # SHOW | LIKE | ||
1701 | 1254 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1702 | 1255 | X 1 1 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1703 | 1256 | # SHOW | WHERE | ||
1704 | 1257 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1705 | 1258 | X 1 1 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1706 | 1259 | # SELECT | LIKE | ||
1707 | 1260 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1708 | 1261 | X 1 1 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1709 | 1262 | # SELECT | WHERE | ||
1710 | 1263 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1711 | 1264 | X 1 1 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1712 | 1265 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
1713 | 1266 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
1714 | 1267 | set global userstat_running=OFF; | ||
1715 | 1268 | set global userstat_running=ON; | ||
1716 | 1269 | # | ||
1717 | 1270 | # Client statistics | ||
1718 | 1271 | # | ||
1719 | 1272 | # SHOW | LIKE | ||
1720 | 1273 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1721 | 1274 | X 2 1 X X X X X X 1 0 0 1 0 7 0 0 0 0 0 0 | ||
1722 | 1275 | # SHOW | WHERE | ||
1723 | 1276 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1724 | 1277 | X 2 1 X X X X X X 1 0 0 1 0 7 0 0 0 0 0 0 | ||
1725 | 1278 | # SELECT | LIKE | ||
1726 | 1279 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1727 | 1280 | X 2 1 X X X X X X 1 0 0 1 0 7 0 0 0 0 0 0 | ||
1728 | 1281 | # SELECT | WHERE | ||
1729 | 1282 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1730 | 1283 | X 2 1 X X X X X X 1 0 0 1 0 7 0 0 0 0 0 0 | ||
1731 | 1284 | # | ||
1732 | 1285 | # Thread statistics | ||
1733 | 1286 | # | ||
1734 | 1287 | # SHOW | LIKE | ||
1735 | 1288 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1736 | 1289 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1737 | 1290 | # SHOW | WHERE | ||
1738 | 1291 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1739 | 1292 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1740 | 1293 | # SELECT | LIKE | ||
1741 | 1294 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1742 | 1295 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1743 | 1296 | # SELECT | WHERE | ||
1744 | 1297 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1745 | 1298 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1746 | 1299 | # | ||
1747 | 1300 | # User statistics | ||
1748 | 1301 | # | ||
1749 | 1302 | # SHOW | LIKE | ||
1750 | 1303 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1751 | 1304 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1752 | 1305 | # SHOW | WHERE | ||
1753 | 1306 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1754 | 1307 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1755 | 1308 | # SELECT | LIKE | ||
1756 | 1309 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1757 | 1310 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1758 | 1311 | # SELECT | WHERE | ||
1759 | 1312 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1760 | 1313 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1761 | 1314 | connect(localhost,foo,wrong,test,MASTER_PORT,MASTER_SOCKET); | ||
1762 | 1315 | ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES) | ||
1763 | 1316 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
1764 | 1317 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
1765 | 1318 | set global userstat_running=OFF; | ||
1766 | 1319 | set global userstat_running=ON; | ||
1767 | 1320 | # | ||
1768 | 1321 | # Client statistics | ||
1769 | 1322 | # | ||
1770 | 1323 | # SHOW | LIKE | ||
1771 | 1324 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1772 | 1325 | X 2 1 X X X X X X 1 0 0 1 0 12 0 0 1 0 1 0 | ||
1773 | 1326 | # SHOW | WHERE | ||
1774 | 1327 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1775 | 1328 | X 2 1 X X X X X X 1 0 0 1 0 12 0 0 1 0 1 0 | ||
1776 | 1329 | # SELECT | LIKE | ||
1777 | 1330 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1778 | 1331 | X 2 1 X X X X X X 1 0 0 1 0 12 0 0 1 0 1 0 | ||
1779 | 1332 | # SELECT | WHERE | ||
1780 | 1333 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1781 | 1334 | X 2 1 X X X X X X 1 0 0 1 0 12 0 0 1 0 1 0 | ||
1782 | 1335 | # | ||
1783 | 1336 | # Thread statistics | ||
1784 | 1337 | # | ||
1785 | 1338 | # SHOW | LIKE | ||
1786 | 1339 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1787 | 1340 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1788 | 1341 | # SHOW | WHERE | ||
1789 | 1342 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1790 | 1343 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1791 | 1344 | # SELECT | LIKE | ||
1792 | 1345 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1793 | 1346 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1794 | 1347 | # SELECT | WHERE | ||
1795 | 1348 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1796 | 1349 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 0 0 0 0 | ||
1797 | 1350 | # | ||
1798 | 1351 | # User statistics | ||
1799 | 1352 | # | ||
1800 | 1353 | # SHOW | LIKE | ||
1801 | 1354 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1802 | 1355 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 1 0 1 0 | ||
1803 | 1356 | # SHOW | WHERE | ||
1804 | 1357 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1805 | 1358 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 1 0 1 0 | ||
1806 | 1359 | # SELECT | LIKE | ||
1807 | 1360 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1808 | 1361 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 1 0 1 0 | ||
1809 | 1362 | # SELECT | WHERE | ||
1810 | 1363 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1811 | 1364 | X 1 0 X X X X X X 1 0 0 1 0 0 0 0 1 0 1 0 | ||
1812 | 1365 | "" | ||
1813 | 1366 | Test access denied | ||
1814 | 1367 | echo "" | ||
1815 | 1368 | flush client_statistics; | ||
1816 | 1369 | flush thread_statistics; | ||
1817 | 1370 | flush user_statistics; | ||
1818 | 1371 | select current_user(); | ||
1819 | 1372 | current_user() | ||
1820 | 1373 | foo@localhost | ||
1821 | 1374 | select count(*) from t1; | ||
1822 | 1375 | count(*) | ||
1823 | 1376 | 3 | ||
1824 | 1377 | select * from t3; | ||
1825 | 1378 | ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't3' | ||
1826 | 1379 | Host | ||
1827 | 1380 | 1 | ||
1828 | 1381 | Thread | ||
1829 | 1382 | 1 | ||
1830 | 1383 | User | ||
1831 | 1384 | 1 | ||
1832 | 1385 | # | ||
1833 | 1386 | # Client statistics | ||
1834 | 1387 | # | ||
1835 | 1388 | # SHOW | LIKE | ||
1836 | 1389 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1837 | 1390 | X 2 2 X X X X X X 2 0 3 3 0 2 1 0 0 0 1 1 | ||
1838 | 1391 | # SHOW | WHERE | ||
1839 | 1392 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1840 | 1393 | X 2 2 X X X X X X 2 0 3 3 0 2 1 0 0 0 1 1 | ||
1841 | 1394 | # SELECT | LIKE | ||
1842 | 1395 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1843 | 1396 | X 2 2 X X X X X X 2 0 3 3 0 2 1 0 0 0 1 1 | ||
1844 | 1397 | # SELECT | WHERE | ||
1845 | 1398 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1846 | 1399 | X 2 2 X X X X X X 2 0 3 3 0 2 1 0 0 0 1 1 | ||
1847 | 1400 | # | ||
1848 | 1401 | # Thread statistics | ||
1849 | 1402 | # | ||
1850 | 1403 | # SHOW | LIKE | ||
1851 | 1404 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1852 | 1405 | X 1 0 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1853 | 1406 | # SHOW | WHERE | ||
1854 | 1407 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1855 | 1408 | X 1 0 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1856 | 1409 | # SELECT | LIKE | ||
1857 | 1410 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1858 | 1411 | X 1 0 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1859 | 1412 | # SELECT | WHERE | ||
1860 | 1413 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1861 | 1414 | X 1 0 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1862 | 1415 | # | ||
1863 | 1416 | # User statistics | ||
1864 | 1417 | # | ||
1865 | 1418 | # SHOW | LIKE | ||
1866 | 1419 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1867 | 1420 | X 1 1 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1868 | 1421 | # SHOW | WHERE | ||
1869 | 1422 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1870 | 1423 | X 1 1 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1871 | 1424 | # SELECT | LIKE | ||
1872 | 1425 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1873 | 1426 | X 1 1 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1874 | 1427 | # SELECT | WHERE | ||
1875 | 1428 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1876 | 1429 | X 1 1 X X X X X X 2 0 3 3 0 0 1 0 0 0 1 1 | ||
1877 | 1430 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
1878 | 1431 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
1879 | 1432 | set global userstat_running=OFF; | ||
1880 | 1433 | set global userstat_running=ON; | ||
1881 | 1434 | "" | ||
1882 | 1435 | Test rollback and commit | ||
1883 | 1436 | echo "" | ||
1884 | 1437 | set autocommit=0; | ||
1885 | 1438 | flush client_statistics; | ||
1886 | 1439 | flush thread_statistics; | ||
1887 | 1440 | flush user_statistics; | ||
1888 | 1441 | insert into t1 values (10,10); | ||
1889 | 1442 | commit; | ||
1890 | 1443 | Host | ||
1891 | 1444 | 1 | ||
1892 | 1445 | Thread | ||
1893 | 1446 | 1 | ||
1894 | 1447 | User | ||
1895 | 1448 | 1 | ||
1896 | 1449 | # | ||
1897 | 1450 | # Client statistics | ||
1898 | 1451 | # | ||
1899 | 1452 | # SHOW | LIKE | ||
1900 | 1453 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1901 | 1454 | X 1 1 X X X X X X 0 1 0 0 1 3 1 0 0 0 0 0 | ||
1902 | 1455 | # SHOW | WHERE | ||
1903 | 1456 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1904 | 1457 | X 1 1 X X X X X X 0 1 0 0 1 3 1 0 0 0 0 0 | ||
1905 | 1458 | # SELECT | LIKE | ||
1906 | 1459 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1907 | 1460 | X 1 1 X X X X X X 0 1 0 0 1 3 1 0 0 0 0 0 | ||
1908 | 1461 | # SELECT | WHERE | ||
1909 | 1462 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1910 | 1463 | X 1 1 X X X X X X 0 1 0 0 1 3 1 0 0 0 0 0 | ||
1911 | 1464 | # | ||
1912 | 1465 | # Thread statistics | ||
1913 | 1466 | # | ||
1914 | 1467 | # SHOW | LIKE | ||
1915 | 1468 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1916 | 1469 | X 1 0 X X X X X X 0 1 0 0 1 2 1 0 0 0 0 0 | ||
1917 | 1470 | # SHOW | WHERE | ||
1918 | 1471 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1919 | 1472 | X 1 0 X X X X X X 0 1 0 0 1 2 1 0 0 0 0 0 | ||
1920 | 1473 | # SELECT | LIKE | ||
1921 | 1474 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1922 | 1475 | X 1 0 X X X X X X 0 1 0 0 1 2 1 0 0 0 0 0 | ||
1923 | 1476 | # SELECT | WHERE | ||
1924 | 1477 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1925 | 1478 | X 1 0 X X X X X X 0 1 0 0 1 2 1 0 0 0 0 0 | ||
1926 | 1479 | # | ||
1927 | 1480 | # User statistics | ||
1928 | 1481 | # | ||
1929 | 1482 | # SHOW | LIKE | ||
1930 | 1483 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1931 | 1484 | X 1 1 X X X X X X 0 1 0 0 1 1 1 0 0 0 0 0 | ||
1932 | 1485 | # SHOW | WHERE | ||
1933 | 1486 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1934 | 1487 | X 1 1 X X X X X X 0 1 0 0 1 1 1 0 0 0 0 0 | ||
1935 | 1488 | # SELECT | LIKE | ||
1936 | 1489 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1937 | 1490 | X 1 1 X X X X X X 0 1 0 0 1 1 1 0 0 0 0 0 | ||
1938 | 1491 | # SELECT | WHERE | ||
1939 | 1492 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1940 | 1493 | X 1 1 X X X X X X 0 1 0 0 1 1 1 0 0 0 0 0 | ||
1941 | 1494 | insert into t1 values (11,11); | ||
1942 | 1495 | rollback; | ||
1943 | 1496 | Host | ||
1944 | 1497 | 1 | ||
1945 | 1498 | Thread | ||
1946 | 1499 | 1 | ||
1947 | 1500 | User | ||
1948 | 1501 | 1 | ||
1949 | 1502 | # | ||
1950 | 1503 | # Client statistics | ||
1951 | 1504 | # | ||
1952 | 1505 | # SHOW | LIKE | ||
1953 | 1506 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1954 | 1507 | X 1 1 X X X X X X 0 2 0 0 2 6 1 1 0 0 0 0 | ||
1955 | 1508 | # SHOW | WHERE | ||
1956 | 1509 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1957 | 1510 | X 1 1 X X X X X X 0 2 0 0 2 6 1 1 0 0 0 0 | ||
1958 | 1511 | # SELECT | LIKE | ||
1959 | 1512 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1960 | 1513 | X 1 1 X X X X X X 0 2 0 0 2 6 1 1 0 0 0 0 | ||
1961 | 1514 | # SELECT | WHERE | ||
1962 | 1515 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1963 | 1516 | X 1 1 X X X X X X 0 2 0 0 2 6 1 1 0 0 0 0 | ||
1964 | 1517 | # | ||
1965 | 1518 | # Thread statistics | ||
1966 | 1519 | # | ||
1967 | 1520 | # SHOW | LIKE | ||
1968 | 1521 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1969 | 1522 | X 1 0 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1970 | 1523 | # SHOW | WHERE | ||
1971 | 1524 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1972 | 1525 | X 1 0 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1973 | 1526 | # SELECT | LIKE | ||
1974 | 1527 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1975 | 1528 | X 1 0 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1976 | 1529 | # SELECT | WHERE | ||
1977 | 1530 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1978 | 1531 | X 1 0 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1979 | 1532 | # | ||
1980 | 1533 | # User statistics | ||
1981 | 1534 | # | ||
1982 | 1535 | # SHOW | LIKE | ||
1983 | 1536 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1984 | 1537 | X 1 1 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1985 | 1538 | # SHOW | WHERE | ||
1986 | 1539 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
1987 | 1540 | X 1 1 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1988 | 1541 | # SELECT | LIKE | ||
1989 | 1542 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1990 | 1543 | X 1 1 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1991 | 1544 | # SELECT | WHERE | ||
1992 | 1545 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
1993 | 1546 | X 1 1 X X X X X X 0 2 0 0 2 4 1 1 0 0 0 0 | ||
1994 | 1547 | select * from t1; | ||
1995 | 1548 | a b | ||
1996 | 1549 | 0 0 | ||
1997 | 1550 | 1 1 | ||
1998 | 1551 | 2 2 | ||
1999 | 1552 | 10 10 | ||
2000 | 1553 | "" | ||
2001 | 1554 | Test empty queries | ||
2002 | 1555 | echo "" | ||
2003 | 1556 | flush client_statistics; | ||
2004 | 1557 | flush thread_statistics; | ||
2005 | 1558 | flush user_statistics; | ||
2006 | 1559 | select * from t1 where a < -1; | ||
2007 | 1560 | a b | ||
2008 | 1561 | select * from t1 where a < -3; | ||
2009 | 1562 | a b | ||
2010 | 1563 | Host | ||
2011 | 1564 | 1 | ||
2012 | 1565 | Thread | ||
2013 | 1566 | 1 | ||
2014 | 1567 | User | ||
2015 | 1568 | 1 | ||
2016 | 1569 | # | ||
2017 | 1570 | # Client statistics | ||
2018 | 1571 | # | ||
2019 | 1572 | # SHOW | LIKE | ||
2020 | 1573 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2021 | 1574 | X 1 1 X X X X X X 0 0 1 2 0 2 0 0 0 0 0 2 | ||
2022 | 1575 | # SHOW | WHERE | ||
2023 | 1576 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2024 | 1577 | X 1 1 X X X X X X 0 0 1 2 0 2 0 0 0 0 0 2 | ||
2025 | 1578 | # SELECT | LIKE | ||
2026 | 1579 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2027 | 1580 | X 1 1 X X X X X X 0 0 1 2 0 2 0 0 0 0 0 2 | ||
2028 | 1581 | # SELECT | WHERE | ||
2029 | 1582 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2030 | 1583 | X 1 1 X X X X X X 0 0 1 2 0 2 0 0 0 0 0 2 | ||
2031 | 1584 | # | ||
2032 | 1585 | # Thread statistics | ||
2033 | 1586 | # | ||
2034 | 1587 | # SHOW | LIKE | ||
2035 | 1588 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2036 | 1589 | X 1 0 X X X X X X 0 0 1 2 0 1 0 0 0 0 0 2 | ||
2037 | 1590 | # SHOW | WHERE | ||
2038 | 1591 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2039 | 1592 | X 1 0 X X X X X X 0 0 1 2 0 1 0 0 0 0 0 2 | ||
2040 | 1593 | # SELECT | LIKE | ||
2041 | 1594 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2042 | 1595 | X 1 0 X X X X X X 0 0 1 2 0 1 0 0 0 0 0 2 | ||
2043 | 1596 | # SELECT | WHERE | ||
2044 | 1597 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2045 | 1598 | X 1 0 X X X X X X 0 0 1 2 0 1 0 0 0 0 0 2 | ||
2046 | 1599 | # | ||
2047 | 1600 | # User statistics | ||
2048 | 1601 | # | ||
2049 | 1602 | # SHOW | LIKE | ||
2050 | 1603 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2051 | 1604 | X 1 1 X X X X X X 0 0 1 2 0 0 0 0 0 0 0 2 | ||
2052 | 1605 | # SHOW | WHERE | ||
2053 | 1606 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2054 | 1607 | X 1 1 X X X X X X 0 0 1 2 0 0 0 0 0 0 0 2 | ||
2055 | 1608 | # SELECT | LIKE | ||
2056 | 1609 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2057 | 1610 | X 1 1 X X X X X X 0 0 1 2 0 0 0 0 0 0 0 2 | ||
2058 | 1611 | # SELECT | WHERE | ||
2059 | 1612 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2060 | 1613 | X 1 1 X X X X X X 0 0 1 2 0 0 0 0 0 0 0 2 | ||
2061 | 1614 | "" | ||
2062 | 1615 | Test lost connections | ||
2063 | 1616 | "" | ||
2064 | 1617 | set global wait_timeout = 1; | ||
2065 | 1618 | set global interactive_timeout = 1; | ||
2066 | 1619 | flush client_statistics; | ||
2067 | 1620 | flush thread_statistics; | ||
2068 | 1621 | flush user_statistics; | ||
2069 | 1622 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
2070 | 1623 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
2071 | 1624 | set global userstat_running=OFF; | ||
2072 | 1625 | set global userstat_running=ON; | ||
2073 | 1626 | Host | ||
2074 | 1627 | 1 | ||
2075 | 1628 | Thread | ||
2076 | 1629 | 1 | ||
2077 | 1630 | User | ||
2078 | 1631 | 1 | ||
2079 | 1632 | # | ||
2080 | 1633 | # Client statistics | ||
2081 | 1634 | # | ||
2082 | 1635 | # SHOW | LIKE | ||
2083 | 1636 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2084 | 1637 | X 2 1 X X X X X X 0 0 0 0 0 5 0 0 0 1 0 0 | ||
2085 | 1638 | # SHOW | WHERE | ||
2086 | 1639 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2087 | 1640 | X 2 1 X X X X X X 0 0 0 0 0 5 0 0 0 1 0 0 | ||
2088 | 1641 | # SELECT | LIKE | ||
2089 | 1642 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2090 | 1643 | X 2 1 X X X X X X 0 0 0 0 0 5 0 0 0 1 0 0 | ||
2091 | 1644 | # SELECT | WHERE | ||
2092 | 1645 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2093 | 1646 | X 2 1 X X X X X X 0 0 0 0 0 5 0 0 0 1 0 0 | ||
2094 | 1647 | # | ||
2095 | 1648 | # Thread statistics | ||
2096 | 1649 | # | ||
2097 | 1650 | # SHOW | LIKE | ||
2098 | 1651 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2099 | 1652 | X 1 0 X X X X X X 0 0 0 0 0 4 0 0 0 0 0 0 | ||
2100 | 1653 | # SHOW | WHERE | ||
2101 | 1654 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2102 | 1655 | X 1 0 X X X X X X 0 0 0 0 0 4 0 0 0 0 0 0 | ||
2103 | 1656 | # SELECT | LIKE | ||
2104 | 1657 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2105 | 1658 | X 1 0 X X X X X X 0 0 0 0 0 4 0 0 0 0 0 0 | ||
2106 | 1659 | # SELECT | WHERE | ||
2107 | 1660 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2108 | 1661 | X 1 0 X X X X X X 0 0 0 0 0 4 0 0 0 0 0 0 | ||
2109 | 1662 | # | ||
2110 | 1663 | # User statistics | ||
2111 | 1664 | # | ||
2112 | 1665 | # SHOW | LIKE | ||
2113 | 1666 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2114 | 1667 | X 2 1 X X X X X X 0 0 0 0 0 3 0 0 0 1 0 0 | ||
2115 | 1668 | # SHOW | WHERE | ||
2116 | 1669 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2117 | 1670 | X 2 1 X X X X X X 0 0 0 0 0 3 0 0 0 1 0 0 | ||
2118 | 1671 | # SELECT | LIKE | ||
2119 | 1672 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2120 | 1673 | X 2 1 X X X X X X 0 0 0 0 0 3 0 0 0 1 0 0 | ||
2121 | 1674 | # SELECT | WHERE | ||
2122 | 1675 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2123 | 1676 | X 2 1 X X X X X X 0 0 0 0 0 3 0 0 0 1 0 0 | ||
2124 | 1677 | set global wait_timeout = DEFAULT; | ||
2125 | 1678 | set global interactive_timeout = DEFAULT; | ||
2126 | 1679 | "" | ||
2127 | 1680 | Test non-existent users | ||
2128 | 1681 | echo "" | ||
2129 | 1682 | flush client_statistics; | ||
2130 | 1683 | flush thread_statistics; | ||
2131 | 1684 | flush user_statistics; | ||
2132 | 1685 | connect(localhost,userDNE,,test,MASTER_PORT,MASTER_SOCKET); | ||
2133 | 1686 | ERROR 28000: Access denied for user 'userDNE'@'localhost' (using password: NO) | ||
2134 | 1687 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
2135 | 1688 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
2136 | 1689 | set global userstat_running=OFF; | ||
2137 | 1690 | set global userstat_running=ON; | ||
2138 | 1691 | # | ||
2139 | 1692 | # Client statistics | ||
2140 | 1693 | # | ||
2141 | 1694 | # SHOW | LIKE | ||
2142 | 1695 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2143 | 1696 | # SHOW | WHERE | ||
2144 | 1697 | Client Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2145 | 1698 | # SELECT | LIKE | ||
2146 | 1699 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2147 | 1700 | # SELECT | WHERE | ||
2148 | 1701 | CLIENT TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2149 | 1702 | # | ||
2150 | 1703 | # Thread statistics | ||
2151 | 1704 | # | ||
2152 | 1705 | # SHOW | LIKE | ||
2153 | 1706 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2154 | 1707 | # SHOW | WHERE | ||
2155 | 1708 | Thread_id Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2156 | 1709 | # SELECT | LIKE | ||
2157 | 1710 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2158 | 1711 | # SELECT | WHERE | ||
2159 | 1712 | THREAD_ID TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2160 | 1713 | # | ||
2161 | 1714 | # User statistics | ||
2162 | 1715 | # | ||
2163 | 1716 | # SHOW | LIKE | ||
2164 | 1717 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2165 | 1718 | # SHOW | WHERE | ||
2166 | 1719 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2167 | 1720 | # SELECT | LIKE | ||
2168 | 1721 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2169 | 1722 | # SELECT | WHERE | ||
2170 | 1723 | USER TOTAL_CONNECTIONS CONCURRENT_CONNECTIONS CONNECTED_TIME BUSY_TIME CPU_TIME BYTES_RECEIVED BYTES_SENT BINLOG_BYTES_WRITTEN ROWS_FETCHED ROWS_UPDATED TABLE_ROWS_READ SELECT_COMMANDS UPDATE_COMMANDS OTHER_COMMANDS COMMIT_TRANSACTIONS ROLLBACK_TRANSACTIONS DENIED_CONNECTIONS LOST_CONNECTIONS ACCESS_DENIED EMPTY_QUERIES | ||
2171 | 1724 | drop table t1; | ||
2172 | 1725 | drop table t2; | ||
2173 | 1726 | drop table t3; | ||
2174 | 1727 | drop user foo@localhost; | ||
2175 | 1728 | update mysql.db set User='' where User='hide'; | ||
2176 | 1729 | insert into mysql.user select * from mysql.user_bak; | ||
2177 | 1730 | drop table mysql.user_bak; | ||
2178 | 1731 | flush privileges; | ||
2179 | 1732 | set global userstat_running=default; | ||
2180 | 1733 | set global thread_statistics=default; | ||
2181 | 1734 | set global debug='reset'; | ||
2182 | 1735 | set debug_sync='reset'; | ||
2183 | 0 | 1736 | ||
2184 | === added file 'Percona-Server/mysql-test/r/user_stats.result' | |||
2185 | --- Percona-Server/mysql-test/r/user_stats.result 1970-01-01 00:00:00 +0000 | |||
2186 | +++ Percona-Server/mysql-test/r/user_stats.result 2012-02-02 06:11:26 +0000 | |||
2187 | @@ -0,0 +1,90 @@ | |||
2188 | 1 | set global userstat_running=ON; | ||
2189 | 2 | drop database if exists mysqltest; | ||
2190 | 3 | flush user_statistics; | ||
2191 | 4 | create database mysqltest; | ||
2192 | 5 | show create database mysqltest; | ||
2193 | 6 | Database Create Database | ||
2194 | 7 | mysqltest CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */ | ||
2195 | 8 | create table mysqltest.t1(a int); | ||
2196 | 9 | create table mysqltest.empty(a int); | ||
2197 | 10 | insert into mysqltest.t1 values(1); | ||
2198 | 11 | grant select on `mysqltest`.* to mysqltest_1@localhost; | ||
2199 | 12 | grant usage on `mysqltest`.* to mysqltest_2@localhost; | ||
2200 | 13 | grant drop on `mysqltest`.* to mysqltest_3@localhost; | ||
2201 | 14 | grant create user on *.* to mysqltest_4@localhost; | ||
2202 | 15 | grant create user on *.* to mysqltest_1@localhost; | ||
2203 | 16 | select current_user(); | ||
2204 | 17 | current_user() | ||
2205 | 18 | mysqltest_1@localhost | ||
2206 | 19 | select * from mysqltest.empty; | ||
2207 | 20 | a | ||
2208 | 21 | drop database mysqltest; | ||
2209 | 22 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' | ||
2210 | 23 | create database mysqltest_db; | ||
2211 | 24 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest_db' | ||
2212 | 25 | show user_statistics like 'mysqltest_%'; | ||
2213 | 26 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2214 | 27 | mysqltest_1 X X X X X X X X X X X X X X X X X X 2 1 | ||
2215 | 28 | mysqltest_4 X X X X X X X X X X X X X X X X X X 0 0 | ||
2216 | 29 | show create database mysqltest_db; | ||
2217 | 30 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest_db' | ||
2218 | 31 | show user_statistics like 'mysqltest_%'; | ||
2219 | 32 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2220 | 33 | mysqltest_1 X X X X X X X X X X X X X X X X X X 3 1 | ||
2221 | 34 | mysqltest_4 X X X X X X X X X X X X X X X X X X 0 0 | ||
2222 | 35 | grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; | ||
2223 | 36 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my\_1' | ||
2224 | 37 | show user_statistics like 'mysqltest_%'; | ||
2225 | 38 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2226 | 39 | mysqltest_1 X X X X X X X X X X X X X X X X X X 4 1 | ||
2227 | 40 | mysqltest_4 X X X X X X X X X X X X X X X X X X 0 0 | ||
2228 | 41 | grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; | ||
2229 | 42 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%' | ||
2230 | 43 | show user_statistics like 'mysqltest_%'; | ||
2231 | 44 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2232 | 45 | mysqltest_1 X X X X X X X X X X X X X X X X X X 5 1 | ||
2233 | 46 | mysqltest_4 X X X X X X X X X X X X X X X X X X 0 0 | ||
2234 | 47 | show grants for root@localhost; | ||
2235 | 48 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' | ||
2236 | 49 | show user_statistics like 'mysqltest_%'; | ||
2237 | 50 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2238 | 51 | mysqltest_1 X X X X X X X X X X X X X X X X X X 6 1 | ||
2239 | 52 | mysqltest_4 X X X X X X X X X X X X X X X X X X 0 0 | ||
2240 | 53 | grant select on `my\_1`.* to mysqltest_2@localhost; | ||
2241 | 54 | ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my\_1' | ||
2242 | 55 | show user_statistics like 'mysqltest_%'; | ||
2243 | 56 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2244 | 57 | mysqltest_1 X X X X X X X X X X X X X X X X X X 7 1 | ||
2245 | 58 | mysqltest_4 X X X X X X X X X X X X X X X X X X 0 0 | ||
2246 | 59 | select current_user(); | ||
2247 | 60 | current_user() | ||
2248 | 61 | root@localhost | ||
2249 | 62 | create database information_schema; | ||
2250 | 63 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2251 | 64 | alter database information_schema upgrade data directory name; | ||
2252 | 65 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2253 | 66 | drop database information_schema; | ||
2254 | 67 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2255 | 68 | drop table information_schema.tables; | ||
2256 | 69 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2257 | 70 | alter table information_schema.tables; | ||
2258 | 71 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2259 | 72 | use information_schema; | ||
2260 | 73 | create temporary table schemata(f1 char(10)); | ||
2261 | 74 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2262 | 75 | show user_statistics like 'root'; | ||
2263 | 76 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2264 | 77 | root X X X X X X X X X X X X X X X X X X 6 0 | ||
2265 | 78 | grant all on information_schema.* to 'user1'@'localhost'; | ||
2266 | 79 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2267 | 80 | grant select on information_schema.* to 'user1'@'localhost'; | ||
2268 | 81 | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' | ||
2269 | 82 | show user_statistics like 'root'; | ||
2270 | 83 | User Total_connections Concurrent_connections Connected_time Busy_time Cpu_time Bytes_received Bytes_sent Binlog_bytes_written Rows_fetched Rows_updated Table_rows_read Select_commands Update_commands Other_commands Commit_transactions Rollback_transactions Denied_connections Lost_connections Access_denied Empty_queries | ||
2271 | 84 | root X X X X X X X X X X X X X X X X X X 8 0 | ||
2272 | 85 | drop user mysqltest_1@localhost; | ||
2273 | 86 | drop user mysqltest_2@localhost; | ||
2274 | 87 | drop user mysqltest_3@localhost; | ||
2275 | 88 | drop user mysqltest_4@localhost; | ||
2276 | 89 | drop database mysqltest; | ||
2277 | 90 | set global userstat_running=default; | ||
2278 | 0 | 91 | ||
2279 | === modified file 'Percona-Server/mysql-test/r/userstat_bug602047.result' | |||
2280 | --- Percona-Server/mysql-test/r/userstat_bug602047.result 2011-11-24 01:59:48 +0000 | |||
2281 | +++ Percona-Server/mysql-test/r/userstat_bug602047.result 2012-02-02 06:11:26 +0000 | |||
2282 | @@ -1,6 +1,8 @@ | |||
2283 | 1 | DROP TABLE IF EXISTS t1; | 1 | DROP TABLE IF EXISTS t1; |
2284 | 2 | SET @userstat_running_old= @@userstat_running; | 2 | SET @userstat_running_old= @@userstat_running; |
2285 | 3 | SET GLOBAL userstat_running=ON; | 3 | SET GLOBAL userstat_running=ON; |
2286 | 4 | FLUSH TABLE_STATISTICS; | ||
2287 | 5 | FLUSH INDEX_STATISTICS; | ||
2288 | 4 | CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB; | 6 | CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB; |
2289 | 5 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); | 7 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
2290 | 6 | SELECT COUNT(*) FROM t1; | 8 | SELECT COUNT(*) FROM t1; |
2291 | 7 | 9 | ||
2292 | === added file 'Percona-Server/mysql-test/t/access_denied.test' | |||
2293 | --- Percona-Server/mysql-test/t/access_denied.test 1970-01-01 00:00:00 +0000 | |||
2294 | +++ Percona-Server/mysql-test/t/access_denied.test 2012-02-02 06:11:26 +0000 | |||
2295 | @@ -0,0 +1,559 @@ | |||
2296 | 1 | # Test of counter for Access_denied for "show user_statistics". | ||
2297 | 2 | # | ||
2298 | 3 | # The errors to be counted include | ||
2299 | 4 | # from *** include/mysqld_error.h: | ||
2300 | 5 | # ER_DBACCESS_DENIED_ERROR 1044 | ||
2301 | 6 | # ER_ACCESS_DENIED_ERROR 1045 | ||
2302 | 7 | # ER_TABLEACCESS_DENIED_ERROR 1142 | ||
2303 | 8 | # ER_COLUMNACCESS_DENIED_ERROR 1143 | ||
2304 | 9 | # ER_SPECIFIC_ACCESS_DENIED_ERROR 1227 | ||
2305 | 10 | # ER_PROCACCESS_DENIED_ERROR 1370 | ||
2306 | 11 | # | ||
2307 | 12 | # All test cases are gleaned from other tests, | ||
2308 | 13 | # specifically, for the counter Access_denied | ||
2309 | 14 | # Access_denied is #20 from "show user_statistics". | ||
2310 | 15 | # shield all other counters to make the test deterministic | ||
2311 | 16 | |||
2312 | 17 | # Grant tests not performed with embedded server | ||
2313 | 18 | -- source include/not_embedded.inc | ||
2314 | 19 | |||
2315 | 20 | create table mysql.user_bak like mysql.user; | ||
2316 | 21 | insert into mysql.user_bak select * from mysql.user; | ||
2317 | 22 | |||
2318 | 23 | set global userstat_running=ON; | ||
2319 | 24 | grant create user on *.* to mysqltest_1@localhost; | ||
2320 | 25 | grant create user on *.* to mysqltest_2@localhost; | ||
2321 | 26 | |||
2322 | 27 | connection default; | ||
2323 | 28 | # Cleanup | ||
2324 | 29 | --disable_warnings | ||
2325 | 30 | drop table if exists t1; | ||
2326 | 31 | --enable_warnings | ||
2327 | 32 | |||
2328 | 33 | # | ||
2329 | 34 | # 1044 | ||
2330 | 35 | # | ||
2331 | 36 | |||
2332 | 37 | # Cleanup | ||
2333 | 38 | --disable_warnings | ||
2334 | 39 | drop database if exists mysqltest; | ||
2335 | 40 | --enable_warnings | ||
2336 | 41 | |||
2337 | 42 | flush user_statistics; | ||
2338 | 43 | |||
2339 | 44 | # | ||
2340 | 45 | # Test of access_denied | ||
2341 | 46 | # | ||
2342 | 47 | |||
2343 | 48 | create database mysqltest; | ||
2344 | 49 | show create database mysqltest; | ||
2345 | 50 | create table mysqltest.t1(a int); | ||
2346 | 51 | create table mysqltest.empty(a int); | ||
2347 | 52 | insert into mysqltest.t1 values(1); | ||
2348 | 53 | grant select on `mysqltest`.* to mysqltest_1@localhost; | ||
2349 | 54 | |||
2350 | 55 | # User with 1 empty query | ||
2351 | 56 | connection default; | ||
2352 | 57 | connect (user1,localhost,mysqltest_1,,); | ||
2353 | 58 | select current_user(); | ||
2354 | 59 | select * from mysqltest.empty; | ||
2355 | 60 | |||
2356 | 61 | --error 1044 | ||
2357 | 62 | drop database mysqltest; | ||
2358 | 63 | |||
2359 | 64 | --error 1044 | ||
2360 | 65 | create database mysqltest_db; | ||
2361 | 66 | |||
2362 | 67 | --error 1044 | ||
2363 | 68 | show create database mysqltest_db; | ||
2364 | 69 | |||
2365 | 70 | --error 1044 | ||
2366 | 71 | grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; | ||
2367 | 72 | |||
2368 | 73 | --error 1044 | ||
2369 | 74 | grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; | ||
2370 | 75 | |||
2371 | 76 | --error 1044 | ||
2372 | 77 | show grants for root@localhost; | ||
2373 | 78 | |||
2374 | 79 | --error 1044 | ||
2375 | 80 | grant select on `my\_1`.* to mysqltest_2@localhost; | ||
2376 | 81 | |||
2377 | 82 | connection default; | ||
2378 | 83 | --echo mysqltest_1 access_denied=7 | ||
2379 | 84 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2380 | 85 | show user_statistics like 'mysqltest_%'; | ||
2381 | 86 | |||
2382 | 87 | disconnect user1; | ||
2383 | 88 | |||
2384 | 89 | select current_user(); | ||
2385 | 90 | |||
2386 | 91 | --error 1044 | ||
2387 | 92 | create database information_schema; | ||
2388 | 93 | |||
2389 | 94 | --error 1044 | ||
2390 | 95 | alter database information_schema upgrade data directory name; | ||
2391 | 96 | |||
2392 | 97 | --error 1044 | ||
2393 | 98 | drop database information_schema; | ||
2394 | 99 | |||
2395 | 100 | --error 1044 | ||
2396 | 101 | drop table information_schema.tables; | ||
2397 | 102 | |||
2398 | 103 | --error 1044 | ||
2399 | 104 | alter table information_schema.tables; | ||
2400 | 105 | |||
2401 | 106 | revoke select on `mysqltest`.* from mysqltest_1@localhost; | ||
2402 | 107 | |||
2403 | 108 | # | ||
2404 | 109 | # Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB | ||
2405 | 110 | # | ||
2406 | 111 | use information_schema; | ||
2407 | 112 | --error 1044 | ||
2408 | 113 | create temporary table schemata(f1 char(10)); | ||
2409 | 114 | |||
2410 | 115 | # | ||
2411 | 116 | # Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema | ||
2412 | 117 | # | ||
2413 | 118 | --error 1044 | ||
2414 | 119 | grant all on information_schema.* to 'user1'@'localhost'; | ||
2415 | 120 | --error 1044 | ||
2416 | 121 | grant select on information_schema.* to 'user1'@'localhost'; | ||
2417 | 122 | |||
2418 | 123 | --echo root access_denied=8 | ||
2419 | 124 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2420 | 125 | show user_statistics like 'root'; | ||
2421 | 126 | |||
2422 | 127 | |||
2423 | 128 | drop user mysqltest_1@localhost; | ||
2424 | 129 | |||
2425 | 130 | drop database mysqltest; | ||
2426 | 131 | |||
2427 | 132 | # | ||
2428 | 133 | # ================================== end of error 1044 ========================================= | ||
2429 | 134 | # | ||
2430 | 135 | |||
2431 | 136 | # | ||
2432 | 137 | # error 1045 | ||
2433 | 138 | # | ||
2434 | 139 | # This test is to check various cases of connections | ||
2435 | 140 | # with right and wrong password, with and without database | ||
2436 | 141 | # Unfortunately the check is incomplete as we can't connect without database | ||
2437 | 142 | |||
2438 | 143 | |||
2439 | 144 | connect (con1,localhost,root,,test); | ||
2440 | 145 | show tables; | ||
2441 | 146 | |||
2442 | 147 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
2443 | 148 | --error 1045 | ||
2444 | 149 | connect (fail_con,localhost,root,z,test2); | ||
2445 | 150 | |||
2446 | 151 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
2447 | 152 | --error 1045 | ||
2448 | 153 | connect (fail_con,localhost,root,z,); | ||
2449 | 154 | |||
2450 | 155 | --echo root access_denied=10 | ||
2451 | 156 | --replace_column 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2452 | 157 | show user_statistics like 'root%'; | ||
2453 | 158 | |||
2454 | 159 | grant ALL on *.* to test@localhost identified by "gambling"; | ||
2455 | 160 | grant ALL on *.* to test@127.0.0.1 identified by "gambling"; | ||
2456 | 161 | |||
2457 | 162 | disconnect con1; | ||
2458 | 163 | |||
2459 | 164 | # Now check this user with different databases | ||
2460 | 165 | connect (con4,localhost,test,gambling,test); | ||
2461 | 166 | show tables; | ||
2462 | 167 | |||
2463 | 168 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
2464 | 169 | --error 1045 | ||
2465 | 170 | connect (fail_con,localhost,test,,test2); | ||
2466 | 171 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
2467 | 172 | --error 1045 | ||
2468 | 173 | connect (fail_con,localhost,test,,""); | ||
2469 | 174 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
2470 | 175 | --error 1045 | ||
2471 | 176 | connect (fail_con,localhost,test,zorro,test2); | ||
2472 | 177 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
2473 | 178 | --error 1045 | ||
2474 | 179 | connect (fail_con,localhost,test,zorro,); | ||
2475 | 180 | |||
2476 | 181 | --echo test access_denied=4 | ||
2477 | 182 | --replace_column 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2478 | 183 | show user_statistics like 'test'; | ||
2479 | 184 | |||
2480 | 185 | # clean up | ||
2481 | 186 | drop user test@localhost; | ||
2482 | 187 | drop user test@127.0.0.1; | ||
2483 | 188 | flush privileges; | ||
2484 | 189 | |||
2485 | 190 | disconnect con4; | ||
2486 | 191 | |||
2487 | 192 | |||
2488 | 193 | # | ||
2489 | 194 | # ================================== end of error 1045 ========================================= | ||
2490 | 195 | # | ||
2491 | 196 | |||
2492 | 197 | |||
2493 | 198 | # | ||
2494 | 199 | # error 1142 and 1143 | ||
2495 | 200 | # | ||
2496 | 201 | |||
2497 | 202 | connect (master,localhost,root,,); | ||
2498 | 203 | connection master; | ||
2499 | 204 | SET NAMES binary; | ||
2500 | 205 | |||
2501 | 206 | # | ||
2502 | 207 | # Bug#7391: Cross-database multi-table UPDATE security problem | ||
2503 | 208 | # | ||
2504 | 209 | create database mysqltest_1; | ||
2505 | 210 | create database mysqltest_2; | ||
2506 | 211 | create table mysqltest_1.t1 select 1 a, 2 q; | ||
2507 | 212 | create table mysqltest_1.t2 select 1 b, 2 r; | ||
2508 | 213 | create table mysqltest_2.t1 select 1 c, 2 s; | ||
2509 | 214 | create table mysqltest_2.t2 select 1 d, 2 t; | ||
2510 | 215 | |||
2511 | 216 | #test the column privileges | ||
2512 | 217 | grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost; | ||
2513 | 218 | grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost; | ||
2514 | 219 | grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost; | ||
2515 | 220 | grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost; | ||
2516 | 221 | |||
2517 | 222 | connect (conn1,localhost,mysqltest_3,,); | ||
2518 | 223 | connection conn1; | ||
2519 | 224 | |||
2520 | 225 | # the following four stmts generate no error messages. | ||
2521 | 226 | # check_access in sql_parse.cc needs !no_errors predicate | ||
2522 | 227 | SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES | ||
2523 | 228 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
2524 | 229 | ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE; | ||
2525 | 230 | SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES | ||
2526 | 231 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
2527 | 232 | ORDER BY TABLE_NAME,PRIVILEGE_TYPE; | ||
2528 | 233 | SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES | ||
2529 | 234 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
2530 | 235 | ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE; | ||
2531 | 236 | SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES | ||
2532 | 237 | WHERE GRANTEE = '''mysqltest_3''@''localhost''' | ||
2533 | 238 | ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE; | ||
2534 | 239 | |||
2535 | 240 | connection default; | ||
2536 | 241 | --echo mysqltest_3 access_denied=0 | ||
2537 | 242 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2538 | 243 | show user_statistics like 'mysqltest_3'; | ||
2539 | 244 | |||
2540 | 245 | connection conn1; | ||
2541 | 246 | --error 1143 | ||
2542 | 247 | update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1; | ||
2543 | 248 | --error 1143 | ||
2544 | 249 | update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1; | ||
2545 | 250 | --error 1142 | ||
2546 | 251 | update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1; | ||
2547 | 252 | --error 1142 | ||
2548 | 253 | update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1; | ||
2549 | 254 | --error 1143 | ||
2550 | 255 | update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2; | ||
2551 | 256 | |||
2552 | 257 | connection default; | ||
2553 | 258 | --echo mysqltest_3 access_denied=5 | ||
2554 | 259 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2555 | 260 | show user_statistics like 'mysqltest_3'; | ||
2556 | 261 | |||
2557 | 262 | connection conn1; | ||
2558 | 263 | |||
2559 | 264 | #the following two should work | ||
2560 | 265 | update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10; | ||
2561 | 266 | update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20; | ||
2562 | 267 | connection master; | ||
2563 | 268 | select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; | ||
2564 | 269 | select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; | ||
2565 | 270 | revoke all on mysqltest_1.t1 from mysqltest_3@localhost; | ||
2566 | 271 | revoke all on mysqltest_1.t2 from mysqltest_3@localhost; | ||
2567 | 272 | revoke all on mysqltest_2.t1 from mysqltest_3@localhost; | ||
2568 | 273 | revoke all on mysqltest_2.t2 from mysqltest_3@localhost; | ||
2569 | 274 | |||
2570 | 275 | #test the db/table level privileges | ||
2571 | 276 | grant all on mysqltest_2.* to mysqltest_3@localhost; | ||
2572 | 277 | grant select on *.* to mysqltest_3@localhost; | ||
2573 | 278 | # Next grant is needed to trigger bug#7391. Do not optimize! | ||
2574 | 279 | grant select on mysqltest_2.t1 to mysqltest_3@localhost; | ||
2575 | 280 | flush privileges; | ||
2576 | 281 | disconnect conn1; | ||
2577 | 282 | connect (conn2,localhost,mysqltest_3,,); | ||
2578 | 283 | connection conn2; | ||
2579 | 284 | use mysqltest_1; | ||
2580 | 285 | update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600; | ||
2581 | 286 | # the following failed before, should fail now. | ||
2582 | 287 | --error 1142 | ||
2583 | 288 | update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; | ||
2584 | 289 | use mysqltest_2; | ||
2585 | 290 | #the following used to succeed, it must fail now. | ||
2586 | 291 | --error 1142 | ||
2587 | 292 | update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200; | ||
2588 | 293 | --error 1142 | ||
2589 | 294 | update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200; | ||
2590 | 295 | --error 1142 | ||
2591 | 296 | update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200; | ||
2592 | 297 | |||
2593 | 298 | connection default; | ||
2594 | 299 | --echo mysqltest_3 access_denied=9 | ||
2595 | 300 | --replace_column 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2596 | 301 | show user_statistics like 'mysqltest_3'; | ||
2597 | 302 | |||
2598 | 303 | #lets see the result | ||
2599 | 304 | connection master; | ||
2600 | 305 | select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2; | ||
2601 | 306 | select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2; | ||
2602 | 307 | |||
2603 | 308 | delete from mysql.user where user='mysqltest_3'; | ||
2604 | 309 | delete from mysql.db where user="mysqltest_3"; | ||
2605 | 310 | delete from mysql.tables_priv where user="mysqltest_3"; | ||
2606 | 311 | delete from mysql.columns_priv where user="mysqltest_3"; | ||
2607 | 312 | flush privileges; | ||
2608 | 313 | drop database mysqltest_1; | ||
2609 | 314 | drop database mysqltest_2; | ||
2610 | 315 | |||
2611 | 316 | # | ||
2612 | 317 | # ================================== end of error 1142/1143 ========================================= | ||
2613 | 318 | # | ||
2614 | 319 | |||
2615 | 320 | |||
2616 | 321 | # | ||
2617 | 322 | # error 1227 | ||
2618 | 323 | # | ||
2619 | 324 | |||
2620 | 325 | create database mysqltest_2; | ||
2621 | 326 | grant select, insert, update on `mysqltest\_2`.* to mysqltest_1@localhost; | ||
2622 | 327 | connect (con10,localhost,mysqltest_2,,); | ||
2623 | 328 | connection con10; | ||
2624 | 329 | --error 1227 | ||
2625 | 330 | set sql_log_off = 1; | ||
2626 | 331 | --error 1227 | ||
2627 | 332 | set sql_log_bin = 0; | ||
2628 | 333 | |||
2629 | 334 | connection default; | ||
2630 | 335 | --echo mysqltest_2 access_denied=2 | ||
2631 | 336 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2632 | 337 | show user_statistics like 'mysqltest_2'; | ||
2633 | 338 | |||
2634 | 339 | disconnect con10; | ||
2635 | 340 | connection default; | ||
2636 | 341 | revoke select, insert, update on `mysqltest\_2`.* from mysqltest_1@localhost; | ||
2637 | 342 | delete from mysql.user where user like 'mysqltest\_2'; | ||
2638 | 343 | delete from mysql.db where user like 'mysqltest\_2'; | ||
2639 | 344 | drop database mysqltest_2; | ||
2640 | 345 | flush privileges; | ||
2641 | 346 | |||
2642 | 347 | # | ||
2643 | 348 | # ================================== end of error 1227 ========================================= | ||
2644 | 349 | # | ||
2645 | 350 | |||
2646 | 351 | # | ||
2647 | 352 | # error 1370 | ||
2648 | 353 | # | ||
2649 | 354 | # | ||
2650 | 355 | # Testing SQL SECURITY of stored procedures | ||
2651 | 356 | # | ||
2652 | 357 | |||
2653 | 358 | connect (con1root,localhost,root,,); | ||
2654 | 359 | |||
2655 | 360 | # | ||
2656 | 361 | # BUG#2777 | ||
2657 | 362 | # | ||
2658 | 363 | |||
2659 | 364 | connection con1root; | ||
2660 | 365 | --disable_warnings | ||
2661 | 366 | drop database if exists db2; | ||
2662 | 367 | --enable_warnings | ||
2663 | 368 | |||
2664 | 369 | create database db2; | ||
2665 | 370 | |||
2666 | 371 | use db2; | ||
2667 | 372 | |||
2668 | 373 | create table t2 (s1 int); | ||
2669 | 374 | insert into t2 values (0); | ||
2670 | 375 | |||
2671 | 376 | grant usage on db2.* to user1@localhost; | ||
2672 | 377 | grant select on db2.* to user1@localhost; | ||
2673 | 378 | grant usage on db2.* to user2@localhost; | ||
2674 | 379 | grant select,insert,update,delete,create routine on db2.* to user2@localhost; | ||
2675 | 380 | grant create routine on db2.* to user1@localhost; | ||
2676 | 381 | flush privileges; | ||
2677 | 382 | |||
2678 | 383 | connect (con2user1,localhost,user1,,); | ||
2679 | 384 | |||
2680 | 385 | connection con2user1; | ||
2681 | 386 | use db2; | ||
2682 | 387 | |||
2683 | 388 | create procedure p () insert into t2 values (1); | ||
2684 | 389 | |||
2685 | 390 | connect (con4user2,localhost,user2,,); | ||
2686 | 391 | |||
2687 | 392 | connection con4user2; | ||
2688 | 393 | use db2; | ||
2689 | 394 | |||
2690 | 395 | # This should not work, since p is executed with definer's (user1's) rights. | ||
2691 | 396 | --error 1370 | ||
2692 | 397 | call p(); | ||
2693 | 398 | |||
2694 | 399 | connection default; | ||
2695 | 400 | # user1 access_denied=0, user2 access_denied=1 | ||
2696 | 401 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2697 | 402 | show user_statistics like 'user%'; | ||
2698 | 403 | |||
2699 | 404 | connection con4user2; | ||
2700 | 405 | create procedure q () insert into t2 values (2); | ||
2701 | 406 | |||
2702 | 407 | connection con1root; | ||
2703 | 408 | grant usage on procedure db2.q to user2@localhost with grant option; | ||
2704 | 409 | |||
2705 | 410 | connection con4user2; | ||
2706 | 411 | grant execute on procedure db2.q to user1@localhost; | ||
2707 | 412 | |||
2708 | 413 | # still connection con2user1 in db2 | ||
2709 | 414 | connection con2user1; | ||
2710 | 415 | use db2; | ||
2711 | 416 | |||
2712 | 417 | # This should work: | ||
2713 | 418 | alter procedure p modifies sql data; | ||
2714 | 419 | drop procedure p; | ||
2715 | 420 | |||
2716 | 421 | # This should NOT work | ||
2717 | 422 | --error 1370 | ||
2718 | 423 | alter procedure q modifies sql data; | ||
2719 | 424 | --error 1370 | ||
2720 | 425 | drop procedure q; | ||
2721 | 426 | |||
2722 | 427 | connection default; | ||
2723 | 428 | --echo user1 access_denied=2, user2 access_denied=1 | ||
2724 | 429 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2725 | 430 | show user_statistics like 'user%'; | ||
2726 | 431 | |||
2727 | 432 | connection con1root; | ||
2728 | 433 | use db2; | ||
2729 | 434 | # But root always can | ||
2730 | 435 | alter procedure q modifies sql data; | ||
2731 | 436 | drop procedure q; | ||
2732 | 437 | |||
2733 | 438 | |||
2734 | 439 | # Clean up | ||
2735 | 440 | #Still connection con1root; | ||
2736 | 441 | |||
2737 | 442 | revoke all on db2.* from user1@localhost; | ||
2738 | 443 | revoke all on db2.* from user2@localhost; | ||
2739 | 444 | |||
2740 | 445 | flush privileges; | ||
2741 | 446 | |||
2742 | 447 | disconnect con2user1; | ||
2743 | 448 | |||
2744 | 449 | disconnect con4user2; | ||
2745 | 450 | use test; | ||
2746 | 451 | select type,db,name from mysql.proc; | ||
2747 | 452 | |||
2748 | 453 | |||
2749 | 454 | drop database db2; | ||
2750 | 455 | |||
2751 | 456 | # Make sure the routines are gone | ||
2752 | 457 | select type,db,name from mysql.proc; | ||
2753 | 458 | # Get rid of the users | ||
2754 | 459 | delete from mysql.user where user='user1' or user='user2'; | ||
2755 | 460 | delete from mysql.user where user='' and host='%'; | ||
2756 | 461 | # And any routine privileges | ||
2757 | 462 | delete from mysql.procs_priv where user='user1' or user='user2'; | ||
2758 | 463 | # Delete the grants to user ''@'%' that was created above | ||
2759 | 464 | delete from mysql.procs_priv where user='' and host='%'; | ||
2760 | 465 | delete from mysql.db where user='user2'; | ||
2761 | 466 | flush privileges; | ||
2762 | 467 | |||
2763 | 468 | # | ||
2764 | 469 | # Test the new security acls | ||
2765 | 470 | # | ||
2766 | 471 | grant usage on *.* to usera@localhost; | ||
2767 | 472 | grant usage on *.* to userb@localhost; | ||
2768 | 473 | grant usage on *.* to userc@localhost; | ||
2769 | 474 | create database sptest; | ||
2770 | 475 | create table t1 ( u varchar(64), i int ); | ||
2771 | 476 | create procedure sptest.p1(i int) insert into test.t1 values (user(), i); | ||
2772 | 477 | grant insert on t1 to usera@localhost; | ||
2773 | 478 | grant execute on procedure sptest.p1 to usera@localhost; | ||
2774 | 479 | show grants for usera@localhost; | ||
2775 | 480 | grant execute on procedure sptest.p1 to userc@localhost with grant option; | ||
2776 | 481 | show grants for userc@localhost; | ||
2777 | 482 | |||
2778 | 483 | connect (con2usera,localhost,usera,,); | ||
2779 | 484 | connect (con3userb,localhost,userb,,); | ||
2780 | 485 | connect (con4userc,localhost,userc,,); | ||
2781 | 486 | |||
2782 | 487 | connection con2usera; | ||
2783 | 488 | call sptest.p1(1); | ||
2784 | 489 | --error 1370 | ||
2785 | 490 | grant execute on procedure sptest.p1 to userb@localhost; | ||
2786 | 491 | |||
2787 | 492 | --error 1370 | ||
2788 | 493 | drop procedure sptest.p1; | ||
2789 | 494 | |||
2790 | 495 | connection default; | ||
2791 | 496 | --echo usera access_denied=2 | ||
2792 | 497 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2793 | 498 | show user_statistics like 'usera%'; | ||
2794 | 499 | |||
2795 | 500 | connection con3userb; | ||
2796 | 501 | --error 1370 | ||
2797 | 502 | call sptest.p1(2); | ||
2798 | 503 | --error 1370 | ||
2799 | 504 | grant execute on procedure sptest.p1 to userb@localhost; | ||
2800 | 505 | --error 1370 | ||
2801 | 506 | drop procedure sptest.p1; | ||
2802 | 507 | |||
2803 | 508 | connection default; | ||
2804 | 509 | --echo userb access_denied=3 | ||
2805 | 510 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2806 | 511 | show user_statistics like 'userb'; | ||
2807 | 512 | |||
2808 | 513 | |||
2809 | 514 | connection con4userc; | ||
2810 | 515 | call sptest.p1(3); | ||
2811 | 516 | grant execute on procedure sptest.p1 to userb@localhost; | ||
2812 | 517 | --error 1370 | ||
2813 | 518 | drop procedure sptest.p1; | ||
2814 | 519 | |||
2815 | 520 | connection default; | ||
2816 | 521 | --echo userc access_denied=1 | ||
2817 | 522 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2818 | 523 | show user_statistics like 'userc'; | ||
2819 | 524 | |||
2820 | 525 | connection con3userb; | ||
2821 | 526 | call sptest.p1(4); | ||
2822 | 527 | --error 1370 | ||
2823 | 528 | grant execute on procedure sptest.p1 to userb@localhost; | ||
2824 | 529 | --error 1370 | ||
2825 | 530 | drop procedure sptest.p1; | ||
2826 | 531 | |||
2827 | 532 | connection default; | ||
2828 | 533 | --echo userb access_denied=5 | ||
2829 | 534 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X 21 X | ||
2830 | 535 | show user_statistics like 'userb'; | ||
2831 | 536 | |||
2832 | 537 | connection con1root; | ||
2833 | 538 | |||
2834 | 539 | #cleanup | ||
2835 | 540 | disconnect con4userc; | ||
2836 | 541 | disconnect con3userb; | ||
2837 | 542 | disconnect con2usera; | ||
2838 | 543 | use test; | ||
2839 | 544 | drop database sptest; | ||
2840 | 545 | delete from mysql.user where user='usera' or user='userb' or user='userc'; | ||
2841 | 546 | delete from mysql.procs_priv where user='usera' or user='userb' or user='userc'; | ||
2842 | 547 | delete from mysql.tables_priv where user='usera'; | ||
2843 | 548 | flush privileges; | ||
2844 | 549 | drop table t1; | ||
2845 | 550 | set global userstat_running=default; | ||
2846 | 551 | |||
2847 | 552 | delete from mysql.user; | ||
2848 | 553 | insert into mysql.user select * from mysql.user_bak; | ||
2849 | 554 | drop table mysql.user_bak; | ||
2850 | 555 | |||
2851 | 556 | # | ||
2852 | 557 | # ================================== end of error 1370 ========================================= | ||
2853 | 558 | # | ||
2854 | 559 | |||
2855 | 0 | 560 | ||
2856 | === added file 'Percona-Server/mysql-test/t/show_stats.test' | |||
2857 | --- Percona-Server/mysql-test/t/show_stats.test 1970-01-01 00:00:00 +0000 | |||
2858 | +++ Percona-Server/mysql-test/t/show_stats.test 2012-02-02 06:11:26 +0000 | |||
2859 | @@ -0,0 +1,484 @@ | |||
2860 | 1 | # Uses GRANT commands that usually disabled in embedded server | ||
2861 | 2 | --source include/not_embedded.inc | ||
2862 | 3 | --source include/have_innodb.inc | ||
2863 | 4 | --source include/have_debug.inc | ||
2864 | 5 | --let wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST | ||
2865 | 6 | --disable_warnings | ||
2866 | 7 | drop table if exists t1; | ||
2867 | 8 | |||
2868 | 9 | update mysql.db set User = 'hide' where User = ''; | ||
2869 | 10 | create table mysql.user_bak like mysql.user; | ||
2870 | 11 | insert into mysql.user_bak select * from mysql.user where length(User) = 0; | ||
2871 | 12 | delete from mysql.user where length(User) = 0; | ||
2872 | 13 | flush privileges; | ||
2873 | 14 | |||
2874 | 15 | --enable_warnings | ||
2875 | 16 | |||
2876 | 17 | SET GLOBAL DEBUG='+d,signal_end_connection'; | ||
2877 | 18 | |||
2878 | 19 | create table t2 (a int not null primary key, b int not null) engine=innodb; | ||
2879 | 20 | create table t3 (a int not null primary key, b int not null, index bx(b)) engine=myisam; | ||
2880 | 21 | |||
2881 | 22 | set global userstat_running=ON; | ||
2882 | 23 | set global thread_statistics=ON; | ||
2883 | 24 | |||
2884 | 25 | flush client_statistics; | ||
2885 | 26 | flush thread_statistics; | ||
2886 | 27 | flush user_statistics; | ||
2887 | 28 | |||
2888 | 29 | --let user=root | ||
2889 | 30 | --source include/show_stats.inc | ||
2890 | 31 | |||
2891 | 32 | flush client_statistics; | ||
2892 | 33 | flush thread_statistics; | ||
2893 | 34 | flush user_statistics; | ||
2894 | 35 | |||
2895 | 36 | create table t1 (a int not null primary key, b int not null) engine=innodb; | ||
2896 | 37 | |||
2897 | 38 | --let user=root | ||
2898 | 39 | --source include/show_stats.inc | ||
2899 | 40 | |||
2900 | 41 | flush client_statistics; | ||
2901 | 42 | flush thread_statistics; | ||
2902 | 43 | flush user_statistics; | ||
2903 | 44 | |||
2904 | 45 | flush table_statistics; | ||
2905 | 46 | flush index_statistics; | ||
2906 | 47 | |||
2907 | 48 | insert into t1 values (1,1), (2,2); | ||
2908 | 49 | |||
2909 | 50 | --let user=root | ||
2910 | 51 | --source include/show_stats.inc | ||
2911 | 52 | |||
2912 | 53 | --let schema=test | ||
2913 | 54 | --let table=t1 | ||
2914 | 55 | --let index= | ||
2915 | 56 | --source include/show_table_index_stats.inc | ||
2916 | 57 | |||
2917 | 58 | create table test.tmy(i int) engine=myisam; | ||
2918 | 59 | insert into test.tmy values (1); | ||
2919 | 60 | |||
2920 | 61 | --let schema=test | ||
2921 | 62 | --let table=tmy | ||
2922 | 63 | --let index= | ||
2923 | 64 | --source include/show_table_index_stats.inc | ||
2924 | 65 | |||
2925 | 66 | drop table test.tmy; | ||
2926 | 67 | |||
2927 | 68 | --let schema=test | ||
2928 | 69 | --let table=t1 | ||
2929 | 70 | --let index= | ||
2930 | 71 | --source include/show_table_index_stats.inc | ||
2931 | 72 | |||
2932 | 73 | # Test insert select | ||
2933 | 74 | |||
2934 | 75 | echo ""; | ||
2935 | 76 | echo Test insert select; | ||
2936 | 77 | echo ""; | ||
2937 | 78 | |||
2938 | 79 | flush client_statistics; | ||
2939 | 80 | flush thread_statistics; | ||
2940 | 81 | flush user_statistics; | ||
2941 | 82 | |||
2942 | 83 | flush table_statistics; | ||
2943 | 84 | flush index_statistics; | ||
2944 | 85 | |||
2945 | 86 | insert into t2 select * from t1; | ||
2946 | 87 | |||
2947 | 88 | --let user=root | ||
2948 | 89 | --source include/show_stats.inc | ||
2949 | 90 | |||
2950 | 91 | --let schema=test | ||
2951 | 92 | --let table=t1 | ||
2952 | 93 | --let index=PRIMARY | ||
2953 | 94 | --source include/show_table_index_stats.inc | ||
2954 | 95 | |||
2955 | 96 | --let schema=test | ||
2956 | 97 | --let table=t2 | ||
2957 | 98 | --let index= | ||
2958 | 99 | --source include/show_table_index_stats.inc | ||
2959 | 100 | |||
2960 | 101 | # Test update with PK scans | ||
2961 | 102 | |||
2962 | 103 | echo ""; | ||
2963 | 104 | echo Test update with PK scans; | ||
2964 | 105 | echo ""; | ||
2965 | 106 | |||
2966 | 107 | insert into t1 values (0,0); | ||
2967 | 108 | select count(*) from t1; | ||
2968 | 109 | |||
2969 | 110 | flush client_statistics; | ||
2970 | 111 | flush thread_statistics; | ||
2971 | 112 | flush user_statistics; | ||
2972 | 113 | |||
2973 | 114 | flush table_statistics; | ||
2974 | 115 | flush index_statistics; | ||
2975 | 116 | |||
2976 | 117 | update t1 set a = 3 where a = 1; | ||
2977 | 118 | |||
2978 | 119 | --let user=root | ||
2979 | 120 | --source include/show_stats.inc | ||
2980 | 121 | |||
2981 | 122 | update t1 set a = 4 where b = 2; | ||
2982 | 123 | |||
2983 | 124 | --let user=root | ||
2984 | 125 | --source include/show_stats.inc | ||
2985 | 126 | |||
2986 | 127 | --let schema=test | ||
2987 | 128 | --let table=t1 | ||
2988 | 129 | --let index=PRIMARY | ||
2989 | 130 | --source include/show_table_index_stats.inc | ||
2990 | 131 | |||
2991 | 132 | update t1 set a = 4 where b < 0; | ||
2992 | 133 | |||
2993 | 134 | --let user=root | ||
2994 | 135 | --source include/show_stats.inc | ||
2995 | 136 | |||
2996 | 137 | # Test update with secondary index scans and MyISAM | ||
2997 | 138 | |||
2998 | 139 | echo ""; | ||
2999 | 140 | echo Test update with secondary index scans and MyISAM; | ||
3000 | 141 | echo ""; | ||
3001 | 142 | |||
3002 | 143 | insert into t3 values (0,0); | ||
3003 | 144 | insert into t3 values (1,1); | ||
3004 | 145 | insert into t3 values (2,2); | ||
3005 | 146 | |||
3006 | 147 | flush client_statistics; | ||
3007 | 148 | flush thread_statistics; | ||
3008 | 149 | flush user_statistics; | ||
3009 | 150 | |||
3010 | 151 | flush table_statistics; | ||
3011 | 152 | flush index_statistics; | ||
3012 | 153 | |||
3013 | 154 | update t3 set a = 4 where b = 1; | ||
3014 | 155 | |||
3015 | 156 | --let user=root | ||
3016 | 157 | --source include/show_stats.inc | ||
3017 | 158 | |||
3018 | 159 | --let schema=test | ||
3019 | 160 | --let table=t3 | ||
3020 | 161 | --let index=bx | ||
3021 | 162 | --source include/show_table_index_stats.inc | ||
3022 | 163 | |||
3023 | 164 | # Test delete with PK scans | ||
3024 | 165 | |||
3025 | 166 | echo ""; | ||
3026 | 167 | echo Test delete with PK scans; | ||
3027 | 168 | echo ""; | ||
3028 | 169 | |||
3029 | 170 | flush client_statistics; | ||
3030 | 171 | flush thread_statistics; | ||
3031 | 172 | flush user_statistics; | ||
3032 | 173 | |||
3033 | 174 | flush table_statistics; | ||
3034 | 175 | flush index_statistics; | ||
3035 | 176 | |||
3036 | 177 | delete from t1 where a = 3; | ||
3037 | 178 | |||
3038 | 179 | --let user=root | ||
3039 | 180 | --source include/show_stats.inc | ||
3040 | 181 | |||
3041 | 182 | delete from t1 where b = 2; | ||
3042 | 183 | |||
3043 | 184 | --let user=root | ||
3044 | 185 | --source include/show_stats.inc | ||
3045 | 186 | |||
3046 | 187 | --let schema=test | ||
3047 | 188 | --let table=t1 | ||
3048 | 189 | --let index=PRIMARY | ||
3049 | 190 | --source include/show_table_index_stats.inc | ||
3050 | 191 | |||
3051 | 192 | delete from t1 where b < 0; | ||
3052 | 193 | |||
3053 | 194 | --let user=root | ||
3054 | 195 | --source include/show_stats.inc | ||
3055 | 196 | |||
3056 | 197 | # Test delete with secondary index scans | ||
3057 | 198 | |||
3058 | 199 | echo ""; | ||
3059 | 200 | echo Test delete with secondary index scans; | ||
3060 | 201 | echo ""; | ||
3061 | 202 | |||
3062 | 203 | flush client_statistics; | ||
3063 | 204 | flush thread_statistics; | ||
3064 | 205 | flush user_statistics; | ||
3065 | 206 | |||
3066 | 207 | flush table_statistics; | ||
3067 | 208 | flush index_statistics; | ||
3068 | 209 | |||
3069 | 210 | delete from t3 where b = 1; | ||
3070 | 211 | |||
3071 | 212 | --let user=root | ||
3072 | 213 | --source include/show_stats.inc | ||
3073 | 214 | |||
3074 | 215 | --let schema=test | ||
3075 | 216 | --let table=t3 | ||
3076 | 217 | --let index=bx | ||
3077 | 218 | --source include/show_table_index_stats.inc | ||
3078 | 219 | |||
3079 | 220 | delete from t3 where b < 0; | ||
3080 | 221 | |||
3081 | 222 | --let user=root | ||
3082 | 223 | --source include/show_stats.inc | ||
3083 | 224 | |||
3084 | 225 | # Test select on PK index | ||
3085 | 226 | |||
3086 | 227 | echo ""; | ||
3087 | 228 | echo Test select with PK scans; | ||
3088 | 229 | echo ""; | ||
3089 | 230 | |||
3090 | 231 | insert into t1 values (1,1), (2,2); | ||
3091 | 232 | |||
3092 | 233 | flush client_statistics; | ||
3093 | 234 | flush thread_statistics; | ||
3094 | 235 | flush user_statistics; | ||
3095 | 236 | |||
3096 | 237 | flush table_statistics; | ||
3097 | 238 | flush index_statistics; | ||
3098 | 239 | |||
3099 | 240 | select count(*) from t1 where a = 1; | ||
3100 | 241 | |||
3101 | 242 | --let user=root | ||
3102 | 243 | --source include/show_stats.inc | ||
3103 | 244 | |||
3104 | 245 | select count(*) from t1 where b < 0; | ||
3105 | 246 | |||
3106 | 247 | --let user=root | ||
3107 | 248 | --source include/show_stats.inc | ||
3108 | 249 | |||
3109 | 250 | --let schema=test | ||
3110 | 251 | --let table=t1 | ||
3111 | 252 | --let index=PRIMARY | ||
3112 | 253 | --source include/show_table_index_stats.inc | ||
3113 | 254 | |||
3114 | 255 | # Test select on secondary index | ||
3115 | 256 | |||
3116 | 257 | echo ""; | ||
3117 | 258 | echo Test select with secondary scans; | ||
3118 | 259 | echo ""; | ||
3119 | 260 | |||
3120 | 261 | insert into t3 values (1,1); | ||
3121 | 262 | analyze table t3; | ||
3122 | 263 | explain select * from t3 where b < 0; | ||
3123 | 264 | |||
3124 | 265 | flush client_statistics; | ||
3125 | 266 | flush thread_statistics; | ||
3126 | 267 | flush user_statistics; | ||
3127 | 268 | |||
3128 | 269 | flush table_statistics; | ||
3129 | 270 | flush index_statistics; | ||
3130 | 271 | |||
3131 | 272 | select * from t3 where b = 1; | ||
3132 | 273 | |||
3133 | 274 | --let user=root | ||
3134 | 275 | --source include/show_stats.inc | ||
3135 | 276 | |||
3136 | 277 | select * from t3 where b < 0; | ||
3137 | 278 | |||
3138 | 279 | --let user=root | ||
3139 | 280 | --source include/show_stats.inc | ||
3140 | 281 | |||
3141 | 282 | --let schema=test | ||
3142 | 283 | --let table=t3 | ||
3143 | 284 | --let index=bx | ||
3144 | 285 | --source include/show_table_index_stats.inc | ||
3145 | 286 | |||
3146 | 287 | # | ||
3147 | 288 | # Test denied connections | ||
3148 | 289 | # | ||
3149 | 290 | |||
3150 | 291 | echo ""; | ||
3151 | 292 | echo Test denied connections; | ||
3152 | 293 | echo ""; | ||
3153 | 294 | |||
3154 | 295 | # user level connection limit to force denied connections. | ||
3155 | 296 | create user foo@localhost identified by 'bar'; | ||
3156 | 297 | grant all on test.t1 to foo@localhost with max_user_connections 2; | ||
3157 | 298 | |||
3158 | 299 | flush client_statistics; | ||
3159 | 300 | flush thread_statistics; | ||
3160 | 301 | flush user_statistics; | ||
3161 | 302 | |||
3162 | 303 | connect (foo0, localhost, foo, bar,,); | ||
3163 | 304 | select current_user(); | ||
3164 | 305 | |||
3165 | 306 | connection default; | ||
3166 | 307 | |||
3167 | 308 | --let user=foo | ||
3168 | 309 | --source include/show_stats.inc | ||
3169 | 310 | |||
3170 | 311 | disconnect foo0; | ||
3171 | 312 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
3172 | 313 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
3173 | 314 | set global userstat_running=OFF; | ||
3174 | 315 | --source include/wait_condition.inc | ||
3175 | 316 | set global userstat_running=ON; | ||
3176 | 317 | |||
3177 | 318 | --let user=foo | ||
3178 | 319 | --source include/show_stats.inc | ||
3179 | 320 | |||
3180 | 321 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
3181 | 322 | --error 1045 | ||
3182 | 323 | connect (foo0, localhost, foo, wrong,,); | ||
3183 | 324 | |||
3184 | 325 | connection default; | ||
3185 | 326 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
3186 | 327 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
3187 | 328 | set global userstat_running=OFF; | ||
3188 | 329 | --source include/wait_condition.inc | ||
3189 | 330 | set global userstat_running=ON; | ||
3190 | 331 | |||
3191 | 332 | --let user=foo | ||
3192 | 333 | --source include/show_stats.inc | ||
3193 | 334 | |||
3194 | 335 | # Test access denied | ||
3195 | 336 | |||
3196 | 337 | echo ""; | ||
3197 | 338 | echo Test access denied | ||
3198 | 339 | echo ""; | ||
3199 | 340 | |||
3200 | 341 | flush client_statistics; | ||
3201 | 342 | flush thread_statistics; | ||
3202 | 343 | flush user_statistics; | ||
3203 | 344 | |||
3204 | 345 | connect (foo0, localhost, foo, bar,,); | ||
3205 | 346 | select current_user(); | ||
3206 | 347 | |||
3207 | 348 | select count(*) from t1; | ||
3208 | 349 | --error 1142 | ||
3209 | 350 | select * from t3; | ||
3210 | 351 | |||
3211 | 352 | connection default; | ||
3212 | 353 | |||
3213 | 354 | --let user=foo | ||
3214 | 355 | --source include/show_stats.inc | ||
3215 | 356 | |||
3216 | 357 | # TODO(mcallaghan): this is a bug | ||
3217 | 358 | #let $val=query_get_value(show user_statistics like 'foo', Access_denied, 1); | ||
3218 | 359 | #echo Access_denied should be 1 and is $val; | ||
3219 | 360 | |||
3220 | 361 | disconnect foo0; | ||
3221 | 362 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
3222 | 363 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
3223 | 364 | set global userstat_running=OFF; | ||
3224 | 365 | --source include/wait_condition.inc | ||
3225 | 366 | set global userstat_running=ON; | ||
3226 | 367 | |||
3227 | 368 | # Test rollback and commit | ||
3228 | 369 | |||
3229 | 370 | echo ""; | ||
3230 | 371 | echo Test rollback and commit | ||
3231 | 372 | echo ""; | ||
3232 | 373 | |||
3233 | 374 | set autocommit=0; | ||
3234 | 375 | flush client_statistics; | ||
3235 | 376 | flush thread_statistics; | ||
3236 | 377 | flush user_statistics; | ||
3237 | 378 | |||
3238 | 379 | insert into t1 values (10,10); | ||
3239 | 380 | commit; | ||
3240 | 381 | |||
3241 | 382 | --let user=root | ||
3242 | 383 | --source include/show_stats.inc | ||
3243 | 384 | |||
3244 | 385 | insert into t1 values (11,11); | ||
3245 | 386 | rollback; | ||
3246 | 387 | |||
3247 | 388 | --let user=root | ||
3248 | 389 | --source include/show_stats.inc | ||
3249 | 390 | |||
3250 | 391 | select * from t1; | ||
3251 | 392 | |||
3252 | 393 | # Test empty queries | ||
3253 | 394 | |||
3254 | 395 | echo ""; | ||
3255 | 396 | echo Test empty queries | ||
3256 | 397 | echo ""; | ||
3257 | 398 | |||
3258 | 399 | flush client_statistics; | ||
3259 | 400 | flush thread_statistics; | ||
3260 | 401 | flush user_statistics; | ||
3261 | 402 | |||
3262 | 403 | select * from t1 where a < -1; | ||
3263 | 404 | select * from t1 where a < -3; | ||
3264 | 405 | |||
3265 | 406 | --let user=root | ||
3266 | 407 | --source include/show_stats.inc | ||
3267 | 408 | |||
3268 | 409 | # | ||
3269 | 410 | # Test lost connections | ||
3270 | 411 | # | ||
3271 | 412 | |||
3272 | 413 | echo ""; | ||
3273 | 414 | echo Test lost connections; | ||
3274 | 415 | echo ""; | ||
3275 | 416 | |||
3276 | 417 | set global wait_timeout = 1; | ||
3277 | 418 | set global interactive_timeout = 1; | ||
3278 | 419 | |||
3279 | 420 | flush client_statistics; | ||
3280 | 421 | flush thread_statistics; | ||
3281 | 422 | flush user_statistics; | ||
3282 | 423 | |||
3283 | 424 | # this connection will get timed out and aborted. | ||
3284 | 425 | connect (abortconn, localhost, root,,,); | ||
3285 | 426 | |||
3286 | 427 | connection default; | ||
3287 | 428 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
3288 | 429 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
3289 | 430 | set global userstat_running=OFF; | ||
3290 | 431 | --source include/wait_condition.inc | ||
3291 | 432 | set global userstat_running=ON; | ||
3292 | 433 | |||
3293 | 434 | --let user=root | ||
3294 | 435 | --source include/show_stats.inc | ||
3295 | 436 | |||
3296 | 437 | set global wait_timeout = DEFAULT; | ||
3297 | 438 | set global interactive_timeout = DEFAULT; | ||
3298 | 439 | |||
3299 | 440 | # | ||
3300 | 441 | # Test non-existent users | ||
3301 | 442 | # | ||
3302 | 443 | |||
3303 | 444 | echo ""; | ||
3304 | 445 | echo Test non-existent users | ||
3305 | 446 | echo ""; | ||
3306 | 447 | |||
3307 | 448 | flush client_statistics; | ||
3308 | 449 | flush thread_statistics; | ||
3309 | 450 | flush user_statistics; | ||
3310 | 451 | |||
3311 | 452 | --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT | ||
3312 | 453 | --error 1045 | ||
3313 | 454 | connect (userDNE, localhost, userDNE,,,); | ||
3314 | 455 | |||
3315 | 456 | connection default; | ||
3316 | 457 | SET DEBUG_SYNC='now WAIT_FOR end_connection'; | ||
3317 | 458 | SET DEBUG_SYNC='now SIGNAL empty'; | ||
3318 | 459 | set global userstat_running=OFF; | ||
3319 | 460 | --source include/wait_condition.inc | ||
3320 | 461 | set global userstat_running=ON; | ||
3321 | 462 | |||
3322 | 463 | # userDNE should not exist in the output. | ||
3323 | 464 | --let user=userDNE | ||
3324 | 465 | --let host=hostDNE | ||
3325 | 466 | --let thread=`select max(Id)+1 from information_schema.processlist` | ||
3326 | 467 | --source include/show_stats.inc | ||
3327 | 468 | |||
3328 | 469 | # Cleanup | ||
3329 | 470 | |||
3330 | 471 | drop table t1; | ||
3331 | 472 | drop table t2; | ||
3332 | 473 | drop table t3; | ||
3333 | 474 | drop user foo@localhost; | ||
3334 | 475 | |||
3335 | 476 | update mysql.db set User='' where User='hide'; | ||
3336 | 477 | insert into mysql.user select * from mysql.user_bak; | ||
3337 | 478 | drop table mysql.user_bak; | ||
3338 | 479 | flush privileges; | ||
3339 | 480 | |||
3340 | 481 | set global userstat_running=default; | ||
3341 | 482 | set global thread_statistics=default; | ||
3342 | 483 | set global debug='reset'; | ||
3343 | 484 | set debug_sync='reset'; | ||
3344 | 0 | 485 | ||
3345 | === added file 'Percona-Server/mysql-test/t/user_stats.test' | |||
3346 | --- Percona-Server/mysql-test/t/user_stats.test 1970-01-01 00:00:00 +0000 | |||
3347 | +++ Percona-Server/mysql-test/t/user_stats.test 2012-02-02 06:11:26 +0000 | |||
3348 | @@ -0,0 +1,135 @@ | |||
3349 | 1 | # Uses GRANT commands that usually disabled in embedded server | ||
3350 | 2 | -- source include/not_embedded.inc | ||
3351 | 3 | -- source include/have_innodb.inc | ||
3352 | 4 | |||
3353 | 5 | set global userstat_running=ON; | ||
3354 | 6 | |||
3355 | 7 | # Cleanup | ||
3356 | 8 | --disable_warnings | ||
3357 | 9 | drop database if exists mysqltest; | ||
3358 | 10 | --enable_warnings | ||
3359 | 11 | |||
3360 | 12 | flush user_statistics; | ||
3361 | 13 | |||
3362 | 14 | # | ||
3363 | 15 | # Test of access_denied | ||
3364 | 16 | # | ||
3365 | 17 | |||
3366 | 18 | create database mysqltest; | ||
3367 | 19 | show create database mysqltest; | ||
3368 | 20 | create table mysqltest.t1(a int); | ||
3369 | 21 | create table mysqltest.empty(a int); | ||
3370 | 22 | insert into mysqltest.t1 values(1); | ||
3371 | 23 | grant select on `mysqltest`.* to mysqltest_1@localhost; | ||
3372 | 24 | grant usage on `mysqltest`.* to mysqltest_2@localhost; | ||
3373 | 25 | grant drop on `mysqltest`.* to mysqltest_3@localhost; | ||
3374 | 26 | |||
3375 | 27 | # User with 0 empty queries | ||
3376 | 28 | grant create user on *.* to mysqltest_4@localhost; | ||
3377 | 29 | connect (user4,localhost,mysqltest_4,,); | ||
3378 | 30 | |||
3379 | 31 | # User with 1 empty query | ||
3380 | 32 | connection default; | ||
3381 | 33 | grant create user on *.* to mysqltest_1@localhost; | ||
3382 | 34 | connect (user1,localhost,mysqltest_1,,); | ||
3383 | 35 | select current_user(); | ||
3384 | 36 | select * from mysqltest.empty; | ||
3385 | 37 | |||
3386 | 38 | --error 1044 | ||
3387 | 39 | drop database mysqltest; | ||
3388 | 40 | |||
3389 | 41 | --error 1044 | ||
3390 | 42 | create database mysqltest_db; | ||
3391 | 43 | |||
3392 | 44 | connection default; | ||
3393 | 45 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3394 | 46 | show user_statistics like 'mysqltest_%'; | ||
3395 | 47 | |||
3396 | 48 | connection user1; | ||
3397 | 49 | --error 1044 | ||
3398 | 50 | show create database mysqltest_db; | ||
3399 | 51 | |||
3400 | 52 | connection default; | ||
3401 | 53 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3402 | 54 | show user_statistics like 'mysqltest_%'; | ||
3403 | 55 | connection user1; | ||
3404 | 56 | |||
3405 | 57 | --error 1044 | ||
3406 | 58 | grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; | ||
3407 | 59 | |||
3408 | 60 | connection default; | ||
3409 | 61 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3410 | 62 | show user_statistics like 'mysqltest_%'; | ||
3411 | 63 | connection user1; | ||
3412 | 64 | |||
3413 | 65 | --error 1044 | ||
3414 | 66 | grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; | ||
3415 | 67 | |||
3416 | 68 | connection default; | ||
3417 | 69 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3418 | 70 | show user_statistics like 'mysqltest_%'; | ||
3419 | 71 | connection user1; | ||
3420 | 72 | |||
3421 | 73 | --error 1044 | ||
3422 | 74 | show grants for root@localhost; | ||
3423 | 75 | |||
3424 | 76 | connection default; | ||
3425 | 77 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3426 | 78 | show user_statistics like 'mysqltest_%'; | ||
3427 | 79 | connection user1; | ||
3428 | 80 | |||
3429 | 81 | --error 1044 | ||
3430 | 82 | grant select on `my\_1`.* to mysqltest_2@localhost; | ||
3431 | 83 | connection default; | ||
3432 | 84 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3433 | 85 | show user_statistics like 'mysqltest_%'; | ||
3434 | 86 | |||
3435 | 87 | connection default; | ||
3436 | 88 | disconnect user4; | ||
3437 | 89 | disconnect user1; | ||
3438 | 90 | |||
3439 | 91 | select current_user(); | ||
3440 | 92 | |||
3441 | 93 | --error 1044 | ||
3442 | 94 | create database information_schema; | ||
3443 | 95 | |||
3444 | 96 | --error 1044 | ||
3445 | 97 | alter database information_schema upgrade data directory name; | ||
3446 | 98 | |||
3447 | 99 | --error 1044 | ||
3448 | 100 | drop database information_schema; | ||
3449 | 101 | |||
3450 | 102 | --error 1044 | ||
3451 | 103 | drop table information_schema.tables; | ||
3452 | 104 | |||
3453 | 105 | --error 1044 | ||
3454 | 106 | alter table information_schema.tables; | ||
3455 | 107 | |||
3456 | 108 | # | ||
3457 | 109 | # Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB | ||
3458 | 110 | # | ||
3459 | 111 | use information_schema; | ||
3460 | 112 | --error 1044 | ||
3461 | 113 | create temporary table schemata(f1 char(10)); | ||
3462 | 114 | |||
3463 | 115 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3464 | 116 | show user_statistics like 'root'; | ||
3465 | 117 | |||
3466 | 118 | # | ||
3467 | 119 | # Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema | ||
3468 | 120 | # | ||
3469 | 121 | --error 1044 | ||
3470 | 122 | grant all on information_schema.* to 'user1'@'localhost'; | ||
3471 | 123 | --error 1044 | ||
3472 | 124 | grant select on information_schema.* to 'user1'@'localhost'; | ||
3473 | 125 | |||
3474 | 126 | --replace_column 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 X 11 X 12 X 13 X 14 X 15 X 16 X 17 X 18 X 19 X | ||
3475 | 127 | show user_statistics like 'root'; | ||
3476 | 128 | |||
3477 | 129 | |||
3478 | 130 | drop user mysqltest_1@localhost; | ||
3479 | 131 | drop user mysqltest_2@localhost; | ||
3480 | 132 | drop user mysqltest_3@localhost; | ||
3481 | 133 | drop user mysqltest_4@localhost; | ||
3482 | 134 | drop database mysqltest; | ||
3483 | 135 | set global userstat_running=default; | ||
3484 | 0 | 136 | ||
3485 | === modified file 'Percona-Server/mysql-test/t/userstat_bug602047.test' | |||
3486 | --- Percona-Server/mysql-test/t/userstat_bug602047.test 2011-11-24 01:59:48 +0000 | |||
3487 | +++ Percona-Server/mysql-test/t/userstat_bug602047.test 2012-02-02 06:11:26 +0000 | |||
3488 | @@ -4,6 +4,8 @@ | |||
3489 | 4 | --enable_warnings | 4 | --enable_warnings |
3490 | 5 | SET @userstat_running_old= @@userstat_running; | 5 | SET @userstat_running_old= @@userstat_running; |
3491 | 6 | SET GLOBAL userstat_running=ON; | 6 | SET GLOBAL userstat_running=ON; |
3492 | 7 | FLUSH TABLE_STATISTICS; | ||
3493 | 8 | FLUSH INDEX_STATISTICS; | ||
3494 | 7 | CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB; | 9 | CREATE TABLE t1 ( id int(10), PRIMARY KEY (id)) ENGINE=InnoDB; |
3495 | 8 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); | 10 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
3496 | 9 | SELECT COUNT(*) FROM t1; | 11 | SELECT COUNT(*) FROM t1; |
3497 | 10 | 12 | ||
3498 | === modified file 'Percona-Server/sql/handler.cc' | |||
3499 | --- Percona-Server/sql/handler.cc 2011-11-24 16:33:30 +0000 | |||
3500 | +++ Percona-Server/sql/handler.cc 2012-02-02 06:11:26 +0000 | |||
3501 | @@ -1199,7 +1199,7 @@ | |||
3502 | 1199 | } | 1199 | } |
3503 | 1200 | DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE();); | 1200 | DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE();); |
3504 | 1201 | if (is_real_trans) | 1201 | if (is_real_trans) |
3506 | 1202 | thd->diff_commit_trans++; | 1202 | thd->diff_stats.commit_trans++; |
3507 | 1203 | end: | 1203 | end: |
3508 | 1204 | if (rw_trans) | 1204 | if (rw_trans) |
3509 | 1205 | start_waiting_global_read_lock(thd); | 1205 | start_waiting_global_read_lock(thd); |
3510 | @@ -1331,7 +1331,7 @@ | |||
3511 | 1331 | if (is_real_trans) | 1331 | if (is_real_trans) |
3512 | 1332 | thd->transaction.cleanup(); | 1332 | thd->transaction.cleanup(); |
3513 | 1333 | 1333 | ||
3515 | 1334 | thd->diff_rollback_trans++; | 1334 | thd->diff_stats.rollback_trans++; |
3516 | 1335 | #endif /* USING_TRANSACTIONS */ | 1335 | #endif /* USING_TRANSACTIONS */ |
3517 | 1336 | if (all) | 1336 | if (all) |
3518 | 1337 | thd->transaction_rollback_request= FALSE; | 1337 | thd->transaction_rollback_request= FALSE; |
3519 | @@ -1771,7 +1771,7 @@ | |||
3520 | 1771 | ha_info->reset(); /* keep it conveniently zero-filled */ | 1771 | ha_info->reset(); /* keep it conveniently zero-filled */ |
3521 | 1772 | } | 1772 | } |
3522 | 1773 | trans->ha_list= sv->ha_list; | 1773 | trans->ha_list= sv->ha_list; |
3524 | 1774 | thd->diff_rollback_trans++; | 1774 | thd->diff_stats.rollback_trans++; |
3525 | 1775 | DBUG_RETURN(error); | 1775 | DBUG_RETURN(error); |
3526 | 1776 | } | 1776 | } |
3527 | 1777 | 1777 | ||
3528 | @@ -3610,110 +3610,158 @@ | |||
3529 | 3610 | return; | 3610 | return; |
3530 | 3611 | } | 3611 | } |
3531 | 3612 | 3612 | ||
3542 | 3613 | // Updates the global table stats with the TABLE this handler represents. | 3613 | /** |
3543 | 3614 | void handler::update_global_table_stats() { | 3614 | Updates the global table stats with the TABLE this handler represents. |
3544 | 3615 | if (!opt_userstat_running) { | 3615 | */ |
3545 | 3616 | rows_read = rows_changed = 0; | 3616 | void handler::update_global_table_stats() |
3546 | 3617 | return; | 3617 | { |
3547 | 3618 | } | 3618 | DBUG_ENTER("handler::update_global_table_stats"); |
3548 | 3619 | 3619 | ||
3549 | 3620 | if (!rows_read && !rows_changed) return; // Nothing to update. | 3620 | if (!opt_userstat_running) |
3550 | 3621 | // table_cache_key is db_name + '\0' + table_name + '\0'. | 3621 | { |
3551 | 3622 | if (!table->s || !table->s->table_cache_key.str || !table->s->table_name.str) return; | 3622 | rows_read= 0; |
3552 | 3623 | rows_changed= 0; | ||
3553 | 3624 | DBUG_VOID_RETURN; | ||
3554 | 3625 | } | ||
3555 | 3626 | |||
3556 | 3627 | if (!rows_read && !rows_changed) | ||
3557 | 3628 | { | ||
3558 | 3629 | /* Noting to update */ | ||
3559 | 3630 | DBUG_VOID_RETURN; | ||
3560 | 3631 | } | ||
3561 | 3632 | |||
3562 | 3633 | /* table_cache_key is db_name + '\0' + table_name + '\0' */ | ||
3563 | 3634 | if (!table->s || | ||
3564 | 3635 | !table->s->table_cache_key.str || | ||
3565 | 3636 | !table->s->table_name.str) | ||
3566 | 3637 | { | ||
3567 | 3638 | /* Noting to update */ | ||
3568 | 3639 | DBUG_VOID_RETURN; | ||
3569 | 3640 | } | ||
3570 | 3623 | 3641 | ||
3571 | 3624 | TABLE_STATS* table_stats; | 3642 | TABLE_STATS* table_stats; |
3575 | 3625 | char key[NAME_LEN * 2 + 2]; | 3643 | char key[NAME_LEN*2 + 2]; |
3576 | 3626 | // [db] + '.' + [table] | 3644 | /* [db] + '.' + [table] */ |
3577 | 3627 | sprintf(key, "%s.%s", table->s->table_cache_key.str, table->s->table_name.str); | 3645 | sprintf(key, "%s.%s", |
3578 | 3646 | table->s->table_cache_key.str, | ||
3579 | 3647 | table->s->table_name.str); | ||
3580 | 3628 | 3648 | ||
3581 | 3629 | pthread_mutex_lock(&LOCK_global_table_stats); | 3649 | pthread_mutex_lock(&LOCK_global_table_stats); |
3584 | 3630 | // Gets the global table stats, creating one if necessary. | 3650 | /* Gets the global table stats, creating one if necessary. */ |
3585 | 3631 | if (!(table_stats = (TABLE_STATS*)hash_search(&global_table_stats, | 3651 | if (!(table_stats= (TABLE_STATS *)hash_search(&global_table_stats, |
3586 | 3632 | (uchar*)key, | 3652 | (uchar*)key, |
3591 | 3633 | strlen(key)))) { | 3653 | strlen(key)))) |
3592 | 3634 | if (!(table_stats = ((TABLE_STATS*) | 3654 | { |
3593 | 3635 | my_malloc(sizeof(TABLE_STATS), MYF(MY_WME | MY_ZEROFILL))))) { | 3655 | if (!(table_stats= (TABLE_STATS *)my_malloc(sizeof(TABLE_STATS), |
3594 | 3636 | // Out of memory. | 3656 | MYF(MY_WME | MY_ZEROFILL)))) |
3595 | 3657 | { | ||
3596 | 3658 | /* Out of memory. */ | ||
3597 | 3637 | sql_print_error("Allocating table stats failed."); | 3659 | sql_print_error("Allocating table stats failed."); |
3598 | 3638 | goto end; | 3660 | goto end; |
3599 | 3639 | } | 3661 | } |
3600 | 3640 | strncpy(table_stats->table, key, sizeof(table_stats->table)); | 3662 | strncpy(table_stats->table, key, sizeof(table_stats->table)); |
3605 | 3641 | table_stats->rows_read = 0; | 3663 | table_stats->rows_read= 0; |
3606 | 3642 | table_stats->rows_changed = 0; | 3664 | table_stats->rows_changed= 0; |
3607 | 3643 | table_stats->rows_changed_x_indexes = 0; | 3665 | table_stats->rows_changed_x_indexes= 0; |
3604 | 3644 | table_stats->engine_type = (int) ht->db_type; | ||
3608 | 3645 | 3666 | ||
3609 | 3646 | if (my_hash_insert(&global_table_stats, (uchar*)table_stats)) { | 3667 | if (my_hash_insert(&global_table_stats, (uchar*)table_stats)) { |
3611 | 3647 | // Out of memory. | 3668 | /* Out of memory. */ |
3612 | 3648 | sql_print_error("Inserting table stats failed."); | 3669 | sql_print_error("Inserting table stats failed."); |
3613 | 3649 | my_free((char*)table_stats, 0); | 3670 | my_free((char*)table_stats, 0); |
3614 | 3650 | goto end; | 3671 | goto end; |
3615 | 3651 | } | 3672 | } |
3616 | 3652 | } | 3673 | } |
3624 | 3653 | // Updates the global table stats. | 3674 | /* Updates the current thread stats. */ |
3625 | 3654 | table_stats->rows_read += rows_read; | 3675 | current_thd->diff_stats.rows_read+= rows_read; |
3626 | 3655 | table_stats->rows_changed += rows_changed; | 3676 | /* Updates the global table stats. */ |
3627 | 3656 | table_stats->rows_changed_x_indexes += | 3677 | table_stats->rows_read+= rows_read; |
3628 | 3657 | rows_changed * (table->s->keys ? table->s->keys : 1); | 3678 | table_stats->rows_changed+= rows_changed; |
3629 | 3658 | current_thd->diff_total_read_rows += rows_read; | 3679 | table_stats->rows_changed_x_indexes+= |
3630 | 3659 | rows_read = rows_changed = 0; | 3680 | rows_changed * (table->s->keys ? table->s->keys : 1); |
3631 | 3681 | /* Reset handler stats */ | ||
3632 | 3682 | rows_read= 0; | ||
3633 | 3683 | rows_changed= 0; | ||
3634 | 3660 | end: | 3684 | end: |
3635 | 3661 | pthread_mutex_unlock(&LOCK_global_table_stats); | 3685 | pthread_mutex_unlock(&LOCK_global_table_stats); |
3636 | 3686 | DBUG_VOID_RETURN; | ||
3637 | 3662 | } | 3687 | } |
3638 | 3663 | 3688 | ||
3647 | 3664 | // Updates the global index stats with this handler's accumulated index reads. | 3689 | /** |
3648 | 3665 | void handler::update_global_index_stats() { | 3690 | Updates the global index stats with this handler's accumulated index reads. |
3649 | 3666 | // table_cache_key is db_name + '\0' + table_name + '\0'. | 3691 | */ |
3650 | 3667 | if (!table->s || !table->s->table_cache_key.str || !table->s->table_name.str) return; | 3692 | void handler::update_global_index_stats() |
3651 | 3668 | 3693 | { | |
3652 | 3669 | if (!opt_userstat_running) { | 3694 | DBUG_ENTER("handler::update_global_index_stats"); |
3653 | 3670 | for (uint x = 0; x < table->s->keys; x++) { | 3695 | |
3654 | 3671 | index_rows_read[x] = 0; | 3696 | /* table_cache_key is db_name + '\0' + table_name + '\0'. */ |
3655 | 3697 | if (!table->s || | ||
3656 | 3698 | !table->s->table_cache_key.str || | ||
3657 | 3699 | !table->s->table_name.str) | ||
3658 | 3700 | { | ||
3659 | 3701 | DBUG_VOID_RETURN; | ||
3660 | 3702 | } | ||
3661 | 3703 | |||
3662 | 3704 | if (!opt_userstat_running) | ||
3663 | 3705 | { | ||
3664 | 3706 | for (uint x= 0; x < table->s->keys; x++) | ||
3665 | 3707 | { | ||
3666 | 3708 | index_rows_read[x]= 0; | ||
3667 | 3672 | } | 3709 | } |
3669 | 3673 | return; | 3710 | DBUG_VOID_RETURN; |
3670 | 3674 | } | 3711 | } |
3671 | 3675 | 3712 | ||
3676 | 3676 | for (uint x = 0; x < table->s->keys; x++) { | 3713 | for (uint x= 0; x < table->s->keys; x++) |
3677 | 3677 | if (index_rows_read[x]) { | 3714 | { |
3678 | 3678 | // Rows were read using this index. | 3715 | if (index_rows_read[x]) |
3679 | 3679 | KEY* key_info = &table->key_info[x]; | 3716 | { |
3680 | 3717 | /* Rows were read using this index. */ | ||
3681 | 3718 | KEY* key_info= &table->key_info[x]; | ||
3682 | 3680 | 3719 | ||
3684 | 3681 | if (!key_info->name) continue; | 3720 | if (!key_info->name) |
3685 | 3721 | { | ||
3686 | 3722 | continue; | ||
3687 | 3723 | } | ||
3688 | 3682 | 3724 | ||
3689 | 3683 | INDEX_STATS* index_stats; | 3725 | INDEX_STATS* index_stats; |
3690 | 3684 | char key[NAME_LEN * 3 + 3]; | 3726 | char key[NAME_LEN * 3 + 3]; |
3694 | 3685 | // [db] + '.' + [table] + '.' + [index] | 3727 | /* [db] + '.' + [table] + '.' + [index] */ |
3695 | 3686 | sprintf(key, "%s.%s.%s", table->s->table_cache_key.str, | 3728 | sprintf(key, "%s.%s.%s", |
3696 | 3687 | table->s->table_name.str, key_info->name); | 3729 | table->s->table_cache_key.str, |
3697 | 3730 | table->s->table_name.str, | ||
3698 | 3731 | key_info->name); | ||
3699 | 3688 | 3732 | ||
3700 | 3689 | pthread_mutex_lock(&LOCK_global_index_stats); | 3733 | pthread_mutex_lock(&LOCK_global_index_stats); |
3703 | 3690 | // Gets the global index stats, creating one if necessary. | 3734 | /* Gets the global index stats, creating one if necessary. */ |
3704 | 3691 | if (!(index_stats = (INDEX_STATS*)hash_search(&global_index_stats, | 3735 | if (!(index_stats= (INDEX_STATS *)hash_search(&global_index_stats, |
3705 | 3692 | (uchar*)key, | 3736 | (uchar*)key, |
3710 | 3693 | strlen(key)))) { | 3737 | strlen(key)))) |
3711 | 3694 | if (!(index_stats = ((INDEX_STATS*) | 3738 | { |
3712 | 3695 | my_malloc(sizeof(INDEX_STATS), MYF(MY_WME | MY_ZEROFILL))))) { | 3739 | if (!(index_stats= (INDEX_STATS *)my_malloc(sizeof(INDEX_STATS), |
3713 | 3696 | // Out of memory. | 3740 | MYF(MY_WME | MY_ZEROFILL)))) |
3714 | 3741 | { | ||
3715 | 3742 | /* Out of memory. */ | ||
3716 | 3697 | sql_print_error("Allocating index stats failed."); | 3743 | sql_print_error("Allocating index stats failed."); |
3717 | 3698 | goto end; | 3744 | goto end; |
3718 | 3699 | } | 3745 | } |
3719 | 3700 | strncpy(index_stats->index, key, sizeof(index_stats->index)); | 3746 | strncpy(index_stats->index, key, sizeof(index_stats->index)); |
3721 | 3701 | index_stats->rows_read = 0; | 3747 | index_stats->rows_read= 0; |
3722 | 3702 | 3748 | ||
3725 | 3703 | if (my_hash_insert(&global_index_stats, (uchar*)index_stats)) { | 3749 | if (my_hash_insert(&global_index_stats, (uchar*)index_stats)) |
3726 | 3704 | // Out of memory. | 3750 | { |
3727 | 3751 | /* Out of memory. */ | ||
3728 | 3705 | sql_print_error("Inserting index stats failed."); | 3752 | sql_print_error("Inserting index stats failed."); |
3729 | 3706 | my_free((char*)index_stats, 0); | 3753 | my_free((char*)index_stats, 0); |
3730 | 3707 | goto end; | 3754 | goto end; |
3731 | 3708 | } | 3755 | } |
3732 | 3709 | } | 3756 | } |
3737 | 3710 | // Updates the global index stats. | 3757 | /* Updates the global index stats. */ |
3738 | 3711 | index_stats->rows_read += index_rows_read[x]; | 3758 | index_stats->rows_read+= index_rows_read[x]; |
3739 | 3712 | index_rows_read[x] = 0; | 3759 | index_rows_read[x]= 0; |
3740 | 3713 | end: | 3760 | end: |
3741 | 3714 | pthread_mutex_unlock(&LOCK_global_index_stats); | 3761 | pthread_mutex_unlock(&LOCK_global_index_stats); |
3742 | 3715 | } | 3762 | } |
3743 | 3716 | } | 3763 | } |
3744 | 3764 | DBUG_VOID_RETURN; | ||
3745 | 3717 | } | 3765 | } |
3746 | 3718 | 3766 | ||
3747 | 3719 | /**************************************************************************** | 3767 | /**************************************************************************** |
3748 | 3720 | 3768 | ||
3749 | === modified file 'Percona-Server/sql/handler.h' | |||
3750 | --- Percona-Server/sql/handler.h 2012-01-17 14:05:16 +0000 | |||
3751 | +++ Percona-Server/sql/handler.h 2012-02-02 06:11:26 +0000 | |||
3752 | @@ -1179,7 +1179,9 @@ | |||
3753 | 1179 | ref_length(sizeof(my_off_t)), | 1179 | ref_length(sizeof(my_off_t)), |
3754 | 1180 | ft_handler(0), inited(NONE), | 1180 | ft_handler(0), inited(NONE), |
3755 | 1181 | locked(FALSE), implicit_emptied(0), | 1181 | locked(FALSE), implicit_emptied(0), |
3757 | 1182 | pushed_cond(0), rows_read(0), rows_changed(0), next_insert_id(0), insert_id_for_cur_row(0), | 1182 | pushed_cond(0), |
3758 | 1183 | rows_read(0), rows_changed(0), | ||
3759 | 1184 | next_insert_id(0), insert_id_for_cur_row(0), | ||
3760 | 1183 | auto_inc_intervals_count(0) | 1185 | auto_inc_intervals_count(0) |
3761 | 1184 | { | 1186 | { |
3762 | 1185 | memset(index_rows_read, 0, sizeof(index_rows_read)); | 1187 | memset(index_rows_read, 0, sizeof(index_rows_read)); |
3763 | @@ -1305,9 +1307,10 @@ | |||
3764 | 1305 | uint get_dup_key(int error); | 1307 | uint get_dup_key(int error); |
3765 | 1306 | virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) | 1308 | virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) |
3766 | 1307 | { | 1309 | { |
3770 | 1308 | table= table_arg; | 1310 | table= table_arg; |
3771 | 1309 | table_share= share; | 1311 | table_share= share; |
3772 | 1310 | rows_read = rows_changed = 0; | 1312 | rows_read= 0; |
3773 | 1313 | rows_changed= 0; | ||
3774 | 1311 | memset(index_rows_read, 0, sizeof(index_rows_read)); | 1314 | memset(index_rows_read, 0, sizeof(index_rows_read)); |
3775 | 1312 | } | 1315 | } |
3776 | 1313 | virtual double scan_time() | 1316 | virtual double scan_time() |
3777 | 1314 | 1317 | ||
3778 | === modified file 'Percona-Server/sql/item.cc' | |||
3779 | --- Percona-Server/sql/item.cc 2011-07-07 08:06:59 +0000 | |||
3780 | +++ Percona-Server/sql/item.cc 2012-02-02 06:11:26 +0000 | |||
3781 | @@ -4435,6 +4435,7 @@ | |||
3782 | 4435 | db, tab, field_name) & | 4435 | db, tab, field_name) & |
3783 | 4436 | VIEW_ANY_ACL))) | 4436 | VIEW_ANY_ACL))) |
3784 | 4437 | { | 4437 | { |
3785 | 4438 | thd->diff_stats.access_denied_errors++; | ||
3786 | 4438 | my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), | 4439 | my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), |
3787 | 4439 | "ANY", thd->security_ctx->priv_user, | 4440 | "ANY", thd->security_ctx->priv_user, |
3788 | 4440 | thd->security_ctx->host_or_ip, field_name, tab); | 4441 | thd->security_ctx->host_or_ip, field_name, tab); |
3789 | 4441 | 4442 | ||
3790 | === modified file 'Percona-Server/sql/mysql_priv.h' | |||
3791 | --- Percona-Server/sql/mysql_priv.h 2011-11-24 02:01:21 +0000 | |||
3792 | +++ Percona-Server/sql/mysql_priv.h 2012-02-02 06:11:26 +0000 | |||
3793 | @@ -1175,6 +1175,7 @@ | |||
3794 | 1175 | void mysql_init_multi_delete(LEX *lex); | 1175 | void mysql_init_multi_delete(LEX *lex); |
3795 | 1176 | bool multi_delete_set_locks_and_link_aux_tables(LEX *lex); | 1176 | bool multi_delete_set_locks_and_link_aux_tables(LEX *lex); |
3796 | 1177 | void init_max_user_conn(void); | 1177 | void init_max_user_conn(void); |
3797 | 1178 | void set_connections_stats(); | ||
3798 | 1178 | void init_update_queries(void); | 1179 | void init_update_queries(void); |
3799 | 1179 | void init_global_user_stats(void); | 1180 | void init_global_user_stats(void); |
3800 | 1180 | void init_global_table_stats(void); | 1181 | void init_global_table_stats(void); |
3801 | @@ -2195,7 +2196,6 @@ | |||
3802 | 2195 | extern pthread_mutex_t LOCK_global_table_stats; | 2196 | extern pthread_mutex_t LOCK_global_table_stats; |
3803 | 2196 | extern HASH global_index_stats; | 2197 | extern HASH global_index_stats; |
3804 | 2197 | extern pthread_mutex_t LOCK_global_index_stats; | 2198 | extern pthread_mutex_t LOCK_global_index_stats; |
3805 | 2198 | extern pthread_mutex_t LOCK_stats; | ||
3806 | 2199 | 2199 | ||
3807 | 2200 | extern const char *opt_date_time_formats[]; | 2200 | extern const char *opt_date_time_formats[]; |
3808 | 2201 | extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[]; | 2201 | extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[]; |
3809 | 2202 | 2202 | ||
3810 | === modified file 'Percona-Server/sql/mysqld.cc' | |||
3811 | --- Percona-Server/sql/mysqld.cc 2012-01-30 04:30:33 +0000 | |||
3812 | +++ Percona-Server/sql/mysqld.cc 2012-02-02 06:11:26 +0000 | |||
3813 | @@ -724,7 +724,6 @@ | |||
3814 | 724 | LOCK_global_system_variables, | 724 | LOCK_global_system_variables, |
3815 | 725 | LOCK_user_conn, LOCK_slave_list, LOCK_active_mi, | 725 | LOCK_user_conn, LOCK_slave_list, LOCK_active_mi, |
3816 | 726 | LOCK_connection_count; | 726 | LOCK_connection_count; |
3817 | 727 | pthread_mutex_t LOCK_stats; | ||
3818 | 728 | pthread_mutex_t LOCK_global_user_client_stats; | 727 | pthread_mutex_t LOCK_global_user_client_stats; |
3819 | 729 | pthread_mutex_t LOCK_global_table_stats; | 728 | pthread_mutex_t LOCK_global_table_stats; |
3820 | 730 | pthread_mutex_t LOCK_global_index_stats; | 729 | pthread_mutex_t LOCK_global_index_stats; |
3821 | @@ -1537,7 +1536,6 @@ | |||
3822 | 1537 | (void) pthread_cond_destroy(&COND_thread_cache); | 1536 | (void) pthread_cond_destroy(&COND_thread_cache); |
3823 | 1538 | (void) pthread_cond_destroy(&COND_flush_thread_cache); | 1537 | (void) pthread_cond_destroy(&COND_flush_thread_cache); |
3824 | 1539 | (void) pthread_cond_destroy(&COND_manager); | 1538 | (void) pthread_cond_destroy(&COND_manager); |
3825 | 1540 | (void) pthread_mutex_destroy(&LOCK_stats); | ||
3826 | 1541 | (void) pthread_mutex_destroy(&LOCK_global_user_client_stats); | 1539 | (void) pthread_mutex_destroy(&LOCK_global_user_client_stats); |
3827 | 1542 | (void) pthread_mutex_destroy(&LOCK_global_table_stats); | 1540 | (void) pthread_mutex_destroy(&LOCK_global_table_stats); |
3828 | 1543 | (void) pthread_mutex_destroy(&LOCK_global_index_stats); | 1541 | (void) pthread_mutex_destroy(&LOCK_global_index_stats); |
3829 | @@ -3735,7 +3733,6 @@ | |||
3830 | 3735 | #endif | 3733 | #endif |
3831 | 3736 | (void) pthread_mutex_init(&LOCK_server_started, MY_MUTEX_INIT_FAST); | 3734 | (void) pthread_mutex_init(&LOCK_server_started, MY_MUTEX_INIT_FAST); |
3832 | 3737 | (void) pthread_cond_init(&COND_server_started,NULL); | 3735 | (void) pthread_cond_init(&COND_server_started,NULL); |
3833 | 3738 | (void) pthread_mutex_init(&LOCK_stats, MY_MUTEX_INIT_FAST); | ||
3834 | 3739 | (void) pthread_mutex_init(&LOCK_global_user_client_stats, MY_MUTEX_INIT_FAST); | 3736 | (void) pthread_mutex_init(&LOCK_global_user_client_stats, MY_MUTEX_INIT_FAST); |
3835 | 3740 | (void) pthread_mutex_init(&LOCK_global_table_stats, MY_MUTEX_INIT_FAST); | 3737 | (void) pthread_mutex_init(&LOCK_global_table_stats, MY_MUTEX_INIT_FAST); |
3836 | 3741 | (void) pthread_mutex_init(&LOCK_global_index_stats, MY_MUTEX_INIT_FAST); | 3738 | (void) pthread_mutex_init(&LOCK_global_index_stats, MY_MUTEX_INIT_FAST); |
3837 | 3742 | 3739 | ||
3838 | === modified file 'Percona-Server/sql/set_var.cc' | |||
3839 | --- Percona-Server/sql/set_var.cc 2012-01-30 04:30:33 +0000 | |||
3840 | +++ Percona-Server/sql/set_var.cc 2012-02-02 06:11:26 +0000 | |||
3841 | @@ -1152,6 +1152,7 @@ | |||
3842 | 1152 | -1 : 0); | 1152 | -1 : 0); |
3843 | 1153 | else | 1153 | else |
3844 | 1154 | { | 1154 | { |
3845 | 1155 | thd->diff_stats.access_denied_errors++; | ||
3846 | 1155 | my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); | 1156 | my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); |
3847 | 1156 | return 1; | 1157 | return 1; |
3848 | 1157 | } | 1158 | } |
3849 | @@ -3283,6 +3284,7 @@ | |||
3850 | 3283 | #ifndef NO_EMBEDDED_ACCESS_CHECKS | 3284 | #ifndef NO_EMBEDDED_ACCESS_CHECKS |
3851 | 3284 | if (!(thd->security_ctx->master_access & SUPER_ACL)) | 3285 | if (!(thd->security_ctx->master_access & SUPER_ACL)) |
3852 | 3285 | { | 3286 | { |
3853 | 3287 | thd->diff_stats.access_denied_errors++; | ||
3854 | 3286 | my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); | 3288 | my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); |
3855 | 3287 | return 1; | 3289 | return 1; |
3856 | 3288 | } | 3290 | } |
3857 | @@ -3321,6 +3323,7 @@ | |||
3858 | 3321 | return 0; | 3323 | return 0; |
3859 | 3322 | else | 3324 | else |
3860 | 3323 | { | 3325 | { |
3861 | 3326 | thd->diff_stats.access_denied_errors++; | ||
3862 | 3324 | my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); | 3327 | my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER"); |
3863 | 3325 | return 1; | 3328 | return 1; |
3864 | 3326 | } | 3329 | } |
3865 | 3327 | 3330 | ||
3866 | === modified file 'Percona-Server/sql/sp_head.cc' | |||
3867 | --- Percona-Server/sql/sp_head.cc 2011-11-24 16:33:30 +0000 | |||
3868 | +++ Percona-Server/sql/sp_head.cc 2012-02-02 06:11:26 +0000 | |||
3869 | @@ -1556,6 +1556,7 @@ | |||
3870 | 1556 | char priv_desc[128]; | 1556 | char priv_desc[128]; |
3871 | 1557 | get_privilege_desc(priv_desc, sizeof(priv_desc), TRIGGER_ACL); | 1557 | get_privilege_desc(priv_desc, sizeof(priv_desc), TRIGGER_ACL); |
3872 | 1558 | 1558 | ||
3873 | 1559 | thd->diff_stats.access_denied_errors++; | ||
3874 | 1559 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc, | 1560 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc, |
3875 | 1560 | thd->security_ctx->priv_user, thd->security_ctx->host_or_ip, | 1561 | thd->security_ctx->priv_user, thd->security_ctx->host_or_ip, |
3876 | 1561 | table_name->str); | 1562 | table_name->str); |
3877 | 1562 | 1563 | ||
3878 | === modified file 'Percona-Server/sql/sql_acl.cc' | |||
3879 | --- Percona-Server/sql/sql_acl.cc 2011-07-03 15:47:37 +0000 | |||
3880 | +++ Percona-Server/sql/sql_acl.cc 2012-02-02 06:11:26 +0000 | |||
3881 | @@ -3068,6 +3068,7 @@ | |||
3882 | 3068 | char command[128]; | 3068 | char command[128]; |
3883 | 3069 | get_privilege_desc(command, sizeof(command), | 3069 | get_privilege_desc(command, sizeof(command), |
3884 | 3070 | table_list->grant.want_privilege); | 3070 | table_list->grant.want_privilege); |
3885 | 3071 | thd->diff_stats.access_denied_errors++; | ||
3886 | 3071 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), | 3072 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), |
3887 | 3072 | command, thd->security_ctx->priv_user, | 3073 | command, thd->security_ctx->priv_user, |
3888 | 3073 | thd->security_ctx->host_or_ip, table_list->alias); | 3074 | thd->security_ctx->host_or_ip, table_list->alias); |
3889 | @@ -4051,6 +4052,7 @@ | |||
3890 | 4051 | { | 4052 | { |
3891 | 4052 | char command[128]; | 4053 | char command[128]; |
3892 | 4053 | get_privilege_desc(command, sizeof(command), want_access); | 4054 | get_privilege_desc(command, sizeof(command), want_access); |
3893 | 4055 | thd->diff_stats.access_denied_errors++; | ||
3894 | 4054 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), | 4056 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), |
3895 | 4055 | command, | 4057 | command, |
3896 | 4056 | sctx->priv_user, | 4058 | sctx->priv_user, |
3897 | @@ -4118,6 +4120,7 @@ | |||
3898 | 4118 | rw_unlock(&LOCK_grant); | 4120 | rw_unlock(&LOCK_grant); |
3899 | 4119 | char command[128]; | 4121 | char command[128]; |
3900 | 4120 | get_privilege_desc(command, sizeof(command), want_access); | 4122 | get_privilege_desc(command, sizeof(command), want_access); |
3901 | 4123 | thd->diff_stats.access_denied_errors++; | ||
3902 | 4121 | my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), | 4124 | my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), |
3903 | 4122 | command, | 4125 | command, |
3904 | 4123 | sctx->priv_user, | 4126 | sctx->priv_user, |
3905 | @@ -4283,6 +4286,7 @@ | |||
3906 | 4283 | Do not give an error message listing a column name unless the user has | 4286 | Do not give an error message listing a column name unless the user has |
3907 | 4284 | privilege to see all columns. | 4287 | privilege to see all columns. |
3908 | 4285 | */ | 4288 | */ |
3909 | 4289 | thd->diff_stats.access_denied_errors++; | ||
3910 | 4286 | if (using_column_privileges) | 4290 | if (using_column_privileges) |
3911 | 4287 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), | 4291 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), |
3912 | 4288 | command, sctx->priv_user, | 4292 | command, sctx->priv_user, |
3913 | @@ -4418,6 +4422,7 @@ | |||
3914 | 4418 | command= "alter routine"; | 4422 | command= "alter routine"; |
3915 | 4419 | else if (want_access & GRANT_ACL) | 4423 | else if (want_access & GRANT_ACL) |
3916 | 4420 | command= "grant"; | 4424 | command= "grant"; |
3917 | 4425 | thd->diff_stats.access_denied_errors++; | ||
3918 | 4421 | my_error(ER_PROCACCESS_DENIED_ERROR, MYF(0), | 4426 | my_error(ER_PROCACCESS_DENIED_ERROR, MYF(0), |
3919 | 4422 | command, user, host, table ? buff : "unknown"); | 4427 | command, user, host, table ? buff : "unknown"); |
3920 | 4423 | } | 4428 | } |
3921 | 4424 | 4429 | ||
3922 | === modified file 'Percona-Server/sql/sql_base.cc' | |||
3923 | --- Percona-Server/sql/sql_base.cc 2011-11-24 16:33:30 +0000 | |||
3924 | +++ Percona-Server/sql/sql_base.cc 2012-02-02 06:11:26 +0000 | |||
3925 | @@ -8101,6 +8101,7 @@ | |||
3926 | 8101 | field_table_name, fld->field_name) & | 8101 | field_table_name, fld->field_name) & |
3927 | 8102 | VIEW_ANY_ACL))) | 8102 | VIEW_ANY_ACL))) |
3928 | 8103 | { | 8103 | { |
3929 | 8104 | thd->diff_stats.access_denied_errors++; | ||
3930 | 8104 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "ANY", | 8105 | my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), "ANY", |
3931 | 8105 | thd->security_ctx->priv_user, | 8106 | thd->security_ctx->priv_user, |
3932 | 8106 | thd->security_ctx->host_or_ip, | 8107 | thd->security_ctx->host_or_ip, |
3933 | 8107 | 8108 | ||
3934 | === modified file 'Percona-Server/sql/sql_class.cc' | |||
3935 | --- Percona-Server/sql/sql_class.cc 2011-11-24 02:00:51 +0000 | |||
3936 | +++ Percona-Server/sql/sql_class.cc 2012-02-02 06:11:26 +0000 | |||
3937 | @@ -725,14 +725,13 @@ | |||
3938 | 725 | bzero(ha_data, sizeof(ha_data)); | 725 | bzero(ha_data, sizeof(ha_data)); |
3939 | 726 | mysys_var=0; | 726 | mysys_var=0; |
3940 | 727 | binlog_evt_union.do_union= FALSE; | 727 | binlog_evt_union.do_union= FALSE; |
3949 | 728 | enable_slow_log= 0; | 728 | enable_slow_log= 0; |
3950 | 729 | busy_time = 0; | 729 | busy_time= 0; |
3951 | 730 | cpu_time = 0; | 730 | cpu_time= 0; |
3952 | 731 | bytes_received = 0; | 731 | bytes_received= 0; |
3953 | 732 | bytes_sent = 0; | 732 | bytes_sent= 0; |
3954 | 733 | binlog_bytes_written = 0; | 733 | binlog_bytes_written= 0; |
3955 | 734 | updated_row_count = 0; | 734 | updated_row_count= 0; |
3948 | 735 | sent_row_count_2 = 0; | ||
3956 | 736 | #ifndef DBUG_OFF | 735 | #ifndef DBUG_OFF |
3957 | 737 | dbug_sentry=THD_SENTRY_MAGIC; | 736 | dbug_sentry=THD_SENTRY_MAGIC; |
3958 | 738 | #endif | 737 | #endif |
3959 | @@ -947,83 +946,109 @@ | |||
3960 | 947 | clear_slow_extended(); | 946 | clear_slow_extended(); |
3961 | 948 | } | 947 | } |
3962 | 949 | 948 | ||
3964 | 950 | // Resets stats in a THD. | 949 | |
3965 | 950 | /** | ||
3966 | 951 | Resets stats in a THD. | ||
3967 | 952 | */ | ||
3968 | 951 | void THD::reset_stats(void) { | 953 | void THD::reset_stats(void) { |
3971 | 952 | current_connect_time = time(NULL); | 954 | current_connect_time= time(NULL); |
3972 | 953 | last_global_update_time = current_connect_time; | 955 | diff_stats.connected_time= current_connect_time; |
3973 | 954 | reset_diff_stats(); | 956 | reset_diff_stats(); |
3974 | 955 | } | 957 | } |
3975 | 956 | 958 | ||
3977 | 957 | // Resets the 'diff' stats, which are used to update global stats. | 959 | |
3978 | 960 | /** | ||
3979 | 961 | Resets the 'diff' stats, which are used to update global stats. | ||
3980 | 962 | */ | ||
3981 | 958 | void THD::reset_diff_stats(void) { | 963 | void THD::reset_diff_stats(void) { |
3999 | 959 | diff_total_busy_time = 0; | 964 | diff_stats.busy_time= 0; |
4000 | 960 | diff_total_cpu_time = 0; | 965 | diff_stats.cpu_time= 0; |
4001 | 961 | diff_total_bytes_received = 0; | 966 | diff_stats.bytes_received= 0; |
4002 | 962 | diff_total_bytes_sent = 0; | 967 | diff_stats.bytes_sent= 0; |
4003 | 963 | diff_total_binlog_bytes_written = 0; | 968 | diff_stats.binlog_bytes_written= 0; |
4004 | 964 | diff_total_sent_rows = 0; | 969 | diff_stats.rows_fetched= 0; |
4005 | 965 | diff_total_updated_rows = 0; | 970 | diff_stats.rows_updated= 0; |
4006 | 966 | diff_total_read_rows = 0; | 971 | diff_stats.rows_read= 0; |
4007 | 967 | diff_select_commands = 0; | 972 | diff_stats.select_commands= 0; |
4008 | 968 | diff_update_commands = 0; | 973 | diff_stats.update_commands= 0; |
4009 | 969 | diff_other_commands = 0; | 974 | diff_stats.other_commands= 0; |
4010 | 970 | diff_commit_trans = 0; | 975 | diff_stats.commit_trans= 0; |
4011 | 971 | diff_rollback_trans = 0; | 976 | diff_stats.rollback_trans= 0; |
4012 | 972 | diff_denied_connections = 0; | 977 | diff_stats.denied_connections= 0; |
4013 | 973 | diff_lost_connections = 0; | 978 | diff_stats.lost_connections= 0; |
4014 | 974 | diff_access_denied_errors = 0; | 979 | diff_stats.access_denied_errors= 0; |
4015 | 975 | diff_empty_queries = 0; | 980 | diff_stats.empty_queries= 0; |
4016 | 976 | } | 981 | } |
4017 | 977 | 982 | ||
4019 | 978 | // Updates 'diff' stats of a THD. | 983 | |
4020 | 984 | /** | ||
4021 | 985 | Updates 'diff' stats of a THD. | ||
4022 | 986 | */ | ||
4023 | 979 | void THD::update_stats(bool ran_command) { | 987 | void THD::update_stats(bool ran_command) { |
4024 | 988 | DBUG_ENTER("THD::update_stats"); | ||
4025 | 989 | DBUG_PRINT("query",("%-.4096s", query())); | ||
4026 | 980 | if (opt_userstat_running) { | 990 | if (opt_userstat_running) { |
4035 | 981 | diff_total_busy_time += busy_time; | 991 | diff_stats.busy_time+= busy_time; |
4036 | 982 | diff_total_cpu_time += cpu_time; | 992 | diff_stats.cpu_time+= cpu_time; |
4037 | 983 | diff_total_bytes_received += bytes_received; | 993 | diff_stats.bytes_received+= bytes_received; |
4038 | 984 | diff_total_bytes_sent += bytes_sent; | 994 | diff_stats.bytes_sent+= bytes_sent; |
4039 | 985 | diff_total_binlog_bytes_written += binlog_bytes_written; | 995 | diff_stats.binlog_bytes_written+= binlog_bytes_written; |
4040 | 986 | diff_total_sent_rows += sent_row_count_2; | 996 | diff_stats.rows_fetched+= sent_row_count; |
4041 | 987 | diff_total_updated_rows += updated_row_count; | 997 | diff_stats.rows_updated+= updated_row_count; |
4042 | 988 | // diff_total_read_rows is updated in handler.cc. | 998 | /* diff_stats.rows_read is updated in handler.cc. */ |
4043 | 989 | 999 | ||
4062 | 990 | if (ran_command) { | 1000 | if (ran_command) |
4063 | 991 | // The replication thread has the COM_CONNECT command. | 1001 | { |
4064 | 992 | if ((old_command == COM_QUERY || command == COM_CONNECT) && | 1002 | /* The replication thread has the COM_CONNECT command. */ |
4065 | 993 | (lex->sql_command >= 0 && lex->sql_command < SQLCOM_END)) { | 1003 | if ((old_command == COM_QUERY || |
4066 | 994 | // A SQL query. | 1004 | command == COM_CONNECT) && |
4067 | 995 | if (lex->sql_command == SQLCOM_SELECT) { | 1005 | (lex->sql_command >= 0 && |
4068 | 996 | diff_select_commands++; | 1006 | lex->sql_command < SQLCOM_END)) |
4069 | 997 | if (!sent_row_count_2) | 1007 | { |
4070 | 998 | diff_empty_queries++; | 1008 | /* A SQL query. */ |
4071 | 999 | } else if (! sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) { | 1009 | if (lex->sql_command == SQLCOM_SELECT) |
4072 | 1000 | // 'SHOW ' commands become SQLCOM_SELECT. | 1010 | { |
4073 | 1001 | diff_other_commands++; | 1011 | diff_stats.select_commands++; |
4074 | 1002 | // 'SHOW ' commands shouldn't inflate total sent row count. | 1012 | if (!sent_row_count) |
4075 | 1003 | diff_total_sent_rows -= sent_row_count_2; | 1013 | { |
4076 | 1004 | } else if (is_update_query(lex->sql_command)) { | 1014 | diff_stats.empty_queries++; |
4077 | 1005 | diff_update_commands++; | 1015 | } |
4078 | 1006 | } else { | 1016 | } |
4079 | 1007 | diff_other_commands++; | 1017 | else if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) |
4080 | 1018 | { | ||
4081 | 1019 | /* 'SHOW ' commands become SQLCOM_SELECT. */ | ||
4082 | 1020 | diff_stats.other_commands++; | ||
4083 | 1021 | /* 'SHOW ' commands shouldn't inflate total sent row count. */ | ||
4084 | 1022 | diff_stats.rows_fetched-= sent_row_count; | ||
4085 | 1023 | } | ||
4086 | 1024 | else if (is_update_query(lex->sql_command)) | ||
4087 | 1025 | { | ||
4088 | 1026 | diff_stats.update_commands++; | ||
4089 | 1027 | } | ||
4090 | 1028 | else | ||
4091 | 1029 | { | ||
4092 | 1030 | diff_stats.other_commands++; | ||
4093 | 1031 | } | ||
4094 | 1008 | } | 1032 | } |
4095 | 1009 | } | 1033 | } |
4102 | 1010 | } | 1034 | /* diff_stats.commit_trans is updated in handler.cc. */ |
4103 | 1011 | // diff_commit_trans is updated in handler.cc. | 1035 | /* diff_stats.rollback_trans is updated in handler.cc. */ |
4104 | 1012 | // diff_rollback_trans is updated in handler.cc. | 1036 | /* diff_stats.denied_connections is updated in sql_parse.cc. */ |
4105 | 1013 | // diff_denied_connections is updated in sql_parse.cc. | 1037 | /* diff_stats.lost_connections is updated in sql_parse.cc. */ |
4106 | 1014 | // diff_lost_connections is updated in sql_parse.cc. | 1038 | /* diff_stats.access_denied_errors is updated in sql_parse.cc.*/ |
4101 | 1015 | // diff_access_denied_errors is updated in sql_parse.cc. | ||
4107 | 1016 | 1039 | ||
4110 | 1017 | /* reset counters to zero to avoid double-counting since values | 1040 | /* |
4111 | 1018 | are already store in diff_total_*. */ | 1041 | reset counters to zero to avoid double-counting since values |
4112 | 1042 | are already store in diff_stats.*. | ||
4113 | 1043 | */ | ||
4114 | 1019 | } | 1044 | } |
4122 | 1020 | busy_time = 0; | 1045 | busy_time= 0; |
4123 | 1021 | cpu_time = 0; | 1046 | cpu_time= 0; |
4124 | 1022 | bytes_received = 0; | 1047 | bytes_received= 0; |
4125 | 1023 | bytes_sent = 0; | 1048 | bytes_sent= 0; |
4126 | 1024 | binlog_bytes_written = 0; | 1049 | binlog_bytes_written= 0; |
4127 | 1025 | updated_row_count = 0; | 1050 | updated_row_count= 0; |
4128 | 1026 | sent_row_count_2 = 0; | 1051 | DBUG_VOID_RETURN; |
4129 | 1027 | } | 1052 | } |
4130 | 1028 | 1053 | ||
4131 | 1029 | /* | 1054 | /* |
4132 | @@ -1888,8 +1913,10 @@ | |||
4133 | 1888 | */ | 1913 | */ |
4134 | 1889 | buffer.set(buff, sizeof(buff), &my_charset_bin); | 1914 | buffer.set(buff, sizeof(buff), &my_charset_bin); |
4135 | 1890 | } | 1915 | } |
4136 | 1916 | |||
4137 | 1917 | DBUG_PRINT("query",("%-.4096s", thd->query())); | ||
4138 | 1891 | thd->sent_row_count++; | 1918 | thd->sent_row_count++; |
4140 | 1892 | thd->sent_row_count_2++; | 1919 | |
4141 | 1893 | if (thd->is_error()) | 1920 | if (thd->is_error()) |
4142 | 1894 | { | 1921 | { |
4143 | 1895 | protocol->remove_last_row(); | 1922 | protocol->remove_last_row(); |
4144 | @@ -1993,8 +2020,7 @@ | |||
4145 | 1993 | 2020 | ||
4146 | 1994 | select_export::~select_export() | 2021 | select_export::~select_export() |
4147 | 1995 | { | 2022 | { |
4150 | 1996 | thd->sent_row_count=row_count; | 2023 | thd->sent_row_count= row_count; |
4149 | 1997 | thd->sent_row_count_2=row_count; | ||
4151 | 1998 | } | 2024 | } |
4152 | 1999 | 2025 | ||
4153 | 2000 | 2026 | ||
4154 | @@ -3027,7 +3053,7 @@ | |||
4155 | 3027 | if (likely(thd != 0)) | 3053 | if (likely(thd != 0)) |
4156 | 3028 | { /* current_thd==0 when close_connection() calls net_send_error() */ | 3054 | { /* current_thd==0 when close_connection() calls net_send_error() */ |
4157 | 3029 | thd->status_var.bytes_sent+= length; | 3055 | thd->status_var.bytes_sent+= length; |
4159 | 3030 | thd->bytes_sent+= length; | 3056 | thd->bytes_sent+= length; |
4160 | 3031 | } | 3057 | } |
4161 | 3032 | } | 3058 | } |
4162 | 3033 | 3059 | ||
4163 | @@ -3035,7 +3061,7 @@ | |||
4164 | 3035 | void thd_increment_bytes_received(ulong length) | 3061 | void thd_increment_bytes_received(ulong length) |
4165 | 3036 | { | 3062 | { |
4166 | 3037 | current_thd->status_var.bytes_received+= length; | 3063 | current_thd->status_var.bytes_received+= length; |
4168 | 3038 | current_thd->bytes_received+= length; | 3064 | current_thd->bytes_received+= length; |
4169 | 3039 | } | 3065 | } |
4170 | 3040 | 3066 | ||
4171 | 3041 | 3067 | ||
4172 | 3042 | 3068 | ||
4173 | === modified file 'Percona-Server/sql/sql_class.h' | |||
4174 | --- Percona-Server/sql/sql_class.h 2012-01-30 04:30:33 +0000 | |||
4175 | +++ Percona-Server/sql/sql_class.h 2012-02-02 06:11:26 +0000 | |||
4176 | @@ -1906,7 +1906,6 @@ | |||
4177 | 1906 | enum_tx_isolation session_tx_isolation; | 1906 | enum_tx_isolation session_tx_isolation; |
4178 | 1907 | enum_check_fields count_cuted_fields; | 1907 | enum_check_fields count_cuted_fields; |
4179 | 1908 | ha_rows updated_row_count; | 1908 | ha_rows updated_row_count; |
4180 | 1909 | ha_rows sent_row_count_2; /* for userstat */ | ||
4181 | 1910 | 1909 | ||
4182 | 1911 | DYNAMIC_ARRAY user_var_events; /* For user variables replication */ | 1910 | DYNAMIC_ARRAY user_var_events; /* For user variables replication */ |
4183 | 1912 | MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */ | 1911 | MEM_ROOT *user_var_events_alloc; /* Allocate above array elements here */ |
4184 | @@ -2001,41 +2000,23 @@ | |||
4185 | 2001 | occasionally with the 'diff' variables. After the update, the 'diff' | 2000 | occasionally with the 'diff' variables. After the update, the 'diff' |
4186 | 2002 | variables are reset to 0. | 2001 | variables are reset to 0. |
4187 | 2003 | */ | 2002 | */ |
4189 | 2004 | // Time when the current thread connected to MySQL. | 2003 | /* Time when the current thread connected to MySQL. */ |
4190 | 2005 | time_t current_connect_time; | 2004 | time_t current_connect_time; |
4194 | 2006 | // Last time when THD stats were updated in global_user_stats. | 2005 | /* Busy (non-idle) time for just one command. */ |
4192 | 2007 | time_t last_global_update_time; | ||
4193 | 2008 | // Busy (non-idle) time for just one command. | ||
4195 | 2009 | double busy_time; | 2006 | double busy_time; |
4199 | 2010 | // Busy time not updated in global_user_stats yet. | 2007 | /* Cpu (non-idle) time for just one thread. */ |
4197 | 2011 | double diff_total_busy_time; | ||
4198 | 2012 | // Cpu (non-idle) time for just one thread. | ||
4200 | 2013 | double cpu_time; | 2008 | double cpu_time; |
4201 | 2014 | // Cpu time not updated in global_user_stats yet. | ||
4202 | 2015 | double diff_total_cpu_time; | ||
4203 | 2016 | /* bytes counting */ | 2009 | /* bytes counting */ |
4204 | 2017 | ulonglong bytes_received; | 2010 | ulonglong bytes_received; |
4205 | 2018 | ulonglong diff_total_bytes_received; | ||
4206 | 2019 | ulonglong bytes_sent; | 2011 | ulonglong bytes_sent; |
4207 | 2020 | ulonglong diff_total_bytes_sent; | ||
4208 | 2021 | ulonglong binlog_bytes_written; | 2012 | ulonglong binlog_bytes_written; |
4226 | 2022 | ulonglong diff_total_binlog_bytes_written; | 2013 | |
4227 | 2023 | 2014 | STATS diff_stats; | |
4228 | 2024 | // Number of rows not reflected in global_user_stats yet. | 2015 | |
4229 | 2025 | ha_rows diff_total_sent_rows, diff_total_updated_rows, diff_total_read_rows; | 2016 | /* |
4230 | 2026 | // Number of commands not reflected in global_user_stats yet. | 2017 | Per account query delay in miliseconds. When not 0, sleep this number of |
4231 | 2027 | ulonglong diff_select_commands, diff_update_commands, diff_other_commands; | 2018 | milliseconds before every SQL command. |
4232 | 2028 | // Number of transactions not reflected in global_user_stats yet. | 2019 | */ |
4216 | 2029 | ulonglong diff_commit_trans, diff_rollback_trans; | ||
4217 | 2030 | // Number of connection errors not reflected in global_user_stats yet. | ||
4218 | 2031 | ulonglong diff_denied_connections, diff_lost_connections; | ||
4219 | 2032 | // Number of db access denied, not reflected in global_user_stats yet. | ||
4220 | 2033 | ulonglong diff_access_denied_errors; | ||
4221 | 2034 | // Number of queries that return 0 rows | ||
4222 | 2035 | ulonglong diff_empty_queries; | ||
4223 | 2036 | |||
4224 | 2037 | // Per account query delay in miliseconds. When not 0, sleep this number of | ||
4225 | 2038 | // milliseconds before every SQL command. | ||
4233 | 2039 | ulonglong query_delay_millis; | 2020 | ulonglong query_delay_millis; |
4234 | 2040 | 2021 | ||
4235 | 2041 | /* Used by the sys_var class to store temporary values */ | 2022 | /* Used by the sys_var class to store temporary values */ |
4236 | @@ -2105,8 +2086,10 @@ | |||
4237 | 2105 | void init_for_queries(); | 2086 | void init_for_queries(); |
4238 | 2106 | void reset_stats(void); | 2087 | void reset_stats(void); |
4239 | 2107 | void reset_diff_stats(void); | 2088 | void reset_diff_stats(void); |
4242 | 2108 | // ran_command is true when this is called immediately after a | 2089 | /* |
4243 | 2109 | // command has been run. | 2090 | ran_command is true when this is called immediately after a |
4244 | 2091 | command has been run. | ||
4245 | 2092 | */ | ||
4246 | 2110 | void update_stats(bool ran_command); | 2093 | void update_stats(bool ran_command); |
4247 | 2111 | void change_user(void); | 2094 | void change_user(void); |
4248 | 2112 | void cleanup(void); | 2095 | void cleanup(void); |
4249 | @@ -2477,13 +2460,15 @@ | |||
4250 | 2477 | *p_db= strmake(db, db_length); | 2460 | *p_db= strmake(db, db_length); |
4251 | 2478 | *p_db_length= db_length; | 2461 | *p_db_length= db_length; |
4252 | 2479 | return FALSE; | 2462 | return FALSE; |
4253 | 2480 | |||
4254 | 2481 | // Returns string as 'IP:port' for the client-side of the connnection represented | ||
4255 | 2482 | // by 'client' as displayed by SHOW PROCESSLIST. Allocates memory from the heap of | ||
4256 | 2483 | // this THD and that is not reclaimed immediately, so use sparingly. May return NULL. | ||
4257 | 2484 | } | 2463 | } |
4258 | 2485 | thd_scheduler scheduler; | 2464 | thd_scheduler scheduler; |
4259 | 2486 | 2465 | ||
4260 | 2466 | /* | ||
4261 | 2467 | Returns string as 'IP:port' for the client-side of the connnection | ||
4262 | 2468 | represented by 'client' as displayed by SHOW PROCESSLIST. | ||
4263 | 2469 | Allocates memory from the heap of this THD and that is not reclaimed | ||
4264 | 2470 | immediately, so use sparingly. May return NULL. | ||
4265 | 2471 | */ | ||
4266 | 2487 | char *get_client_host_port(THD *client); | 2472 | char *get_client_host_port(THD *client); |
4267 | 2488 | 2473 | ||
4268 | 2489 | public: | 2474 | public: |
4269 | 2490 | 2475 | ||
4270 | === modified file 'Percona-Server/sql/sql_connect.cc' | |||
4271 | --- Percona-Server/sql/sql_connect.cc 2011-11-24 01:59:48 +0000 | |||
4272 | +++ Percona-Server/sql/sql_connect.cc 2012-02-02 06:11:26 +0000 | |||
4273 | @@ -20,6 +20,7 @@ | |||
4274 | 20 | */ | 20 | */ |
4275 | 21 | 21 | ||
4276 | 22 | #include "mysql_priv.h" | 22 | #include "mysql_priv.h" |
4277 | 23 | #include "debug_sync.h" | ||
4278 | 23 | 24 | ||
4279 | 24 | /** Size of the header fields of an authentication packet. */ | 25 | /** Size of the header fields of an authentication packet. */ |
4280 | 25 | #define AUTH_PACKET_HEADER_SIZE_PROTO_41 32 | 26 | #define AUTH_PACKET_HEADER_SIZE_PROTO_41 32 |
4281 | @@ -30,24 +31,26 @@ | |||
4282 | 30 | extern void win_install_sigabrt_handler(); | 31 | extern void win_install_sigabrt_handler(); |
4283 | 31 | #endif | 32 | #endif |
4284 | 32 | 33 | ||
4292 | 33 | // Increments connection count for user. | 34 | /* Increments connection count for user. */ |
4293 | 34 | static int increment_connection_count(THD* thd, bool use_lock); | 35 | /*static int increment_connection_count(THD* thd, bool use_lock);*/ |
4294 | 35 | 36 | ||
4295 | 36 | // Uses the THD to update the global stats by user name and client IP | 37 | /* Uses the THD to update the global stats by user name and client hostname */ |
4296 | 37 | void update_global_user_stats(THD* thd, bool create_user, time_t now); | 38 | /*void update_global_stats(THD* thd, bool create_user, time_t now);*/ |
4297 | 38 | 39 | ||
4298 | 39 | HASH global_user_stats; | 40 | /* Set stats for concurrent connections displayed by mysqld_show(). */ |
4299 | 41 | /*void set_connections_stats();*/ | ||
4300 | 42 | |||
4301 | 40 | HASH global_client_stats; | 43 | HASH global_client_stats; |
4302 | 44 | HASH global_index_stats; | ||
4303 | 45 | HASH global_table_stats; | ||
4304 | 41 | HASH global_thread_stats; | 46 | HASH global_thread_stats; |
4306 | 42 | // Protects global_user_stats and global_client_stats | 47 | HASH global_user_stats; |
4307 | 48 | |||
4308 | 49 | /* Protects global_user_stats and global_client_stats */ | ||
4309 | 43 | extern pthread_mutex_t LOCK_global_user_client_stats; | 50 | extern pthread_mutex_t LOCK_global_user_client_stats; |
4312 | 44 | 51 | extern pthread_mutex_t LOCK_global_index_stats; | |
4311 | 45 | HASH global_table_stats; | ||
4313 | 46 | extern pthread_mutex_t LOCK_global_table_stats; | 52 | extern pthread_mutex_t LOCK_global_table_stats; |
4314 | 47 | 53 | ||
4315 | 48 | HASH global_index_stats; | ||
4316 | 49 | extern pthread_mutex_t LOCK_global_index_stats; | ||
4317 | 50 | |||
4318 | 51 | /* | 54 | /* |
4319 | 52 | Get structure for logging connection data for the current user | 55 | Get structure for logging connection data for the current user |
4320 | 53 | */ | 56 | */ |
4321 | @@ -59,6 +62,7 @@ | |||
4322 | 59 | const char *host, | 62 | const char *host, |
4323 | 60 | USER_RESOURCES *mqh) | 63 | USER_RESOURCES *mqh) |
4324 | 61 | { | 64 | { |
4325 | 65 | DBUG_ENTER("get_or_create_user_conn"); | ||
4326 | 62 | int return_val= 0; | 66 | int return_val= 0; |
4327 | 63 | size_t temp_len, user_len; | 67 | size_t temp_len, user_len; |
4328 | 64 | char temp_user[USER_HOST_BUFF_SIZE]; | 68 | char temp_user[USER_HOST_BUFF_SIZE]; |
4329 | @@ -70,8 +74,8 @@ | |||
4330 | 70 | user_len= strlen(user); | 74 | user_len= strlen(user); |
4331 | 71 | temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1; | 75 | temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1; |
4332 | 72 | (void) pthread_mutex_lock(&LOCK_user_conn); | 76 | (void) pthread_mutex_lock(&LOCK_user_conn); |
4335 | 73 | if (!(uc = (struct user_conn *) hash_search(&hash_user_connections, | 77 | if (!(uc= (struct user_conn *) hash_search(&hash_user_connections, |
4336 | 74 | (uchar*) temp_user, temp_len))) | 78 | (uchar*) temp_user, temp_len))) |
4337 | 75 | { | 79 | { |
4338 | 76 | /* First connection for user; Create a user connection object */ | 80 | /* First connection for user; Create a user connection object */ |
4339 | 77 | if (!(uc= ((struct user_conn*) | 81 | if (!(uc= ((struct user_conn*) |
4340 | @@ -101,567 +105,504 @@ | |||
4341 | 101 | uc->connections++; | 105 | uc->connections++; |
4342 | 102 | end: | 106 | end: |
4343 | 103 | (void) pthread_mutex_unlock(&LOCK_user_conn); | 107 | (void) pthread_mutex_unlock(&LOCK_user_conn); |
4361 | 104 | return return_val; | 108 | DBUG_RETURN(return_val); |
4362 | 105 | 109 | ||
4363 | 106 | } | 110 | } |
4364 | 107 | 111 | ||
4365 | 108 | extern "C" uchar *get_key_user_stats(USER_STATS *user_stats, size_t *length, | 112 | extern "C" uchar *get_key_index_stats(INDEX_STATS* index_stats, |
4366 | 109 | my_bool not_used __attribute__((unused))) | 113 | size_t* length, |
4367 | 110 | { | 114 | my_bool not_used __attribute__((unused))) |
4368 | 111 | *length = strlen(user_stats->user); | 115 | { |
4369 | 112 | return (uchar*)user_stats->user; | 116 | DBUG_ENTER("get_key_index_stats"); |
4370 | 113 | } | 117 | *length= strlen(index_stats->index); |
4371 | 114 | 118 | DBUG_RETURN((uchar*)index_stats->index); | |
4372 | 115 | extern "C" uchar *get_key_thread_stats(THREAD_STATS *thread_stats, size_t *length, | 119 | } |
4373 | 116 | my_bool not_used __attribute__((unused))) | 120 | |
4374 | 117 | { | 121 | |
4375 | 118 | *length = sizeof(my_thread_id); | 122 | extern "C" uchar *get_key_table_stats(TABLE_STATS* table_stats, |
4376 | 119 | return (uchar*)&(thread_stats->id); | 123 | size_t* length, |
4377 | 120 | } | 124 | my_bool not_used __attribute__((unused))) |
4378 | 125 | { | ||
4379 | 126 | DBUG_ENTER("get_key_table_stats"); | ||
4380 | 127 | *length= strlen(table_stats->table); | ||
4381 | 128 | DBUG_RETURN((uchar*)table_stats->table); | ||
4382 | 129 | } | ||
4383 | 130 | |||
4384 | 131 | |||
4385 | 132 | extern "C" uchar *get_key_thread_stats(THREAD_STATS* thread_stats, | ||
4386 | 133 | size_t* length, | ||
4387 | 134 | my_bool not_used __attribute__((unused))) | ||
4388 | 135 | { | ||
4389 | 136 | DBUG_ENTER("get_key_thread_stats"); | ||
4390 | 137 | *length= sizeof(my_thread_id); | ||
4391 | 138 | DBUG_RETURN((uchar*)&(thread_stats->id)); | ||
4392 | 139 | } | ||
4393 | 140 | |||
4394 | 141 | |||
4395 | 142 | extern "C" uchar *get_key_user_stats(USER_STATS* user_stats, | ||
4396 | 143 | size_t* length, | ||
4397 | 144 | my_bool not_used __attribute__((unused))) | ||
4398 | 145 | { | ||
4399 | 146 | DBUG_ENTER("get_key_user_stats"); | ||
4400 | 147 | *length= strlen(user_stats->user); | ||
4401 | 148 | DBUG_RETURN((uchar*)user_stats->user); | ||
4402 | 149 | } | ||
4403 | 150 | |||
4404 | 151 | |||
4405 | 152 | extern "C" void free_index_stats(INDEX_STATS* index_stats) | ||
4406 | 153 | { | ||
4407 | 154 | my_free((char*)index_stats, MYF(0)); | ||
4408 | 155 | } | ||
4409 | 156 | |||
4410 | 157 | |||
4411 | 158 | extern "C" void free_table_stats(TABLE_STATS* table_stats) | ||
4412 | 159 | { | ||
4413 | 160 | my_free((char*)table_stats, MYF(0)); | ||
4414 | 161 | } | ||
4415 | 162 | |||
4416 | 163 | |||
4417 | 164 | void free_thread_stats(THREAD_STATS* thread_stats) | ||
4418 | 165 | { | ||
4419 | 166 | my_free((char*)thread_stats, MYF(0)); | ||
4420 | 167 | } | ||
4421 | 168 | |||
4422 | 121 | 169 | ||
4423 | 122 | void free_user_stats(USER_STATS* user_stats) | 170 | void free_user_stats(USER_STATS* user_stats) |
4424 | 123 | { | 171 | { |
4425 | 124 | my_free((char*)user_stats, MYF(0)); | 172 | my_free((char*)user_stats, MYF(0)); |
4426 | 125 | } | 173 | } |
4427 | 126 | 174 | ||
4461 | 127 | void free_thread_stats(THREAD_STATS* thread_stats) | 175 | void free_global_client_stats(void) |
4462 | 128 | { | 176 | { |
4463 | 129 | my_free((char*)thread_stats, MYF(0)); | 177 | hash_free(&global_client_stats); |
4464 | 130 | } | 178 | } |
4465 | 131 | 179 | ||
4466 | 132 | void init_user_stats(USER_STATS *user_stats, | 180 | |
4467 | 133 | const char *user, | 181 | void free_global_index_stats(void) |
4468 | 134 | const char *priv_user, | 182 | { |
4469 | 135 | uint total_connections, | 183 | hash_free(&global_index_stats); |
4470 | 136 | uint concurrent_connections, | 184 | } |
4471 | 137 | time_t connected_time, | 185 | |
4472 | 138 | double busy_time, | 186 | |
4473 | 139 | double cpu_time, | 187 | void free_global_table_stats(void) |
4474 | 140 | ulonglong bytes_received, | 188 | { |
4475 | 141 | ulonglong bytes_sent, | 189 | hash_free(&global_table_stats); |
4476 | 142 | ulonglong binlog_bytes_written, | 190 | } |
4477 | 143 | ha_rows rows_fetched, | 191 | |
4478 | 144 | ha_rows rows_updated, | 192 | |
4479 | 145 | ha_rows rows_read, | 193 | void free_global_thread_stats(void) |
4480 | 146 | ulonglong select_commands, | 194 | { |
4481 | 147 | ulonglong update_commands, | 195 | hash_free(&global_thread_stats); |
4482 | 148 | ulonglong other_commands, | 196 | } |
4483 | 149 | ulonglong commit_trans, | 197 | |
4484 | 150 | ulonglong rollback_trans, | 198 | |
4485 | 151 | ulonglong denied_connections, | 199 | void free_global_user_stats(void) |
4486 | 152 | ulonglong lost_connections, | 200 | { |
4487 | 153 | ulonglong access_denied_errors, | 201 | hash_free(&global_user_stats); |
4488 | 154 | ulonglong empty_queries) | 202 | } |
4489 | 155 | { | 203 | |
4490 | 156 | DBUG_ENTER("init_user_stats"); | 204 | |
4491 | 157 | DBUG_PRINT("info", | 205 | void init_stats(STATS* stats) |
4492 | 158 | ("Add user_stats entry for user %s - priv_user %s", | 206 | { |
4493 | 159 | user, priv_user)); | 207 | memset(stats, 0, sizeof(stats)); |
4494 | 208 | } | ||
4495 | 209 | |||
4496 | 210 | |||
4497 | 211 | void init_thread_stats(THREAD_STATS* thread_stats, my_thread_id id) | ||
4498 | 212 | { | ||
4499 | 213 | thread_stats->id= id; | ||
4500 | 214 | init_stats(&thread_stats->stats); | ||
4501 | 215 | } | ||
4502 | 216 | |||
4503 | 217 | |||
4504 | 218 | void init_user_stats(USER_STATS *user_stats, const char *user) | ||
4505 | 219 | { | ||
4506 | 160 | strncpy(user_stats->user, user, sizeof(user_stats->user)); | 220 | strncpy(user_stats->user, user, sizeof(user_stats->user)); |
4681 | 161 | strncpy(user_stats->priv_user, priv_user, sizeof(user_stats->priv_user)); | 221 | init_stats(&user_stats->stats); |
4682 | 162 | 222 | } | |
4683 | 163 | user_stats->total_connections = total_connections; | 223 | |
4510 | 164 | user_stats->concurrent_connections = concurrent_connections; | ||
4511 | 165 | user_stats->connected_time = connected_time; | ||
4512 | 166 | user_stats->busy_time = busy_time; | ||
4513 | 167 | user_stats->cpu_time = cpu_time; | ||
4514 | 168 | user_stats->bytes_received = bytes_received; | ||
4515 | 169 | user_stats->bytes_sent = bytes_sent; | ||
4516 | 170 | user_stats->binlog_bytes_written = binlog_bytes_written; | ||
4517 | 171 | user_stats->rows_fetched = rows_fetched; | ||
4518 | 172 | user_stats->rows_updated = rows_updated; | ||
4519 | 173 | user_stats->rows_read = rows_read; | ||
4520 | 174 | user_stats->select_commands = select_commands; | ||
4521 | 175 | user_stats->update_commands = update_commands; | ||
4522 | 176 | user_stats->other_commands = other_commands; | ||
4523 | 177 | user_stats->commit_trans = commit_trans; | ||
4524 | 178 | user_stats->rollback_trans = rollback_trans; | ||
4525 | 179 | user_stats->denied_connections = denied_connections; | ||
4526 | 180 | user_stats->lost_connections = lost_connections; | ||
4527 | 181 | user_stats->access_denied_errors = access_denied_errors; | ||
4528 | 182 | user_stats->empty_queries = empty_queries; | ||
4529 | 183 | DBUG_VOID_RETURN; | ||
4530 | 184 | } | ||
4531 | 185 | |||
4532 | 186 | void init_thread_stats(THREAD_STATS *thread_stats, | ||
4533 | 187 | my_thread_id id, | ||
4534 | 188 | uint total_connections, | ||
4535 | 189 | uint concurrent_connections, | ||
4536 | 190 | time_t connected_time, | ||
4537 | 191 | double busy_time, | ||
4538 | 192 | double cpu_time, | ||
4539 | 193 | ulonglong bytes_received, | ||
4540 | 194 | ulonglong bytes_sent, | ||
4541 | 195 | ulonglong binlog_bytes_written, | ||
4542 | 196 | ha_rows rows_fetched, | ||
4543 | 197 | ha_rows rows_updated, | ||
4544 | 198 | ha_rows rows_read, | ||
4545 | 199 | ulonglong select_commands, | ||
4546 | 200 | ulonglong update_commands, | ||
4547 | 201 | ulonglong other_commands, | ||
4548 | 202 | ulonglong commit_trans, | ||
4549 | 203 | ulonglong rollback_trans, | ||
4550 | 204 | ulonglong denied_connections, | ||
4551 | 205 | ulonglong lost_connections, | ||
4552 | 206 | ulonglong access_denied_errors, | ||
4553 | 207 | ulonglong empty_queries) | ||
4554 | 208 | { | ||
4555 | 209 | DBUG_ENTER("init_thread_stats"); | ||
4556 | 210 | DBUG_PRINT("info", | ||
4557 | 211 | ("Add thread_stats entry for thread %lu", | ||
4558 | 212 | id)); | ||
4559 | 213 | thread_stats->id = id; | ||
4560 | 214 | |||
4561 | 215 | thread_stats->total_connections = total_connections; | ||
4562 | 216 | thread_stats->concurrent_connections = concurrent_connections; | ||
4563 | 217 | thread_stats->connected_time = connected_time; | ||
4564 | 218 | thread_stats->busy_time = busy_time; | ||
4565 | 219 | thread_stats->cpu_time = cpu_time; | ||
4566 | 220 | thread_stats->bytes_received = bytes_received; | ||
4567 | 221 | thread_stats->bytes_sent = bytes_sent; | ||
4568 | 222 | thread_stats->binlog_bytes_written = binlog_bytes_written; | ||
4569 | 223 | thread_stats->rows_fetched = rows_fetched; | ||
4570 | 224 | thread_stats->rows_updated = rows_updated; | ||
4571 | 225 | thread_stats->rows_read = rows_read; | ||
4572 | 226 | thread_stats->select_commands = select_commands; | ||
4573 | 227 | thread_stats->update_commands = update_commands; | ||
4574 | 228 | thread_stats->other_commands = other_commands; | ||
4575 | 229 | thread_stats->commit_trans = commit_trans; | ||
4576 | 230 | thread_stats->rollback_trans = rollback_trans; | ||
4577 | 231 | thread_stats->denied_connections = denied_connections; | ||
4578 | 232 | thread_stats->lost_connections = lost_connections; | ||
4579 | 233 | thread_stats->access_denied_errors = access_denied_errors; | ||
4580 | 234 | thread_stats->empty_queries = empty_queries; | ||
4581 | 235 | DBUG_VOID_RETURN; | ||
4582 | 236 | } | ||
4583 | 237 | |||
4584 | 238 | void add_user_stats(USER_STATS *user_stats, | ||
4585 | 239 | uint total_connections, | ||
4586 | 240 | uint concurrent_connections, | ||
4587 | 241 | time_t connected_time, | ||
4588 | 242 | double busy_time, | ||
4589 | 243 | double cpu_time, | ||
4590 | 244 | ulonglong bytes_received, | ||
4591 | 245 | ulonglong bytes_sent, | ||
4592 | 246 | ulonglong binlog_bytes_written, | ||
4593 | 247 | ha_rows rows_fetched, | ||
4594 | 248 | ha_rows rows_updated, | ||
4595 | 249 | ha_rows rows_read, | ||
4596 | 250 | ulonglong select_commands, | ||
4597 | 251 | ulonglong update_commands, | ||
4598 | 252 | ulonglong other_commands, | ||
4599 | 253 | ulonglong commit_trans, | ||
4600 | 254 | ulonglong rollback_trans, | ||
4601 | 255 | ulonglong denied_connections, | ||
4602 | 256 | ulonglong lost_connections, | ||
4603 | 257 | ulonglong access_denied_errors, | ||
4604 | 258 | ulonglong empty_queries) | ||
4605 | 259 | { | ||
4606 | 260 | user_stats->total_connections += total_connections; | ||
4607 | 261 | user_stats->concurrent_connections += concurrent_connections; | ||
4608 | 262 | user_stats->connected_time += connected_time; | ||
4609 | 263 | user_stats->busy_time += busy_time; | ||
4610 | 264 | user_stats->cpu_time += cpu_time; | ||
4611 | 265 | user_stats->bytes_received += bytes_received; | ||
4612 | 266 | user_stats->bytes_sent += bytes_sent; | ||
4613 | 267 | user_stats->binlog_bytes_written += binlog_bytes_written; | ||
4614 | 268 | user_stats->rows_fetched += rows_fetched; | ||
4615 | 269 | user_stats->rows_updated += rows_updated; | ||
4616 | 270 | user_stats->rows_read += rows_read; | ||
4617 | 271 | user_stats->select_commands += select_commands; | ||
4618 | 272 | user_stats->update_commands += update_commands; | ||
4619 | 273 | user_stats->other_commands += other_commands; | ||
4620 | 274 | user_stats->commit_trans += commit_trans; | ||
4621 | 275 | user_stats->rollback_trans += rollback_trans; | ||
4622 | 276 | user_stats->denied_connections += denied_connections; | ||
4623 | 277 | user_stats->lost_connections += lost_connections; | ||
4624 | 278 | user_stats->access_denied_errors += access_denied_errors; | ||
4625 | 279 | user_stats->empty_queries += empty_queries; | ||
4626 | 280 | } | ||
4627 | 281 | |||
4628 | 282 | void add_thread_stats(THREAD_STATS *thread_stats, | ||
4629 | 283 | uint total_connections, | ||
4630 | 284 | uint concurrent_connections, | ||
4631 | 285 | time_t connected_time, | ||
4632 | 286 | double busy_time, | ||
4633 | 287 | double cpu_time, | ||
4634 | 288 | ulonglong bytes_received, | ||
4635 | 289 | ulonglong bytes_sent, | ||
4636 | 290 | ulonglong binlog_bytes_written, | ||
4637 | 291 | ha_rows rows_fetched, | ||
4638 | 292 | ha_rows rows_updated, | ||
4639 | 293 | ha_rows rows_read, | ||
4640 | 294 | ulonglong select_commands, | ||
4641 | 295 | ulonglong update_commands, | ||
4642 | 296 | ulonglong other_commands, | ||
4643 | 297 | ulonglong commit_trans, | ||
4644 | 298 | ulonglong rollback_trans, | ||
4645 | 299 | ulonglong denied_connections, | ||
4646 | 300 | ulonglong lost_connections, | ||
4647 | 301 | ulonglong access_denied_errors, | ||
4648 | 302 | ulonglong empty_queries) | ||
4649 | 303 | { | ||
4650 | 304 | thread_stats->total_connections += total_connections; | ||
4651 | 305 | thread_stats->concurrent_connections += concurrent_connections; | ||
4652 | 306 | thread_stats->connected_time += connected_time; | ||
4653 | 307 | thread_stats->busy_time += busy_time; | ||
4654 | 308 | thread_stats->cpu_time += cpu_time; | ||
4655 | 309 | thread_stats->bytes_received += bytes_received; | ||
4656 | 310 | thread_stats->bytes_sent += bytes_sent; | ||
4657 | 311 | thread_stats->binlog_bytes_written += binlog_bytes_written; | ||
4658 | 312 | thread_stats->rows_fetched += rows_fetched; | ||
4659 | 313 | thread_stats->rows_updated += rows_updated; | ||
4660 | 314 | thread_stats->rows_read += rows_read; | ||
4661 | 315 | thread_stats->select_commands += select_commands; | ||
4662 | 316 | thread_stats->update_commands += update_commands; | ||
4663 | 317 | thread_stats->other_commands += other_commands; | ||
4664 | 318 | thread_stats->commit_trans += commit_trans; | ||
4665 | 319 | thread_stats->rollback_trans += rollback_trans; | ||
4666 | 320 | thread_stats->denied_connections += denied_connections; | ||
4667 | 321 | thread_stats->lost_connections += lost_connections; | ||
4668 | 322 | thread_stats->access_denied_errors += access_denied_errors; | ||
4669 | 323 | thread_stats->empty_queries += empty_queries; | ||
4670 | 324 | } | ||
4671 | 325 | |||
4672 | 326 | void init_global_user_stats(void) | ||
4673 | 327 | { | ||
4674 | 328 | if (hash_init(&global_user_stats, system_charset_info, max_connections, | ||
4675 | 329 | 0, 0, (hash_get_key)get_key_user_stats, | ||
4676 | 330 | (hash_free_key)free_user_stats, 0)) { | ||
4677 | 331 | sql_print_error("Initializing global_user_stats failed."); | ||
4678 | 332 | exit(1); | ||
4679 | 333 | } | ||
4680 | 334 | } | ||
4684 | 335 | 224 | ||
4685 | 336 | void init_global_client_stats(void) | 225 | void init_global_client_stats(void) |
4686 | 337 | { | 226 | { |
4687 | 227 | DBUG_ENTER("init_global_client_stats"); | ||
4688 | 338 | if (hash_init(&global_client_stats, system_charset_info, max_connections, | 228 | if (hash_init(&global_client_stats, system_charset_info, max_connections, |
4689 | 339 | 0, 0, (hash_get_key)get_key_user_stats, | 229 | 0, 0, (hash_get_key)get_key_user_stats, |
4717 | 340 | (hash_free_key)free_user_stats, 0)) { | 230 | (hash_free_key)free_user_stats, 0)) |
4718 | 341 | sql_print_error("Initializing global_client_stats failed."); | 231 | { |
4719 | 342 | exit(1); | 232 | sql_print_error("Initializing global_client_stats failed."); |
4720 | 343 | } | 233 | exit(1); |
4721 | 344 | } | 234 | } |
4722 | 345 | 235 | DBUG_VOID_RETURN; | |
4723 | 346 | void init_global_thread_stats(void) | 236 | } |
4724 | 347 | { | 237 | |
4725 | 348 | if (hash_init(&global_thread_stats, &my_charset_bin, max_connections, | 238 | |
4726 | 349 | 0, 0, (hash_get_key)get_key_thread_stats, | 239 | void init_global_index_stats(void) |
4727 | 350 | (hash_free_key)free_thread_stats, 0)) { | 240 | { |
4728 | 351 | sql_print_error("Initializing global_client_stats failed."); | 241 | if (hash_init(&global_index_stats, system_charset_info, max_connections, |
4729 | 352 | exit(1); | 242 | 0, 0, (hash_get_key)get_key_index_stats, |
4730 | 353 | } | 243 | (hash_free_key)free_index_stats, 0)) |
4731 | 354 | } | 244 | { |
4732 | 355 | 245 | sql_print_error("Initializing global_index_stats failed."); | |
4733 | 356 | extern "C" uchar *get_key_table_stats(TABLE_STATS *table_stats, size_t *length, | 246 | exit(1); |
4734 | 357 | my_bool not_used __attribute__((unused))) | 247 | } |
4735 | 358 | { | 248 | } |
4736 | 359 | *length = strlen(table_stats->table); | 249 | |
4710 | 360 | return (uchar*)table_stats->table; | ||
4711 | 361 | } | ||
4712 | 362 | |||
4713 | 363 | extern "C" void free_table_stats(TABLE_STATS* table_stats) | ||
4714 | 364 | { | ||
4715 | 365 | my_free((char*)table_stats, MYF(0)); | ||
4716 | 366 | } | ||
4737 | 367 | 250 | ||
4738 | 368 | void init_global_table_stats(void) | 251 | void init_global_table_stats(void) |
4739 | 369 | { | 252 | { |
4740 | 253 | DBUG_ENTER("init_global_table_stats"); | ||
4741 | 370 | if (hash_init(&global_table_stats, system_charset_info, max_connections, | 254 | if (hash_init(&global_table_stats, system_charset_info, max_connections, |
4742 | 371 | 0, 0, (hash_get_key)get_key_table_stats, | 255 | 0, 0, (hash_get_key)get_key_table_stats, |
4744 | 372 | (hash_free_key)free_table_stats, 0)) { | 256 | (hash_free_key)free_table_stats, 0)) |
4745 | 257 | { | ||
4746 | 373 | sql_print_error("Initializing global_table_stats failed."); | 258 | sql_print_error("Initializing global_table_stats failed."); |
4747 | 374 | exit(1); | 259 | exit(1); |
4748 | 375 | } | 260 | } |
4803 | 376 | } | 261 | DBUG_VOID_RETURN; |
4804 | 377 | 262 | } | |
4805 | 378 | extern "C" uchar *get_key_index_stats(INDEX_STATS *index_stats, size_t *length, | 263 | |
4806 | 379 | my_bool not_used __attribute__((unused))) | 264 | |
4807 | 380 | { | 265 | void init_global_thread_stats(void) |
4808 | 381 | *length = strlen(index_stats->index); | 266 | { |
4809 | 382 | return (uchar*)index_stats->index; | 267 | DBUG_ENTER("init_global_thread_stats"); |
4810 | 383 | } | 268 | if (hash_init(&global_thread_stats, &my_charset_bin, max_connections, |
4811 | 384 | 269 | 0, 0, (hash_get_key)get_key_thread_stats, | |
4812 | 385 | extern "C" void free_index_stats(INDEX_STATS* index_stats) | 270 | (hash_free_key)free_thread_stats, 0)) |
4813 | 386 | { | 271 | { |
4814 | 387 | my_free((char*)index_stats, MYF(0)); | 272 | sql_print_error("Initializing global_thread_stats failed."); |
4815 | 388 | } | 273 | exit(1); |
4816 | 389 | 274 | } | |
4817 | 390 | void init_global_index_stats(void) | 275 | DBUG_VOID_RETURN; |
4818 | 391 | { | 276 | } |
4819 | 392 | if (hash_init(&global_index_stats, system_charset_info, max_connections, | 277 | |
4820 | 393 | 0, 0, (hash_get_key)get_key_index_stats, | 278 | |
4821 | 394 | (hash_free_key)free_index_stats, 0)) { | 279 | void init_global_user_stats(void) |
4822 | 395 | sql_print_error("Initializing global_index_stats failed."); | 280 | { |
4823 | 396 | exit(1); | 281 | DBUG_ENTER("init_global_user_stats"); |
4824 | 397 | } | 282 | if (hash_init(&global_user_stats, system_charset_info, max_connections, |
4825 | 398 | } | 283 | 0, 0, (hash_get_key)get_key_user_stats, |
4826 | 399 | 284 | (hash_free_key)free_user_stats, 0)) | |
4827 | 400 | void free_global_user_stats(void) | 285 | { |
4828 | 401 | { | 286 | sql_print_error("Initializing global_user_stats failed."); |
4829 | 402 | hash_free(&global_user_stats); | 287 | exit(1); |
4830 | 403 | } | 288 | } |
4831 | 404 | 289 | DBUG_VOID_RETURN; | |
4832 | 405 | void free_global_thread_stats(void) | 290 | } |
4833 | 406 | { | 291 | |
4834 | 407 | hash_free(&global_thread_stats); | 292 | |
4835 | 408 | } | 293 | /* 'mysql_system_user' is used for when the user is not defined for a THD. */ |
4836 | 409 | 294 | static char mysql_system_user[]= "#mysql_system#"; | |
4837 | 410 | void free_global_table_stats(void) | 295 | |
4838 | 411 | { | 296 | /** |
4839 | 412 | hash_free(&global_table_stats); | 297 | Stringify the user name (system user too) |
4840 | 413 | } | 298 | |
4841 | 414 | 299 | @retval user if user is not NULL. | |
4842 | 415 | void free_global_index_stats(void) | 300 | @retval mysqld_system_user if user is NULL. |
4843 | 416 | { | 301 | */ |
4844 | 417 | hash_free(&global_index_stats); | 302 | static const char* get_valid_user_string(const char* user) |
4845 | 418 | } | 303 | { |
4792 | 419 | |||
4793 | 420 | void free_global_client_stats(void) | ||
4794 | 421 | { | ||
4795 | 422 | hash_free(&global_client_stats); | ||
4796 | 423 | } | ||
4797 | 424 | |||
4798 | 425 | // 'mysql_system_user' is used for when the user is not defined for a THD. | ||
4799 | 426 | static char mysql_system_user[] = "#mysql_system#"; | ||
4800 | 427 | |||
4801 | 428 | // Returns 'user' if it's not NULL. Returns 'mysql_system_user' otherwise. | ||
4802 | 429 | static char* get_valid_user_string(char* user) { | ||
4846 | 430 | return user ? user : mysql_system_user; | 304 | return user ? user : mysql_system_user; |
4847 | 431 | } | 305 | } |
4848 | 432 | 306 | ||
4854 | 433 | // Increments the global stats connection count for an entry from | 307 | /** |
4855 | 434 | // global_client_stats or global_user_stats. Returns 0 on success | 308 | Increments the global stats connection count for an entry from |
4856 | 435 | // and 1 on error. | 309 | global_client_stats or global_user_stats. |
4857 | 436 | static int increment_count_by_name(const char *name, const char *role_name, | 310 | |
4858 | 437 | HASH *users_or_clients, THD *thd) | 311 | @retval 0 on success. |
4859 | 312 | @retval 1 on error. | ||
4860 | 313 | */ | ||
4861 | 314 | static int increment_count_by_name(const char *name, | ||
4862 | 315 | HASH *collection, | ||
4863 | 316 | THD *thd) | ||
4864 | 438 | { | 317 | { |
4866 | 439 | USER_STATS* user_stats; | 318 | DBUG_ENTER("increment_count_by_name"); |
4867 | 319 | USER_STATS* stats; | ||
4868 | 440 | 320 | ||
4871 | 441 | if (!(user_stats = (USER_STATS*)hash_search(users_or_clients, (uchar*) name, | 321 | if (!(stats= (USER_STATS*)hash_search(collection, |
4872 | 442 | strlen(name)))) | 322 | (uchar*) name, |
4873 | 323 | strlen(name)))) | ||
4874 | 443 | { | 324 | { |
4878 | 444 | // First connection for this user or client | 325 | /* First connection for this user or client */ |
4879 | 445 | if (!(user_stats = ((USER_STATS*) | 326 | if (!(stats= ((USER_STATS*)my_malloc(sizeof(USER_STATS), |
4880 | 446 | my_malloc(sizeof(USER_STATS), MYF(MY_WME | MY_ZEROFILL))))) | 327 | MYF(MY_WME | MY_ZEROFILL))))) |
4881 | 447 | { | 328 | { |
4883 | 448 | return 1; // Out of memory | 329 | /* Out of memory */ |
4884 | 330 | DBUG_RETURN(1); | ||
4885 | 449 | } | 331 | } |
4886 | 450 | 332 | ||
4898 | 451 | init_user_stats(user_stats, name, role_name, | 333 | init_user_stats(stats, name); |
4899 | 452 | 0, 0, // connections | 334 | stats->stats.denied_connections= thd->diff_stats.denied_connections; |
4889 | 453 | 0, 0, 0, // time | ||
4890 | 454 | 0, 0, 0, // bytes sent, received and written | ||
4891 | 455 | 0, 0, 0, // rows fetched, updated and read | ||
4892 | 456 | 0, 0, 0, // select, update and other commands | ||
4893 | 457 | 0, 0, // commit and rollback trans | ||
4894 | 458 | thd->diff_denied_connections, | ||
4895 | 459 | 0, // lost connections | ||
4896 | 460 | 0, // access denied errors | ||
4897 | 461 | 0); // empty queries | ||
4900 | 462 | 335 | ||
4902 | 463 | if (my_hash_insert(users_or_clients, (uchar*)user_stats)) | 336 | if (my_hash_insert(collection, (uchar*)stats)) |
4903 | 464 | { | 337 | { |
4906 | 465 | my_free((char*)user_stats, 0); | 338 | my_free((char*)stats, 0); |
4907 | 466 | return 1; // Out of memory | 339 | /* Out of memory */ |
4908 | 340 | DBUG_RETURN(1); | ||
4909 | 467 | } | 341 | } |
4910 | 468 | } | 342 | } |
4913 | 469 | user_stats->total_connections++; | 343 | stats->stats.total_connections++; |
4914 | 470 | return 0; | 344 | DBUG_RETURN(0); |
4915 | 471 | } | 345 | } |
4916 | 472 | 346 | ||
4917 | 473 | static int increment_count_by_id(my_thread_id id, | 347 | static int increment_count_by_id(my_thread_id id, |
4919 | 474 | HASH *users_or_clients, THD *thd) | 348 | HASH *collection, |
4920 | 349 | THD *thd) | ||
4921 | 475 | { | 350 | { |
4923 | 476 | THREAD_STATS* thread_stats; | 351 | DBUG_ENTER("increment_count_by_id"); |
4924 | 352 | THREAD_STATS* stats; | ||
4925 | 477 | 353 | ||
4928 | 478 | if (!(thread_stats = (THREAD_STATS*)hash_search(users_or_clients, (uchar*) &id, | 354 | if (!(stats= (THREAD_STATS*)hash_search(collection, |
4929 | 479 | sizeof(my_thread_id)))) | 355 | (uchar*) &id, |
4930 | 356 | sizeof(my_thread_id)))) | ||
4931 | 480 | { | 357 | { |
4935 | 481 | // First connection for this user or client | 358 | /* First connection for this user or client */ |
4936 | 482 | if (!(thread_stats = ((THREAD_STATS*) | 359 | if (!(stats= ((THREAD_STATS*)my_malloc(sizeof(THREAD_STATS), |
4937 | 483 | my_malloc(sizeof(THREAD_STATS), MYF(MY_WME | MY_ZEROFILL))))) | 360 | MYF(MY_WME | MY_ZEROFILL))))) |
4938 | 484 | { | 361 | { |
4940 | 485 | return 1; // Out of memory | 362 | /* Out of memory */ |
4941 | 363 | DBUG_RETURN(1); | ||
4942 | 486 | } | 364 | } |
4943 | 487 | 365 | ||
4957 | 488 | init_thread_stats(thread_stats, id, | 366 | init_thread_stats(stats, id); |
4958 | 489 | 0, 0, // connections | 367 | stats->stats.denied_connections= thd->diff_stats.denied_connections; |
4959 | 490 | 0, 0, 0, // time | 368 | if (my_hash_insert(collection, (uchar*)stats)) |
4947 | 491 | 0, 0, 0, // bytes sent, received and written | ||
4948 | 492 | 0, 0, 0, // rows fetched, updated and read | ||
4949 | 493 | 0, 0, 0, // select, update and other commands | ||
4950 | 494 | 0, 0, // commit and rollback trans | ||
4951 | 495 | thd->diff_denied_connections, | ||
4952 | 496 | 0, // lost connections | ||
4953 | 497 | 0, // access denied errors | ||
4954 | 498 | 0); // empty queries | ||
4955 | 499 | |||
4956 | 500 | if (my_hash_insert(users_or_clients, (uchar*)thread_stats)) | ||
4960 | 501 | { | 369 | { |
4963 | 502 | my_free((char*)thread_stats, 0); | 370 | my_free((char*)stats, 0); |
4964 | 503 | return 1; // Out of memory | 371 | /* Out of memory */ |
4965 | 372 | DBUG_RETURN(1); | ||
4966 | 504 | } | 373 | } |
4967 | 505 | } | 374 | } |
4970 | 506 | thread_stats->total_connections++; | 375 | stats->stats.total_connections++; |
4971 | 507 | return 0; | 376 | DBUG_RETURN(0); |
4972 | 508 | } | 377 | } |
4973 | 509 | 378 | ||
4978 | 510 | // Increments the global user and client stats connection count. If 'use_lock' | 379 | /** |
4979 | 511 | // is true, LOCK_global_user_client_stats will be locked/unlocked. Returns | 380 | Increments the global client, thread and user stats connection count. |
4980 | 512 | // 0 on success, 1 on error. | 381 | |
4981 | 513 | static int increment_connection_count(THD* thd, bool use_lock) | 382 | @retval 0 on success. |
4982 | 383 | @retval 1 on error. | ||
4983 | 384 | */ | ||
4984 | 385 | static int increment_connection_count(THD* thd) | ||
4985 | 514 | { | 386 | { |
4989 | 515 | char* user_string = get_valid_user_string(thd->main_security_ctx.user); | 387 | DBUG_ENTER("increment_connection_count"); |
4990 | 516 | const char* client_string = get_client_host(thd); | 388 | const char* user_string= get_valid_user_string(thd->main_security_ctx.user); |
4991 | 517 | int return_value = 0; | 389 | const char* client_string= get_client_host(thd); |
4992 | 390 | int return_value= 0; | ||
4993 | 518 | 391 | ||
4994 | 519 | if (!opt_userstat_running) | 392 | if (!opt_userstat_running) |
4995 | 520 | return return_value; | ||
4996 | 521 | |||
4997 | 522 | if (use_lock) pthread_mutex_lock(&LOCK_global_user_client_stats); | ||
4998 | 523 | |||
4999 | 524 | if (increment_count_by_name(user_string, user_string, | ||
5000 | 525 | &global_user_stats, thd)) |
The Jenkins failures are too many to be confident, although none look
like they are directly related to userstat. Please get a cleaner
Jenkins run.
What is the exact source of the patches, tests, etc? I cannot find them by code.google. com/p/google- mysql-tools/ .
casually browsing http://
No need to replace "// foo" comments by "/* foo */"
I am unable to review the whole MP as-is. Maybe other reviews would
be able to, but I'd have doubts in their review quality :)
In order for me to be able to review it, there should be several
smaller MPs. One suggested split would be (might be not fully correct
due to technical details I don't know):
1) Port the Google tests that pass with the current PS code; show_stats. inc refactoring, 3.2)
2) userstats_bug602047 (incorrect behavior on --repeat run);
3) user_stats.test: 3.1) include/
Concurrency fixes (remove sleep, use end_connection debug signal) 3.3)
backup of mysql.user;
4) Code refactorings that do not change behaviour: 4.1) remove
sent_row_count_2, 4.2) remove LOCK_stats, 4.3) STATS struct
refactoring 4.4) etc...
5) Code fixes with associated tests split as necessary.
Yes, such split suggests many MPs, but I don't see any other way for
me to review it.