From: Marc Alff Date: December 1 2010 6:47pm Subject: bzr commit into mysql-trunk-bugfixing branch (marc.alff:3402) List-Archive: http://lists.mysql.com/commits/125695 Message-Id: <201012011847.oB1HaxmH013886@rcsinet13.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///Users/malff/BZR_TREE/mysql-trunk-bugfixing-merge/ based on revid:mikael@dator8-20101201124400-9xipggg3zbeer5i1 3402 Marc Alff 2010-12-01 [merge] Merge mysql-5.5-bugteam --> mysql-trunk-bugfixing added: mysql-test/suite/perfschema/r/dml_threads.result mysql-test/suite/perfschema/r/thread_cache.result mysql-test/suite/perfschema/t/dml_threads.test mysql-test/suite/perfschema/t/thread_cache.test modified: mysql-test/suite/perfschema/include/privilege.inc mysql-test/suite/perfschema/r/dml_cond_instances.result mysql-test/suite/perfschema/r/dml_ews_by_instance.result mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result mysql-test/suite/perfschema/r/dml_file_instances.result mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result mysql-test/suite/perfschema/r/dml_mutex_instances.result mysql-test/suite/perfschema/r/dml_rwlock_instances.result mysql-test/suite/perfschema/r/misc.result mysql-test/suite/perfschema/r/myisam_file_io.result mysql-test/suite/perfschema/r/privilege.result mysql-test/suite/perfschema/t/dml_cond_instances.test mysql-test/suite/perfschema/t/dml_ews_by_instance.test mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test mysql-test/suite/perfschema/t/dml_file_instances.test mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test mysql-test/suite/perfschema/t/dml_mutex_instances.test mysql-test/suite/perfschema/t/dml_rwlock_instances.test mysql-test/suite/perfschema/t/misc.test mysql-test/suite/perfschema/t/myisam_file_io.test storage/perfschema/ha_perfschema.cc storage/perfschema/ha_perfschema.h storage/perfschema/pfs_engine_table.cc storage/perfschema/table_setup_actors.cc storage/perfschema/table_setup_consumers.cc storage/perfschema/table_setup_instruments.cc storage/perfschema/table_setup_timers.cc storage/perfschema/table_threads.cc === modified file 'mysql-test/suite/perfschema/include/privilege.inc' --- a/mysql-test/suite/perfschema/include/privilege.inc 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/include/privilege.inc 2010-12-01 18:46:51 +0000 @@ -100,16 +100,16 @@ create trigger performance_schema.bi_fil before insert on performance_schema.file_instances for each row begin end; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1(a int) engine=PERFORMANCE_SCHEMA; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1 like performance_schema.setup_instruments; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1 like performance_schema.events_waits_current; ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1 like performance_schema.file_instances; --error ER_TABLEACCESS_DENIED_ERROR === modified file 'mysql-test/suite/perfschema/r/dml_cond_instances.result' --- a/mysql-test/suite/perfschema/r/dml_cond_instances.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_cond_instances.result 2010-12-01 18:46:51 +0000 @@ -1,9 +1,6 @@ select * from performance_schema.cond_instances limit 1; -NAME OBJECT_INSTANCE_BEGIN -# # select * from performance_schema.cond_instances where name='FOO'; -NAME OBJECT_INSTANCE_BEGIN insert into performance_schema.cond_instances set name='FOO', object_instance_begin=12; ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'cond_instances' === modified file 'mysql-test/suite/perfschema/r/dml_ews_by_instance.result' --- a/mysql-test/suite/perfschema/r/dml_ews_by_instance.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_ews_by_instance.result 2010-12-01 18:46:51 +0000 @@ -1,26 +1,15 @@ select * from performance_schema.events_waits_summary_by_instance where event_name like 'Wait/Synch/%' limit 1; -EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -# # # # # # # select * from performance_schema.events_waits_summary_by_instance where event_name='FOO'; -EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT select * from performance_schema.events_waits_summary_by_instance order by count_star limit 1; -EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -# # # # # # # select * from performance_schema.events_waits_summary_by_instance order by count_star desc limit 1; -EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -# # # # # # # select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star limit 1; -EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -# # # # # # # select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star desc limit 1; -EVENT_NAME OBJECT_INSTANCE_BEGIN COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -# # # # # # # insert into performance_schema.events_waits_summary_by_instance set event_name='FOO', object_instance_begin=0, count_star=1, sum_timer_wait=2, min_timer_wait=3, === modified file 'mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result' --- a/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result 2010-12-01 18:46:51 +0000 @@ -1,10 +1,7 @@ select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name like 'Wait/Synch/%' limit 1; -THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -# # # # # # # select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name='FOO'; -THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT insert into performance_schema.events_waits_summary_by_thread_by_event_name set event_name='FOO', thread_id=1, count_star=1, sum_timer_wait=2, min_timer_wait=3, === modified file 'mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result' --- a/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result 2010-12-01 18:46:51 +0000 @@ -1,10 +1,7 @@ select * from performance_schema.events_waits_summary_global_by_event_name where event_name like 'Wait/Synch/%' limit 1; -EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT -# # # # # # select * from performance_schema.events_waits_summary_global_by_event_name where event_name='FOO'; -EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT insert into performance_schema.events_waits_summary_global_by_event_name set event_name='FOO', count_star=1, sum_timer_wait=2, min_timer_wait=3, avg_timer_wait=4, max_timer_wait=5; === modified file 'mysql-test/suite/perfschema/r/dml_file_instances.result' --- a/mysql-test/suite/perfschema/r/dml_file_instances.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_file_instances.result 2010-12-01 18:46:51 +0000 @@ -1,9 +1,6 @@ select * from performance_schema.file_instances limit 1; -FILE_NAME EVENT_NAME OPEN_COUNT -# # # select * from performance_schema.file_instances where file_name='FOO'; -FILE_NAME EVENT_NAME OPEN_COUNT insert into performance_schema.file_instances set file_name='FOO', event_name='BAR', open_count=12; ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'file_instances' === modified file 'mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result' --- a/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result 2010-12-01 18:46:51 +0000 @@ -1,10 +1,7 @@ select * from performance_schema.file_summary_by_event_name where event_name like 'Wait/io/%' limit 1; -EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE -# # # # # select * from performance_schema.file_summary_by_event_name where event_name='FOO'; -EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE insert into performance_schema.file_summary_by_event_name set event_name='FOO', count_read=1, count_write=2, sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; === modified file 'mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result' --- a/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result 2010-12-01 18:46:51 +0000 @@ -1,10 +1,7 @@ select * from performance_schema.file_summary_by_instance where event_name like 'Wait/io/%' limit 1; -FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE -# # # # # # select * from performance_schema.file_summary_by_instance where event_name='FOO'; -FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE insert into performance_schema.file_summary_by_instance set event_name='FOO', count_read=1, count_write=2, sum_number_of_bytes_read=4, sum_number_of_bytes_write=5; === modified file 'mysql-test/suite/perfschema/r/dml_mutex_instances.result' --- a/mysql-test/suite/perfschema/r/dml_mutex_instances.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_mutex_instances.result 2010-12-01 18:46:51 +0000 @@ -1,9 +1,6 @@ select * from performance_schema.mutex_instances limit 1; -NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID -# # # select * from performance_schema.mutex_instances where name='FOO'; -NAME OBJECT_INSTANCE_BEGIN LOCKED_BY_THREAD_ID insert into performance_schema.mutex_instances set name='FOO', object_instance_begin=12; ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'mutex_instances' === modified file 'mysql-test/suite/perfschema/r/dml_rwlock_instances.result' --- a/mysql-test/suite/perfschema/r/dml_rwlock_instances.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/dml_rwlock_instances.result 2010-12-01 18:46:51 +0000 @@ -1,9 +1,6 @@ select * from performance_schema.rwlock_instances limit 1; -NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT -# # # # select * from performance_schema.rwlock_instances where name='FOO'; -NAME OBJECT_INSTANCE_BEGIN WRITE_LOCKED_BY_THREAD_ID READ_LOCKED_BY_COUNT insert into performance_schema.rwlock_instances set name='FOO', object_instance_begin=12; ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'rwlock_instances' === added file 'mysql-test/suite/perfschema/r/dml_threads.result' --- a/mysql-test/suite/perfschema/r/dml_threads.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/dml_threads.result 2010-12-01 18:46:51 +0000 @@ -0,0 +1,34 @@ +select * from performance_schema.threads +where name like 'Thread/%' limit 1; +select * from performance_schema.threads +where name='FOO'; +insert into performance_schema.threads +set name='FOO', thread_id=1, processlist_id=2; +ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'threads' +update performance_schema.threads +set thread_id=12; +ERROR HY000: Invalid performance_schema usage. +update performance_schema.threads +set thread_id=12 where PROCESSLIST_ID=connection_id(); +ERROR HY000: Invalid performance_schema usage. +update performance_schema.threads +set instrumented= 'NO' where PROCESSLIST_ID=connection_id(); +select instrumented from performance_schema.threads +where PROCESSLIST_ID=connection_id(); +instrumented +NO +update performance_schema.threads +set instrumented= 'YES' where PROCESSLIST_ID=connection_id(); +select instrumented from performance_schema.threads +where PROCESSLIST_ID=connection_id(); +instrumented +YES +delete from performance_schema.threads +where id=1; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'threads' +delete from performance_schema.threads; +ERROR 42000: DELETE command denied to user 'root'@'localhost' for table 'threads' +LOCK TABLES performance_schema.threads READ; +UNLOCK TABLES; +LOCK TABLES performance_schema.threads WRITE; +UNLOCK TABLES; === modified file 'mysql-test/suite/perfschema/r/misc.result' --- a/mysql-test/suite/perfschema/r/misc.result 2010-11-09 08:16:50 +0000 +++ b/mysql-test/suite/perfschema/r/misc.result 2010-12-01 18:46:51 +0000 @@ -6,9 +6,9 @@ AND EVENT_NAME IN WHERE NAME LIKE "wait/synch/%") LIMIT 1; create table test.t1(a int) engine=performance_schema; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.events_waits_current; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table performance_schema.t1(a int); ERROR 42000: CREATE command denied to user 'root'@'localhost' for table 't1' drop table if exists test.ghost; === modified file 'mysql-test/suite/perfschema/r/myisam_file_io.result' --- a/mysql-test/suite/perfschema/r/myisam_file_io.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/myisam_file_io.result 2010-12-01 18:46:51 +0000 @@ -15,8 +15,8 @@ left(source, locate(":", source)) as sho operation, number_of_bytes, substring(object_name, locate("no_index_tab", object_name)) as short_name from performance_schema.events_waits_history_long -where event_name like 'wait/io/file/%' - and operation not like "tell" +where operation not like "tell" + and event_name like "wait/io/file/myisam/%" order by thread_id, event_id; event_name short_source operation number_of_bytes short_name wait/io/file/myisam/kfile mi_create.c: create NULL no_index_tab.MYI === modified file 'mysql-test/suite/perfschema/r/privilege.result' --- a/mysql-test/suite/perfschema/r/privilege.result 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/r/privilege.result 2010-12-01 18:46:51 +0000 @@ -152,13 +152,13 @@ before insert on performance_schema.file for each row begin end; ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.setup_instruments; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.events_waits_current; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.file_instances; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) insert into performance_schema.setup_instruments set name="foo"; ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_instruments' @@ -250,13 +250,13 @@ before insert on performance_schema.file for each row begin end; ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.setup_instruments; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.events_waits_current; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.file_instances; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) insert into performance_schema.setup_instruments set name="foo"; ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'setup_instruments' @@ -348,13 +348,13 @@ before insert on performance_schema.file for each row begin end; ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.setup_instruments; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.events_waits_current; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.file_instances; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) insert into performance_schema.setup_instruments set name="foo"; ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'setup_instruments' @@ -446,13 +446,13 @@ before insert on performance_schema.file for each row begin end; ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema' create table test.t1(a int) engine=PERFORMANCE_SCHEMA; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.setup_instruments; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.events_waits_current; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) create table test.t1 like performance_schema.file_instances; -ERROR HY000: Invalid performance_schema usage. +ERROR HY000: Can't create table 'test.t1' (errno: 131) insert into performance_schema.setup_instruments set name="foo"; ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'setup_instruments' === added file 'mysql-test/suite/perfschema/r/thread_cache.result' --- a/mysql-test/suite/perfschema/r/thread_cache.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/thread_cache.result 2010-12-01 18:46:51 +0000 @@ -0,0 +1,39 @@ +flush status; +SET @saved_thread_cache_size = @@global.thread_cache_size; +set global thread_cache_size = 0; +show variables like "thread_cache_size"; +Variable_name Value +thread_cache_size 0 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +set global thread_cache_size = 100; +show variables like "thread_cache_size"; +Variable_name Value +thread_cache_size 100 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +select @id_increment; +@id_increment +1 +select @thread_id_increment; +@thread_id_increment +1 +set global thread_cache_size = @saved_thread_cache_size; +show status like "performance_schema_thread%"; +Variable_name Value +Performance_schema_thread_classes_lost 0 +Performance_schema_thread_instances_lost 0 === modified file 'mysql-test/suite/perfschema/t/dml_cond_instances.test' --- a/mysql-test/suite/perfschema/t/dml_cond_instances.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_cond_instances.test 2010-12-01 18:46:51 +0000 @@ -18,11 +18,12 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # +--disable_result_log select * from performance_schema.cond_instances limit 1; select * from performance_schema.cond_instances where name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.cond_instances === modified file 'mysql-test/suite/perfschema/t/dml_ews_by_instance.test' --- a/mysql-test/suite/perfschema/t/dml_ews_by_instance.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_ews_by_instance.test 2010-12-01 18:46:51 +0000 @@ -18,28 +18,25 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +--disable_result_log select * from performance_schema.events_waits_summary_by_instance where event_name like 'Wait/Synch/%' limit 1; select * from performance_schema.events_waits_summary_by_instance where event_name='FOO'; ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # select * from performance_schema.events_waits_summary_by_instance order by count_star limit 1; ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # select * from performance_schema.events_waits_summary_by_instance order by count_star desc limit 1; ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star limit 1; ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # select * from performance_schema.events_waits_summary_by_instance where min_timer_wait > 0 order by count_star desc limit 1; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.events_waits_summary_by_instance === modified file 'mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test' --- a/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test 2010-12-01 18:46:51 +0000 @@ -18,12 +18,13 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # +--disable_result_log select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name like 'Wait/Synch/%' limit 1; select * from performance_schema.events_waits_summary_by_thread_by_event_name where event_name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.events_waits_summary_by_thread_by_event_name === modified file 'mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test' --- a/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test 2010-11-03 15:42:33 +0000 +++ b/mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test 2010-12-01 08:01:04 +0000 @@ -18,12 +18,13 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # +--disable_result_log select * from performance_schema.events_waits_summary_global_by_event_name where event_name like 'Wait/Synch/%' limit 1; select * from performance_schema.events_waits_summary_global_by_event_name where event_name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.events_waits_summary_global_by_event_name === modified file 'mysql-test/suite/perfschema/t/dml_file_instances.test' --- a/mysql-test/suite/perfschema/t/dml_file_instances.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_file_instances.test 2010-12-01 18:46:51 +0000 @@ -18,11 +18,12 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # +--disable_result_log select * from performance_schema.file_instances limit 1; select * from performance_schema.file_instances where file_name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.file_instances === modified file 'mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test' --- a/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test 2010-12-01 18:46:51 +0000 @@ -18,12 +18,13 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # 4 # 5 # +--disable_result_log select * from performance_schema.file_summary_by_event_name where event_name like 'Wait/io/%' limit 1; select * from performance_schema.file_summary_by_event_name where event_name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.file_summary_by_event_name === modified file 'mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test' --- a/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test 2010-12-01 18:46:51 +0000 @@ -18,12 +18,13 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # +--disable_result_log select * from performance_schema.file_summary_by_instance where event_name like 'Wait/io/%' limit 1; select * from performance_schema.file_summary_by_instance where event_name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.file_summary_by_instance === modified file 'mysql-test/suite/perfschema/t/dml_mutex_instances.test' --- a/mysql-test/suite/perfschema/t/dml_mutex_instances.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_mutex_instances.test 2010-12-01 18:46:51 +0000 @@ -18,11 +18,12 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # +--disable_result_log select * from performance_schema.mutex_instances limit 1; select * from performance_schema.mutex_instances where name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.mutex_instances === modified file 'mysql-test/suite/perfschema/t/dml_rwlock_instances.test' --- a/mysql-test/suite/perfschema/t/dml_rwlock_instances.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/dml_rwlock_instances.test 2010-12-01 18:46:51 +0000 @@ -18,11 +18,12 @@ --source include/not_embedded.inc --source include/have_perfschema.inc ---replace_column 1 # 2 # 3 # 4 # +--disable_result_log select * from performance_schema.rwlock_instances limit 1; select * from performance_schema.rwlock_instances where name='FOO'; +--enable_result_log --error ER_TABLEACCESS_DENIED_ERROR insert into performance_schema.rwlock_instances === added file 'mysql-test/suite/perfschema/t/dml_threads.test' --- a/mysql-test/suite/perfschema/t/dml_threads.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/dml_threads.test 2010-12-01 18:46:51 +0000 @@ -0,0 +1,65 @@ +# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--disable_result_log +select * from performance_schema.threads + where name like 'Thread/%' limit 1; + +select * from performance_schema.threads + where name='FOO'; +--enable_result_log + +--error ER_TABLEACCESS_DENIED_ERROR +insert into performance_schema.threads + set name='FOO', thread_id=1, processlist_id=2; + +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.threads + set thread_id=12; + +--error ER_WRONG_PERFSCHEMA_USAGE +update performance_schema.threads + set thread_id=12 where PROCESSLIST_ID=connection_id(); + +update performance_schema.threads + set instrumented= 'NO' where PROCESSLIST_ID=connection_id(); + +select instrumented from performance_schema.threads + where PROCESSLIST_ID=connection_id(); + +update performance_schema.threads + set instrumented= 'YES' where PROCESSLIST_ID=connection_id(); + +select instrumented from performance_schema.threads + where PROCESSLIST_ID=connection_id(); + +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.threads + where id=1; + +--error ER_TABLEACCESS_DENIED_ERROR +delete from performance_schema.threads; + +LOCK TABLES performance_schema.threads READ; +UNLOCK TABLES; + +LOCK TABLES performance_schema.threads WRITE; +UNLOCK TABLES; + === modified file 'mysql-test/suite/perfschema/t/misc.test' --- a/mysql-test/suite/perfschema/t/misc.test 2010-11-09 08:16:50 +0000 +++ b/mysql-test/suite/perfschema/t/misc.test 2010-12-01 18:46:51 +0000 @@ -38,14 +38,14 @@ LIMIT 1; # Bug#45088 Should not be able to create tables of engine PERFORMANCE_SCHEMA # ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1(a int) engine=performance_schema; # # Bug#44897 Performance Schema: can create a ghost table in another database # ---error ER_WRONG_PERFSCHEMA_USAGE +--error ER_CANT_CREATE_TABLE create table test.t1 like performance_schema.events_waits_current; # === modified file 'mysql-test/suite/perfschema/t/myisam_file_io.test' --- a/mysql-test/suite/perfschema/t/myisam_file_io.test 2010-11-08 19:35:17 +0000 +++ b/mysql-test/suite/perfschema/t/myisam_file_io.test 2010-12-01 18:46:51 +0000 @@ -46,14 +46,21 @@ insert into no_index_tab set a = 'foo', # Verification # Note that mi_create.c contains mysql_file_tell() calls in debug only, # so the result are filtered to remove 'tell'. +# Note that even after setting other instruments to enabled='NO' +# and truncating the events_waits_history_long table, +# some events -- that were already started but not completed -- +# for other instruments could still be added in the history. +# To protect against that, an extra where clause +# "and event_name like "wait/io/file/myisam/%" +# is added to the select to filter out the result. select event_name, left(source, locate(":", source)) as short_source, operation, number_of_bytes, substring(object_name, locate("no_index_tab", object_name)) as short_name from performance_schema.events_waits_history_long - where event_name like 'wait/io/file/%' - and operation not like "tell" + where operation not like "tell" + and event_name like "wait/io/file/myisam/%" order by thread_id, event_id; # In case of failures, this will tell if file io are lost. === added file 'mysql-test/suite/perfschema/t/thread_cache.test' --- a/mysql-test/suite/perfschema/t/thread_cache.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/thread_cache.test 2010-12-01 18:46:51 +0000 @@ -0,0 +1,166 @@ +# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA + +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +# Setup + +flush status; + +SET @saved_thread_cache_size = @@global.thread_cache_size; + +set global thread_cache_size = 0; + +show variables like "thread_cache_size"; + +connect (con1, localhost, root, , ); + +let $con1_ID=`select connection_id()`; + +let $con1_THREAD_ID=`select thread_id from performance_schema.threads + where PROCESSLIST_ID = connection_id()`; + +connect (con2, localhost, root, , ); + +let $con2_ID=`select connection_id()`; + +let $con2_THREAD_ID=`select thread_id from performance_schema.threads + where PROCESSLIST_ID = connection_id()`; + +--connection default + +--disable_query_log +eval select ($con2_ID - $con1_ID) into @id_increment; +eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_query_log + +# Expect 1, connection_id() is incremented for each new connection +select @id_increment; +# Expect 1, THREAD_ID is incremented for each new connection +select @thread_id_increment; + +--disconnect con2 + +--connection default + +# Wait for the disconnect con2 to complete +let $wait_condition= + select count(*) = 2 from performance_schema.threads + where name like "thread/sql/one_connection"; +--source include/wait_condition.inc + +connect (con3, localhost, root, , ); + +let $con3_ID=`select connection_id()`; + +let $con3_THREAD_ID=`select thread_id from performance_schema.threads + where PROCESSLIST_ID = connection_id()`; + +--disconnect con3 +--disconnect con1 + +--connection default + +# Wait for the disconnect con1 and con3 to complete +let $wait_condition= + select count(*) = 1 from performance_schema.threads + where name like "thread/sql/one_connection"; +--source include/wait_condition.inc + +--disable_query_log +eval select ($con3_ID - $con2_ID) into @id_increment; +eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_query_log + +select @id_increment; +select @thread_id_increment; + +set global thread_cache_size = 100; + +show variables like "thread_cache_size"; + +connect (con1, localhost, root, , ); + +let $con1_ID=`select connection_id()`; + +let $con1_THREAD_ID=`select thread_id from performance_schema.threads + where PROCESSLIST_ID = connection_id()`; + +connect (con2, localhost, root, , ); + +let $con2_ID=`select connection_id()`; + +let $con2_THREAD_ID=`select thread_id from performance_schema.threads + where PROCESSLIST_ID = connection_id()`; + +--connection default + +--disable_query_log +eval select ($con2_ID - $con1_ID) into @id_increment; +eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_query_log + +select @id_increment; +select @thread_id_increment; + +--disconnect con2 + +--connection default + +# Wait for the disconnect con2 to complete +let $wait_condition= + select count(*) = 2 from performance_schema.threads + where name like "thread/sql/one_connection"; +--source include/wait_condition.inc + +connect (con3, localhost, root, , ); + +let $con3_ID=`select connection_id()`; + +let $con3_THREAD_ID=`select thread_id from performance_schema.threads + where PROCESSLIST_ID = connection_id()`; + +--disconnect con3 +--disconnect con1 + +--connection default + +# Wait for the disconnect con1 and con3 to complete +let $wait_condition= + select count(*) = 1 from performance_schema.threads + where name like "thread/sql/one_connection"; +--source include/wait_condition.inc + +--disable_query_log +eval select ($con3_ID - $con2_ID) into @id_increment; +eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_query_log + +# When caching threads, the pthread that executed con2 was parked in the +# cache on disconnect, and then picked up con3. + +# Still expect a new connection_id() +select @id_increment; + +# And expect a new instrumentation: the THREAD_ID of old connections should not be reused. +select @thread_id_increment; + +set global thread_cache_size = @saved_thread_cache_size; + +show status like "performance_schema_thread%"; + === modified file 'storage/perfschema/ha_perfschema.cc' --- a/storage/perfschema/ha_perfschema.cc 2010-10-21 12:18:25 +0000 +++ b/storage/perfschema/ha_perfschema.cc 2010-12-01 18:46:51 +0000 @@ -339,7 +339,6 @@ int ha_perfschema::delete_all_rows(void) result= m_table_share->m_delete_all_rows(); else { - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); result= HA_ERR_WRONG_COMMAND; } DBUG_RETURN(result); @@ -370,7 +369,6 @@ int ha_perfschema::delete_table(const ch int ha_perfschema::rename_table(const char * from, const char * to) { DBUG_ENTER("ha_perfschema::rename_table "); - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } @@ -395,7 +393,37 @@ int ha_perfschema::create(const char *na This is not a general purpose engine. Failure to CREATE TABLE is the expected result. */ - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } +void ha_perfschema::print_error(int error, myf errflag) +{ + switch (error) + { + case HA_ERR_TABLE_NEEDS_UPGRADE: + /* + The error message for ER_TABLE_NEEDS_UPGRADE refers to REPAIR table, + which does not apply to performance schema tables. + */ + my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), + table_share->db.str, table_share->table_name.str); + break; + case HA_ERR_WRONG_COMMAND: + /* + The performance schema is not a general purpose storage engine, + some operations are not supported, by design. + We do not want to print "Command not supported", + which gives the impression that a command implementation is missing, + and that the failure should be considered a bug. + We print "Invalid performance_schema usage." instead, + to emphasise that the operation attempted is not meant to be legal, + and that the failure returned is indeed the expected result. + */ + my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); + break; + default: + handler::print_error(error, errflag); + break; + } +} + === modified file 'storage/perfschema/ha_perfschema.h' --- a/storage/perfschema/ha_perfschema.h 2010-10-21 11:34:17 +0000 +++ b/storage/perfschema/ha_perfschema.h 2010-12-01 18:46:51 +0000 @@ -101,9 +101,6 @@ public: double scan_time(void) { return 1.0; } - double read_time(ha_rows) - { return 1.0; } - int open(const char *name, int mode, uint test_if_locked); int close(void); @@ -152,6 +149,8 @@ public: return FALSE; } + virtual void print_error(int error, myf errflags); + private: /** MySQL lock */ THR_LOCK_DATA m_thr_lock; === modified file 'storage/perfschema/pfs_engine_table.cc' --- a/storage/perfschema/pfs_engine_table.cc 2010-09-28 15:17:29 +0000 +++ b/storage/perfschema/pfs_engine_table.cc 2010-12-01 18:46:51 +0000 @@ -193,14 +193,11 @@ int PFS_engine_table_share::write_row(TA */ if (! m_checked) { - my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), - PERFORMANCE_SCHEMA_str.str, m_name); return HA_ERR_TABLE_NEEDS_UPGRADE; } if (m_write_row == NULL) { - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; } @@ -275,8 +272,6 @@ int PFS_engine_table::read_row(TABLE *ta */ if (! m_share_ptr->m_checked) { - my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), - PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str); return HA_ERR_TABLE_NEEDS_UPGRADE; } @@ -322,8 +317,6 @@ int PFS_engine_table::update_row(TABLE * */ if (! m_share_ptr->m_checked) { - my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), - PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str); return HA_ERR_TABLE_NEEDS_UPGRADE; } @@ -347,8 +340,6 @@ int PFS_engine_table::delete_row(TABLE * */ if (! m_share_ptr->m_checked) { - my_error(ER_WRONG_NATIVE_TABLE_STRUCTURE, MYF(0), - PERFORMANCE_SCHEMA_str.str, m_share_ptr->m_name.str); return HA_ERR_TABLE_NEEDS_UPGRADE; } @@ -364,7 +355,6 @@ int PFS_engine_table::delete_row_values( const unsigned char *, Field **) { - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; } @@ -461,7 +451,6 @@ int PFS_engine_table::update_row_values( unsigned char *, Field **) { - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; } === modified file 'storage/perfschema/table_setup_actors.cc' --- a/storage/perfschema/table_setup_actors.cc 2010-11-09 08:16:50 +0000 +++ b/storage/perfschema/table_setup_actors.cc 2010-12-01 18:46:51 +0000 @@ -249,7 +249,6 @@ int table_setup_actors::update_row_value case 0: /* HOST */ case 1: /* USER */ case 2: /* ROLE */ - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; break; default: === modified file 'storage/perfschema/table_setup_consumers.cc' --- a/storage/perfschema/table_setup_consumers.cc 2010-11-09 08:16:50 +0000 +++ b/storage/perfschema/table_setup_consumers.cc 2010-12-01 18:46:51 +0000 @@ -193,7 +193,6 @@ int table_setup_consumers::update_row_va switch(f->field_index) { case 0: /* NAME */ - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; case 1: /* ENABLED */ { === modified file 'storage/perfschema/table_setup_instruments.cc' --- a/storage/perfschema/table_setup_instruments.cc 2010-11-09 08:16:50 +0000 +++ b/storage/perfschema/table_setup_instruments.cc 2010-12-01 18:46:51 +0000 @@ -269,7 +269,6 @@ int table_setup_instruments::update_row_ switch(f->field_index) { case 0: /* NAME */ - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; case 1: /* ENABLED */ value= (enum_yes_no) get_field_enum(f); === modified file 'storage/perfschema/table_setup_timers.cc' --- a/storage/perfschema/table_setup_timers.cc 2010-11-09 08:16:50 +0000 +++ b/storage/perfschema/table_setup_timers.cc 2010-12-01 18:46:51 +0000 @@ -165,7 +165,6 @@ int table_setup_timers::update_row_value switch(f->field_index) { case 0: /* NAME */ - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; case 1: /* TIMER_NAME */ value= get_field_enum(f); === modified file 'storage/perfschema/table_threads.cc' --- a/storage/perfschema/table_threads.cc 2010-11-09 10:36:41 +0000 +++ b/storage/perfschema/table_threads.cc 2010-12-01 18:46:51 +0000 @@ -354,7 +354,6 @@ int table_threads::update_row_values(TAB case 10: /* PROCESSLIST_INFO */ case 11: /* PARENT_THREAD_ID */ case 12: /* ROLE */ - my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; case 13: /* INSTRUMENTED */ value= (enum_yes_no) get_field_enum(f); No bundle (reason: revision is a merge).