From: Marc Alff Date: December 19 2011 9:17am Subject: bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3454 to 3456) List-Archive: http://lists.mysql.com/commits/142173 Message-Id: <201112190917.pBJ9HJQ9014142@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3456 Marc Alff 2011-12-19 [merge] Merge mysql-trunk --> mysql-trunk-pfs-tuning modified: storage/innobase/buf/buf0buddy.cc storage/innobase/buf/buf0buf.cc storage/innobase/buf/buf0flu.cc storage/innobase/buf/buf0lru.cc storage/innobase/dict/dict0dict.cc storage/innobase/dict/dict0mem.cc storage/innobase/dyn/dyn0dyn.cc storage/innobase/fil/fil0fil.cc storage/innobase/include/dict0mem.h storage/innobase/include/lock0lock.h storage/innobase/include/lock0priv.h storage/innobase/include/lock0types.h storage/innobase/include/mem0mem.ic storage/innobase/include/sync0sync.h storage/innobase/include/trx0roll.h storage/innobase/include/trx0trx.h storage/innobase/include/usr0sess.h storage/innobase/include/ut0lst.h storage/innobase/lock/lock0iter.cc storage/innobase/lock/lock0lock.cc storage/innobase/log/log0log.cc storage/innobase/log/log0recv.cc storage/innobase/mem/mem0mem.cc storage/innobase/mem/mem0pool.cc storage/innobase/os/os0sync.cc storage/innobase/pars/pars0opt.cc storage/innobase/pars/pars0pars.cc storage/innobase/pars/pars0sym.cc storage/innobase/que/que0que.cc storage/innobase/read/read0read.cc storage/innobase/row/row0ftsort.cc storage/innobase/row/row0ins.cc storage/innobase/row/row0merge.cc storage/innobase/row/row0mysql.cc storage/innobase/srv/srv0mon.cc storage/innobase/srv/srv0srv.cc storage/innobase/sync/sync0rw.cc storage/innobase/sync/sync0sync.cc storage/innobase/trx/trx0roll.cc storage/innobase/trx/trx0rseg.cc storage/innobase/trx/trx0sys.cc storage/innobase/trx/trx0trx.cc storage/innobase/trx/trx0undo.cc storage/innobase/usr/usr0sess.cc storage/innobase/ut/ut0mem.cc 3455 Marc Alff 2011-12-19 [merge] Merge mysql-trunk --> mysql-trunk-pfs-tuning added: mysql-test/suite/perfschema/r/start_server_disable_idle.result mysql-test/suite/perfschema/r/start_server_disable_stages.result mysql-test/suite/perfschema/r/start_server_disable_statements.result mysql-test/suite/perfschema/r/start_server_disable_waits.result mysql-test/suite/perfschema/t/start_server_disable_idle-master.opt mysql-test/suite/perfschema/t/start_server_disable_idle.test mysql-test/suite/perfschema/t/start_server_disable_stages-master.opt mysql-test/suite/perfschema/t/start_server_disable_stages.test mysql-test/suite/perfschema/t/start_server_disable_statements-master.opt mysql-test/suite/perfschema/t/start_server_disable_statements.test mysql-test/suite/perfschema/t/start_server_disable_waits-master.opt mysql-test/suite/perfschema/t/start_server_disable_waits.test modified: mysql-test/r/type_temporal_fractional.result mysql-test/t/type_temporal_fractional.test scripts/mysql_system_tables.sql sql/item_timefunc.cc storage/innobase/buf/buf0buddy.cc storage/innobase/buf/buf0buf.cc storage/innobase/buf/buf0flu.cc storage/innobase/buf/buf0lru.cc storage/innobase/dict/dict0dict.cc storage/innobase/dict/dict0mem.cc storage/innobase/dict/dict0stats.cc storage/innobase/dyn/dyn0dyn.cc storage/innobase/fil/fil0fil.cc storage/innobase/fts/fts0fts.cc storage/innobase/include/dict0mem.h storage/innobase/include/fts0fts.h storage/innobase/include/lock0lock.h storage/innobase/include/lock0priv.h storage/innobase/include/lock0types.h storage/innobase/include/mem0mem.ic storage/innobase/include/sync0sync.h storage/innobase/include/trx0roll.h storage/innobase/include/trx0trx.h storage/innobase/include/usr0sess.h storage/innobase/include/ut0lst.h storage/innobase/lock/lock0iter.cc storage/innobase/lock/lock0lock.cc storage/innobase/log/log0log.cc storage/innobase/log/log0recv.cc storage/innobase/mem/mem0mem.cc storage/innobase/mem/mem0pool.cc storage/innobase/os/os0sync.cc storage/innobase/pars/pars0opt.cc storage/innobase/pars/pars0pars.cc storage/innobase/pars/pars0sym.cc storage/innobase/que/que0que.cc storage/innobase/read/read0read.cc storage/innobase/row/row0ftsort.cc storage/innobase/row/row0ins.cc storage/innobase/row/row0merge.cc storage/innobase/row/row0mysql.cc storage/innobase/srv/srv0mon.cc storage/innobase/srv/srv0srv.cc storage/innobase/sync/sync0rw.cc storage/innobase/sync/sync0sync.cc storage/innobase/trx/trx0roll.cc storage/innobase/trx/trx0rseg.cc storage/innobase/trx/trx0sys.cc storage/innobase/trx/trx0trx.cc storage/innobase/trx/trx0undo.cc storage/innobase/usr/usr0sess.cc storage/innobase/ut/ut0mem.cc 3454 Marc Alff 2011-12-16 [merge] Merge mysql-trunk --> mysql-trunk-pfs-tuning added: sql/sql_executor.cc sql/sql_executor.h sql/sql_join_buffer.h sql/sql_optimizer.cc sql/sql_optimizer.h sql/sql_planner.cc sql/sql_planner.h sql/sql_resolver.cc sql/sql_resolver.h sql/sql_tmp_table.cc sql/sql_tmp_table.h renamed: sql/sql_join_cache.cc => sql/sql_join_buffer.cc modified: cmake/install_macros.cmake mysql-test/include/range.inc mysql-test/include/select.inc mysql-test/include/subquery_sj.inc mysql-test/r/func_in_all.result mysql-test/r/innodb_explain_non_select_all.result mysql-test/r/innodb_explain_non_select_none.result mysql-test/r/innodb_mrr_all.result mysql-test/r/innodb_mrr_cost_all.result mysql-test/r/myisam_mrr_all.result mysql-test/r/myisam_mrr_cost_all.result mysql-test/r/mysqld--help-win.result mysql-test/r/partition_hash.result mysql-test/r/partition_mgm.result mysql-test/r/range_all.result mysql-test/r/range_icp.result mysql-test/r/range_icp_mrr.result mysql-test/r/range_mrr.result mysql-test/r/range_mrr_cost.result mysql-test/r/range_none.result mysql-test/r/select_all.result mysql-test/r/select_icp_mrr.result mysql-test/r/select_icp_mrr_bka.result mysql-test/r/select_icp_mrr_bka_nixbnl.result mysql-test/r/select_none.result mysql-test/r/select_none_bka.result mysql-test/r/select_none_bka_nixbnl.result mysql-test/r/sp.result mysql-test/r/subquery_all.result mysql-test/r/subquery_all_bka.result mysql-test/r/subquery_all_bka_nixbnl.result mysql-test/r/subquery_sj_all.result mysql-test/r/subquery_sj_all_bka.result mysql-test/r/subquery_sj_all_bka_nixbnl.result mysql-test/r/subquery_sj_all_bkaunique.result mysql-test/r/subquery_sj_dupsweed.result mysql-test/r/subquery_sj_dupsweed_bka.result mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result mysql-test/r/subquery_sj_dupsweed_bkaunique.result mysql-test/r/subquery_sj_firstmatch.result mysql-test/r/subquery_sj_firstmatch_bka.result mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result mysql-test/r/subquery_sj_firstmatch_bkaunique.result mysql-test/r/subquery_sj_loosescan.result mysql-test/r/subquery_sj_loosescan_bka.result mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result mysql-test/r/subquery_sj_loosescan_bkaunique.result mysql-test/r/subquery_sj_mat.result mysql-test/r/subquery_sj_mat_bka.result mysql-test/r/subquery_sj_mat_bka_nixbnl.result mysql-test/r/subquery_sj_mat_bkaunique.result mysql-test/r/subquery_sj_mat_nosj.result mysql-test/r/subquery_sj_none.result mysql-test/r/subquery_sj_none_bka.result mysql-test/r/subquery_sj_none_bka_nixbnl.result mysql-test/r/subquery_sj_none_bkaunique.result mysql-test/r/update.result mysql-test/suite/binlog/t/binlog_index.test mysql-test/suite/rpl/r/rpl_row_img_sanity.result mysql-test/suite/rpl/t/rpl_binlog_errors.test mysql-test/suite/rpl/t/rpl_empty_master_host.test mysql-test/suite/rpl/t/rpl_row_img_sanity.test mysql-test/suite/rpl/t/rpl_server_id_ignore.test mysql-test/t/partition_hash.test mysql-test/t/partition_mgm.test mysql-test/t/sp.test mysql-test/t/update.test sql/CMakeLists.txt sql/field.cc sql/ha_partition.cc sql/ha_partition.h sql/item.cc sql/item_cmpfunc.cc sql/item_strfunc.cc sql/item_subselect.cc sql/item_sum.cc sql/opt_explain.cc sql/opt_explain.h sql/opt_range.cc sql/opt_range.h sql/records.cc sql/records.h sql/rpl_utility.cc sql/sp_rcontext.cc sql/sql_base.cc sql/sql_class.cc sql/sql_class.h sql/sql_cursor.cc sql/sql_delete.cc sql/sql_derived.cc sql/sql_insert.cc sql/sql_lex.cc sql/sql_lex.h sql/sql_partition.cc sql/sql_select.cc sql/sql_select.h sql/sql_show.cc sql/sql_table.cc sql/sql_test.cc sql/sql_union.cc sql/sql_update.cc sql/sql_yacc.yy storage/innobase/dict/dict0dict.cc storage/innobase/dict/dict0mem.cc sql/sql_join_buffer.cc === modified file 'mysql-test/r/type_temporal_fractional.result' --- a/mysql-test/r/type_temporal_fractional.result 2011-11-21 15:17:51 +0000 +++ b/mysql-test/r/type_temporal_fractional.result 2011-12-16 16:57:46 +0000 @@ -4022,7 +4022,7 @@ a a + INTERVAL 1 HOUR a - INTERVAL 1 HOU SELECT a, a + INTERVAL 1 SECOND, a - INTERVAL 1 SECOND FROM t1; a a + INTERVAL 1 SECOND a - INTERVAL 1 SECOND -10:00:00.100000 -09:59:59.100000 -10:00:01.100000 -00:00:00.100000 00:00:01.100000 00:00:00.900000 +00:00:00.100000 00:00:01.100000 -00:00:00.900000 10:00:00.100000 10:00:01.100000 09:59:59.100000 SELECT a, a + INTERVAL 1.1 SECOND, a - INTERVAL 1.1 SECOND FROM t1; a a + INTERVAL 1.1 SECOND a - INTERVAL 1.1 SECOND @@ -16937,3 +16937,50 @@ SELECT c_time AS c1 FROM t1 WHERE c_timestamp NOT IN (NULL, '0000-00-00 00:00:00'); c1 DROP TABLE t1; +# +# BUG#13450867 - CRASH ON UPDATE A TIME COLUMN +# +CREATE TABLE t1 (a TIME(6), b TIME(6), c TIME(6), d TIME(6)); +INSERT INTO t1 VALUES +('-838:59:59.999999', '-838:59:59.000001', +'838:59:59.999999', '838:59:59.000001'); +Warnings: +Warning 1264 Out of range value for column 'a' at row 1 +Warning 1264 Out of range value for column 'b' at row 1 +Warning 1264 Out of range value for column 'c' at row 1 +Warning 1264 Out of range value for column 'd' at row 1 +SELECT * FROM t1; +a b c d +-838:59:59.000000 -838:59:59.000000 838:59:59.000000 838:59:59.000000 +UPDATE t1 SET +a= a - INTERVAL 999999 MICROSECOND, b= b - INTERVAL 1 MICROSECOND, +c= c + INTERVAL 999999 MICROSECOND, d= d + INTERVAL 1 MICROSECOND; +Warnings: +Warning 1441 Datetime function: time field overflow +Warning 1441 Datetime function: time field overflow +Warning 1441 Datetime function: time field overflow +Warning 1441 Datetime function: time field overflow +SELECT * FROM t1; +a b c d +NULL NULL NULL NULL +DROP TABLE t1; +SELECT SEC_TO_TIME(3200399.999999); +SEC_TO_TIME(3200399.999999) +838:59:59.000000 +Warnings: +Warning 1292 Truncated incorrect time value: '3200399.999999' +SELECT SEC_TO_TIME(3200399.000001); +SEC_TO_TIME(3200399.000001) +838:59:59.000000 +Warnings: +Warning 1292 Truncated incorrect time value: '3200399.000001' +SELECT SEC_TO_TIME(-3200399.999999); +SEC_TO_TIME(-3200399.999999) +-838:59:59.000000 +Warnings: +Warning 1292 Truncated incorrect time value: '-3200399.999999' +SELECT SEC_TO_TIME(-3200399.000001); +SEC_TO_TIME(-3200399.000001) +-838:59:59.000000 +Warnings: +Warning 1292 Truncated incorrect time value: '-3200399.000001' === added file 'mysql-test/suite/perfschema/r/start_server_disable_idle.result' --- a/mysql-test/suite/perfschema/r/start_server_disable_idle.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/start_server_disable_idle.result 2011-12-16 11:01:45 +0000 @@ -0,0 +1,118 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +11 +select count(*) > 3 from performance_schema.setup_instruments; +count(*) > 3 +1 +select count(*) from performance_schema.setup_timers; +count(*) +4 +select * from performance_schema.accounts; +select * from performance_schema.cond_instances; +select * from performance_schema.events_stages_current; +select * from performance_schema.events_stages_history; +select * from performance_schema.events_stages_history_long; +select * from performance_schema.events_stages_summary_by_account_by_event_name; +select * from performance_schema.events_stages_summary_by_host_by_event_name; +select * from performance_schema.events_stages_summary_by_thread_by_event_name; +select * from performance_schema.events_stages_summary_by_user_by_event_name; +select * from performance_schema.events_stages_summary_global_by_event_name; +select * from performance_schema.events_statements_current; +select * from performance_schema.events_statements_history; +select * from performance_schema.events_statements_history_long; +select * from performance_schema.events_statements_summary_by_account_by_event_name; +select * from performance_schema.events_statements_summary_by_host_by_event_name; +select * from performance_schema.events_statements_summary_by_thread_by_event_name; +select * from performance_schema.events_statements_summary_by_user_by_event_name; +select * from performance_schema.events_statements_summary_global_by_event_name; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_account_by_event_name; +select * from performance_schema.events_waits_summary_by_host_by_event_name; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_by_user_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.socket_instances; +select * from performance_schema.socket_summary_by_instance; +select * from performance_schema.socket_summary_by_event_name; +select * from performance_schema.hosts; +select * from performance_schema.mutex_instances; +select * from performance_schema.objects_summary_global_by_type; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_actors; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_objects; +select * from performance_schema.setup_timers; +select * from performance_schema.table_io_waits_summary_by_index_usage; +select * from performance_schema.table_io_waits_summary_by_table; +select * from performance_schema.table_lock_waits_summary_by_table; +select * from performance_schema.threads; +select * from performance_schema.users; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_accounts_size 100 +performance_schema_events_stages_history_long_size 1000 +performance_schema_events_stages_history_size 10 +performance_schema_events_statements_history_long_size 1000 +performance_schema_events_statements_history_size 10 +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_hosts_size 100 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 5000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 5000 +performance_schema_max_socket_classes 10 +performance_schema_max_socket_instances 1000 +performance_schema_max_stage_classes 150 +performance_schema_max_statement_classes 167 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 200 +performance_schema_setup_actors_size 100 +performance_schema_setup_objects_size 100 +performance_schema_users_size 100 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +select * from performance_schema.setup_instruments +where name like "idle" and enabled='YES'; +NAME ENABLED TIMED +select * from performance_schema.events_waits_summary_global_by_event_name +where event_name like "idle" and count_star > 0; +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 like "idle" and count_star > 0; +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_user_by_event_name +where event_name like "idle" and count_star > 0; +USER EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_waits_summary_by_host_by_event_name +where event_name like "idle" and count_star > 0; +HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_waits_summary_by_account_by_event_name +where event_name like "idle" and count_star > 0; +USER HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT === added file 'mysql-test/suite/perfschema/r/start_server_disable_stages.result' --- a/mysql-test/suite/perfschema/r/start_server_disable_stages.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/start_server_disable_stages.result 2011-12-16 11:01:45 +0000 @@ -0,0 +1,118 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +11 +select count(*) > 3 from performance_schema.setup_instruments; +count(*) > 3 +1 +select count(*) from performance_schema.setup_timers; +count(*) +4 +select * from performance_schema.accounts; +select * from performance_schema.cond_instances; +select * from performance_schema.events_stages_current; +select * from performance_schema.events_stages_history; +select * from performance_schema.events_stages_history_long; +select * from performance_schema.events_stages_summary_by_account_by_event_name; +select * from performance_schema.events_stages_summary_by_host_by_event_name; +select * from performance_schema.events_stages_summary_by_thread_by_event_name; +select * from performance_schema.events_stages_summary_by_user_by_event_name; +select * from performance_schema.events_stages_summary_global_by_event_name; +select * from performance_schema.events_statements_current; +select * from performance_schema.events_statements_history; +select * from performance_schema.events_statements_history_long; +select * from performance_schema.events_statements_summary_by_account_by_event_name; +select * from performance_schema.events_statements_summary_by_host_by_event_name; +select * from performance_schema.events_statements_summary_by_thread_by_event_name; +select * from performance_schema.events_statements_summary_by_user_by_event_name; +select * from performance_schema.events_statements_summary_global_by_event_name; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_account_by_event_name; +select * from performance_schema.events_waits_summary_by_host_by_event_name; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_by_user_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.socket_instances; +select * from performance_schema.socket_summary_by_instance; +select * from performance_schema.socket_summary_by_event_name; +select * from performance_schema.hosts; +select * from performance_schema.mutex_instances; +select * from performance_schema.objects_summary_global_by_type; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_actors; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_objects; +select * from performance_schema.setup_timers; +select * from performance_schema.table_io_waits_summary_by_index_usage; +select * from performance_schema.table_io_waits_summary_by_table; +select * from performance_schema.table_lock_waits_summary_by_table; +select * from performance_schema.threads; +select * from performance_schema.users; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_accounts_size 100 +performance_schema_events_stages_history_long_size 1000 +performance_schema_events_stages_history_size 10 +performance_schema_events_statements_history_long_size 1000 +performance_schema_events_statements_history_size 10 +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_hosts_size 100 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 5000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 5000 +performance_schema_max_socket_classes 10 +performance_schema_max_socket_instances 1000 +performance_schema_max_stage_classes 150 +performance_schema_max_statement_classes 167 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 200 +performance_schema_setup_actors_size 100 +performance_schema_setup_objects_size 100 +performance_schema_users_size 100 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +select * from performance_schema.setup_instruments +where name like "stage/%" and enabled='YES'; +NAME ENABLED TIMED +select * from performance_schema.events_stages_summary_global_by_event_name +where count_star > 0; +EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_stages_summary_by_thread_by_event_name +where count_star > 0; +THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_stages_summary_by_user_by_event_name +where count_star > 0; +USER EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_stages_summary_by_host_by_event_name +where count_star > 0; +HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_stages_summary_by_account_by_event_name +where count_star > 0; +USER HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT === added file 'mysql-test/suite/perfschema/r/start_server_disable_statements.result' --- a/mysql-test/suite/perfschema/r/start_server_disable_statements.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/start_server_disable_statements.result 2011-12-16 11:01:45 +0000 @@ -0,0 +1,118 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +11 +select count(*) > 3 from performance_schema.setup_instruments; +count(*) > 3 +1 +select count(*) from performance_schema.setup_timers; +count(*) +4 +select * from performance_schema.accounts; +select * from performance_schema.cond_instances; +select * from performance_schema.events_stages_current; +select * from performance_schema.events_stages_history; +select * from performance_schema.events_stages_history_long; +select * from performance_schema.events_stages_summary_by_account_by_event_name; +select * from performance_schema.events_stages_summary_by_host_by_event_name; +select * from performance_schema.events_stages_summary_by_thread_by_event_name; +select * from performance_schema.events_stages_summary_by_user_by_event_name; +select * from performance_schema.events_stages_summary_global_by_event_name; +select * from performance_schema.events_statements_current; +select * from performance_schema.events_statements_history; +select * from performance_schema.events_statements_history_long; +select * from performance_schema.events_statements_summary_by_account_by_event_name; +select * from performance_schema.events_statements_summary_by_host_by_event_name; +select * from performance_schema.events_statements_summary_by_thread_by_event_name; +select * from performance_schema.events_statements_summary_by_user_by_event_name; +select * from performance_schema.events_statements_summary_global_by_event_name; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_account_by_event_name; +select * from performance_schema.events_waits_summary_by_host_by_event_name; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_by_user_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.socket_instances; +select * from performance_schema.socket_summary_by_instance; +select * from performance_schema.socket_summary_by_event_name; +select * from performance_schema.hosts; +select * from performance_schema.mutex_instances; +select * from performance_schema.objects_summary_global_by_type; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_actors; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_objects; +select * from performance_schema.setup_timers; +select * from performance_schema.table_io_waits_summary_by_index_usage; +select * from performance_schema.table_io_waits_summary_by_table; +select * from performance_schema.table_lock_waits_summary_by_table; +select * from performance_schema.threads; +select * from performance_schema.users; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_accounts_size 100 +performance_schema_events_stages_history_long_size 1000 +performance_schema_events_stages_history_size 10 +performance_schema_events_statements_history_long_size 1000 +performance_schema_events_statements_history_size 10 +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_hosts_size 100 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 5000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 5000 +performance_schema_max_socket_classes 10 +performance_schema_max_socket_instances 1000 +performance_schema_max_stage_classes 150 +performance_schema_max_statement_classes 167 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 200 +performance_schema_setup_actors_size 100 +performance_schema_setup_objects_size 100 +performance_schema_users_size 100 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +select * from performance_schema.setup_instruments +where name like "statement/%" and enabled='YES'; +NAME ENABLED TIMED +select * from performance_schema.events_statements_summary_global_by_event_name +where count_star > 0; +EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT SUM_LOCK_TIME SUM_ERRORS SUM_WARNINGS SUM_ROWS_AFFECTED SUM_ROWS_SENT SUM_ROWS_EXAMINED SUM_CREATED_TMP_DISK_TABLES SUM_CREATED_TMP_TABLES SUM_SELECT_FULL_JOIN SUM_SELECT_FULL_RANGE_JOIN SUM_SELECT_RANGE SUM_SELECT_RANGE_CHECK SUM_SELECT_SCAN SUM_SORT_MERGE_PASSES SUM_SORT_RANGE SUM_SORT_ROWS SUM_SORT_SCAN SUM_NO_INDEX_USED SUM_NO_GOOD_INDEX_USED +select * from performance_schema.events_statements_summary_by_thread_by_event_name +where count_star > 0; +THREAD_ID EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT SUM_LOCK_TIME SUM_ERRORS SUM_WARNINGS SUM_ROWS_AFFECTED SUM_ROWS_SENT SUM_ROWS_EXAMINED SUM_CREATED_TMP_DISK_TABLES SUM_CREATED_TMP_TABLES SUM_SELECT_FULL_JOIN SUM_SELECT_FULL_RANGE_JOIN SUM_SELECT_RANGE SUM_SELECT_RANGE_CHECK SUM_SELECT_SCAN SUM_SORT_MERGE_PASSES SUM_SORT_RANGE SUM_SORT_ROWS SUM_SORT_SCAN SUM_NO_INDEX_USED SUM_NO_GOOD_INDEX_USED +select * from performance_schema.events_statements_summary_by_user_by_event_name +where count_star > 0; +USER EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT SUM_LOCK_TIME SUM_ERRORS SUM_WARNINGS SUM_ROWS_AFFECTED SUM_ROWS_SENT SUM_ROWS_EXAMINED SUM_CREATED_TMP_DISK_TABLES SUM_CREATED_TMP_TABLES SUM_SELECT_FULL_JOIN SUM_SELECT_FULL_RANGE_JOIN SUM_SELECT_RANGE SUM_SELECT_RANGE_CHECK SUM_SELECT_SCAN SUM_SORT_MERGE_PASSES SUM_SORT_RANGE SUM_SORT_ROWS SUM_SORT_SCAN SUM_NO_INDEX_USED SUM_NO_GOOD_INDEX_USED +select * from performance_schema.events_statements_summary_by_host_by_event_name +where count_star > 0; +HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT SUM_LOCK_TIME SUM_ERRORS SUM_WARNINGS SUM_ROWS_AFFECTED SUM_ROWS_SENT SUM_ROWS_EXAMINED SUM_CREATED_TMP_DISK_TABLES SUM_CREATED_TMP_TABLES SUM_SELECT_FULL_JOIN SUM_SELECT_FULL_RANGE_JOIN SUM_SELECT_RANGE SUM_SELECT_RANGE_CHECK SUM_SELECT_SCAN SUM_SORT_MERGE_PASSES SUM_SORT_RANGE SUM_SORT_ROWS SUM_SORT_SCAN SUM_NO_INDEX_USED SUM_NO_GOOD_INDEX_USED +select * from performance_schema.events_statements_summary_by_account_by_event_name +where count_star > 0; +USER HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT SUM_LOCK_TIME SUM_ERRORS SUM_WARNINGS SUM_ROWS_AFFECTED SUM_ROWS_SENT SUM_ROWS_EXAMINED SUM_CREATED_TMP_DISK_TABLES SUM_CREATED_TMP_TABLES SUM_SELECT_FULL_JOIN SUM_SELECT_FULL_RANGE_JOIN SUM_SELECT_RANGE SUM_SELECT_RANGE_CHECK SUM_SELECT_SCAN SUM_SORT_MERGE_PASSES SUM_SORT_RANGE SUM_SORT_ROWS SUM_SORT_SCAN SUM_NO_INDEX_USED SUM_NO_GOOD_INDEX_USED === added file 'mysql-test/suite/perfschema/r/start_server_disable_waits.result' --- a/mysql-test/suite/perfschema/r/start_server_disable_waits.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/r/start_server_disable_waits.result 2011-12-16 11:01:45 +0000 @@ -0,0 +1,118 @@ +show databases; +Database +information_schema +mtr +mysql +performance_schema +test +select count(*) from performance_schema.performance_timers; +count(*) +5 +select count(*) from performance_schema.setup_consumers; +count(*) +11 +select count(*) > 3 from performance_schema.setup_instruments; +count(*) > 3 +1 +select count(*) from performance_schema.setup_timers; +count(*) +4 +select * from performance_schema.accounts; +select * from performance_schema.cond_instances; +select * from performance_schema.events_stages_current; +select * from performance_schema.events_stages_history; +select * from performance_schema.events_stages_history_long; +select * from performance_schema.events_stages_summary_by_account_by_event_name; +select * from performance_schema.events_stages_summary_by_host_by_event_name; +select * from performance_schema.events_stages_summary_by_thread_by_event_name; +select * from performance_schema.events_stages_summary_by_user_by_event_name; +select * from performance_schema.events_stages_summary_global_by_event_name; +select * from performance_schema.events_statements_current; +select * from performance_schema.events_statements_history; +select * from performance_schema.events_statements_history_long; +select * from performance_schema.events_statements_summary_by_account_by_event_name; +select * from performance_schema.events_statements_summary_by_host_by_event_name; +select * from performance_schema.events_statements_summary_by_thread_by_event_name; +select * from performance_schema.events_statements_summary_by_user_by_event_name; +select * from performance_schema.events_statements_summary_global_by_event_name; +select * from performance_schema.events_waits_current; +select * from performance_schema.events_waits_history; +select * from performance_schema.events_waits_history_long; +select * from performance_schema.events_waits_summary_by_account_by_event_name; +select * from performance_schema.events_waits_summary_by_host_by_event_name; +select * from performance_schema.events_waits_summary_by_instance; +select * from performance_schema.events_waits_summary_by_thread_by_event_name; +select * from performance_schema.events_waits_summary_by_user_by_event_name; +select * from performance_schema.events_waits_summary_global_by_event_name; +select * from performance_schema.file_instances; +select * from performance_schema.file_summary_by_event_name; +select * from performance_schema.file_summary_by_instance; +select * from performance_schema.socket_instances; +select * from performance_schema.socket_summary_by_instance; +select * from performance_schema.socket_summary_by_event_name; +select * from performance_schema.hosts; +select * from performance_schema.mutex_instances; +select * from performance_schema.objects_summary_global_by_type; +select * from performance_schema.performance_timers; +select * from performance_schema.rwlock_instances; +select * from performance_schema.setup_actors; +select * from performance_schema.setup_consumers; +select * from performance_schema.setup_instruments; +select * from performance_schema.setup_objects; +select * from performance_schema.setup_timers; +select * from performance_schema.table_io_waits_summary_by_index_usage; +select * from performance_schema.table_io_waits_summary_by_table; +select * from performance_schema.table_lock_waits_summary_by_table; +select * from performance_schema.threads; +select * from performance_schema.users; +show variables like "performance_schema%"; +Variable_name Value +performance_schema ON +performance_schema_accounts_size 100 +performance_schema_events_stages_history_long_size 1000 +performance_schema_events_stages_history_size 10 +performance_schema_events_statements_history_long_size 1000 +performance_schema_events_statements_history_size 10 +performance_schema_events_waits_history_long_size 10000 +performance_schema_events_waits_history_size 10 +performance_schema_hosts_size 100 +performance_schema_max_cond_classes 80 +performance_schema_max_cond_instances 1000 +performance_schema_max_file_classes 50 +performance_schema_max_file_handles 32768 +performance_schema_max_file_instances 10000 +performance_schema_max_mutex_classes 200 +performance_schema_max_mutex_instances 5000 +performance_schema_max_rwlock_classes 30 +performance_schema_max_rwlock_instances 5000 +performance_schema_max_socket_classes 10 +performance_schema_max_socket_instances 1000 +performance_schema_max_stage_classes 150 +performance_schema_max_statement_classes 167 +performance_schema_max_table_handles 1000 +performance_schema_max_table_instances 500 +performance_schema_max_thread_classes 50 +performance_schema_max_thread_instances 200 +performance_schema_setup_actors_size 100 +performance_schema_setup_objects_size 100 +performance_schema_users_size 100 +show engine PERFORMANCE_SCHEMA status; +show status like "performance_schema%"; +select * from performance_schema.setup_instruments +where name like "wait/%" and enabled='YES'; +NAME ENABLED TIMED +select * from performance_schema.events_waits_summary_global_by_event_name +where event_name like "wait/%" and count_star > 0; +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 like "wait/%" and count_star > 0; +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_user_by_event_name +where event_name like "wait/%" and count_star > 0; +USER EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_waits_summary_by_host_by_event_name +where event_name like "wait/%" and count_star > 0; +HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT +select * from performance_schema.events_waits_summary_by_account_by_event_name +where event_name like "wait/%" and count_star > 0; +USER HOST EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT === added file 'mysql-test/suite/perfschema/t/start_server_disable_idle-master.opt' --- a/mysql-test/suite/perfschema/t/start_server_disable_idle-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_idle-master.opt 2011-12-16 11:01:45 +0000 @@ -0,0 +1 @@ +--loose-performance-schema-instrument='idle=OFF' === added file 'mysql-test/suite/perfschema/t/start_server_disable_idle.test' --- a/mysql-test/suite/perfschema/t/start_server_disable_idle.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_idle.test 2011-12-16 11:01:45 +0000 @@ -0,0 +1,28 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no enabled idle instruments +select * from performance_schema.setup_instruments + where name like "idle" and enabled='YES'; + +# Expect no idle statistics collected + +select * from performance_schema.events_waits_summary_global_by_event_name + where event_name like "idle" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_thread_by_event_name + where event_name like "idle" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_user_by_event_name + where event_name like "idle" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_host_by_event_name + where event_name like "idle" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_account_by_event_name + where event_name like "idle" and count_star > 0; + === added file 'mysql-test/suite/perfschema/t/start_server_disable_stages-master.opt' --- a/mysql-test/suite/perfschema/t/start_server_disable_stages-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_stages-master.opt 2011-12-16 11:01:45 +0000 @@ -0,0 +1 @@ +--loose-performance-schema-instrument='stage/%=OFF' === added file 'mysql-test/suite/perfschema/t/start_server_disable_stages.test' --- a/mysql-test/suite/perfschema/t/start_server_disable_stages.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_stages.test 2011-12-16 11:01:45 +0000 @@ -0,0 +1,28 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no enabled stages instruments +select * from performance_schema.setup_instruments + where name like "stage/%" and enabled='YES'; + +# Expect no stage statistics collected + +select * from performance_schema.events_stages_summary_global_by_event_name + where count_star > 0; + +select * from performance_schema.events_stages_summary_by_thread_by_event_name + where count_star > 0; + +select * from performance_schema.events_stages_summary_by_user_by_event_name + where count_star > 0; + +select * from performance_schema.events_stages_summary_by_host_by_event_name + where count_star > 0; + +select * from performance_schema.events_stages_summary_by_account_by_event_name + where count_star > 0; + === added file 'mysql-test/suite/perfschema/t/start_server_disable_statements-master.opt' --- a/mysql-test/suite/perfschema/t/start_server_disable_statements-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_statements-master.opt 2011-12-16 11:01:45 +0000 @@ -0,0 +1 @@ +--loose-performance-schema-instrument='statement/%=OFF' === added file 'mysql-test/suite/perfschema/t/start_server_disable_statements.test' --- a/mysql-test/suite/perfschema/t/start_server_disable_statements.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_statements.test 2011-12-16 11:01:45 +0000 @@ -0,0 +1,28 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no enabled statements instruments +select * from performance_schema.setup_instruments + where name like "statement/%" and enabled='YES'; + +# Expect no statement statistics collected + +select * from performance_schema.events_statements_summary_global_by_event_name + where count_star > 0; + +select * from performance_schema.events_statements_summary_by_thread_by_event_name + where count_star > 0; + +select * from performance_schema.events_statements_summary_by_user_by_event_name + where count_star > 0; + +select * from performance_schema.events_statements_summary_by_host_by_event_name + where count_star > 0; + +select * from performance_schema.events_statements_summary_by_account_by_event_name + where count_star > 0; + === added file 'mysql-test/suite/perfschema/t/start_server_disable_waits-master.opt' --- a/mysql-test/suite/perfschema/t/start_server_disable_waits-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_waits-master.opt 2011-12-16 11:01:45 +0000 @@ -0,0 +1 @@ +--loose-performance-schema-instrument='wait/%=OFF' === added file 'mysql-test/suite/perfschema/t/start_server_disable_waits.test' --- a/mysql-test/suite/perfschema/t/start_server_disable_waits.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/perfschema/t/start_server_disable_waits.test 2011-12-16 11:01:45 +0000 @@ -0,0 +1,28 @@ +# Tests for PERFORMANCE_SCHEMA + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +--source ../include/start_server_common.inc + +# Expect no enabled waits instruments +select * from performance_schema.setup_instruments + where name like "wait/%" and enabled='YES'; + +# Expect no wait statistics collected + +select * from performance_schema.events_waits_summary_global_by_event_name + where event_name like "wait/%" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_thread_by_event_name + where event_name like "wait/%" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_user_by_event_name + where event_name like "wait/%" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_host_by_event_name + where event_name like "wait/%" and count_star > 0; + +select * from performance_schema.events_waits_summary_by_account_by_event_name + where event_name like "wait/%" and count_star > 0; + === modified file 'mysql-test/t/type_temporal_fractional.test' --- a/mysql-test/t/type_temporal_fractional.test 2011-11-21 15:17:51 +0000 +++ b/mysql-test/t/type_temporal_fractional.test 2011-12-16 16:57:46 +0000 @@ -7468,3 +7468,23 @@ DROP TABLE t1; ## alter session set nls_timestamp_format='YYYY-MM-DD HH24:MI:SS.FF'; ##select * from t1 where a=b; ##2011-04-09 15:36:32.225000 2011-04-09 15:36:32.225 + + +--echo # +--echo # BUG#13450867 - CRASH ON UPDATE A TIME COLUMN +--echo # +CREATE TABLE t1 (a TIME(6), b TIME(6), c TIME(6), d TIME(6)); +INSERT INTO t1 VALUES + ('-838:59:59.999999', '-838:59:59.000001', + '838:59:59.999999', '838:59:59.000001'); +SELECT * FROM t1; +UPDATE t1 SET + a= a - INTERVAL 999999 MICROSECOND, b= b - INTERVAL 1 MICROSECOND, + c= c + INTERVAL 999999 MICROSECOND, d= d + INTERVAL 1 MICROSECOND; +SELECT * FROM t1; +DROP TABLE t1; + +SELECT SEC_TO_TIME(3200399.999999); +SELECT SEC_TO_TIME(3200399.000001); +SELECT SEC_TO_TIME(-3200399.999999); +SELECT SEC_TO_TIME(-3200399.000001); === modified file 'scripts/mysql_system_tables.sql' --- a/scripts/mysql_system_tables.sql 2011-12-06 09:18:55 +0000 +++ b/scripts/mysql_system_tables.sql 2011-12-14 08:24:11 +0000 @@ -110,31 +110,31 @@ SET @sql_mode_orig=@@SESSION.sql_mode; SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION'; CREATE TABLE IF NOT EXISTS innodb_table_stats ( - database_name VARCHAR(64) NOT NULL, - table_name VARCHAR(64) NOT NULL, - last_update TIMESTAMP NOT NULL, - n_rows BIGINT UNSIGNED NOT NULL, - clustered_index_size BIGINT UNSIGNED NOT NULL, - sum_of_other_index_sizes BIGINT UNSIGNED NOT NULL, - PRIMARY KEY (database_name, table_name) + database_name VARCHAR(64) NOT NULL, + table_name VARCHAR(64) NOT NULL, + last_update TIMESTAMP NOT NULL, + n_rows BIGINT UNSIGNED NOT NULL, + clustered_index_size BIGINT UNSIGNED NOT NULL, + sum_of_other_index_sizes BIGINT UNSIGNED NOT NULL, + PRIMARY KEY (database_name, table_name) ) ENGINE=INNODB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS innodb_index_stats ( - database_name VARCHAR(64) NOT NULL, - table_name VARCHAR(64) NOT NULL, - index_name VARCHAR(64) NOT NULL, - last_update TIMESTAMP NOT NULL, - /* there are at least: - stat_name='size' - stat_name='n_leaf_pages' - stat_name='n_diff_pfx%' */ - stat_name VARCHAR(64) NOT NULL, - stat_value BIGINT UNSIGNED NOT NULL, - sample_size BIGINT UNSIGNED, - stat_description VARCHAR(1024) NOT NULL, - PRIMARY KEY (database_name, table_name, index_name, stat_name), - FOREIGN KEY (database_name, table_name) - REFERENCES innodb_table_stats (database_name, table_name) + database_name VARCHAR(64) NOT NULL, + table_name VARCHAR(64) NOT NULL, + index_name VARCHAR(64) NOT NULL, + last_update TIMESTAMP NOT NULL, + /* there are at least: + stat_name='size' + stat_name='n_leaf_pages' + stat_name='n_diff_pfx%' */ + stat_name VARCHAR(64) NOT NULL, + stat_value BIGINT UNSIGNED NOT NULL, + sample_size BIGINT UNSIGNED, + stat_description VARCHAR(1024) NOT NULL, + PRIMARY KEY (database_name, table_name, index_name, stat_name), + FOREIGN KEY (database_name, table_name) + REFERENCES innodb_table_stats (database_name, table_name) ) ENGINE=INNODB DEFAULT CHARSET=utf8; SET SESSION sql_mode=@sql_mode_orig; === modified file 'sql/item_timefunc.cc' --- a/sql/item_timefunc.cc 2011-11-21 11:58:25 +0000 +++ b/sql/item_timefunc.cc 2011-12-16 16:57:46 +0000 @@ -79,59 +79,51 @@ adjust_time_range_with_warn(MYSQL_TIME * /* - Convert seconds to MYSQL_TIME value with overflow checking + Convert seconds to MYSQL_TIME value with overflow checking. SYNOPSIS: sec_to_time() seconds number of seconds - unsigned_flag 1, if 'seconds' is unsigned, 0, otherwise ltime output MYSQL_TIME value - send_warn whether to send a generic warning on truncation DESCRIPTION If the 'seconds' argument is inside MYSQL_TIME data range, convert it to a corresponding value. - Otherwise, truncate the resulting value to the nearest endpoint, and - produce a warning message. + Otherwise, truncate the resulting value to the nearest endpoint. RETURN 1 if the value was truncated during conversion 0 otherwise */ -static bool sec_to_time(longlong seconds, bool unsigned_flag, - MYSQL_TIME *ltime, bool send_warn) +static bool sec_to_time(lldiv_t seconds, MYSQL_TIME *ltime) { - uint sec; + int warning= 0; set_zero_time(ltime, MYSQL_TIMESTAMP_TIME); - if (seconds < 0) + if (seconds.quot < 0 || seconds.rem < 0) { - if (unsigned_flag) - goto overflow; ltime->neg= 1; - if (seconds < -3020399) - goto overflow; - seconds= -seconds; + seconds.quot= -seconds.quot; + seconds.rem= -seconds.rem; } - else if (seconds > 3020399) - goto overflow; - sec= (uint) ((ulonglong) seconds % 3600); - ltime->hour= (uint) (seconds/3600); - ltime->minute= sec/60; - ltime->second= sec % 60; - - return 0; + if (seconds.quot > TIME_MAX_VALUE_SECONDS) + { + set_max_hhmmss(ltime); + return true; + } -overflow: - set_max_hhmmss(ltime); + ltime->hour= (uint) (seconds.quot / 3600); + uint sec= (uint) (seconds.quot % 3600); + ltime->minute= sec / 60; + ltime->second= sec % 60; + ltime->second_part= (uint) (seconds.rem / 1000); + + adjust_time_range(ltime, &warning); - if (send_warn) - make_truncated_value_warning(ErrConvString(seconds, unsigned_flag), - MYSQL_TIMESTAMP_TIME); - return 1; + return warning ? true : false; } @@ -1927,13 +1919,9 @@ bool Item_func_sec_to_time::get_time(MYS make_truncated_value_warning(ErrConvString(val), MYSQL_TIMESTAMP_TIME); return false; } - sec_to_time(seconds.quot, 0, ltime, true); - /* - Both negative seconds.quot and negative seconds.rem - affect ltime->neg, hence "|=" to combine them. - */ - ltime->neg|= seconds.rem < 0; - ltime->second_part= (seconds.rem < 0 ? -seconds.rem : seconds.rem) / 1000; + if (sec_to_time(seconds, ltime)) + make_truncated_value_warning(ErrConvString(val), + MYSQL_TIMESTAMP_TIME); return false; } @@ -2335,8 +2323,11 @@ bool Item_date_add_interval::get_time_in interval.second_part) * (interval.neg ? -1 : 1); longlong diff= usec1 + usec2; + lldiv_t seconds; + seconds.quot= diff / 1000000; + seconds.rem= diff % 1000000 * 1000; /* time->second_part= lldiv.rem / 1000 */ if ((null_value= (interval.year || interval.month || - sec_to_time(diff / 1000000, 0, ltime, false)))) + sec_to_time(seconds, ltime)))) { push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_DATETIME_FUNCTION_OVERFLOW, @@ -2344,8 +2335,6 @@ bool Item_date_add_interval::get_time_in "time"); return true; } - ltime->second_part= (diff % 1000000) * (diff < 0 ? -1 : 1); - ltime->time_type= MYSQL_TIMESTAMP_TIME; return false; } === modified file 'storage/innobase/dict/dict0stats.cc' --- a/storage/innobase/dict/dict0stats.cc 2011-12-07 17:18:09 +0000 +++ b/storage/innobase/dict/dict0stats.cc 2011-12-16 14:34:14 +0000 @@ -97,9 +97,15 @@ each page and diving below it. This way, a total of A leaf pages are analyzed for the given n-prefix. Let the number of different key values found in each leaf page i be Pi (i=1..A). +Let N_DIFF_AVG_LEAF be (P1 + P2 + ... + PA) / A. +Let the number of different key values on level LA be N_DIFF_LA. +Let the total number of records on level LA be TOTAL_LA. +Let R be N_DIFF_LA / TOTAL_LA, we assume this ratio is the same on the +leaf level. Let the number of leaf pages be N. Then the total number of different key values on the leaf level is: -N * (P1 + P2 + ... + PA) / A +N * R * N_DIFF_AVG_LEAF. +See REF01 for the implementation. The above describes how to calculate the cardinality of an index. This algorithm is executed for each n-prefix of a multi-column index @@ -358,7 +364,7 @@ an index. Each of the 1..n_uniq prefixes saved in the array n_diff[]. Notice that n_diff[] must be able to store n_uniq+1 numbers because the results are saved in n_diff[1] .. n_diff[n_uniq]. The total number of records on the level is -saved in total. +saved in total_recs. Also, the index of the last record in each group of equal records is saved in n_diff_boundaries[1..n_uniq], records indexing starts from the leftmost record on the level and continues cross pages boundaries, counting from 0. @@ -611,10 +617,13 @@ dict_stats_analyze_index_level( *total_pages, i, n_diff[i]); +#if 0 if (n_diff_boundaries != NULL) { ib_uint64_t j; - DEBUG_PRINTF(" %s(): boundaries: ", __func__); + DEBUG_PRINTF(" %s(): boundaries[%lu]: ", + __func__, i); + for (j = 0; j < n_diff[i]; j++) { ib_uint64_t idx; @@ -627,6 +636,7 @@ dict_stats_analyze_index_level( } DEBUG_PRINTF("\n"); } +#endif } #endif /* UNIV_STATS_DEBUG */ @@ -725,7 +735,6 @@ dict_stats_scan_page( index, FALSE, &matched_fields, &matched_bytes); - if (matched_fields < n_prefix) { /* rec != next_rec, => rec is non-boring */ @@ -852,7 +861,7 @@ dict_stats_analyze_index_below_cur( /* pages on level > 0 are not allowed to be empty */ ut_a(offsets_rec != NULL); - /* if page is not empty (rec != NULL) then n_diff must + /* if page is not empty (offsets_rec != NULL) then n_diff must be > 0, otherwise there is a bug in dict_stats_scan_page() */ ut_a(n_diff > 0); @@ -894,7 +903,7 @@ dict_stats_analyze_index_below_cur( } #if 0 - DEBUG_PRINTF(" %s(): n_diff below page_no=%lu: %llu\n", + DEBUG_PRINTF(" %s(): n_diff below page_no=%lu: " UINT64PF "\n", __func__, page_no, n_diff); #endif @@ -918,6 +927,8 @@ dict_stats_analyze_index_for_n_prefix( dict_index_t* index, /*!< in/out: index */ ulint level, /*!< in: level, must be >= 1 */ + ib_uint64_t total_recs_on_level, /*!< in: total number of + records on the given level */ ulint n_prefix, /*!< in: look at first n_prefix columns when comparing records */ @@ -953,8 +964,10 @@ dict_stats_analyze_index_for_n_prefix( n_prefix, n_diff_for_this_prefix); #endif - /* if this is 0 then there is exactly one page in the B-tree and it - is empty and we should have done full scan and should not be here */ + /* if some of those is 0 then this means that there is exactly one + page in the B-tree and it is empty and we should have done full scan + and should not be here */ + ut_ad(total_recs_on_level > 0); ut_ad(n_diff_for_this_prefix > 0); /* this is configured to be min 1, someone has changed the code */ @@ -1082,20 +1095,57 @@ dict_stats_analyze_index_for_n_prefix( ut_a(rec_idx == dive_below_idx); - n_diff_sum_of_all_analyzed_pages - += dict_stats_analyze_index_below_cur( - btr_pcur_get_btr_cur(&pcur), n_prefix, &mtr); + ib_uint64_t n_diff_on_leaf_page; + + n_diff_on_leaf_page = dict_stats_analyze_index_below_cur( + btr_pcur_get_btr_cur(&pcur), n_prefix, &mtr); + + /* We adjust n_diff_on_leaf_page here to avoid counting + one record twice - once as the last on some page and once + as the first on another page. Consider the following example: + Leaf level: + page: (2,2,2,2,3,3) + ... many pages like (3,3,3,3,3,3) ... + page: (3,3,3,3,5,5) + ... many pages like (5,5,5,5,5,5) ... + page: (5,5,5,5,8,8) + page: (8,8,8,8,9,9) + our algo would (correctly) get an estimate that there are + 2 distinct records per page (average). Having 4 pages below + non-boring records, it would (wrongly) estimate the number + of distinct records to 8. */ + if (n_diff_on_leaf_page > 0) { + n_diff_on_leaf_page--; + } + + n_diff_sum_of_all_analyzed_pages += n_diff_on_leaf_page; + } + + if (n_diff_sum_of_all_analyzed_pages == 0) { + n_diff_sum_of_all_analyzed_pages = 1; } + /* See REF01 for an explanation of the algorithm */ index->stat_n_diff_key_vals[n_prefix] - = index->stat_n_leaf_pages * n_diff_sum_of_all_analyzed_pages + = index->stat_n_leaf_pages + + * n_diff_for_this_prefix + / total_recs_on_level + + * n_diff_sum_of_all_analyzed_pages / n_recs_to_dive_below; index->stat_n_sample_sizes[n_prefix] = n_recs_to_dive_below; - DEBUG_PRINTF(" %s(): n_diff=" UINT64PF " for n_prefix=%lu\n", + DEBUG_PRINTF(" %s(): n_diff=" UINT64PF " for n_prefix=%lu " + "(%lu" + " * " UINT64PF " / " UINT64PF + " * " UINT64PF " / " UINT64PF ")\n", __func__, index->stat_n_diff_key_vals[n_prefix], - n_prefix); + n_prefix, + index->stat_n_leaf_pages, + n_diff_for_this_prefix, total_recs_on_level, + n_diff_sum_of_all_analyzed_pages, n_recs_to_dive_below); btr_pcur_close(&pcur); @@ -1321,7 +1371,7 @@ found_level: the given n_prefix */ dict_stats_analyze_index_for_n_prefix( - index, level, n_prefix, + index, level, total_recs, n_prefix, n_diff_on_level[n_prefix], &n_diff_boundaries[n_prefix]); } @@ -2226,11 +2276,11 @@ dict_stats_update( /* FTS auxiliary tables do not need persistent stats */ if ((ut_strcount(table->name, "FTS") > 0 - && (ut_strcount(table->name, "CONFIG") > 0 - || ut_strcount(table->name, "INDEX") > 0 - || ut_strcount(table->name, "DELETED") > 0 - || ut_strcount(table->name, "DOC_ID") > 0 - || ut_strcount(table->name, "ADDED") > 0))) { + && (ut_strcount(table->name, "CONFIG") > 0 + || ut_strcount(table->name, "INDEX") > 0 + || ut_strcount(table->name, "DELETED") > 0 + || ut_strcount(table->name, "DOC_ID") > 0 + || ut_strcount(table->name, "ADDED") > 0))) { goto transient; } === modified file 'storage/innobase/fts/fts0fts.cc' --- a/storage/innobase/fts/fts0fts.cc 2011-12-12 16:06:47 +0000 +++ b/storage/innobase/fts/fts0fts.cc 2011-12-16 11:18:13 +0000 @@ -2255,7 +2255,8 @@ fts_trx_add_op( dict_table_t* table, /*!< in: table */ doc_id_t doc_id, /*!< in: new doc id */ fts_row_state state, /*!< in: state of the row */ - ib_vector_t* fts_indexes) /*!< in: FTS indexes affected */ + ib_vector_t* fts_indexes) /*!< in: FTS indexes affected + (NULL=all) */ { fts_trx_table_t* tran_ftt; fts_trx_table_t* stmt_ftt; === modified file 'storage/innobase/include/fts0fts.h' --- a/storage/innobase/include/fts0fts.h 2011-11-30 10:09:12 +0000 +++ b/storage/innobase/include/fts0fts.h 2011-12-16 11:18:13 +0000 @@ -470,7 +470,9 @@ fts_trx_add_op( dict_table_t* table, /*!< in: table */ doc_id_t doc_id, /*!< in: doc id */ fts_row_state state, /*!< in: state of the row */ - ib_vector_t* indexes); /*!< in: FTS indexes affected */ + ib_vector_t* fts_indexes) /*!< in: FTS indexes affected + (NULL=all) */ + __attribute__((nonnull(1,2))); /******************************************************************//** Free an FTS trx. */ === modified file 'storage/innobase/include/sync0sync.h' --- a/storage/innobase/include/sync0sync.h 2011-11-11 08:46:18 +0000 +++ b/storage/innobase/include/sync0sync.h 2011-12-19 08:43:28 +0000 @@ -42,7 +42,7 @@ Created 9/5/1995 Heikki Tuuri #include "sync0arr.h" #if defined(UNIV_DEBUG) && !defined(UNIV_HOTBACKUP) -extern my_bool timed_mutexes; +extern "C" my_bool timed_mutexes; #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */ #ifdef HAVE_WINDOWS_ATOMICS === modified file 'storage/innobase/row/row0mysql.cc' --- a/storage/innobase/row/row0mysql.cc 2011-12-13 10:46:08 +0000 +++ b/storage/innobase/row/row0mysql.cc 2011-12-19 08:43:28 +0000 @@ -1345,7 +1345,7 @@ error_exit: } } - /* Pass NULL for the colums affected, since an INSERT affects + /* Pass NULL for the columns affected, since an INSERT affects all FTS indexes. */ fts_trx_add_op(trx, table, doc_id, FTS_INSERT, NULL); } No bundle (reason: useless for push emails).