List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:October 12 2011 8:16pm
Subject:bzr push into mysql-trunk-wl5908 branch (chris.powers:3425 to 3427) WL#5908
View as plain text  
 3427 Christopher Powers	2011-10-12
      WL#5908 PERFORMANCE_SCHEMA File IO Summary Extensions
      
      Changes per code review

    modified:
      scripts/mysql_system_tables.sql
      storage/perfschema/pfs.cc
      storage/perfschema/table_file_summary_by_event_name.cc
      storage/perfschema/table_file_summary_by_event_name.h
      storage/perfschema/table_file_summary_by_instance.cc
      storage/perfschema/table_file_summary_by_instance.h
 3426 Christopher Powers	2011-10-12 [merge]
      WL#5908 PERFORMANCE_SCHEMA File IO Summary Extensions
      
      - Downmerge from mysql-trunk

    added:
      mysql-test/std_data/bug11747887-bin.000002
      mysql-test/std_data/bug48633.ARM
      mysql-test/std_data/bug48633.ARZ
      mysql-test/std_data/bug48633.frm
      mysql-test/suite/rpl/r/binlog-hexdump.result
      mysql-test/suite/rpl/t/binlog-hexdump.test
    modified:
      mysql-test/collections/default.experimental
      mysql-test/r/archive.result
      mysql-test/r/ctype_utf16.result
      mysql-test/r/ctype_utf32.result
      mysql-test/r/ctype_utf8.result
      mysql-test/r/partition_innodb.result
      mysql-test/r/partition_myisam.result
      mysql-test/suite/engines/funcs/r/de_calendar_range.result
      mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result
      mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result
      mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result
      mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result
      mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result
      mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result
      mysql-test/suite/engines/funcs/r/up_calendar_range.result
      mysql-test/suite/engines/funcs/t/de_calendar_range.test
      mysql-test/suite/engines/funcs/t/in_calendar_2_unique_constraints_duplicate_update.test
      mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_duplicate_update.test
      mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_ignore.test
      mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_duplicate_update.test
      mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_ignore.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_duplicate_update.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_ignore.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_duplicate_update.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_error.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_ignore.test
      mysql-test/suite/engines/funcs/t/in_multicolumn_number_pk_constraint_duplicate_update.test
      mysql-test/suite/engines/funcs/t/up_calendar_range.test
      mysql-test/suite/rpl/t/rpl_parallel_switch_sequential.test
      mysql-test/t/archive.test
      mysql-test/t/ctype_utf16.test
      mysql-test/t/ctype_utf32.test
      mysql-test/t/ctype_utf8.test
      mysql-test/t/file_contents.test
      mysql-test/t/partition_innodb.test
      mysql-test/t/partition_myisam.test
      mysql-test/valgrind.supp
      scripts/mysql_install_db.pl.in
      scripts/mysql_install_db.sh
      sql/ha_partition.cc
      sql/item.h
      sql/item_sum.cc
      sql/item_sum.h
      sql/log_event.cc
      sql/rpl_info_file.cc
      sql/rpl_rli_pdb.cc
      sql/share/errmsg-utf8.txt
      sql/sql_table.cc
      sql/table.cc
      sql/udf_example.c
      storage/archive/azio.c
      storage/archive/ha_archive.cc
      storage/archive/ha_archive.h
      storage/innobase/btr/btr0cur.c
      storage/innobase/btr/btr0sea.c
      storage/innobase/buf/buf0buf.c
      storage/innobase/buf/buf0lru.c
      storage/innobase/ha/ha0ha.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/i_s.cc
      storage/innobase/ibuf/ibuf0ibuf.c
      storage/innobase/include/btr0sea.h
      storage/innobase/include/btr0types.h
      storage/innobase/include/buf0buf.h
      storage/innobase/include/ha0ha.h
      storage/innobase/include/ha0ha.ic
      storage/innobase/include/row0upd.ic
      storage/innobase/include/sync0sync.h
      storage/innobase/page/page0page.c
      storage/innobase/row/row0sel.c
      storage/innobase/sync/sync0sync.c
      storage/perfschema/table_ews_by_thread_by_event_name.cc
      storage/perfschema/table_file_summary_by_event_name.cc
      storage/perfschema/table_socket_summary_by_event_name.cc
      storage/perfschema/table_socket_summary_by_instance.cc
      storage/perfschema/table_socket_summary_by_instance.h
 3425 Christopher Powers	2011-10-06 [merge]
      downmerge with mysql-trunk

    removed:
      mysql-test/collections/default.release
      mysql-test/r/join_cache_bka_nobnl.result
      mysql-test/r/join_nested_bka_nobnl.result
      mysql-test/r/join_outer_bka_nobnl.result
      mysql-test/r/select_all_bka_nobnl.result
      mysql-test/r/select_icp_mrr_bka_nobnl.result
      mysql-test/r/select_none_bka_nobnl.result
      mysql-test/r/subquery_all_bka_nobnl.result
      mysql-test/r/subquery_nomat_nosj_bka_nobnl.result
      mysql-test/r/subquery_none_bka_nobnl.result
      mysql-test/r/subquery_sj_all_bka_nobnl.result
      mysql-test/r/subquery_sj_dupsweed_bka_nobnl.result
      mysql-test/r/subquery_sj_firstmatch_bka_nobnl.result
      mysql-test/r/subquery_sj_innodb_all_bka_nobnl.result
      mysql-test/r/subquery_sj_innodb_none_bka_nobnl.result
      mysql-test/r/subquery_sj_loosescan_bka_nobnl.result
      mysql-test/r/subquery_sj_mat_bka_nobnl.result
      mysql-test/r/subquery_sj_none_bka_nobnl.result
      mysql-test/t/join_cache_bka_nobnl.test
      mysql-test/t/join_nested_bka_nobnl.test
      mysql-test/t/join_outer_bka_nobnl.test
      mysql-test/t/select_all_bka_nobnl.test
      mysql-test/t/select_icp_mrr_bka_nobnl.test
      mysql-test/t/select_none_bka_nobnl.test
      mysql-test/t/subquery_all_bka_nobnl.test
      mysql-test/t/subquery_nomat_nosj_bka_nobnl.test
      mysql-test/t/subquery_none_bka_nobnl.test
      mysql-test/t/subquery_sj_all_bka_nobnl.test
      mysql-test/t/subquery_sj_dupsweed_bka_nobnl.test
      mysql-test/t/subquery_sj_firstmatch_bka_nobnl.test
      mysql-test/t/subquery_sj_innodb_all_bka_nobnl.test
      mysql-test/t/subquery_sj_innodb_none_bka_nobnl.test
      mysql-test/t/subquery_sj_loosescan_bka_nobnl.test
      mysql-test/t/subquery_sj_mat_bka_nobnl.test
      mysql-test/t/subquery_sj_none_bka_nobnl.test
    added:
      mysql-test/collections/default.release.in
      mysql-test/r/join_cache_bka_nixbnl.result
      mysql-test/r/join_nested_bka_nixbnl.result
      mysql-test/r/join_outer_bka_nixbnl.result
      mysql-test/r/select_all_bka_nixbnl.result
      mysql-test/r/select_icp_mrr_bka_nixbnl.result
      mysql-test/r/select_none_bka_nixbnl.result
      mysql-test/r/subquery_all_bka_nixbnl.result
      mysql-test/r/subquery_nomat_nosj_bka_nixbnl.result
      mysql-test/r/subquery_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result
      mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result
      mysql-test/r/subquery_sj_innodb_all_bka_nixbnl.result
      mysql-test/r/subquery_sj_innodb_none_bka_nixbnl.result
      mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result
      mysql-test/r/subquery_sj_mat_bka_nixbnl.result
      mysql-test/r/subquery_sj_none_bka_nixbnl.result
      mysql-test/suite/innodb/t/innodb_bug47167-master.opt
      mysql-test/suite/innodb/t/innodb_file_format-master.opt
      mysql-test/suite/rpl/r/rpl_general_log.result
      mysql-test/suite/rpl/r/rpl_replicate_rewrite_db.result
      mysql-test/suite/rpl/t/rpl_general_log.test
      mysql-test/suite/rpl/t/rpl_replicate_rewrite_db.test
      mysql-test/suite/sys_vars/r/innodb_analyze_is_persistent_basic.result
      mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
      mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
      mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
      mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
      mysql-test/suite/sys_vars/r/innodb_print_all_deadlocks_basic.result
      mysql-test/suite/sys_vars/r/innodb_stats_persistent_sample_pages_basic.result
      mysql-test/suite/sys_vars/r/innodb_stats_transient_sample_pages_basic.result
      mysql-test/suite/sys_vars/r/innodb_sync_array_size_basic.result
      mysql-test/suite/sys_vars/t/innodb_analyze_is_persistent_basic.test
      mysql-test/suite/sys_vars/t/innodb_file_format_max_basic-master.opt
      mysql-test/suite/sys_vars/t/innodb_monitor_disable_basic.test
      mysql-test/suite/sys_vars/t/innodb_monitor_enable_basic.test
      mysql-test/suite/sys_vars/t/innodb_monitor_reset_all_basic.test
      mysql-test/suite/sys_vars/t/innodb_monitor_reset_basic.test
      mysql-test/suite/sys_vars/t/innodb_print_all_deadlocks_basic.test
      mysql-test/suite/sys_vars/t/innodb_stats_persistent_sample_pages_basic.test
      mysql-test/suite/sys_vars/t/innodb_stats_transient_sample_pages_basic.test
      mysql-test/suite/sys_vars/t/innodb_sync_array_size_basic.test
      mysql-test/t/join_cache_bka_nixbnl.test
      mysql-test/t/join_nested_bka_nixbnl.test
      mysql-test/t/join_outer_bka_nixbnl.test
      mysql-test/t/select_all_bka_nixbnl.test
      mysql-test/t/select_icp_mrr_bka_nixbnl.test
      mysql-test/t/select_none_bka_nixbnl.test
      mysql-test/t/subquery_all_bka_nixbnl.test
      mysql-test/t/subquery_nomat_nosj_bka_nixbnl.test
      mysql-test/t/subquery_none_bka_nixbnl.test
      mysql-test/t/subquery_sj_all_bka_nixbnl.test
      mysql-test/t/subquery_sj_dupsweed_bka_nixbnl.test
      mysql-test/t/subquery_sj_firstmatch_bka_nixbnl.test
      mysql-test/t/subquery_sj_innodb_all_bka_nixbnl.test
      mysql-test/t/subquery_sj_innodb_none_bka_nixbnl.test
      mysql-test/t/subquery_sj_loosescan_bka_nixbnl.test
      mysql-test/t/subquery_sj_mat_bka_nixbnl.test
      mysql-test/t/subquery_sj_none_bka_nixbnl.test
    modified:
      .bzrignore
      VERSION
      include/my_pthread.h
      libmysqld/lib_sql.cc
      mysql-test/CMakeLists.txt
      mysql-test/collections/README
      mysql-test/collections/default.experimental
      mysql-test/include/commit.inc
      mysql-test/include/explain_non_select.inc
      mysql-test/include/icp_tests.inc
      mysql-test/include/mrr_tests.inc
      mysql-test/include/mtr_check.sql
      mysql-test/include/subquery_sj.inc
      mysql-test/lib/My/CoreDump.pm
      mysql-test/mysql-test-run.pl
      mysql-test/r/commit_1innodb.result
      mysql-test/r/derived.result
      mysql-test/r/error_simulation.result
      mysql-test/r/index_merge_myisam.result
      mysql-test/r/innodb_explain_non_select_all.result
      mysql-test/r/innodb_explain_non_select_none.result
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/innodb_mrr.result
      mysql-test/r/innodb_mrr_all.result
      mysql-test/r/innodb_mrr_cost.result
      mysql-test/r/innodb_mrr_cost_all.result
      mysql-test/r/innodb_mrr_cost_icp.result
      mysql-test/r/innodb_mrr_icp.result
      mysql-test/r/innodb_mrr_none.result
      mysql-test/r/join_cache_bka.result
      mysql-test/r/join_cache_bkaunique.result
      mysql-test/r/join_cache_nojb.result
      mysql-test/r/join_nested_bka.result
      mysql-test/r/join_outer_bka.result
      mysql-test/r/myisam_explain_non_select_all.result
      mysql-test/r/myisam_explain_non_select_none.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/r/myisam_mrr.result
      mysql-test/r/myisam_mrr_all.result
      mysql-test/r/myisam_mrr_cost.result
      mysql-test/r/myisam_mrr_cost_all.result
      mysql-test/r/myisam_mrr_cost_icp.result
      mysql-test/r/myisam_mrr_icp.result
      mysql-test/r/myisam_mrr_none.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/optimizer_switch.result
      mysql-test/r/partition.result
      mysql-test/r/partition_innodb_plugin.result
      mysql-test/r/partition_myisam.result
      mysql-test/r/select_all_bka.result
      mysql-test/r/select_icp_mrr_bka.result
      mysql-test/r/select_none_bka.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_nomat_nosj_bka.result
      mysql-test/r/subquery_none_bka.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.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_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_innodb_all_bka.result
      mysql-test/r/subquery_sj_innodb_all_bkaunique.result
      mysql-test/r/subquery_sj_innodb_none_bka.result
      mysql-test/r/subquery_sj_innodb_none_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.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_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_bkaunique.result
      mysql-test/suite/innodb/r/innodb_bug52745.result
      mysql-test/suite/innodb/r/innodb_bug53591.result
      mysql-test/suite/innodb/r/innodb_file_format.result
      mysql-test/suite/innodb/r/innodb_index_large_prefix.result
      mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result
      mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
      mysql-test/suite/innodb/t/innodb-autoinc-44030.test
      mysql-test/suite/innodb/t/innodb-autoinc.test
      mysql-test/suite/innodb/t/innodb-create-options.test
      mysql-test/suite/innodb/t/innodb-index.test
      mysql-test/suite/innodb/t/innodb-zip.test
      mysql-test/suite/innodb/t/innodb_bug36172.test
      mysql-test/suite/innodb/t/innodb_bug52745.test
      mysql-test/suite/innodb/t/innodb_bug53591.test
      mysql-test/suite/innodb/t/innodb_bug56680.test
      mysql-test/suite/innodb/t/innodb_file_format.test
      mysql-test/suite/innodb/t/innodb_index_large_prefix.test
      mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
      mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
      mysql-test/suite/opt_trace/include/subquery.inc
      mysql-test/suite/opt_trace/r/bugs_no_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
      mysql-test/suite/opt_trace/r/filesort_pq.result
      mysql-test/suite/opt_trace/r/general2_no_prot.result
      mysql-test/suite/opt_trace/r/general2_ps_prot.result
      mysql-test/suite/opt_trace/r/general_no_prot_all.result
      mysql-test/suite/opt_trace/r/general_no_prot_none.result
      mysql-test/suite/opt_trace/r/general_ps_prot_all.result
      mysql-test/suite/opt_trace/r/general_ps_prot_none.result
      mysql-test/suite/opt_trace/r/range_no_prot.result
      mysql-test/suite/opt_trace/r/range_ps_prot.result
      mysql-test/suite/opt_trace/r/subquery_no_prot.result
      mysql-test/suite/opt_trace/r/subquery_ps_prot.result
      mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
      mysql-test/suite/rpl/r/rpl_packet.result
      mysql-test/suite/rpl/r/rpl_row_event_max_size.result
      mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
      mysql-test/suite/rpl/t/rpl_packet.test
      mysql-test/suite/rpl/t/rpl_row_event_max_size.test
      mysql-test/suite/sys_vars/r/all_vars.result
      mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
      mysql-test/t/derived.test
      mysql-test/t/error_simulation.test
      mysql-test/t/join_cache_bka.test
      mysql-test/t/join_cache_bkaunique.test
      mysql-test/t/join_cache_nojb.test
      mysql-test/t/join_nested_bka.test
      mysql-test/t/join_outer_bka.test
      mysql-test/t/partition.test
      mysql-test/t/partition_innodb_plugin.test
      mysql-test/t/partition_myisam.test
      mysql-test/t/select_all_bka.test
      mysql-test/t/select_icp_mrr_bka.test
      mysql-test/t/select_none_bka.test
      mysql-test/t/subquery_all_bka.test
      mysql-test/t/subquery_nomat_nosj_bka.test
      mysql-test/t/subquery_none_bka.test
      mysql-test/t/subquery_sj_all_bka.test
      mysql-test/t/subquery_sj_all_bkaunique.test
      mysql-test/t/subquery_sj_dupsweed_bka.test
      mysql-test/t/subquery_sj_dupsweed_bkaunique.test
      mysql-test/t/subquery_sj_firstmatch.test
      mysql-test/t/subquery_sj_firstmatch_bka.test
      mysql-test/t/subquery_sj_firstmatch_bkaunique.test
      mysql-test/t/subquery_sj_innodb_all_bka.test
      mysql-test/t/subquery_sj_innodb_all_bkaunique.test
      mysql-test/t/subquery_sj_innodb_none_bka.test
      mysql-test/t/subquery_sj_innodb_none_bkaunique.test
      mysql-test/t/subquery_sj_loosescan_bka.test
      mysql-test/t/subquery_sj_loosescan_bkaunique.test
      mysql-test/t/subquery_sj_mat_bka.test
      mysql-test/t/subquery_sj_mat_bkaunique.test
      mysql-test/t/subquery_sj_none_bka.test
      mysql-test/t/subquery_sj_none_bkaunique.test
      scripts/mysqld_safe.sh
      sql/event_scheduler.cc
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/item_subselect.cc
      sql/item_subselect.h
      sql/log_event.cc
      sql/mysqld.cc
      sql/opt_explain.cc
      sql/opt_range.cc
      sql/opt_trace.cc
      sql/opt_trace.h
      sql/opt_trace2server.cc
      sql/rpl_slave.cc
      sql/sp_head.cc
      sql/sql_class.cc
      sql/sql_insert.cc
      sql/sql_list.h
      sql/sql_parse.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sys_vars.cc
      storage/innobase/buf/buf0buf.c
      storage/innobase/buf/buf0lru.c
      storage/innobase/dict/dict0stats.c
      storage/innobase/handler/i_s.cc
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0buf.ic
      storage/innobase/include/buf0types.h
      storage/innobase/include/sync0rw.h
      storage/innobase/include/sync0rw.ic
      storage/innobase/include/ut0crc32.h
      storage/innobase/os/os0file.c
      storage/innobase/rem/rem0rec.c
      storage/innobase/srv/srv0start.c
      storage/innobase/sync/sync0rw.c
      storage/innobase/ut/ut0crc32.c
      storage/myisam/ha_myisam.cc
      support-files/mysql.spec.sh
      tests/mysql_client_test.c
      unittest/gunit/opt_trace-t.cc
      unittest/gunit/sql_list-t.cc
      unittest/mysys/my_atomic-t.c
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-10-04 10:55:09 +0000
+++ b/mysql-test/collections/default.experimental	2011-10-07 08:36:04 +0000
@@ -41,6 +41,6 @@ sys_vars.have_ndbcluster_basic
 sys_vars.ndb_log_updated_only_basic
 sys_vars.rpl_init_slave_func		 # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5
 
-rpl.rpl_mixed_mts_rec_crash_safe @solaris          # Bug 12902514 2011-08-19 andrei mts recovery tests are slow
-rpl.rpl_mixed_mts_rec_crash_safe_checksum @solaris # same as rpl_mixed_mts_rec_crash_safe
-rpl.rpl_mixed_mts_crash_safe @solaris              # same as rpl_mixed_mts_rec_crash_safe
+rpl.rpl_mixed_mts_rec_crash_safe @solaris          # Bug#12902514 2011-08-19 andrei mts recovery tests are slow
+rpl.rpl_mixed_mts_rec_crash_safe_checksum @solaris # Bug#12902514 2011-08-19 andrei same as rpl_mixed_mts_rec_crash_safe
+rpl.rpl_mixed_mts_crash_safe @solaris              # Bug#12902514 2011-08-19 andrei same as rpl_mixed_mts_rec_crash_safe

=== modified file 'mysql-test/r/archive.result'
--- a/mysql-test/r/archive.result	2011-03-03 09:22:17 +0000
+++ b/mysql-test/r/archive.result	2011-10-06 13:51:28 +0000
@@ -12729,15 +12729,17 @@ id	id	name	name
 2	2	a	b
 DROP TABLE t1,t2;
 SHOW CREATE TABLE t1;
-ERROR HY000: Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `col1` int(11) DEFAULT NULL,
+  `col2` varchar(20) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
 SELECT * FROM t1;
-ERROR HY000: Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+col1	col2
 INSERT INTO t1 (col1, col2) VALUES (1, "value");
-ERROR HY000: Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
 REPAIR TABLE t1;
 Table	Op	Msg_type	Msg_text
-test.t1	repair	Error	Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
-test.t1	repair	error	Corrupt
+test.t1	repair	status	OK
 DROP TABLE t1;
 #
 # BUG#48757 - missing .ARZ file causes server crash
@@ -12823,3 +12825,59 @@ a	b	c	d	e	f
 -1	b	c	d	e	1
 DROP TABLE t1;
 SET sort_buffer_size=DEFAULT;
+#
+# BUG#11756687 - 48633: ARCHIVE TABLES ARE NOT UPGRADEABLE
+#
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` text,
+  `c` varchar(255) DEFAULT NULL,
+  `d` blob,
+  `e` blob
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a	b	c	d	e
+1	text	varchar	blob1	blob2
+2	text	varchar	blob1	blob2
+SELECT * FROM t1;
+a	b	c	d	e
+1	text	varchar	blob1	blob2
+2	text	varchar	blob1	blob2
+FLUSH TABLE t1;
+SELECT * FROM t1;
+a	b	c	d	e
+1	text	varchar	blob1	blob2
+2	text	varchar	blob1	blob2
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	error	Table upgrade required. Please do "REPAIR TABLE `t1`" or dump/reload to fix it!
+SELECT * FROM t1;
+a	b	c	d	e
+1	text	varchar	blob1	blob2
+2	text	varchar	blob1	blob2
+INSERT INTO t1 VALUES(3, 'text', 'varchar', 'blob1', 'blob2');
+SELECT * FROM t1;
+a	b	c	d	e
+1	text	varchar	blob1	blob2
+2	text	varchar	blob1	blob2
+3	text	varchar	blob1	blob2
+FLUSH TABLE t1;
+SELECT * FROM t1;
+a	b	c	d	e
+1	text	varchar	blob1	blob2
+2	text	varchar	blob1	blob2
+3	text	varchar	blob1	blob2
+REPAIR TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	status	OK
+SELECT * FROM t1;
+a	b	c	d	e
+1	text	varchar	blob1	blob2
+2	text	varchar	blob1	blob2
+3	text	varchar	blob1	blob2
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	status	OK
+DROP TABLE t1;

=== modified file 'mysql-test/r/ctype_utf16.result'
--- a/mysql-test/r/ctype_utf16.result	2011-09-22 10:42:10 +0000
+++ b/mysql-test/r/ctype_utf16.result	2011-10-12 13:58:31 +0000
@@ -1133,6 +1133,20 @@ NULL
 Warnings:
 Warning	1301	Result of space() was larger than max_allowed_packet (1048576) - truncated
 #
+# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+#
+SET NAMES utf8, @@character_set_connection=utf16;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+id	l
+a	512
+Warnings:
+Warning	1260	Row 1 was cut by GROUP_CONCAT()
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/ctype_utf32.result'
--- a/mysql-test/r/ctype_utf32.result	2011-03-01 12:20:38 +0000
+++ b/mysql-test/r/ctype_utf32.result	2011-10-12 13:58:31 +0000
@@ -1188,6 +1188,20 @@ CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END
 b
 DROP TABLE t1;
 #
+# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+#
+SET NAMES utf8, @@character_set_connection=utf32;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+id	l
+a	256
+Warnings:
+Warning	1260	Row 1 was cut by GROUP_CONCAT()
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/ctype_utf8.result	2011-10-12 13:58:31 +0000
@@ -2879,7 +2879,7 @@ create table t1 as select group_concat(1
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `c1` varchar(342) CHARACTER SET utf8 DEFAULT NULL
+  `c1` text CHARACTER SET utf8
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 as select 1 as c1 union select 'a';
@@ -5124,6 +5124,20 @@ id	select_type	table	type	possible_keys
 Warnings:
 Note	1003	/* select#1 */ select 'abcdÁÂÃÄÅ' AS `abcdÁÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÁÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÁÂÃÄÅ`
 #
+# Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+#
+SET NAMES utf8;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+id	l
+a	1024
+Warnings:
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result	2011-08-29 07:08:18 +0000
+++ b/mysql-test/r/partition_innodb.result	2011-10-07 08:30:01 +0000
@@ -1,5 +1,16 @@
 drop table if exists t1, t2;
 #
+# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
+#               and PARTITIONING
+#
+CREATE TABLE t1 (a INT, KEY(a))
+ENGINE = InnoDB
+PARTITION BY KEY (a) PARTITIONS 1;
+SELECT 1 FROM t1 WHERE a > (SELECT LAST_INSERT_ID() FROM t1 LIMIT 0)
+ORDER BY a;
+1
+DROP TABLE t1;
+#
 # Bug#56287: crash when using Partition datetime in sub in query
 #
 CREATE TABLE t1

=== modified file 'mysql-test/r/partition_myisam.result'
--- a/mysql-test/r/partition_myisam.result	2011-10-06 09:50:40 +0000
+++ b/mysql-test/r/partition_myisam.result	2011-10-07 14:20:21 +0000
@@ -1,5 +1,25 @@
 DROP TABLE IF EXISTS t1, t2;
 #
+# Bug#11763825/56590: PARTITIONS: FULLTEXT SEARCHES FAIL
+# (bad/confusing error message)
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+b VARCHAR(200),
+c TEXT)
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+CREATE FULLTEXT INDEX msg ON t1 (b, c);
+ERROR HY000: FULLTEXT index is not supported for partitioned tables.
+DROP TABLE t1;
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+b VARCHAR(200),
+c TEXT,
+FULLTEXT (b, c))
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+ERROR HY000: FULLTEXT index is not supported for partitioned tables.
+#
 # BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE
 #
 CREATE TABLE t1 (

=== added file 'mysql-test/std_data/bug11747887-bin.000002'
Files a/mysql-test/std_data/bug11747887-bin.000002	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug11747887-bin.000002	2011-10-10 06:22:13 +0000 differ

=== added file 'mysql-test/std_data/bug48633.ARM'
Files a/mysql-test/std_data/bug48633.ARM	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug48633.ARM	2011-10-06 13:51:28 +0000 differ

=== added file 'mysql-test/std_data/bug48633.ARZ'
Files a/mysql-test/std_data/bug48633.ARZ	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug48633.ARZ	2011-10-06 13:51:28 +0000 differ

=== added file 'mysql-test/std_data/bug48633.frm'
Files a/mysql-test/std_data/bug48633.frm	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug48633.frm	2011-10-06 13:51:28 +0000 differ

=== modified file 'mysql-test/suite/engines/funcs/r/de_calendar_range.result'
--- a/mysql-test/suite/engines/funcs/r/de_calendar_range.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/de_calendar_range.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1,t2,t3;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -89,3 +90,4 @@ c1
 2007-02-16 12:10:34
 2007-02-17 13:10:34
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result'
--- a/mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_2_unique_constraints_duplicate_update.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NULL, c3 DATE NULL, PRIMARY KEY(c1), UNIQUE(c2));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'4 04:01:01'),NOW());
@@ -128,3 +129,4 @@ c1	c2	c3
 2003	2001	2000
 2004	2000	2000
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result'
--- a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_duplicate_update.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -82,3 +83,4 @@ c1
 2000
 2011
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result'
--- a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_error.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -87,3 +88,4 @@ c1
 1999
 2000
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result'
--- a/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_pk_constraint_ignore.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -87,3 +88,4 @@ c1
 1999
 2000
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result'
--- a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_duplicate_update.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL UNIQUE);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -82,3 +83,4 @@ c1
 2000
 2011
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result'
--- a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_error.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL UNIQUE);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -87,3 +88,4 @@ c1
 1999
 2000
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result'
--- a/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_calendar_unique_constraint_ignore.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL UNIQUE);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -81,3 +82,4 @@ c1
 1999
 2000
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result'
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_duplicate_update.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -144,3 +145,4 @@ c1	c2	c3
 2011	2011	2000
 2011	2011	2011
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result'
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_error.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -147,3 +148,4 @@ c1	c2	c3
 1999	2000	1999
 2000	1999	1999
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result'
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_pk_constraint_ignore.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -147,3 +148,4 @@ c1	c2	c3
 1999	2000	1999
 2000	1999	1999
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result'
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_duplicate_update.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -144,3 +145,4 @@ c1	c2	c3
 2011	2011	2000
 2011	2011	2011
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result'
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_error.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -147,3 +148,4 @@ c1	c2	c3
 1999	2000	1999
 2000	1999	1999
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result'
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_calendar_unique_constraint_ignore.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -139,3 +140,4 @@ c1	c2	c3
 1999	2000	1999
 2000	1999	1999
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result'
--- a/mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/in_multicolumn_number_pk_constraint_duplicate_update.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -144,3 +145,4 @@ c1	c2	c3
 2011	2011	2000
 2011	2011	2011
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/r/up_calendar_range.result'
--- a/mysql-test/suite/engines/funcs/r/up_calendar_range.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/up_calendar_range.result	2011-10-12 04:40:52 +0000
@@ -1,4 +1,5 @@
 DROP TABLE IF EXISTS t1,t2,t3;
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL);
 SET TIMESTAMP=1171346973;
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -104,3 +105,4 @@ c1
 2007-02-13 09:09:33
 2007-02-14 10:10:34
 DROP TABLE t1;
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/de_calendar_range.test'
--- a/mysql-test/suite/engines/funcs/t/de_calendar_range.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/de_calendar_range.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -45,4 +47,5 @@ SELECT * FROM t1 ORDER BY c1;
 DELETE FROM t1 WHERE c1 <= ADDTIME(NOW(),'2 02:01:01');
 SELECT * FROM t1 ORDER BY c1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_calendar_2_unique_constraints_duplicate_update.test'
--- a/mysql-test/suite/engines/funcs/t/in_calendar_2_unique_constraints_duplicate_update.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_calendar_2_unique_constraints_duplicate_update.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NULL, c3 DATE NULL, PRIMARY KEY(c1), UNIQUE(c2));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),ADDTIME(NOW(),'4 04:01:01'),NOW());
@@ -70,4 +72,6 @@ INSERT INTO t1 (c1,c2,c3) VALUES(2000,20
 --sorted_result
 SELECT * FROM t1;
 DROP TABLE t1;
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;
 

=== modified file 'mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_duplicate_update.test'
--- a/mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_duplicate_update.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_duplicate_update.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(1999) ON DUPL
 --sorted_result
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_error.test'
--- a/mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_error.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_error.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(2000);
 INSERT INTO t1 (c1) VALUES(1999);
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_ignore.test'
--- a/mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_ignore.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_calendar_pk_constraint_ignore.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL PRIMARY KEY);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -61,4 +63,6 @@ INSERT INTO t1 (c1) VALUES(2000);
 INSERT INTO t1 (c1) VALUES(1999);
 SELECT * FROM t1;
 DROP TABLE t1;
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;
 

=== modified file 'mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_duplicate_update.test'
--- a/mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_duplicate_update.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_duplicate_update.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL UNIQUE);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(1999) ON DUPL
 --sorted_result
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_error.test'
--- a/mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_error.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_error.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL UNIQUE);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -61,4 +63,5 @@ INSERT INTO t1 (c1) VALUES(2000);
 INSERT INTO t1 (c1) VALUES(1999);
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_ignore.test'
--- a/mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_ignore.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_calendar_unique_constraint_ignore.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL UNIQUE);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -53,4 +55,5 @@ INSERT INTO t1 (c1) VALUES(2000);
 INSERT IGNORE INTO t1 (c1) VALUES(1999);
 SELECT * FROM t1;
 DROP TABLE t1;
-
+#restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_duplicate_update.test'
--- a/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_duplicate_update.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_duplicate_update.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -85,4 +87,6 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,19
 --sorted_result
 SELECT * FROM t1;
 DROP TABLE t1;
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;
 

=== modified file 'mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_error.test'
--- a/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_error.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_error.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -93,4 +95,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,19
 INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_ignore.test'
--- a/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_ignore.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_pk_constraint_ignore.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -93,4 +95,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,19
 INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_duplicate_update.test'
--- a/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_duplicate_update.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_duplicate_update.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -85,4 +87,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,19
 --sorted_result
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_error.test'
--- a/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_error.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_error.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -93,4 +95,5 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,19
 INSERT INTO t1 (c1,c2,c3) VALUES(1999,1999,2000);
 SELECT * FROM t1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== modified file 'mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_ignore.test'
--- a/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_ignore.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_calendar_unique_constraint_ignore.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NULL, c2 DATE NULL, c3 DATE NULL, UNIQUE(c1,c2,c3));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -85,4 +87,6 @@ INSERT IGNORE INTO t1 (c1,c2,c3) VALUES(
 --sorted_result
 SELECT * FROM t1;
 DROP TABLE t1;
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;
 

=== modified file 'mysql-test/suite/engines/funcs/t/in_multicolumn_number_pk_constraint_duplicate_update.test'
--- a/mysql-test/suite/engines/funcs/t/in_multicolumn_number_pk_constraint_duplicate_update.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/in_multicolumn_number_pk_constraint_duplicate_update.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NOT NULL, c3 DATE NOT NULL, PRIMARY KEY(c1,c2,c3));
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1,c2,c3) VALUES(NOW(),NOW(),NOW());
@@ -93,4 +95,6 @@ INSERT INTO t1 (c1,c2,c3) VALUES(1999,19
 --sorted_result
 SELECT * FROM t1;
 DROP TABLE t1;
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;
 

=== modified file 'mysql-test/suite/engines/funcs/t/up_calendar_range.test'
--- a/mysql-test/suite/engines/funcs/t/up_calendar_range.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/t/up_calendar_range.test	2011-10-12 04:40:52 +0000
@@ -1,6 +1,8 @@
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3;
 --enable_warnings
+# Set Correct timezone to match result
+SET TIME_ZONE="+03:00";
 CREATE TABLE t1(c1 DATE NOT NULL);
 SET TIMESTAMP=1171346973; # 2007-02-13 15:09:33
 INSERT INTO t1 (c1) VALUES(NOW());
@@ -53,4 +55,5 @@ UPDATE t1 SET c1 = NOW() WHERE c1 >= ADD
 --sorted_result
 SELECT * FROM t1 ORDER BY c1;
 DROP TABLE t1;
-
+# Restore timezone to default
+SET TIME_ZONE= @@global.time_zone;

=== added file 'mysql-test/suite/rpl/r/binlog-hexdump.result'
--- a/mysql-test/suite/rpl/r/binlog-hexdump.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/binlog-hexdump.result	2011-10-10 06:22:13 +0000
@@ -0,0 +1,88 @@
+include/master-slave.inc
+[connection master]
+include/rpl_reset.inc
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+# at 4
+#110927 20:57:19 server id 1  end_log_pos 114 
+# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
+#        4 7f 0e 82 4e   0f   01 00 00 00   6e 00 00 00   72 00 00 00   00 00
+#       17 04 00 35 2e 36 2e 34 2d  6d 35 2d 64 65 62 75 67 |..5.6.4.m5.debug|
+#       27 2d 6c 6f 67 00 00 00 00  00 00 00 00 00 00 00 00 |.log............|
+#       37 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
+#       47 00 00 00 00 7f 0e 82 4e  13 38 0d 00 08 00 12 00 |.......N.8......|
+#       57 04 04 04 04 12 00 00 56  00 04 1a 08 00 00 00 08 |.......V........|
+#       67 08 08 02 00 00 00 00 93  fa cd dc                |...........|
+# 	Start: binlog v 4, server v 5.6.4-m5-debug-log created 110927 20:57:19 at startup
+ROLLBACK/*!*/;
+BINLOG '
+fw6CTg8BAAAAbgAAAHIAAAAAAAQANS42LjQtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAB/DoJOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAJP6zdw=
+'/*!*/;
+# at 114
+#110927 20:57:23 server id 1  end_log_pos 231 
+# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
+#       72 83 0e 82 4e   02   01 00 00 00   75 00 00 00   e7 00 00 00   00 00
+#       85 01 00 00 00 00 00 00 00  04 00 00 21 00 00 00 00 |................|
+#       95 00 00 01 00 00 00 00 00  00 00 00 06 03 73 74 64 |.............std|
+#       a5 04 21 00 21 00 08 00 0c  01 74 65 73 74 00 74 65 |.........test.te|
+#       b5 73 74 00 63 72 65 61 74  65 20 74 61 62 6c 65 20 |st.create.table.|
+#       c5 74 31 20 28 61 20 65 6e  75 6d 28 27 6f 6e 65 27 |t1..a.enum..one.|
+#       d5 2c 20 27 74 77 6f 27 2c  20 27 74 68 72 65 65 27 |...two....three.|
+#       e5 29 29                                            |..|
+# 	Query	thread_id=1	exec_time=0	error_code=0
+use test/*!*/;
+SET TIMESTAMP=1317146243/*!*/;
+SET @@session.pseudo_thread_id=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C utf8 *//*!*/;
+SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+create table t1 (a enum('one', 'two', 'three'))
+/*!*/;
+# at 231
+#110927 20:57:25 server id 1  end_log_pos 306 
+# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
+#       e7 85 0e 82 4e   02   01 00 00 00   4b 00 00 00   32 01 00 00   08 00
+#       fa 01 00 00 00 00 00 00 00  04 00 00 21 00 00 00 00 |................|
+#      10a 00 00 01 00 00 00 00 00  00 00 00 06 03 73 74 64 |.............std|
+#      11a 04 21 00 21 00 08 00 0c  01 74 65 73 74 00 74 65 |.........test.te|
+#      12a 73 74 00 42 45 47 49 4e                          |st.BEGIN|
+# 	Query	thread_id=1	exec_time=0	error_code=0
+SET TIMESTAMP=1317146245/*!*/;
+BEGIN
+/*!*/;
+# at 306
+#110927 20:57:25 server id 1  end_log_pos 405 
+# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
+#      132 85 0e 82 4e   02   01 00 00 00   63 00 00 00   95 01 00 00   00 00
+#      145 01 00 00 00 00 00 00 00  04 00 00 21 00 00 00 00 |................|
+#      155 00 00 01 00 00 00 00 00  00 00 00 06 03 73 74 64 |.............std|
+#      165 04 21 00 21 00 08 00 0c  01 74 65 73 74 00 74 65 |.........test.te|
+#      175 73 74 00 69 6e 73 65 72  74 20 69 6e 74 6f 20 74 |st.insert.into.t|
+#      185 31 20 76 61 6c 75 65 73  20 28 27 74 77 6f 27 29 |1.values...two..|
+# 	Query	thread_id=1	exec_time=0	error_code=0
+SET TIMESTAMP=1317146245/*!*/;
+insert into t1 values ('two')
+/*!*/;
+# at 405
+#110927 20:57:25 server id 1  end_log_pos 432 
+# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
+#      195 85 0e 82 4e   10   01 00 00 00   1b 00 00 00   b0 01 00 00   00 00
+#      1a8 07 00 00 00 00 00 00 00                          |........|
+# 	Xid = 7
+COMMIT/*!*/;
+# at 432
+#110927 20:57:30 server id 1  end_log_pos 451 
+# Position  Timestamp   Type   Master ID        Size      Master Pos    Flags 
+#      1b0 8a 0e 82 4e   03   01 00 00 00   13 00 00 00   c3 01 00 00   00 00
+# 	Stop
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/binlog-hexdump.test'
--- a/mysql-test/suite/rpl/t/binlog-hexdump.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/binlog-hexdump.test	2011-10-10 06:22:13 +0000
@@ -0,0 +1,15 @@
+#
+# Bug#11747887 - 34386: MYSQLBINLOG --HEXDUMP PRINTS LAST ROW OF HEXDUMP
+# INCORRECTLY
+#
+
+--source include/master-slave.inc
+--source include/rpl_reset.inc
+
+--sync_slave_with_master
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+
+--exec $MYSQL_BINLOG --hexdump std_data/bug11747887-bin.000002
+
+--source include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_switch_sequential.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_switch_sequential.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_switch_sequential.test	2011-10-07 08:36:04 +0000
@@ -40,6 +40,11 @@ let $slave_status= 0;
 let $trx= 0;
 let $alter= 0;
 let $i= 200; # with bigger value test times out on some PB hosts 
+if ($VALGRIND_TEST)
+{
+  # test may be slow on Valgrind
+  let $i=50;
+}
 if (`select @@binlog_format like "STATEMENT"`) {
    # relax mtr to scan unsafe warnings
    let $i=50;

=== modified file 'mysql-test/t/archive.test'
--- a/mysql-test/t/archive.test	2011-03-03 09:22:17 +0000
+++ b/mysql-test/t/archive.test	2011-10-06 13:51:28 +0000
@@ -12,6 +12,7 @@ DROP TABLE if exists t1,t2,t3,t4,t5,t6;
 --enable_warnings
 
 SET default_storage_engine=ARCHIVE;
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
 CREATE TABLE t1 (
   Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
@@ -1641,18 +1642,14 @@ DROP TABLE t1,t2;
 #
 # BUG#47012 archive tables are not upgradeable, and server crashes on any access
 #
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
 copy_file std_data/bug47012.frm $MYSQLD_DATADIR/test/t1.frm;
 copy_file std_data/bug47012.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
 copy_file std_data/bug47012.ARM $MYSQLD_DATADIR/test/t1.ARM;
 
---error ER_TABLE_NEEDS_UPGRADE
 SHOW CREATE TABLE t1;
 
---error ER_TABLE_NEEDS_UPGRADE
 SELECT * FROM t1;
 
---error ER_TABLE_NEEDS_UPGRADE
 INSERT INTO t1 (col1, col2) VALUES (1, "value");
 
 REPAIR TABLE t1;
@@ -1715,7 +1712,6 @@ CREATE TABLE t1 (a int) ENGINE=ARCHIVE;
 SHOW CREATE TABLE t1;
 INSERT INTO t1 VALUES (1);
 OPTIMIZE TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
 remove_file $MYSQLD_DATADIR/test/t1.frm;
 FLUSH TABLES;
 INSERT INTO t1 VALUES (2);
@@ -1745,3 +1741,33 @@ INSERT INTO t1 SELECT t1.* FROM t1,t1 t2
 SELECT * FROM t1 ORDER BY f LIMIT 1;
 DROP TABLE t1;
 SET sort_buffer_size=DEFAULT;
+
+--echo #
+--echo # BUG#11756687 - 48633: ARCHIVE TABLES ARE NOT UPGRADEABLE
+--echo #
+copy_file std_data/bug48633.frm $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/bug48633.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
+copy_file std_data/bug48633.ARM $MYSQLD_DATADIR/test/t1.ARM;
+SHOW CREATE TABLE t1;
+# Test first table scan
+SELECT * FROM t1;
+# Test second table scan
+SELECT * FROM t1;
+# Test table close
+FLUSH TABLE t1;
+SELECT * FROM t1;
+# Test check
+CHECK TABLE t1;
+SELECT * FROM t1;
+# Test insert
+INSERT INTO t1 VALUES(3, 'text', 'varchar', 'blob1', 'blob2');
+SELECT * FROM t1;
+# Test table close after insert
+FLUSH TABLE t1;
+SELECT * FROM t1;
+# Test repair
+REPAIR TABLE t1;
+SELECT * FROM t1;
+# Test check table after upgrade
+CHECK TABLE t1;
+DROP TABLE t1;

=== modified file 'mysql-test/t/ctype_utf16.test'
--- a/mysql-test/t/ctype_utf16.test	2011-05-02 11:31:27 +0000
+++ b/mysql-test/t/ctype_utf16.test	2011-10-12 13:58:31 +0000
@@ -763,6 +763,20 @@ DROP TABLE t1;
 
 SELECT space(date_add(101, INTERVAL CHAR('1' USING utf16) hour_second)); 
 
+
+--echo #
+--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+--echo #
+
+SET NAMES utf8, @@character_set_connection=utf16;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+
+
 #
 ## TODO: add tests for all engines
 #

=== modified file 'mysql-test/t/ctype_utf32.test'
--- a/mysql-test/t/ctype_utf32.test	2011-03-01 12:20:38 +0000
+++ b/mysql-test/t/ctype_utf32.test	2011-10-12 13:58:31 +0000
@@ -852,6 +852,19 @@ SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c
 DROP TABLE t1;
 
 --echo #
+--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+--echo #
+
+SET NAMES utf8, @@character_set_connection=utf32;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+
+
+--echo #
 --echo # End of 5.5 tests
 --echo #
 

=== modified file 'mysql-test/t/ctype_utf8.test'
--- a/mysql-test/t/ctype_utf8.test	2011-03-04 15:55:18 +0000
+++ b/mysql-test/t/ctype_utf8.test	2011-10-12 13:58:31 +0000
@@ -1582,6 +1582,18 @@ SET NAMES utf8;
 EXPLAIN EXTENDED SELECT 'abcdÁÂÃÄÅ', _latin1'abcdÁÂÃÄÅ', _utf8'abcdÁÂÃÄÅ';
 
 --echo #
+--echo # Bug#11750518 41090: ORDER BY TRUNCATES GROUP_CONCAT RESULT
+--echo #
+
+SET NAMES utf8;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
+GROUP BY id
+ORDER BY l DESC;
+
+--echo #
 --echo # End of 5.5 tests
 --echo #
 

=== modified file 'mysql-test/t/file_contents.test'
--- a/mysql-test/t/file_contents.test	2011-03-11 15:00:53 +0000
+++ b/mysql-test/t/file_contents.test	2011-10-10 12:03:29 +0000
@@ -15,9 +15,9 @@ if ($dir_bin =~ m|/usr/|) {
   # RPM package
   $dir_docs = $dir_bin;
   $dir_docs =~ s|/lib|/share/doc|;
-  if(-d "$dir_docs/packages/MySQL-server") {
-    # SuSE
-    $dir_docs = "$dir_docs/packages/MySQL-server";
+  if(-d "$dir_docs/packages") {
+    # SuSE: "packages/" in the documentation path
+    $dir_docs = glob "$dir_docs/packages/MySQL-server*";
   } else {
     # RedHat: version number in directory name
     $dir_docs = glob "$dir_docs/MySQL-server*";
@@ -25,9 +25,9 @@ if ($dir_bin =~ m|/usr/|) {
 } elsif ($dir_bin =~ m|/usr$|) {
   # RPM build during development
   $dir_docs = "$dir_bin/share/doc";
-  if(-d "$dir_docs/packages/MySQL-server") {
-    # SuSE
-    $dir_docs = "$dir_docs/packages/MySQL-server";
+  if(-d "$dir_docs/packages") {
+    # SuSE: "packages/" in the documentation path
+    $dir_docs = glob "$dir_docs/packages/MySQL-server*";
   } else {
     # RedHat: version number in directory name
     $dir_docs = glob "$dir_docs/MySQL-server*";

=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test	2011-08-29 07:08:18 +0000
+++ b/mysql-test/t/partition_innodb.test	2011-10-07 08:30:01 +0000
@@ -9,6 +9,17 @@ drop table if exists t1, t2;
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
 --echo #
+--echo # Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
+--echo #               and PARTITIONING
+--echo #
+CREATE TABLE t1 (a INT, KEY(a))
+ENGINE = InnoDB
+PARTITION BY KEY (a) PARTITIONS 1;
+SELECT 1 FROM t1 WHERE a > (SELECT LAST_INSERT_ID() FROM t1 LIMIT 0)
+ORDER BY a;
+DROP TABLE t1;
+
+--echo #
 --echo # Bug#56287: crash when using Partition datetime in sub in query
 --echo #
 

=== modified file 'mysql-test/t/partition_myisam.test'
--- a/mysql-test/t/partition_myisam.test	2011-10-06 09:50:40 +0000
+++ b/mysql-test/t/partition_myisam.test	2011-10-07 14:20:21 +0000
@@ -10,6 +10,27 @@ DROP TABLE IF EXISTS t1, t2;
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
 --echo #
+--echo # Bug#11763825/56590: PARTITIONS: FULLTEXT SEARCHES FAIL
+--echo # (bad/confusing error message)
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ b VARCHAR(200),
+ c TEXT)
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+--error ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING
+CREATE FULLTEXT INDEX msg ON t1 (b, c);
+DROP TABLE t1;
+--error ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING
+CREATE TABLE t1
+(a INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ b VARCHAR(200),
+ c TEXT,
+ FULLTEXT (b, c))
+ENGINE=MyISAM
+PARTITION BY HASH(a) PARTITIONS 1;
+
+--echo #
 --echo # BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE
 --echo #
 CREATE TABLE t1 (

=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp	2011-09-19 14:08:30 +0000
+++ b/mysql-test/valgrind.supp	2011-10-07 06:03:14 +0000
@@ -281,6 +281,16 @@
    fun:do_flush
 }
 
+{
+  libz deflate4
+  Memcheck:Param
+  write(buf)
+  fun:*
+  fun:my_write
+  fun:do_flush
+  fun:azclose
+}
+
 #
 # Warning from my_thread_init becasue mysqld dies before kill thread exists
 #

=== modified file 'scripts/mysql_install_db.pl.in'
--- a/scripts/mysql_install_db.pl.in	2011-09-06 16:23:43 +0000
+++ b/scripts/mysql_install_db.pl.in	2011-10-10 06:59:58 +0000
@@ -538,7 +538,7 @@ else
          "",
         "Examine the logs in $opt->{ldata} for more information.",
         "You can try to start the mysqld daemon with:",
-        "$mysqld --skip-grant &",
+        "$mysqld --skip-grant-tables &",
         "and use the command line tool",
         "$bindir/mysql to connect to the mysql",
         "database and look at the grant tables:",

=== modified file 'scripts/mysql_install_db.sh'
--- a/scripts/mysql_install_db.sh	2011-09-06 15:59:12 +0000
+++ b/scripts/mysql_install_db.sh	2011-10-10 06:59:58 +0000
@@ -410,7 +410,7 @@ else
   echo
   echo "You can try to start the mysqld daemon with:"
   echo
-  echo "    shell> $mysqld --skip-grant &"
+  echo "    shell> $mysqld --skip-grant-tables &"
   echo
   echo "and use the command line tool $bindir/mysql"
   echo "to connect to the mysql database and look at the grant tables:"

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2011-09-21 12:47:15 +0000
+++ b/scripts/mysql_system_tables.sql	2011-10-12 20:15:19 +0000
@@ -453,13 +453,13 @@ SET @cmd="CREATE TABLE performance_schem
   "MIN_TIMER_READ BIGINT unsigned not null,"
   "AVG_TIMER_READ BIGINT unsigned not null,"
   "MAX_TIMER_READ BIGINT unsigned not null,"
-  "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
   "COUNT_WRITE BIGINT unsigned not null,"
   "SUM_TIMER_WRITE BIGINT unsigned not null,"
   "MIN_TIMER_WRITE BIGINT unsigned not null,"
   "AVG_TIMER_WRITE BIGINT unsigned not null,"
   "MAX_TIMER_WRITE BIGINT unsigned not null,"
-  "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null,"
   "COUNT_MISC BIGINT unsigned not null,"
   "SUM_TIMER_MISC BIGINT unsigned not null,"
   "MIN_TIMER_MISC BIGINT unsigned not null,"
@@ -490,13 +490,13 @@ SET @cmd="CREATE TABLE performance_schem
   "MIN_TIMER_READ BIGINT unsigned not null,"
   "AVG_TIMER_READ BIGINT unsigned not null,"
   "MAX_TIMER_READ BIGINT unsigned not null,"
-  "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
   "COUNT_WRITE BIGINT unsigned not null,"
   "SUM_TIMER_WRITE BIGINT unsigned not null,"
   "MIN_TIMER_WRITE BIGINT unsigned not null,"
   "AVG_TIMER_WRITE BIGINT unsigned not null,"
   "MAX_TIMER_WRITE BIGINT unsigned not null,"
-  "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null,"
   "COUNT_MISC BIGINT unsigned not null,"
   "SUM_TIMER_MISC BIGINT unsigned not null,"
   "MIN_TIMER_MISC BIGINT unsigned not null,"

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2011-10-06 09:50:40 +0000
+++ b/sql/ha_partition.cc	2011-10-07 08:30:01 +0000
@@ -6474,23 +6474,19 @@ void ha_partition::late_extra_no_cache(u
                 MODULE optimiser support
 ****************************************************************************/
 
-/*
-  Get keys to use for scanning
+/**
+  Get keys to use for scanning.
 
-  SYNOPSIS
-    keys_to_use_for_scanning()
+  @return key_map of keys usable for scanning
 
-  RETURN VALUE
-    key_map of keys usable for scanning
+  @note No need to use read_partitions here, since it does not depend on
+  which partitions is used, only which storage engine used.
 */
 
 const key_map *ha_partition::keys_to_use_for_scanning()
 {
-  uint first_used_partition;
   DBUG_ENTER("ha_partition::keys_to_use_for_scanning");
-
-  first_used_partition= bitmap_get_first_set(&(m_part_info->read_partitions));
-  DBUG_RETURN(m_file[first_used_partition]->keys_to_use_for_scanning());
+  DBUG_RETURN(m_file[0]->keys_to_use_for_scanning());
 }
 
 #define MAX_PARTS_FOR_OPTIMIZER_CALLS 10

=== modified file 'sql/item.h'
--- a/sql/item.h	2011-09-07 12:41:53 +0000
+++ b/sql/item.h	2011-10-12 13:58:31 +0000
@@ -599,7 +599,7 @@ public:
   void init_make_field(Send_field *tmp_field,enum enum_field_types type);
   virtual void cleanup();
   virtual void make_field(Send_field *field);
-  Field *make_string_field(TABLE *table);
+  virtual Field *make_string_field(TABLE *table);
   virtual bool fix_fields(THD *, Item **);
   /**
     Fix after tables have been moved from one select_lex level to the parent

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2011-07-29 09:29:11 +0000
+++ b/sql/item_sum.cc	2011-10-12 13:58:31 +0000
@@ -3129,6 +3129,31 @@ void Item_func_group_concat::cleanup()
 }
 
 
+Field *Item_func_group_concat::make_string_field(TABLE *table)
+{
+  Field *field;
+  DBUG_ASSERT(collation.collation);
+  /*
+    max_characters is maximum number of characters
+    what can fit into max_length size. It's necessary
+    to use field size what allows to store group_concat
+    result without truncation. For this purpose we use
+    max_characters * CS->mbmaxlen.
+  */
+  const uint32 max_characters= max_length / collation.collation->mbminlen;
+  if (max_characters > CONVERT_IF_BIGGER_TO_BLOB)
+    field= new Field_blob(max_characters * collation.collation->mbmaxlen,
+                          maybe_null, name, collation.collation, TRUE);
+  else
+    field= new Field_varstring(max_characters * collation.collation->mbmaxlen,
+                               maybe_null, name, table->s, collation.collation);
+
+  if (field)
+    field->init(table);
+  return field;
+}
+
+
 Item *Item_func_group_concat::copy_or_same(THD* thd)
 {
   return new (thd->mem_root) Item_func_group_concat(thd, this);

=== modified file 'sql/item_sum.h'
--- a/sql/item_sum.h	2011-06-30 15:50:45 +0000
+++ b/sql/item_sum.h	2011-10-12 13:58:31 +0000
@@ -1409,6 +1409,7 @@ public:
   enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
   const char *func_name() const { return "group_concat"; }
   virtual Item_result result_type () const { return STRING_RESULT; }
+  virtual Field *make_string_field(TABLE *table);
   enum_field_types field_type() const
   {
     if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-09-22 10:14:00 +0000
+++ b/sql/log_event.cc	2011-10-10 06:22:13 +0000
@@ -1677,6 +1677,11 @@ void Log_event::print_header(IO_CACHE* f
     if (hex_string[0])
     {
       char emit_buf[256];
+      int pad_length= 48 - strlen(h);
+      DBUG_ASSERT(strlen(h) < 48);
+      for(int pad_done= 0; pad_done < pad_length; pad_done++)
+        *h++ = ' ';
+      *h= '\0';
       size_t const bytes_written=
         my_snprintf(emit_buf, sizeof(emit_buf),
                     "# %8.8lx %-48.48s |%s|\n",

=== modified file 'sql/rpl_info_file.cc'
--- a/sql/rpl_info_file.cc	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_file.cc	2011-09-14 16:12:22 +0000
@@ -130,26 +130,14 @@ int Rpl_info_file::do_prepare_info_for_w
 int Rpl_info_file::do_check_info(const ulong *uidx __attribute__((unused)),
                                  const uint nidx __attribute__((unused)))
 {
-#ifndef NO_DBUG
   /*
-    This function checks if the file exists and in other modules
-    further actions are taken based on this. If the file exists
-    but users do not have the appropriated rights to access it,
-    other modules will assume that the file does not exist and
-    will take the appropriate actions and most likely will fail
-    safely after trying to create it. 
+    This function is used by callers to check if the file exists.
 
-    This is behavior is not a problem. However, in other modules,
-    it is not possible to print out what is the root of the
-    failure as a detailed error code is not returned. For that
-    reason, we print out such information in here.
+    If the file exists but users do not have the appropriated
+    rights to access it, callers will assume that the file does
+    not exist taking the appropriate actions and failing when
+    trying to create the file.
   */
-  if (my_access(info_fname, F_OK | R_OK | W_OK))
-    sql_print_information("Info file %s cannot be accessed (errno %d)."
-                          " Most likely this is a new slave or you are"
-                          " changing the repository type.", info_fname,
-                          errno);
-#endif
   return my_access(info_fname, F_OK);
 }
 

=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2011-10-05 13:16:38 +0000
+++ b/sql/rpl_rli_pdb.cc	2011-10-06 15:32:21 +0000
@@ -692,12 +692,11 @@ Slave_worker *map_db_to_worker(const cha
       Unless \exists the last assigned Worker, get a free worker based
       on a policy described in the function get_least_occupied_worker().
     */
+    mysql_mutex_lock(&slave_worker_hash_lock);
+
     entry->worker= (!last_worker) ?
       get_least_occupied_worker(workers) : last_worker;
     entry->worker->usage_partition++;
-
-    mysql_mutex_lock(&slave_worker_hash_lock);
-
     if (mapping_db_to_worker.records > mts_partition_hash_soft_max)
     {
       /* remove zero-usage (todo: rare or long ago scheduled) records */

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2011-09-29 12:55:06 +0000
+++ b/sql/share/errmsg-utf8.txt	2011-10-07 14:20:21 +0000
@@ -6592,3 +6592,7 @@ ER_PLUGIN_NO_UNINSTALL
 
 ER_PLUGIN_NO_INSTALL
   eng "Plugin '%s' is marked as not dynamically installable. You have to stop the server to install it."
+
+ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING
+  eng "FULLTEXT index is not supported for partitioned tables."
+  swe "FULLTEXT index stöds ej för partitionerade tabeller."

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2011-08-30 04:28:18 +0000
+++ b/sql/sql_table.cc	2011-10-07 14:20:21 +0000
@@ -3457,6 +3457,15 @@ mysql_prepare_create_table(THD *thd, HA_
     {
       if (!(file->ha_table_flags() & HA_CAN_FULLTEXT))
       {
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+        if (file->ht == partition_hton)
+        {
+          my_message(ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING,
+                     ER(ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING),
+                     MYF(0));
+          DBUG_RETURN(TRUE);
+        }
+#endif
 	my_message(ER_TABLE_CANT_HANDLE_FT, ER(ER_TABLE_CANT_HANDLE_FT),
                    MYF(0));
 	DBUG_RETURN(TRUE);

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2011-09-26 13:48:06 +0000
+++ b/sql/table.cc	2011-10-07 06:03:14 +0000
@@ -1173,7 +1173,7 @@ static int open_binary_frm(THD *thd, TAB
     }
     else
 #endif
-    if (share->mysql_version >= 50110)
+    if (share->mysql_version >= 50110 && next_chunk < buff_end)
     {
       /* New auto_partitioned indicator introduced in 5.1.11 */
 #ifdef WITH_PARTITION_STORAGE_ENGINE

=== modified file 'sql/udf_example.c'
--- a/sql/udf_example.c	2011-06-30 15:50:45 +0000
+++ b/sql/udf_example.c	2011-10-10 06:59:58 +0000
@@ -20,7 +20,7 @@
 ** The functions name, type and shared library is saved in the new system
 ** table 'func'.  To be able to create new functions one must have write
 ** privilege for the database 'mysql'.	If one starts MySQL with
-** --skip-grant, then UDF initialization will also be skipped.
+** --skip-grant-tables, then UDF initialization will also be skipped.
 **
 ** Syntax for the new commands are:
 ** create function <function_name> returns {string|real|integer}

=== modified file 'storage/archive/azio.c'
--- a/storage/archive/azio.c	2011-06-03 07:49:05 +0000
+++ b/storage/archive/azio.c	2011-10-06 13:51:28 +0000
@@ -71,6 +71,7 @@ int az_open (azio_stream *s, const char
   s->version = (unsigned char)az_magic[1]; /* this needs to be a define to version */
   s->minor_version= (unsigned char) az_magic[2]; /* minor version */
   s->dirty= AZ_STATE_CLEAN;
+  s->start= 0;
 
   /*
     We do our own version of append by nature. 
@@ -169,6 +170,9 @@ int write_header(azio_stream *s)
   char buffer[AZHEADER_SIZE + AZMETA_BUFFER_SIZE];
   char *ptr= buffer;
 
+  if (s->version == 1)
+    return 0;
+
   s->block_size= AZ_BUFSIZE_WRITE;
   s->version = (unsigned char)az_magic[1];
   s->minor_version = (unsigned char)az_magic[2];
@@ -290,9 +294,9 @@ void check_header(azio_stream *s)
   /* Peek ahead to check the gzip magic header */
   if ( s->stream.next_in[0] == gz_magic[0]  && s->stream.next_in[1] == gz_magic[1])
   {
+    read_header(s, s->stream.next_in);
     s->stream.avail_in -= 2;
     s->stream.next_in += 2;
-    s->version= (unsigned char)2;
 
     /* Check the rest of the gzip header */
     method = get_byte(s);
@@ -321,7 +325,8 @@ void check_header(azio_stream *s)
       for (len = 0; len < 2; len++) (void)get_byte(s);
     }
     s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
-    s->start = my_tell(s->file, MYF(0)) - s->stream.avail_in;
+    if (!s->start)
+      s->start= my_tell(s->file, MYF(0)) - s->stream.avail_in;
   }
   else if ( s->stream.next_in[0] == az_magic[0]  && s->stream.next_in[1] == az_magic[1])
   {
@@ -365,9 +370,11 @@ void read_header(azio_stream *s, unsigne
   else if (buffer[0] == gz_magic[0]  && buffer[1] == gz_magic[1])
   {
     /*
-      Set version number to previous version (2).
+      Set version number to previous version (1).
     */
-    s->version= (unsigned char) 2;
+    s->version= 1;
+    s->auto_increment= 0;
+    s->frm_length= 0;
   } else {
     /*
       Unknown version.

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2011-09-21 11:01:41 +0000
+++ b/storage/archive/ha_archive.cc	2011-10-08 17:18:28 +0000
@@ -93,6 +93,11 @@
      inserts a lot faster, but would mean highly arbitrary reads.
 
     -Brian
+
+  Archive file format versions:
+  <5.1.5 - v.1
+  5.1.5-5.1.15 - v.2
+  >5.1.15 - v.3
 */
 
 /* Variables for archive share methods */
@@ -104,6 +109,14 @@ static HASH archive_open_tables;
 #define ARN ".ARN"               // Files used during an optimize call
 #define ARM ".ARM"               // Meta file (deprecated)
 
+/* 5.0 compatibility */
+#define META_V1_OFFSET_CHECK_HEADER  0
+#define META_V1_OFFSET_VERSION       1
+#define META_V1_OFFSET_ROWS_RECORDED 2
+#define META_V1_OFFSET_CHECK_POINT   10
+#define META_V1_OFFSET_CRASHED       18
+#define META_V1_LENGTH               19
+
 /*
   uchar + uchar
 */
@@ -281,6 +294,106 @@ err:
   DBUG_RETURN(1);
 }
 
+
+/**
+  @brief Read version 1 meta file (5.0 compatibility routine).
+
+  @return Completion status
+    @retval  0 Success
+    @retval !0 Failure
+*/
+
+int ha_archive::read_v1_metafile()
+{
+  char file_name[FN_REFLEN];
+  uchar buf[META_V1_LENGTH];
+  File fd;
+  DBUG_ENTER("ha_archive::read_v1_metafile");
+
+  fn_format(file_name, share->data_file_name, "", ARM, MY_REPLACE_EXT);
+  if ((fd= my_open(file_name, O_RDONLY, MYF(0))) == -1)
+    DBUG_RETURN(-1);
+
+  if (my_read(fd, buf, sizeof(buf), MYF(0)) != sizeof(buf))
+  {
+    my_close(fd, MYF(0));
+    DBUG_RETURN(-1);
+  }
+  
+  share->rows_recorded= uint8korr(buf + META_V1_OFFSET_ROWS_RECORDED);
+  share->crashed= buf[META_V1_OFFSET_CRASHED];
+  my_close(fd, MYF(0));
+  DBUG_RETURN(0);
+}
+
+
+/**
+  @brief Write version 1 meta file (5.0 compatibility routine).
+
+  @return Completion status
+    @retval  0 Success
+    @retval !0 Failure
+*/
+
+int ha_archive::write_v1_metafile()
+{
+  char file_name[FN_REFLEN];
+  uchar buf[META_V1_LENGTH];
+  File fd;
+  DBUG_ENTER("ha_archive::write_v1_metafile");
+
+  buf[META_V1_OFFSET_CHECK_HEADER]= ARCHIVE_CHECK_HEADER;
+  buf[META_V1_OFFSET_VERSION]= 1;
+  int8store(buf + META_V1_OFFSET_ROWS_RECORDED, share->rows_recorded);
+  int8store(buf + META_V1_OFFSET_CHECK_POINT, (ulonglong) 0);
+  buf[META_V1_OFFSET_CRASHED]= share->crashed;
+  
+  fn_format(file_name, share->data_file_name, "", ARM, MY_REPLACE_EXT);
+  if ((fd= my_open(file_name, O_WRONLY, MYF(0))) == -1)
+    DBUG_RETURN(-1);
+
+  if (my_write(fd, buf, sizeof(buf), MYF(0)) != sizeof(buf))
+  {
+    my_close(fd, MYF(0));
+    DBUG_RETURN(-1);
+  }
+  
+  my_close(fd, MYF(0));
+  DBUG_RETURN(0);
+}
+
+
+/**
+  @brief Pack version 1 row (5.0 compatibility routine).
+
+  @param[in]  record  the record to pack
+
+  @return Length of packed row
+*/
+
+unsigned int ha_archive::pack_row_v1(uchar *record)
+{
+  uint *blob, *end;
+  uchar *pos;
+  DBUG_ENTER("pack_row_v1");
+  memcpy(record_buffer->buffer, record, table->s->reclength);
+  pos= record_buffer->buffer + table->s->reclength;
+  for (blob= table->s->blob_field, end= blob + table->s->blob_fields;
+       blob != end; blob++)
+  {
+    uint32 length= ((Field_blob *) table->field[*blob])->get_length();
+    if (length)
+    {
+      uchar *data_ptr;
+      ((Field_blob *) table->field[*blob])->get_ptr(&data_ptr);
+      memcpy(pos, data_ptr, length);
+      pos+= length;
+    }
+  }
+  DBUG_RETURN(pos - record_buffer->buffer);
+}
+
+
 /*
   This method reads the header of a datafile and returns whether or not it was successful.
 */
@@ -390,12 +503,8 @@ ARCHIVE_SHARE *ha_archive::get_share(con
     stats.auto_increment_value= archive_tmp.auto_increment + 1;
     share->rows_recorded= (ha_rows)archive_tmp.rows;
     share->crashed= archive_tmp.dirty;
-    /*
-      If archive version is less than 3, It should be upgraded before
-      use.
-    */
-    if (archive_tmp.version < ARCHIVE_VERSION)
-      *rc= HA_ERR_TABLE_NEEDS_UPGRADE;
+    if (archive_tmp.version == 1)
+      read_v1_metafile();
     azclose(&archive_tmp);
 
     (void) my_hash_insert(&archive_open_tables, (uchar*) share);
@@ -441,6 +550,8 @@ int ha_archive::free_share()
     */
     if (share->archive_write_open)
     {
+      if (share->archive_write.version == 1)
+        write_v1_metafile();
       if (azclose(&(share->archive_write)))
         rc= 1;
     }
@@ -527,13 +638,7 @@ int ha_archive::open(const char *name, i
                       (open_options & HA_OPEN_FOR_REPAIR) ? "yes" : "no"));
   share= get_share(name, &rc);
 
- /*
-    Allow open on crashed table in repair mode only.
-    Block open on 5.0 ARCHIVE table. Though we have almost all
-    routines to access these tables, they were not well tested.
-    For now we have to refuse to open such table to avoid
-    potential data loss.
-  */
+  /* Allow open on crashed table in repair mode only. */
   switch (rc)
   {
   case 0:
@@ -541,8 +646,6 @@ int ha_archive::open(const char *name, i
   case HA_ERR_CRASHED_ON_USAGE:
     if (open_options & HA_OPEN_FOR_REPAIR)
       break;
-    /* fall through */
-  case HA_ERR_TABLE_NEEDS_UPGRADE:
     free_share();
     /* fall through */
   default:
@@ -610,11 +713,40 @@ int ha_archive::close(void)
 }
 
 
+void ha_archive::frm_load(const char *name, azio_stream *dst)
+{
+  char name_buff[FN_REFLEN];
+  MY_STAT file_stat;
+  File frm_file;
+  uchar *frm_ptr;
+  DBUG_ENTER("ha_archive::frm_load");
+  fn_format(name_buff, name, "", ".frm", MY_REPLACE_EXT | MY_UNPACK_FILENAME);
+
+  /* Here is where we open up the frm and pass it to archive to store */
+  if ((frm_file= my_open(name_buff, O_RDONLY, MYF(0))) >= 0)
+  {
+    if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME)))
+    {
+      frm_ptr= (uchar *) my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0));
+      if (frm_ptr)
+      {
+        if (my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0)) ==
+            (size_t) file_stat.st_size)
+          azwrite_frm(dst, (char *) frm_ptr, file_stat.st_size);
+        my_free(frm_ptr);
+      }
+    }
+    my_close(frm_file, MYF(0));
+  }
+  DBUG_VOID_RETURN;
+}
+
+
 /**
   Copy a frm blob between streams.
 
-  @param  src   The source stream.
-  @param  dst   The destination stream.
+  @param[in]  src   The source stream.
+  @param[in]  dst   The destination stream.
 
   @return Zero on success, non-zero otherwise.
 */
@@ -624,6 +756,13 @@ int ha_archive::frm_copy(azio_stream *sr
   int rc= 0;
   char *frm_ptr;
 
+  /* If there is no .frm in source stream, try to read .frm from file. */
+  if (!src->frm_length)
+  {
+    frm_load(table->s->normalized_path.str, dst);
+    return 0;
+  }
+
   if (!(frm_ptr= (char *) my_malloc(src->frm_length, MYF(0))))
     return HA_ERR_OUT_OF_MEM;
 
@@ -654,9 +793,7 @@ int ha_archive::create(const char *name,
   char linkname[FN_REFLEN];
   int error;
   azio_stream create_stream;            /* Archive file we are working with */
-  File frm_file;                   /* File handler for readers */
   MY_STAT file_stat;  // Stat information for the data file
-  uchar *frm_ptr;
 
   DBUG_ENTER("ha_archive::create");
 
@@ -716,26 +853,8 @@ int ha_archive::create(const char *name,
 
     if (linkname[0])
       my_symlink(name_buff, linkname, MYF(0));
-    fn_format(name_buff, name, "", ".frm",
-              MY_REPLACE_EXT | MY_UNPACK_FILENAME);
 
-    /*
-      Here is where we open up the frm and pass it to archive to store 
-    */
-    if ((frm_file= my_open(name_buff, O_RDONLY, MYF(0))) > 0)
-    {
-      if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME)))
-      {
-        frm_ptr= (uchar *)my_malloc(sizeof(uchar) * file_stat.st_size, MYF(0));
-        if (frm_ptr)
-        {
-          my_read(frm_file, frm_ptr, file_stat.st_size, MYF(0));
-          azwrite_frm(&create_stream, (char *)frm_ptr, file_stat.st_size);
-          my_free(frm_ptr);
-        }
-      }
-      my_close(frm_file, MYF(0));
-    }
+    frm_load(name, &create_stream);
 
     if (create_info->comment.str)
       azwrite_comment(&create_stream, create_info->comment.str, 
@@ -829,6 +948,9 @@ unsigned int ha_archive::pack_row(uchar
   if (fix_rec_buff(max_row_length(record)))
     DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */
 
+  if (share->archive_write.version == 1)
+    DBUG_RETURN(pack_row_v1(record));
+
   /* Copy null bits */
   memcpy(record_buffer->buffer+ARCHIVE_ROW_HEADER_SIZE, 
          record, table->s->null_bytes);
@@ -1382,6 +1504,8 @@ int ha_archive::optimize(THD* thd, HA_CH
   // now we close both our writer and our reader for the rename
   if (share->archive_write_open)
   {
+    if (share->archive_write.version == 1)
+      write_v1_metafile();
     azclose(&(share->archive_write));
     share->archive_write_open= FALSE;
   }
@@ -1426,7 +1550,7 @@ int ha_archive::optimize(THD* thd, HA_CH
       share->rows_recorded= 0;
       stats.auto_increment_value= 1;
       share->archive_write.auto_increment= 0;
-      my_bitmap_map *org_bitmap= dbug_tmp_use_all_columns(table, table->read_set);
+      my_bitmap_map *org_bitmap= tmp_use_all_columns(table, table->read_set);
 
       while (!(rc= get_row(&archive, table->record[0])))
       {
@@ -1447,7 +1571,7 @@ int ha_archive::optimize(THD* thd, HA_CH
         }
       }
 
-      dbug_tmp_restore_column_map(table->read_set, org_bitmap);
+      tmp_restore_column_map(table->read_set, org_bitmap);
       share->rows_recorded= (ha_rows)writer.rows;
     }
 
@@ -1664,6 +1788,29 @@ bool ha_archive::is_crashed() const
   DBUG_RETURN(share->crashed); 
 }
 
+
+/**
+  @brief Check for upgrade
+
+  @param[in]  check_opt  check options
+
+  @return Completion status
+    @retval HA_ADMIN_OK            No upgrade required
+    @retval HA_ADMIN_CORRUPT       Cannot read meta-data
+    @retval HA_ADMIN_NEEDS_UPGRADE Upgrade required
+*/
+
+int ha_archive::check_for_upgrade(HA_CHECK_OPT *check_opt)
+{
+  DBUG_ENTER("ha_archive::check_for_upgrade");
+  if (init_archive_reader())
+    DBUG_RETURN(HA_ADMIN_CORRUPT);
+  if (archive.version < ARCHIVE_VERSION)
+    DBUG_RETURN(HA_ADMIN_NEEDS_UPGRADE);
+  DBUG_RETURN(HA_ADMIN_OK);
+}
+
+
 /*
   Simple scan of the tables to make sure everything is ok.
 */
@@ -1677,9 +1824,12 @@ int ha_archive::check(THD* thd, HA_CHECK
 
   old_proc_info= thd_proc_info(thd, "Checking table");
   /* Flush any waiting data */
-  mysql_mutex_lock(&share->mutex);
-  azflush(&(share->archive_write), Z_SYNC_FLUSH);
-  mysql_mutex_unlock(&share->mutex);
+  if (share->archive_write_open)
+  {
+    mysql_mutex_lock(&share->mutex);
+    azflush(&(share->archive_write), Z_SYNC_FLUSH);
+    mysql_mutex_unlock(&share->mutex);
+  }
 
   if (init_archive_reader())
     DBUG_RETURN(HA_ADMIN_CORRUPT);

=== modified file 'storage/archive/ha_archive.h'
--- a/storage/archive/ha_archive.h	2011-06-30 15:50:45 +0000
+++ b/storage/archive/ha_archive.h	2011-10-07 06:03:14 +0000
@@ -72,6 +72,10 @@ class ha_archive: public handler
   archive_record_buffer *create_record_buffer(unsigned int length);
   void destroy_record_buffer(archive_record_buffer *r);
   int frm_copy(azio_stream *src, azio_stream *dst);
+  void frm_load(const char *name, azio_stream *dst);
+  int read_v1_metafile();
+  int write_v1_metafile();
+  unsigned int pack_row_v1(uchar *record);
 
 public:
   ha_archive(handlerton *hton, TABLE_SHARE *table_arg);
@@ -139,6 +143,7 @@ public:
   THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
                              enum thr_lock_type lock_type);
   bool is_crashed() const;
+  int check_for_upgrade(HA_CHECK_OPT *check_opt);
   int check(THD* thd, HA_CHECK_OPT* check_opt);
   bool check_and_repair(THD *thd);
   uint32 max_row_length(const uchar *buf);

=== modified file 'storage/innobase/btr/btr0cur.c'
--- a/storage/innobase/btr/btr0cur.c	2011-09-30 12:49:33 +0000
+++ b/storage/innobase/btr/btr0cur.c	2011-10-12 13:46:34 +0000
@@ -1893,7 +1893,7 @@ btr_cur_update_in_place(
 	was_delete_marked = rec_get_deleted_flag(
 		rec, page_is_comp(buf_block_get_frame(block)));
 
-	is_hashed = block->is_hashed;
+	is_hashed = (block->index != NULL);
 
 	if (is_hashed) {
 		/* TO DO: Can we skip this if none of the fields

=== modified file 'storage/innobase/btr/btr0sea.c'
--- a/storage/innobase/btr/btr0sea.c	2011-08-15 09:34:39 +0000
+++ b/storage/innobase/btr/btr0sea.c	2011-10-12 13:46:34 +0000
@@ -44,17 +44,8 @@ Created 2/17/1996 Heikki Tuuri
 #include "ha0ha.h"
 
 /** Flag: has the search system been enabled?
-Protected by btr_search_latch and btr_search_enabled_mutex. */
+Protected by btr_search_latch. */
 UNIV_INTERN char		btr_search_enabled	= TRUE;
-UNIV_INTERN ibool		btr_search_fully_disabled = FALSE;
-
-/** Mutex protecting btr_search_enabled */
-static mutex_t			btr_search_enabled_mutex;
-
-#ifdef UNIV_PFS_MUTEX
-/* Key to register btr_search_enabled_mutex with performance schema */
-UNIV_INTERN mysql_pfs_key_t	btr_search_enabled_mutex_key;
-#endif /* UNIV_PFS_MUTEX */
 
 /** A dummy variable to fool the compiler */
 UNIV_INTERN ulint		btr_search_this_is_zero = 0;
@@ -180,8 +171,6 @@ btr_search_sys_create(
 
 	rw_lock_create(btr_search_latch_key, &btr_search_latch,
 		       SYNC_SEARCH_SYS);
-	mutex_create(btr_search_enabled_mutex_key,
-		     &btr_search_enabled_mutex, SYNC_SEARCH_SYS_CONF);
 
 	btr_search_sys = mem_alloc(sizeof(btr_search_sys_t));
 
@@ -210,33 +199,65 @@ btr_search_sys_free(void)
 }
 
 /********************************************************************//**
+Set index->ref_count = 0 on all indexes of a table. */
+static
+void
+btr_search_disable_ref_count(
+/*=========================*/
+	dict_table_t*	table)	/*!< in/out: table */
+{
+	dict_index_t*	index;
+
+	ut_ad(mutex_own(&dict_sys->mutex));
+#ifdef UNIV_SYNC_DEBUG
+	ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
+
+	for (index = dict_table_get_first_index(table); index;
+	     index = dict_table_get_next_index(index)) {
+
+		index->search_info->ref_count = 0;
+	}
+}
+
+/********************************************************************//**
 Disable the adaptive hash search system and empty the index. */
 UNIV_INTERN
 void
 btr_search_disable(void)
 /*====================*/
 {
-	mutex_enter(&btr_search_enabled_mutex);
+	dict_table_t*	table;
+
+	mutex_enter(&dict_sys->mutex);
 	rw_lock_x_lock(&btr_search_latch);
 
-	/* Disable access to hash index, also tell ha_insert_for_fold()
-	stop adding new nodes to hash index, but still allow updating
-	existing nodes */
 	btr_search_enabled = FALSE;
 
-	/* Clear all block->is_hashed flags and remove all entries
-	from btr_search_sys->hash_index. */
-	buf_pool_drop_hash_index();
-
-	/* hash index has been cleaned up, disallow any operation to
-	the hash index */
-	btr_search_fully_disabled = TRUE;
+	/* Clear the index->search_info->ref_count of every index in
+	the data dictionary cache. */
+	for (table = UT_LIST_GET_FIRST(dict_sys->table_LRU); table;
+	     table = UT_LIST_GET_NEXT(table_LRU, table)) {
 
-	/* btr_search_enabled_mutex should guarantee this. */
-	ut_ad(!btr_search_enabled);
+		btr_search_disable_ref_count(table);
+	}
+
+	for (table = UT_LIST_GET_FIRST(dict_sys->table_non_LRU); table;
+	     table = UT_LIST_GET_NEXT(table_LRU, table)) {
+
+		btr_search_disable_ref_count(table);
+	}
+
+	mutex_exit(&dict_sys->mutex);
+
+	/* Set all block->index = NULL. */
+	buf_pool_clear_hash_index();
+
+	/* Clear the adaptive hash index. */
+	hash_table_clear(btr_search_sys->hash_index);
+	mem_heap_empty(btr_search_sys->hash_index->heap);
 
 	rw_lock_x_unlock(&btr_search_latch);
-	mutex_exit(&btr_search_enabled_mutex);
 }
 
 /********************************************************************//**
@@ -246,14 +267,11 @@ void
 btr_search_enable(void)
 /*====================*/
 {
-	mutex_enter(&btr_search_enabled_mutex);
 	rw_lock_x_lock(&btr_search_latch);
 
 	btr_search_enabled = TRUE;
-	btr_search_fully_disabled = FALSE;
 
 	rw_lock_x_unlock(&btr_search_latch);
-	mutex_exit(&btr_search_enabled_mutex);
 }
 
 /*****************************************************************//**
@@ -476,7 +494,7 @@ btr_search_update_block_hash_info(
 	    && (block->n_bytes == info->n_bytes)
 	    && (block->left_side == info->left_side)) {
 
-		if ((block->is_hashed)
+		if ((block->index)
 		    && (block->curr_n_fields == info->n_fields)
 		    && (block->curr_n_bytes == info->n_bytes)
 		    && (block->curr_left_side == info->left_side)) {
@@ -505,7 +523,7 @@ btr_search_update_block_hash_info(
 	     / BTR_SEARCH_PAGE_BUILD_LIMIT)
 	    && (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
 
-		if ((!block->is_hashed)
+		if ((!block->index)
 		    || (block->n_hash_helps
 			> 2 * page_get_n_recs(block->frame))
 		    || (block->n_fields != block->curr_n_fields)
@@ -537,9 +555,9 @@ btr_search_update_hash_ref(
 	buf_block_t*	block,	/*!< in: buffer block where cursor positioned */
 	btr_cur_t*	cursor)	/*!< in: cursor */
 {
+	dict_index_t*	index;
 	ulint		fold;
-	rec_t*		rec;
-	index_id_t	index_id;
+	const rec_t*	rec;
 
 	ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
 #ifdef UNIV_SYNC_DEBUG
@@ -550,13 +568,15 @@ btr_search_update_hash_ref(
 	ut_ad(page_align(btr_cur_get_rec(cursor))
 	      == buf_block_get_frame(block));
 
-	if (!block->is_hashed) {
+	index = block->index;
+
+	if (!index) {
 
 		return;
 	}
 
-	ut_a(block->index == cursor->index);
-	ut_a(!dict_index_is_ibuf(cursor->index));
+	ut_a(index == cursor->index);
+	ut_a(!dict_index_is_ibuf(index));
 
 	if ((info->n_hash_potential > 0)
 	    && (block->curr_n_fields == info->n_fields)
@@ -573,12 +593,11 @@ btr_search_update_hash_ref(
 			return;
 		}
 
-		index_id = cursor->index->id;
 		fold = rec_fold(rec,
-				rec_get_offsets(rec, cursor->index, offsets_,
+				rec_get_offsets(rec, index, offsets_,
 						ULINT_UNDEFINED, &heap),
 				block->curr_n_fields,
-				block->curr_n_bytes, index_id);
+				block->curr_n_bytes, index->id);
 		if (UNIV_LIKELY_NULL(heap)) {
 			mem_heap_free(heap);
 		}
@@ -844,7 +863,7 @@ btr_search_guess_on_hash(
 {
 	buf_pool_t*	buf_pool;
 	buf_block_t*	block;
-	rec_t*		rec;
+	const rec_t*	rec;
 	ulint		fold;
 	index_id_t	index_id;
 #ifdef notdefined
@@ -930,7 +949,7 @@ btr_search_guess_on_hash(
 
 	ut_ad(page_rec_is_user_rec(rec));
 
-	btr_cur_position(index, rec, block, cursor);
+	btr_cur_position(index, (rec_t*) rec, block, cursor);
 
 	/* Check the validity of the guess within the page */
 
@@ -1062,26 +1081,25 @@ btr_search_drop_page_hash_index(
 	ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
 #endif /* UNIV_SYNC_DEBUG */
 
-	/* Do a dirty check on btr_search_fully_disabled and
-	block->is_hashed, return if AHI is disabled. This is
-	to avoid acquiring shared btr_search_latch for performance
-	consideration. If either condition is not satisfied
-	continue to acquire btr_search_latch before checking again */
-	if (btr_search_fully_disabled && (!block->is_hashed)) {
+	/* Do a dirty check on block->index, return if the block is
+	not in the adaptive hash index. This is to avoid acquiring
+	shared btr_search_latch for performance consideration. */
+	if (!block->index) {
 		return;
 	}
 
 retry:
 	rw_lock_s_lock(&btr_search_latch);
-	page = block->frame;
+	index = block->index;
 
-	if (UNIV_LIKELY(!block->is_hashed)) {
+	if (UNIV_LIKELY(!index)) {
 
 		rw_lock_s_unlock(&btr_search_latch);
 
 		return;
 	}
 
+	ut_a(!dict_index_is_ibuf(index));
 	table = btr_search_sys->hash_index;
 
 #ifdef UNIV_SYNC_DEBUG
@@ -1093,8 +1111,6 @@ retry:
 
 	n_fields = block->curr_n_fields;
 	n_bytes = block->curr_n_bytes;
-	index = block->index;
-	ut_a(!dict_index_is_ibuf(index));
 
 	/* NOTE: The fields of block must not be accessed after
 	releasing btr_search_latch, as the index page might only
@@ -1104,6 +1120,7 @@ retry:
 
 	ut_a(n_fields + n_bytes > 0);
 
+	page = block->frame;
 	n_recs = page_get_n_recs(page);
 
 	/* Calculate and cache fold values into an array for fast deletion
@@ -1152,7 +1169,7 @@ next_rec:
 
 	rw_lock_x_lock(&btr_search_latch);
 
-	if (UNIV_UNLIKELY(!block->is_hashed)) {
+	if (UNIV_UNLIKELY(!block->index)) {
 		/* Someone else has meanwhile dropped the hash index */
 
 		goto cleanup;
@@ -1180,7 +1197,6 @@ next_rec:
 	ut_a(index->search_info->ref_count > 0);
 	index->search_info->ref_count--;
 
-	block->is_hashed = FALSE;
 	block->index = NULL;
 
 	MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_REMOVED);
@@ -1211,8 +1227,8 @@ cleanup:
 }
 
 /********************************************************************//**
-Drops a page hash index when a page is freed from a fseg to the file system.
-Drops possible hash index if the page happens to be in the buffer pool. */
+Drops a possible page hash index when a page is evicted from the buffer pool
+or freed in a file segment. */
 UNIV_INTERN
 void
 btr_search_drop_page_hash_when_freed(
@@ -1225,28 +1241,19 @@ btr_search_drop_page_hash_when_freed(
 	buf_block_t*	block;
 	mtr_t		mtr;
 
-	if (!buf_page_peek_if_search_hashed(space, page_no)) {
-
-		return;
-	}
-
 	mtr_start(&mtr);
 
-	/* We assume that if the caller has a latch on the page, then the
-	caller has already dropped the hash index for the page, and we never
-	get here. Therefore we can acquire the s-latch to the page without
-	having to fear a deadlock. */
+	/* If the caller has a latch on the page, then the caller must
+	have a x-latch on the page and it must have already dropped
+	the hash index for the page. Because of the x-latch that we
+	are possibly holding, we cannot s-latch the page, but must
+	(recursively) x-latch it, even though we are only reading. */
 
-	block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH, NULL,
+	block = buf_page_get_gen(space, zip_size, page_no, RW_X_LATCH, NULL,
 				 BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__,
 				 &mtr);
-	/* Because the buffer pool mutex was released by
-	buf_page_peek_if_search_hashed(), it is possible that the
-	block was removed from the buffer pool by another thread
-	before buf_page_get_gen() got a chance to acquire the buffer
-	pool mutex again.  Thus, we must check for a NULL return. */
 
-	if (UNIV_LIKELY(block != NULL)) {
+	if (block && block->index) {
 
 		buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
 
@@ -1278,7 +1285,6 @@ btr_search_build_page_hash_index(
 	rec_t*		next_rec;
 	ulint		fold;
 	ulint		next_fold;
-	index_id_t	index_id;
 	ulint		n_cached;
 	ulint		n_recs;
 	ulint*		folds;
@@ -1292,9 +1298,6 @@ btr_search_build_page_hash_index(
 	ut_ad(index);
 	ut_a(!dict_index_is_ibuf(index));
 
-	table = btr_search_sys->hash_index;
-	page = buf_block_get_frame(block);
-
 #ifdef UNIV_SYNC_DEBUG
 	ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
 	ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
@@ -1303,9 +1306,17 @@ btr_search_build_page_hash_index(
 
 	rw_lock_s_lock(&btr_search_latch);
 
-	if (block->is_hashed && ((block->curr_n_fields != n_fields)
-				 || (block->curr_n_bytes != n_bytes)
-				 || (block->curr_left_side != left_side))) {
+	if (!btr_search_enabled) {
+		rw_lock_s_unlock(&btr_search_latch);
+		return;
+	}
+
+	table = btr_search_sys->hash_index;
+	page = buf_block_get_frame(block);
+
+	if (block->index && ((block->curr_n_fields != n_fields)
+			     || (block->curr_n_bytes != n_bytes)
+			     || (block->curr_left_side != left_side))) {
 
 		rw_lock_s_unlock(&btr_search_latch);
 
@@ -1342,7 +1353,7 @@ btr_search_build_page_hash_index(
 
 	n_cached = 0;
 
-	index_id = btr_page_get_index_id(page);
+	ut_a(index->id == btr_page_get_index_id(page));
 
 	rec = page_rec_get_next(page_get_infimum_rec(page));
 
@@ -1357,7 +1368,7 @@ btr_search_build_page_hash_index(
 		}
 	}
 
-	fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
+	fold = rec_fold(rec, offsets, n_fields, n_bytes, index->id);
 
 	if (left_side) {
 
@@ -1384,7 +1395,7 @@ btr_search_build_page_hash_index(
 		offsets = rec_get_offsets(next_rec, index, offsets,
 					  n_fields + (n_bytes > 0), &heap);
 		next_fold = rec_fold(next_rec, offsets, n_fields,
-				     n_bytes, index_id);
+				     n_bytes, index->id);
 
 		if (fold != next_fold) {
 			/* Insert an entry into the hash index */
@@ -1409,13 +1420,13 @@ btr_search_build_page_hash_index(
 
 	rw_lock_x_lock(&btr_search_latch);
 
-	if (UNIV_UNLIKELY(btr_search_fully_disabled)) {
+	if (UNIV_UNLIKELY(!btr_search_enabled)) {
 		goto exit_func;
 	}
 
-	if (block->is_hashed && ((block->curr_n_fields != n_fields)
-				 || (block->curr_n_bytes != n_bytes)
-				 || (block->curr_left_side != left_side))) {
+	if (block->index && ((block->curr_n_fields != n_fields)
+			     || (block->curr_n_bytes != n_bytes)
+			     || (block->curr_left_side != left_side))) {
 		goto exit_func;
 	}
 
@@ -1424,11 +1435,10 @@ btr_search_build_page_hash_index(
 	rebuild hash index for a page that is already hashed, we
 	have to take care not to increment the counter in that
 	case. */
-	if (!block->is_hashed) {
+	if (!block->index) {
 		index->search_info->ref_count++;
 	}
 
-	block->is_hashed = TRUE;
 	block->n_hash_helps = 0;
 
 	block->curr_n_fields = n_fields;
@@ -1478,14 +1488,15 @@ btr_search_move_or_delete_hash_entries(
 	ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
 	ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_EX));
 #endif /* UNIV_SYNC_DEBUG */
-	ut_a(!new_block->is_hashed || new_block->index == index);
-	ut_a(!block->is_hashed || block->index == index);
-	ut_a(!(new_block->is_hashed || block->is_hashed)
-	     || !dict_index_is_ibuf(index));
 
 	rw_lock_s_lock(&btr_search_latch);
 
-	if (new_block->is_hashed) {
+	ut_a(!new_block->index || new_block->index == index);
+	ut_a(!block->index || block->index == index);
+	ut_a(!(new_block->index || block->index)
+	     || !dict_index_is_ibuf(index));
+
+	if (new_block->index) {
 
 		rw_lock_s_unlock(&btr_search_latch);
 
@@ -1494,7 +1505,7 @@ btr_search_move_or_delete_hash_entries(
 		return;
 	}
 
-	if (block->is_hashed) {
+	if (block->index) {
 
 		n_fields = block->curr_n_fields;
 		n_bytes = block->curr_n_bytes;
@@ -1531,45 +1542,52 @@ btr_search_update_hash_on_delete(
 {
 	hash_table_t*	table;
 	buf_block_t*	block;
-	rec_t*		rec;
+	const rec_t*	rec;
 	ulint		fold;
-	index_id_t	index_id;
+	dict_index_t*	index;
 	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	mem_heap_t*	heap		= NULL;
 	rec_offs_init(offsets_);
 
-	rec = btr_cur_get_rec(cursor);
-
 	block = btr_cur_get_block(cursor);
 
 #ifdef UNIV_SYNC_DEBUG
 	ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
 #endif /* UNIV_SYNC_DEBUG */
 
-	if (!block->is_hashed) {
+	index = block->index;
+
+	if (!index) {
 
 		return;
 	}
 
-	ut_a(block->index == cursor->index);
+	ut_a(index == cursor->index);
 	ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
-	ut_a(!dict_index_is_ibuf(cursor->index));
+	ut_a(!dict_index_is_ibuf(index));
 
 	table = btr_search_sys->hash_index;
 
-	index_id = cursor->index->id;
-	fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
+	rec = btr_cur_get_rec(cursor);
+
+	fold = rec_fold(rec, rec_get_offsets(rec, index, offsets_,
 					     ULINT_UNDEFINED, &heap),
-			block->curr_n_fields, block->curr_n_bytes, index_id);
+			block->curr_n_fields, block->curr_n_bytes, index->id);
 	if (UNIV_LIKELY_NULL(heap)) {
 		mem_heap_free(heap);
 	}
+
 	rw_lock_x_lock(&btr_search_latch);
 
-	if (ha_search_and_delete_if_found(table, fold, rec)) {
-		MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_REMOVED);
-	} else {
-		MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND);
+	if (block->index) {
+		ut_a(block->index == index);
+
+		if (ha_search_and_delete_if_found(table, fold, rec)) {
+			MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_REMOVED);
+		} else {
+			MONITOR_INC(
+				MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND);
+		}
 	}
 
 	rw_lock_x_unlock(&btr_search_latch);
@@ -1588,6 +1606,7 @@ btr_search_update_hash_node_on_insert(
 {
 	hash_table_t*	table;
 	buf_block_t*	block;
+	dict_index_t*	index;
 	rec_t*		rec;
 
 	rec = btr_cur_get_rec(cursor);
@@ -1598,16 +1617,25 @@ btr_search_update_hash_node_on_insert(
 	ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
 #endif /* UNIV_SYNC_DEBUG */
 
-	if (!block->is_hashed) {
+	index = block->index;
+
+	if (!index) {
 
 		return;
 	}
 
-	ut_a(block->index == cursor->index);
-	ut_a(!dict_index_is_ibuf(cursor->index));
+	ut_a(cursor->index == index);
+	ut_a(!dict_index_is_ibuf(index));
 
 	rw_lock_x_lock(&btr_search_latch);
 
+	if (!block->index) {
+
+		goto func_exit;
+	}
+
+	ut_a(block->index == index);
+
 	if ((cursor->flag == BTR_CUR_HASH)
 	    && (cursor->n_fields == block->curr_n_fields)
 	    && (cursor->n_bytes == block->curr_n_bytes)
@@ -1621,6 +1649,7 @@ btr_search_update_hash_node_on_insert(
 			MONITOR_INC(MONITOR_ADAPTIVE_HASH_ROW_UPDATED);
 		}
 
+func_exit:
 		rw_lock_x_unlock(&btr_search_latch);
 	} else {
 		rw_lock_x_unlock(&btr_search_latch);
@@ -1642,10 +1671,10 @@ btr_search_update_hash_on_insert(
 {
 	hash_table_t*	table;
 	buf_block_t*	block;
-	rec_t*		rec;
-	rec_t*		ins_rec;
-	rec_t*		next_rec;
-	index_id_t	index_id;
+	dict_index_t*	index;
+	const rec_t*	rec;
+	const rec_t*	ins_rec;
+	const rec_t*	next_rec;
 	ulint		fold;
 	ulint		ins_fold;
 	ulint		next_fold = 0; /* remove warning (??? bug ???) */
@@ -1664,44 +1693,44 @@ btr_search_update_hash_on_insert(
 	ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
 #endif /* UNIV_SYNC_DEBUG */
 
-	if (!block->is_hashed) {
+	index = block->index;
+
+	if (!index) {
 
 		return;
 	}
 
-	table = btr_search_sys->hash_index;
-
 	btr_search_check_free_space_in_heap();
 
-	rec = btr_cur_get_rec(cursor);
+	table = btr_search_sys->hash_index;
 
-	ut_a(block->index == cursor->index);
-	ut_a(!dict_index_is_ibuf(cursor->index));
+	rec = btr_cur_get_rec(cursor);
 
-	index_id = cursor->index->id;
+	ut_a(index == cursor->index);
+	ut_a(!dict_index_is_ibuf(index));
 
 	n_fields = block->curr_n_fields;
 	n_bytes = block->curr_n_bytes;
 	left_side = block->curr_left_side;
 
-	ins_rec = page_rec_get_next(rec);
-	next_rec = page_rec_get_next(ins_rec);
+	ins_rec = page_rec_get_next_const(rec);
+	next_rec = page_rec_get_next_const(ins_rec);
 
-	offsets = rec_get_offsets(ins_rec, cursor->index, offsets,
+	offsets = rec_get_offsets(ins_rec, index, offsets,
 				  ULINT_UNDEFINED, &heap);
-	ins_fold = rec_fold(ins_rec, offsets, n_fields, n_bytes, index_id);
+	ins_fold = rec_fold(ins_rec, offsets, n_fields, n_bytes, index->id);
 
 	if (!page_rec_is_supremum(next_rec)) {
-		offsets = rec_get_offsets(next_rec, cursor->index, offsets,
+		offsets = rec_get_offsets(next_rec, index, offsets,
 					  n_fields + (n_bytes > 0), &heap);
 		next_fold = rec_fold(next_rec, offsets, n_fields,
-				     n_bytes, index_id);
+				     n_bytes, index->id);
 	}
 
 	if (!page_rec_is_infimum(rec)) {
-		offsets = rec_get_offsets(rec, cursor->index, offsets,
+		offsets = rec_get_offsets(rec, index, offsets,
 					  n_fields + (n_bytes > 0), &heap);
-		fold = rec_fold(rec, offsets, n_fields, n_bytes, index_id);
+		fold = rec_fold(rec, offsets, n_fields, n_bytes, index->id);
 	} else {
 		if (left_side) {
 
@@ -1709,6 +1738,10 @@ btr_search_update_hash_on_insert(
 
 			locked = TRUE;
 
+			if (!btr_search_enabled) {
+				goto function_exit;
+			}
+
 			ha_insert_for_fold(table, ins_fold, block, ins_rec);
 		}
 
@@ -1722,6 +1755,10 @@ btr_search_update_hash_on_insert(
 			rw_lock_x_lock(&btr_search_latch);
 
 			locked = TRUE;
+
+			if (!btr_search_enabled) {
+				goto function_exit;
+			}
 		}
 
 		if (!left_side) {
@@ -1740,6 +1777,10 @@ check_next_rec:
 				rw_lock_x_lock(&btr_search_latch);
 
 				locked = TRUE;
+
+				if (!btr_search_enabled) {
+					goto function_exit;
+				}
 			}
 
 			ha_insert_for_fold(table, ins_fold, block, ins_rec);
@@ -1755,6 +1796,10 @@ check_next_rec:
 			rw_lock_x_lock(&btr_search_latch);
 
 			locked = TRUE;
+
+			if (!btr_search_enabled) {
+				goto function_exit;
+			}
 		}
 
 		if (!left_side) {
@@ -1762,7 +1807,7 @@ check_next_rec:
 			ha_insert_for_fold(table, ins_fold, block, ins_rec);
 			/*
 			fputs("Hash insert for ", stderr);
-			dict_index_name_print(stderr, cursor->index);
+			dict_index_name_print(stderr, index);
 			fprintf(stderr, " fold %lu\n", ins_fold);
 			*/
 		} else {
@@ -1865,21 +1910,20 @@ btr_search_validate(void)
 
 			ut_a(!dict_index_is_ibuf(block->index));
 
-			offsets = rec_get_offsets((const rec_t*) node->data,
+			page_index_id = btr_page_get_index_id(block->frame);
+
+			offsets = rec_get_offsets(node->data,
 						  block->index, offsets,
 						  block->curr_n_fields
 						  + (block->curr_n_bytes > 0),
 						  &heap);
 
-			page_index_id = btr_page_get_index_id(block->frame);
-
-			if (UNIV_UNLIKELY
-			    (!block->is_hashed || node->fold
-			     != rec_fold((rec_t*)(node->data),
-					 offsets,
-					 block->curr_n_fields,
-					 block->curr_n_bytes,
-					 page_index_id))) {
+			if (!block->index || node->fold
+			    != rec_fold(node->data,
+					offsets,
+					block->curr_n_fields,
+					block->curr_n_bytes,
+					page_index_id)) {
 				const page_t*	page = block->frame;
 
 				ok = FALSE;
@@ -1895,20 +1939,19 @@ btr_search_validate(void)
 					node->data,
 					(ullint) page_index_id,
 					(ulong) node->fold,
-					(ulong) rec_fold((rec_t*)(node->data),
+					(ulong) rec_fold(node->data,
 							 offsets,
 							 block->curr_n_fields,
 							 block->curr_n_bytes,
 							 page_index_id));
 
 				fputs("InnoDB: Record ", stderr);
-				rec_print_new(stderr, (rec_t*)node->data,
-					      offsets);
+				rec_print_new(stderr, node->data, offsets);
 				fprintf(stderr, "\nInnoDB: on that page."
-					" Page mem address %p, is hashed %lu,"
+					" Page mem address %p, is hashed %p,"
 					" n fields %lu, n bytes %lu\n"
 					"InnoDB: side %lu\n",
-					(void*) page, (ulong) block->is_hashed,
+					(void*) page, (void*) block->index,
 					(ulong) block->curr_n_fields,
 					(ulong) block->curr_n_bytes,
 					(ulong) block->curr_left_side);

=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	2011-10-03 17:53:54 +0000
+++ b/storage/innobase/buf/buf0buf.c	2011-10-12 13:46:34 +0000
@@ -871,8 +871,6 @@ buf_block_init(
 	block->check_index_page_at_flush = FALSE;
 	block->index = NULL;
 
-	block->is_hashed = FALSE;
-
 #ifdef UNIV_DEBUG
 	block->page.in_page_hash = FALSE;
 	block->page.in_zip_hash = FALSE;
@@ -1227,7 +1225,6 @@ buf_pool_free_instance(
 	}
 
 	mem_free(buf_pool->chunks);
-	ha_clear(buf_pool->page_hash);
 	hash_table_free(buf_pool->page_hash);
 	hash_table_free(buf_pool->zip_hash);
 }
@@ -1291,108 +1288,47 @@ buf_pool_free(
 }
 
 /********************************************************************//**
-Drops adaptive hash index for a buffer pool instance. */
-static
-void
-buf_pool_drop_hash_index_instance(
-/*==============================*/
-	buf_pool_t*	buf_pool,		/*!< in: buffer pool instance */
-	ibool*		released_search_latch)	/*!< out: flag for signalling
-						whether the search latch was
-						released */
-{
-	buf_chunk_t*	chunks	= buf_pool->chunks;
-	buf_chunk_t*	chunk	= chunks + buf_pool->n_chunks;
-
-	while (--chunk >= chunks) {
-		ulint		i;
-		buf_block_t*	block	= chunk->blocks;
-
-		for (i = chunk->size; i--; block++) {
-			/* block->is_hashed cannot be modified
-			when we have an x-latch on btr_search_latch;
-			see the comment in buf0buf.h */
-
-			if (!block->is_hashed) {
-				continue;
-			}
-
-			/* To follow the latching order, we
-			have to release btr_search_latch
-			before acquiring block->latch. */
-			rw_lock_x_unlock(&btr_search_latch);
-			/* When we release the search latch,
-			we must rescan all blocks, because
-			some may become hashed again. */
-			*released_search_latch = TRUE;
-
-			rw_lock_x_lock(&block->lock);
-
-			/* This should be guaranteed by the
-			callers, which will be holding
-			btr_search_enabled_mutex. */
-			ut_ad(!btr_search_enabled);
-
-			/* Because we did not buffer-fix the
-			block by calling buf_block_get_gen(),
-			it is possible that the block has been
-			allocated for some other use after
-			btr_search_latch was released above.
-			We do not care which file page the
-			block is mapped to.  All we want to do
-			is to drop any hash entries referring
-			to the page. */
-
-			/* It is possible that
-			block->page.state != BUF_FILE_PAGE.
-			Even that does not matter, because
-			btr_search_drop_page_hash_index() will
-			check block->is_hashed before doing
-			anything.  block->is_hashed can only
-			be set on uncompressed file pages. */
-
-			btr_search_drop_page_hash_index(block);
-
-			rw_lock_x_unlock(&block->lock);
-
-			rw_lock_x_lock(&btr_search_latch);
-
-			ut_ad(!btr_search_enabled);
-		}
-	}
-}
-
-/********************************************************************//**
-Drops the adaptive hash index.  To prevent a livelock, this function
-is only to be called while holding btr_search_latch and while
-btr_search_enabled == FALSE. */
+Clears the adaptive hash index on all pages in the buffer pool. */
 UNIV_INTERN
 void
-buf_pool_drop_hash_index(void)
-/*==========================*/
+buf_pool_clear_hash_index(void)
+/*===========================*/
 {
-	ibool		released_search_latch;
+	ulint	p;
 
 #ifdef UNIV_SYNC_DEBUG
 	ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
 #endif /* UNIV_SYNC_DEBUG */
 	ut_ad(!btr_search_enabled);
 
-	do {
- 		ulint	i;
-
-		released_search_latch = FALSE;
-
-		for (i = 0; i < srv_buf_pool_instances; i++) {
- 			buf_pool_t*	buf_pool;
-
-			buf_pool = buf_pool_from_array(i);
-
-			buf_pool_drop_hash_index_instance(
-				buf_pool, &released_search_latch);
+	for (p = 0; p < srv_buf_pool_instances; p++) {
+		buf_pool_t*	buf_pool = buf_pool_from_array(p);
+		buf_chunk_t*	chunks	= buf_pool->chunks;
+		buf_chunk_t*	chunk	= chunks + buf_pool->n_chunks;
+
+		while (--chunk >= chunks) {
+			buf_block_t*	block	= chunk->blocks;
+			ulint		i	= chunk->size;
+
+			for (; i--; block++) {
+				dict_index_t*	index	= block->index;
+
+				/* We can set block->index = NULL
+				when we have an x-latch on btr_search_latch;
+				see the comment in buf0buf.h */
+
+				if (!index) {
+					/* Not hashed */
+					continue;
+				}
+
+				block->index = NULL;
+# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
+				block->n_pointers = 0;
+# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+			}
 		}
-
-	} while (released_search_latch);
+	}
 }
 
 /********************************************************************//**
@@ -1796,37 +1732,28 @@ buf_page_set_accessed_make_young(
 }
 
 /********************************************************************//**
-Returns the current state of is_hashed of a page. FALSE if the page is
-not in the pool. NOTE that this operation does not fix the page in the
-pool if it is found there.
-@return	TRUE if page hash index is built in search system */
+Resets the check_index_page_at_flush field of a page if found in the buffer
+pool. */
 UNIV_INTERN
-ibool
-buf_page_peek_if_search_hashed(
-/*===========================*/
+void
+buf_reset_check_index_page_at_flush(
+/*================================*/
 	ulint	space,	/*!< in: space id */
 	ulint	offset)	/*!< in: page number */
 {
 	buf_block_t*	block;
-	ibool		is_hashed;
 	buf_pool_t*	buf_pool = buf_pool_get(space, offset);
-	rw_lock_t*	hash_lock;
 
-	block = buf_block_hash_get_s_locked(buf_pool, space, offset,
-					    &hash_lock);
+	buf_pool_mutex_enter(buf_pool);
 
-	if (!block || buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
-		is_hashed = FALSE;
-	} else {
-		ut_ad(!buf_pool_watch_is_sentinel(buf_pool, &block->page));
-		is_hashed = block->is_hashed;
-	}
+	block = (buf_block_t*) buf_page_hash_get(buf_pool, space, offset);
 
-	if (block) {
-		rw_lock_s_unlock(hash_lock);
+	if (block && buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE) {
+		ut_ad(!buf_pool_watch_is_sentinel(buf_pool, &block->page));
+		block->check_index_page_at_flush = FALSE;
 	}
 
-	return(is_hashed);
+	buf_pool_mutex_exit(buf_pool);
 }
 
 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
@@ -2077,7 +2004,6 @@ buf_block_init_low(
 	block->index		= NULL;
 
 	block->n_hash_helps	= 0;
-	block->is_hashed	= FALSE;
 	block->n_fields		= 1;
 	block->n_bytes		= 0;
 	block->left_side	= TRUE;

=== modified file 'storage/innobase/buf/buf0lru.c'
--- a/storage/innobase/buf/buf0lru.c	2011-10-03 17:53:54 +0000
+++ b/storage/innobase/buf/buf0lru.c	2011-10-12 13:46:34 +0000
@@ -283,7 +283,7 @@ next_page:
 
 		mutex_enter(&((buf_block_t*) bpage)->mutex);
 		is_fixed = bpage->buf_fix_count > 0
-			|| !((buf_block_t*) bpage)->is_hashed;
+			|| !((buf_block_t*) bpage)->index;
 		mutex_exit(&((buf_block_t*) bpage)->mutex);
 
 		if (is_fixed) {

=== modified file 'storage/innobase/ha/ha0ha.c'
--- a/storage/innobase/ha/ha0ha.c	2011-04-13 08:34:16 +0000
+++ b/storage/innobase/ha/ha0ha.c	2011-10-12 13:46:34 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -179,7 +179,7 @@ ha_insert_for_fold_func(
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	buf_block_t*	block,	/*!< in: buffer block containing the data */
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-	void*		data)	/*!< in: data, must not be NULL */
+	const rec_t*	data)	/*!< in: data, must not be NULL */
 {
 	hash_cell_t*	cell;
 	ha_node_t*	node;
@@ -193,6 +193,7 @@ ha_insert_for_fold_func(
 	ut_a(block->frame == page_align(data));
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
 	hash_assert_can_modify(table, fold);
+	ut_ad(btr_search_enabled);
 
 	hash = hash_calc_hash(fold, table);
 
@@ -212,7 +213,6 @@ ha_insert_for_fold_func(
 				prev_block->n_pointers--;
 				block->n_pointers++;
 			}
-			ut_ad(!btr_search_fully_disabled);
 # endif /* !UNIV_HOTBACKUP */
 
 			prev_node->block = block;
@@ -225,15 +225,6 @@ ha_insert_for_fold_func(
 		prev_node = prev_node->next;
 	}
 
-#ifndef UNIV_HOTBACKUP
-	/* We are in the process of disabling hash index, do not add
-	new chain node */
-	if (!btr_search_enabled) {
-		ut_ad(!btr_search_fully_disabled);
-		return(TRUE);
-	}
-#endif /* !UNIV_HOTBACKUP */
-
 	/* We have to allocate a new chain node */
 
 	node = mem_heap_alloc(hash_get_heap(table, fold), sizeof(ha_node_t));
@@ -291,6 +282,10 @@ ha_delete_hash_node(
 {
 	ut_ad(table);
 	ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
+#ifdef UNIV_SYNC_DEBUG
+	ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
+	ut_ad(btr_search_enabled);
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 # ifndef UNIV_HOTBACKUP
 	if (table->adaptive) {
@@ -314,11 +309,11 @@ ha_search_and_update_if_found_func(
 /*===============================*/
 	hash_table_t*	table,	/*!< in/out: hash table */
 	ulint		fold,	/*!< in: folded value of the searched data */
-	void*		data,	/*!< in: pointer to the data */
+	const rec_t*	data,	/*!< in: pointer to the data */
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	buf_block_t*	new_block,/*!< in: block containing new_data */
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-	void*		new_data)/*!< in: new pointer to the data */
+	const rec_t*	new_data)/*!< in: new pointer to the data */
 {
 	ha_node_t*	node;
 
@@ -328,6 +323,13 @@ ha_search_and_update_if_found_func(
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	ut_a(new_block->frame == page_align(new_data));
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+#ifdef UNIV_SYNC_DEBUG
+	ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+#endif /* UNIV_SYNC_DEBUG */
+
+	if (!btr_search_enabled) {
+		return(FALSE);
+	}
 
 	node = ha_search_with_data(table, fold, data);
 
@@ -368,6 +370,7 @@ ha_remove_all_nodes_to_page(
 	ut_ad(table);
 	ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
 	hash_assert_can_modify(table, fold);
+	ut_ad(btr_search_enabled);
 
 	node = ha_chain_get_first(table, fold);
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-10-04 05:55:38 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-10-12 13:46:34 +0000
@@ -263,7 +263,6 @@ performance schema instrumented if "UNIV
 is defined */
 static PSI_mutex_info all_innodb_mutexes[] = {
 	{&autoinc_mutex_key, "autoinc_mutex", 0},
-	{&btr_search_enabled_mutex_key, "btr_search_enabled_mutex", 0},
 #  ifndef PFS_SKIP_BUFFER_MUTEX_RWLOCK
 	{&buffer_block_mutex_key, "buffer_block_mutex", 0},
 #  endif /* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
@@ -2877,7 +2876,6 @@ innobase_change_buffering_inited_ok:
 	/* Turn on monitor counters that are default on */
 	srv_mon_default_on();
 
-	btr_search_fully_disabled = (!btr_search_enabled);
 	DBUG_RETURN(FALSE);
 error:
 	DBUG_RETURN(TRUE);

=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc	2011-10-03 17:53:54 +0000
+++ b/storage/innobase/handler/i_s.cc	2011-10-12 13:46:34 +0000
@@ -3412,7 +3412,7 @@ i_s_innodb_buffer_page_get_info(
 
 			block = reinterpret_cast<const buf_block_t*>(bpage);
 			frame = block->frame;
-			page_info->hashed = block->is_hashed;
+			page_info->hashed = (block->index != NULL);
 		} else {
 			ut_ad(page_info->zip_ssize);
 			frame = bpage->zip.data;

=== modified file 'storage/innobase/ibuf/ibuf0ibuf.c'
--- a/storage/innobase/ibuf/ibuf0ibuf.c	2011-09-13 06:24:25 +0000
+++ b/storage/innobase/ibuf/ibuf0ibuf.c	2011-10-12 13:46:34 +0000
@@ -3986,7 +3986,7 @@ ibuf_insert_to_index_page(
 
 	ut_ad(ibuf_inside(mtr));
 	ut_ad(dtuple_check_typed(entry));
-	ut_ad(!buf_block_align(page)->is_hashed);
+	ut_ad(!buf_block_align(page)->index);
 
 	if (UNIV_UNLIKELY(dict_table_is_comp(index->table)
 			  != (ibool)!!page_is_comp(page))) {

=== modified file 'storage/innobase/include/btr0sea.h'
--- a/storage/innobase/include/btr0sea.h	2011-08-19 06:13:33 +0000
+++ b/storage/innobase/include/btr0sea.h	2011-10-12 13:46:34 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, 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
@@ -141,8 +141,8 @@ btr_search_drop_page_hash_index(
 				for which we know that
 				block->buf_fix_count == 0 */
 /********************************************************************//**
-Drops a page hash index when a page is freed from a fseg to the file system.
-Drops possible hash index if the page happens to be in the buffer pool. */
+Drops a possible page hash index when a page is evicted from the buffer pool
+or freed in a file segment. */
 UNIV_INTERN
 void
 btr_search_drop_page_hash_when_freed(
@@ -192,16 +192,6 @@ btr_search_validate(void);
 # define btr_search_validate()	TRUE
 #endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
 
-/** Flag: has the search system been enabled?
-Protected by btr_search_latch and btr_search_enabled_mutex. */
-extern char	btr_search_enabled;
-
-/** Flag: whether the search system has completed its disabling process,
-It is set to TRUE right after buf_pool_drop_hash_index() in
-btr_search_disable(), indicating hash index entries are cleaned up.
-Protected by btr_search_latch and btr_search_enabled_mutex. */
-extern ibool	btr_search_fully_disabled;
-
 /** The search info struct in an index */
 struct btr_search_struct{
 	ulint	ref_count;	/*!< Number of blocks in this index tree

=== modified file 'storage/innobase/include/btr0types.h'
--- a/storage/innobase/include/btr0types.h	2011-02-08 12:16:14 +0000
+++ b/storage/innobase/include/btr0types.h	2011-10-12 13:46:34 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2011, 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
@@ -30,6 +30,7 @@ Created 2/17/1996 Heikki Tuuri
 
 #include "rem0types.h"
 #include "page0types.h"
+#include "sync0rw.h"
 
 /** Persistent cursor */
 typedef struct btr_pcur_struct		btr_pcur_t;
@@ -38,6 +39,28 @@ typedef struct btr_cur_struct		btr_cur_t
 /** B-tree search information for the adaptive hash index */
 typedef struct btr_search_struct	btr_search_t;
 
+/** @brief The latch protecting the adaptive search system
+
+This latch protects the
+(1) hash index;
+(2) columns of a record to which we have a pointer in the hash index;
+
+but does NOT protect:
+
+(3) next record offset field in a record;
+(4) next or previous records on the same page.
+
+Bear in mind (3) and (4) when using the hash index.
+*/
+extern rw_lock_t*	btr_search_latch_temp;
+
+/** The latch protecting the adaptive search system */
+#define btr_search_latch	(*btr_search_latch_temp)
+
+/** Flag: has the search system been enabled?
+Protected by btr_search_latch. */
+extern char	btr_search_enabled;
+
 #ifdef UNIV_BLOB_DEBUG
 # include "buf0types.h"
 /** An index->blobs entry for keeping track of off-page column references */

=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h	2011-10-03 17:53:54 +0000
+++ b/storage/innobase/include/buf0buf.h	2011-10-12 13:46:34 +0000
@@ -239,13 +239,11 @@ buf_pool_free(
 	ulint	n_instances);	/*!< in: numbere of instances to free */
 
 /********************************************************************//**
-Drops the adaptive hash index.  To prevent a livelock, this function
-is only to be called while holding btr_search_latch and while
-btr_search_enabled == FALSE. */
+Clears the adaptive hash index on all pages in the buffer pool. */
 UNIV_INTERN
 void
-buf_pool_drop_hash_index(void);
-/*==========================*/
+buf_pool_clear_hash_index(void);
+/*===========================*/
 
 /********************************************************************//**
 Relocate a buffer control block.  Relocates the block on the LRU list
@@ -568,17 +566,6 @@ buf_page_peek_if_too_old(
 /*=====================*/
 	const buf_page_t*	bpage);	/*!< in: block to make younger */
 /********************************************************************//**
-Returns the current state of is_hashed of a page. FALSE if the page is
-not in the pool. NOTE that this operation does not fix the page in the
-pool if it is found there.
-@return	TRUE if page hash index is built in search system */
-UNIV_INTERN
-ibool
-buf_page_peek_if_search_hashed(
-/*===========================*/
-	ulint	space,	/*!< in: space id */
-	ulint	offset);/*!< in: page number */
-/********************************************************************//**
 Gets the youngest modification log sequence number for a frame.
 Returns zero if not file page or no modification occurred yet.
 @return	newest modification to page */
@@ -1634,13 +1621,16 @@ struct buf_block_struct{
 	/* @} */
 
 	/** @name Hash search fields
-	These 6 fields may only be modified when we have
+	These 5 fields may only be modified when we have
 	an x-latch on btr_search_latch AND
 	- we are holding an s-latch or x-latch on buf_block_struct::lock or
 	- we know that buf_block_struct::buf_fix_count == 0.
 
 	An exception to this is when we init or create a page
-	in the buffer pool in buf0buf.c. */
+	in the buffer pool in buf0buf.c.
+
+	Another exception is that assigning block->index = NULL
+	is allowed whenever holding an x-latch on btr_search_latch. */
 
 	/* @{ */
 
@@ -1649,20 +1639,20 @@ struct buf_block_struct{
 					pointers in the adaptive hash index
 					pointing to this frame */
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-	unsigned	is_hashed:1;	/*!< TRUE if hash index has
-					already been built on this
-					page; note that it does not
-					guarantee that the index is
-					complete, though: there may
-					have been hash collisions,
-					record deletions, etc. */
 	unsigned	curr_n_fields:10;/*!< prefix length for hash indexing:
 					number of full fields */
 	unsigned	curr_n_bytes:15;/*!< number of bytes in hash
 					indexing */
 	unsigned	curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
-	dict_index_t*	index;		/*!< Index for which the adaptive
-					hash index has been created. */
+	dict_index_t*	index;		/*!< Index for which the
+					adaptive hash index has been
+					created, or NULL if the page
+					does not exist in the
+					index. Note that it does not
+					guarantee that the index is
+					complete, though: there may
+					have been hash collisions,
+					record deletions, etc. */
 	/* @} */
 # ifdef UNIV_SYNC_DEBUG
 	/** @name Debug fields */

=== modified file 'storage/innobase/include/ha0ha.h'
--- a/storage/innobase/include/ha0ha.h	2011-02-18 16:16:09 +0000
+++ b/storage/innobase/include/ha0ha.h	2011-10-12 13:46:34 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -31,13 +31,14 @@ Created 8/18/1994 Heikki Tuuri
 #include "hash0hash.h"
 #include "page0types.h"
 #include "buf0types.h"
+#include "rem0types.h"
 
 /*************************************************************//**
 Looks for an element in a hash table.
 @return pointer to the data of the first hash table node in chain
 having the fold number, NULL if not found */
 UNIV_INLINE
-void*
+const rec_t*
 ha_search_and_get_data(
 /*===================*/
 	hash_table_t*	table,	/*!< in: hash table */
@@ -52,11 +53,11 @@ ha_search_and_update_if_found_func(
 /*===============================*/
 	hash_table_t*	table,	/*!< in/out: hash table */
 	ulint		fold,	/*!< in: folded value of the searched data */
-	void*		data,	/*!< in: pointer to the data */
+	const rec_t*	data,	/*!< in: pointer to the data */
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	buf_block_t*	new_block,/*!< in: block containing new_data */
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-	void*		new_data);/*!< in: new pointer to the data */
+	const rec_t*	new_data);/*!< in: new pointer to the data */
 
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 /** Looks for an element when we know the pointer to the data and
@@ -143,7 +144,7 @@ ha_insert_for_fold_func(
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	buf_block_t*	block,	/*!< in: buffer block containing the data */
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-	void*		data);	/*!< in: data, must not be NULL */
+	const rec_t*	data);	/*!< in: data, must not be NULL */
 
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 /**
@@ -185,7 +186,7 @@ ha_search_and_delete_if_found(
 /*==========================*/
 	hash_table_t*	table,	/*!< in: hash table */
 	ulint		fold,	/*!< in: folded value of the searched data */
-	void*		data);	/*!< in: pointer to the data */
+	const rec_t*	data);	/*!< in: pointer to the data */
 #ifndef UNIV_HOTBACKUP
 /*****************************************************************//**
 Removes from the chain determined by fold all nodes whose data pointer
@@ -228,7 +229,7 @@ struct ha_node_struct {
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	buf_block_t*	block;	/*!< buffer block containing the data, or NULL */
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-	void*		data;	/*!< pointer to the data */
+	const rec_t*	data;	/*!< pointer to the data */
 	ulint		fold;	/*!< fold value for the data */
 };
 

=== modified file 'storage/innobase/include/ha0ha.ic'
--- a/storage/innobase/include/ha0ha.ic	2010-12-08 15:30:01 +0000
+++ b/storage/innobase/include/ha0ha.ic	2011-10-12 13:46:34 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1994, 2011, 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
@@ -25,6 +25,7 @@ Created 8/18/1994 Heikki Tuuri
 
 #include "ut0rnd.h"
 #include "mem0mem.h"
+#include "btr0types.h"
 
 /***********************************************************//**
 Deletes a hash node. */
@@ -39,10 +40,10 @@ ha_delete_hash_node(
 Gets a hash node data.
 @return	pointer to the data */
 UNIV_INLINE
-void*
+const rec_t*
 ha_node_get_data(
 /*=============*/
-	ha_node_t*	node)	/*!< in: hash chain node */
+	const ha_node_t*	node)	/*!< in: hash chain node */
 {
 	return(node->data);
 }
@@ -57,7 +58,7 @@ ha_node_set_data_func(
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	buf_block_t*	block,	/*!< in: buffer block containing the data */
 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
-	void*		data)	/*!< in: pointer to the data */
+	const rec_t*	data)	/*!< in: pointer to the data */
 {
 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
 	node->block = block;
@@ -157,39 +158,10 @@ hash_assert_can_search(
 
 /*************************************************************//**
 Looks for an element in a hash table.
-@return pointer to the first hash table node in chain having the fold
-number, NULL if not found */
-UNIV_INLINE
-ha_node_t*
-ha_search(
-/*======*/
-	hash_table_t*	table,	/*!< in: hash table */
-	ulint		fold)	/*!< in: folded value of the searched data */
-{
-	ha_node_t*	node;
-
-	hash_assert_can_search(table, fold);
-
-	node = ha_chain_get_first(table, fold);
-
-	while (node) {
-		if (node->fold == fold) {
-
-			return(node);
-		}
-
-		node = ha_chain_get_next(node);
-	}
-
-	return(NULL);
-}
-
-/*************************************************************//**
-Looks for an element in a hash table.
 @return pointer to the data of the first hash table node in chain
 having the fold number, NULL if not found */
 UNIV_INLINE
-void*
+const rec_t*
 ha_search_and_get_data(
 /*===================*/
 	hash_table_t*	table,	/*!< in: hash table */
@@ -198,6 +170,7 @@ ha_search_and_get_data(
 	ha_node_t*	node;
 
 	hash_assert_can_search(table, fold);
+	ut_ad(btr_search_enabled);
 
 	node = ha_chain_get_first(table, fold);
 
@@ -222,12 +195,14 @@ ha_search_with_data(
 /*================*/
 	hash_table_t*	table,	/*!< in: hash table */
 	ulint		fold,	/*!< in: folded value of the searched data */
-	void*		data)	/*!< in: pointer to the data */
+	const rec_t*	data)	/*!< in: pointer to the data */
 {
 	ha_node_t*	node;
 
 	hash_assert_can_search(table, fold);
 
+	ut_ad(btr_search_enabled);
+
 	node = ha_chain_get_first(table, fold);
 
 	while (node) {
@@ -252,11 +227,12 @@ ha_search_and_delete_if_found(
 /*==========================*/
 	hash_table_t*	table,	/*!< in: hash table */
 	ulint		fold,	/*!< in: folded value of the searched data */
-	void*		data)	/*!< in: pointer to the data */
+	const rec_t*	data)	/*!< in: pointer to the data */
 {
 	ha_node_t*	node;
 
 	hash_assert_can_modify(table, fold);
+	ut_ad(btr_search_enabled);
 
 	node = ha_search_with_data(table, fold, data);
 

=== modified file 'storage/innobase/include/row0upd.ic'
--- a/storage/innobase/include/row0upd.ic	2011-09-08 13:29:05 +0000
+++ b/storage/innobase/include/row0upd.ic	2011-10-12 13:46:34 +0000
@@ -28,7 +28,6 @@ Created 12/27/1996 Heikki Tuuri
 # include "trx0trx.h"
 # include "trx0undo.h"
 # include "row0row.h"
-# include "btr0sea.h"
 #endif /* !UNIV_HOTBACKUP */
 #include "page0zip.h"
 

=== modified file 'storage/innobase/include/sync0sync.h'
--- a/storage/innobase/include/sync0sync.h	2011-09-30 12:49:33 +0000
+++ b/storage/innobase/include/sync0sync.h	2011-10-12 13:46:34 +0000
@@ -66,7 +66,6 @@ instrumentation due to their large numbe
 #ifdef UNIV_PFS_MUTEX
 /* Key defines to register InnoDB mutexes with performance schema */
 extern mysql_pfs_key_t	autoinc_mutex_key;
-extern mysql_pfs_key_t	btr_search_enabled_mutex_key;
 extern mysql_pfs_key_t	buffer_block_mutex_key;
 extern mysql_pfs_key_t	buf_pool_mutex_key;
 extern mysql_pfs_key_t	buf_pool_zip_mutex_key;
@@ -697,7 +696,6 @@ or row lock! */
 #define SYNC_LOG_FLUSH_ORDER	147
 #define SYNC_RECV		168
 #define	SYNC_WORK_QUEUE		162
-#define	SYNC_SEARCH_SYS_CONF	161	/* for assigning btr_search_enabled */
 #define	SYNC_SEARCH_SYS		160	/* NOTE that if we have a memory
 					heap that can be extended to the
 					buffer pool, its logical level is

=== modified file 'storage/innobase/page/page0page.c'
--- a/storage/innobase/page/page0page.c	2011-09-30 12:49:33 +0000
+++ b/storage/innobase/page/page0page.c	2011-10-12 13:46:34 +0000
@@ -215,12 +215,6 @@ page_set_max_trx_id(
 {
 	page_t*		page		= buf_block_get_frame(block);
 #ifndef UNIV_HOTBACKUP
-	const ibool	is_hashed	= block->is_hashed;
-
-	if (is_hashed) {
-		rw_lock_x_lock(&btr_search_latch);
-	}
-
 	ut_ad(!mtr || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
 #endif /* !UNIV_HOTBACKUP */
 
@@ -241,12 +235,6 @@ page_set_max_trx_id(
 	} else {
 		mach_write_to_8(page + (PAGE_HEADER + PAGE_MAX_TRX_ID), trx_id);
 	}
-
-#ifndef UNIV_HOTBACKUP
-	if (is_hashed) {
-		rw_lock_x_unlock(&btr_search_latch);
-	}
-#endif /* !UNIV_HOTBACKUP */
 }
 
 /************************************************************//**

=== modified file 'storage/innobase/row/row0sel.c'
--- a/storage/innobase/row/row0sel.c	2011-09-23 10:55:10 +0000
+++ b/storage/innobase/row/row0sel.c	2011-10-12 13:46:34 +0000
@@ -1400,11 +1400,9 @@ table_loop:
 	    && !plan->must_get_clust
 	    && !plan->table->big_rows) {
 		if (!search_latch_locked) {
-			if (!btr_search_fully_disabled) {
-				rw_lock_s_lock(&btr_search_latch);
+			rw_lock_s_lock(&btr_search_latch);
 
-				search_latch_locked = TRUE;
-			}
+			search_latch_locked = TRUE;
 		} else if (rw_lock_get_writer(&btr_search_latch) == RW_LOCK_WAIT_EX) {
 
 			/* There is an x-latch request waiting: release the
@@ -3880,8 +3878,7 @@ row_search_for_mysql(
 			hash index semaphore! */
 
 #ifndef UNIV_SEARCH_DEBUG
-			if (!trx->has_search_latch
-			    &&(!btr_search_fully_disabled)) {
+			if (!trx->has_search_latch) {
 				rw_lock_s_lock(&btr_search_latch);
 				trx->has_search_latch = TRUE;
 			}

=== modified file 'storage/innobase/sync/sync0sync.c'
--- a/storage/innobase/sync/sync0sync.c	2011-09-30 12:49:33 +0000
+++ b/storage/innobase/sync/sync0sync.c	2011-10-12 13:46:34 +0000
@@ -1218,7 +1218,6 @@ sync_thread_add_level(
 	case SYNC_FILE_FORMAT_TAG:
 	case SYNC_DOUBLEWRITE:
 	case SYNC_SEARCH_SYS:
-	case SYNC_SEARCH_SYS_CONF:
 	case SYNC_THREADS:
 	case SYNC_LOCK_SYS:
 	case SYNC_LOCK_WAIT_SYS:

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2011-10-06 16:06:40 +0000
+++ b/storage/perfschema/pfs.cc	2011-10-12 20:15:19 +0000
@@ -3932,8 +3932,6 @@ static void end_file_wait_v1(PSI_file_lo
     case PSI_FILE_RENAME:
     case PSI_FILE_SYNC:
     case PSI_FILE_STAT:
-      byte_stat= &file->m_file_stat.m_io_stat.m_misc;
-      break;
     case PSI_FILE_CLOSE:
       byte_stat= &file->m_file_stat.m_io_stat.m_misc;
       break;

=== modified file 'storage/perfschema/table_ews_by_thread_by_event_name.cc'
--- a/storage/perfschema/table_ews_by_thread_by_event_name.cc	2011-08-16 03:57:30 +0000
+++ b/storage/perfschema/table_ews_by_thread_by_event_name.cc	2011-10-06 17:15:47 +0000
@@ -246,8 +246,8 @@ void table_ews_by_thread_by_event_name
   */  
   if (klass->is_deferred())
   {
-    /* Visit instances owned by this thread. Do not visit the class. */
-    PFS_instance_wait_visitor inst_visitor;
+    /* Visit instances owned by this thread. Do not visit the class. */
+    PFS_instance_wait_visitor inst_visitor;
     PFS_instance_iterator::visit_instances(klass, &inst_visitor,
                                            thread, false);
     /* Combine the deferred stats and global stats */

=== modified file 'storage/perfschema/table_file_summary_by_event_name.cc'
--- a/storage/perfschema/table_file_summary_by_event_name.cc	2011-09-02 20:03:36 +0000
+++ b/storage/perfschema/table_file_summary_by_event_name.cc	2011-10-12 20:15:19 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2011, 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
@@ -25,134 +25,134 @@
 #include "pfs_column_values.h"
 #include "table_file_summary_by_event_name.h"
 #include "pfs_global.h"
-#include "pfs_visitor.h"
+#include "pfs_visitor.h"
 
 THR_LOCK table_file_summary_by_event_name::m_table_lock;
 
-static const TABLE_FIELD_TYPE field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("EVENT_NAME") },
-    { C_STRING_WITH_LEN("varchar(128)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_STAR") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Read */
-  {
-    { C_STRING_WITH_LEN("COUNT_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Write */
-  {
-    { C_STRING_WITH_LEN("COUNT_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Misc */
-  {
-    { C_STRING_WITH_LEN("COUNT_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  }
-};
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("EVENT_NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_STAR") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Read */
+  {
+    { C_STRING_WITH_LEN("COUNT_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Write */
+  {
+    { C_STRING_WITH_LEN("COUNT_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Misc */
+  {
+    { C_STRING_WITH_LEN("COUNT_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
+};
 
 TABLE_FIELD_DEF
 table_file_summary_by_event_name::m_field_def=
@@ -236,117 +236,117 @@ int table_file_summary_by_event_name::rn
 */
 void table_file_summary_by_event_name::make_row(PFS_file_class *file_class)
 {
-  m_row.m_event_name.make_row(file_class);
-
-  PFS_instance_file_io_stat_visitor visitor;
-  PFS_instance_iterator::visit_file_instances(file_class, &visitor);
-
-  time_normalizer *normalizer= time_normalizer::get(wait_timer);
-  
-  /* Collect timer and byte count stats */
-  m_row.m_io_stat.set(normalizer, &visitor.m_file_io_stat);
-  m_row_exists= true;
+  m_row.m_event_name.make_row(file_class);
+
+  PFS_instance_file_io_stat_visitor visitor;
+  PFS_instance_iterator::visit_file_instances(file_class, &visitor);
+
+  time_normalizer *normalizer= time_normalizer::get(wait_timer);
+  
+  /* Collect timer and byte count stats */
+  m_row.m_io_stat.set(normalizer, &visitor.m_file_io_stat);
+  m_row_exists= true;
 
 }
 
-int table_file_summary_by_event_name::read_row_values(TABLE *table,
-                                                      unsigned char *,
-                                                      Field **fields,
-                                                      bool read_all)
-{
-  Field *f;
-
-  if (unlikely(!m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case  0: /* EVENT_NAME */
-        m_row.m_event_name.set_field(f);
-        break;
-      case  1: /* COUNT_STAR */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
-        break;
-      case  2: /* SUM_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
-        break;
-      case  3: /* MIN_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
-        break;
-      case  4: /* AVG_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
-        break;
-      case  5: /* MAX_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
-        break;
-
-      case  6: /* COUNT_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
-        break;
-      case  7: /* SUM_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
-        break;
-      case  8: /* MIN_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
-        break;
-      case  9: /* AVG_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
-        break;
-      case 10: /* MAX_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
-        break;
-      case 11: /* SUM_NUMBER_OF_BYTES_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
-        break;
-
-      case 12: /* COUNT_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
-        break;
-      case 13: /* SUM_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
-        break;
-      case 14: /* MIN_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
-        break;
-      case 15: /* AVG_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
-        break;
-      case 16: /* MAX_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
-        break;
-      case 17: /* SUM_NUMBER_OF_BYTES_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
-        break;
-
-      case 18: /* COUNT_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
-        break;
-      case 19: /* SUM_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
-        break;
-      case 20: /* MIN_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
-        break;
-      case 21: /* AVG_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
-        break;
-      case 22: /* MAX_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
-        break;
-
-      default:
-        DBUG_ASSERT(false);
-        break;
-      }
-    } // if
-  } // for
+int table_file_summary_by_event_name::read_row_values(TABLE *table,
+                                                      unsigned char *,
+                                                      Field **fields,
+                                                      bool read_all)
+{
+  Field *f;
+
+  if (unlikely(!m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 0);
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case  0: /* EVENT_NAME */
+        m_row.m_event_name.set_field(f);
+        break;
+      case  1: /* COUNT_STAR */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
+        break;
+      case  2: /* SUM_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
+        break;
+      case  3: /* MIN_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
+        break;
+      case  4: /* AVG_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
+        break;
+      case  5: /* MAX_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
+        break;
+
+      case  6: /* COUNT_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
+        break;
+      case  7: /* SUM_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
+        break;
+      case  8: /* MIN_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
+        break;
+      case  9: /* AVG_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
+        break;
+      case 10: /* MAX_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
+        break;
+      case 11: /* SUM_NUMBER_OF_BYTES_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
+        break;
+
+      case 12: /* COUNT_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
+        break;
+      case 13: /* SUM_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
+        break;
+      case 14: /* MIN_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
+        break;
+      case 15: /* AVG_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
+        break;
+      case 16: /* MAX_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
+        break;
+      case 17: /* SUM_NUMBER_OF_BYTES_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
+        break;
+
+      case 18: /* COUNT_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
+        break;
+      case 19: /* SUM_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
+        break;
+      case 20: /* MIN_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
+        break;
+      case 21: /* AVG_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
+        break;
+      case 22: /* MAX_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
+        break;
+
+      default:
+        DBUG_ASSERT(false);
+        break;
+      }
+    } // if
+  } // for
 
   return 0;
 }

=== modified file 'storage/perfschema/table_file_summary_by_event_name.h'
--- a/storage/perfschema/table_file_summary_by_event_name.h	2011-09-02 20:03:36 +0000
+++ b/storage/perfschema/table_file_summary_by_event_name.h	2011-10-12 20:15:19 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2011, 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

=== modified file 'storage/perfschema/table_file_summary_by_instance.cc'
--- a/storage/perfschema/table_file_summary_by_instance.cc	2011-09-02 20:03:36 +0000
+++ b/storage/perfschema/table_file_summary_by_instance.cc	2011-10-12 20:15:19 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2011, 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
@@ -40,127 +40,127 @@ static const TABLE_FIELD_TYPE field_type
     { C_STRING_WITH_LEN("varchar(128)") },
     { NULL, 0}
   },
-  {
-    { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_STAR") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Read */
-  {
-    { C_STRING_WITH_LEN("COUNT_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Write */
-  {
-    { C_STRING_WITH_LEN("COUNT_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Misc */
-  {
-    { C_STRING_WITH_LEN("COUNT_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  }
+  {
+    { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_STAR") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Read */
+  {
+    { C_STRING_WITH_LEN("COUNT_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Write */
+  {
+    { C_STRING_WITH_LEN("COUNT_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Misc */
+  {
+    { C_STRING_WITH_LEN("COUNT_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
 };
 
 TABLE_FIELD_DEF
@@ -261,12 +261,12 @@ void table_file_summary_by_instance::mak
   m_row.m_filename= pfs->m_filename;
   m_row.m_filename_length= pfs->m_filename_length;
   m_row.m_event_name.make_row(safe_class);
-  m_row.m_identity= pfs->m_identity;
-
-  time_normalizer *normalizer= time_normalizer::get(wait_timer);
-
-  /* Collect timer and byte count stats */
-  m_row.m_io_stat.set(normalizer, &pfs->m_file_stat.m_io_stat);
+  m_row.m_identity= pfs->m_identity;
+
+  time_normalizer *normalizer= time_normalizer::get(wait_timer);
+
+  /* Collect timer and byte count stats */
+  m_row.m_io_stat.set(normalizer, &pfs->m_file_stat.m_io_stat);
 
   if (pfs->m_lock.end_optimistic_lock(&lock))
     m_row_exists= true;
@@ -297,79 +297,79 @@ int table_file_summary_by_instance::read
       case  1: /* EVENT_NAME */
         m_row.m_event_name.set_field(f);
         break;
-      case  2: /* OBJECT_INSTANCE */
-        set_field_ulonglong(f, (ulonglong)m_row.m_identity);
-        break;
-
-      case  3:/* COUNT_STAR */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
-        break;
-      case  4:/* SUM_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
-        break;
-      case  5: /* MIN_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
-        break;
-      case  6: /* AVG_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
-        break;
-      case  7: /* MAX_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
-        break;
-
-      case  8: /* COUNT_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
-        break;
-      case  9: /* SUM_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
-        break;
-      case 10: /* MIN_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
-        break;
-      case 11: /* AVG_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
-        break;
-      case 12: /* MAX_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
-        break;
-      case 13: /* SUM_NUMBER_OF_BYTES_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
-        break;
-
-      case 14: /* COUNT_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
-        break;
-      case 15: /* SUM_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
-        break;
-      case 16: /* MIN_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
-        break;
-      case 17: /* AVG_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
-        break;
-      case 18: /* MAX_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
-        break;
-      case 19: /* SUM_NUMBER_OF_BYTES_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
-        break;
-
-      case 20: /* COUNT_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
-        break;
-      case 21: /* SUM_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
-        break;
-      case 22: /* MIN_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
-        break;
-      case 23: /* AVG_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
-        break;
-      case 24: /* MAX_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
-        break;
+      case  2: /* OBJECT_INSTANCE */
+        set_field_ulonglong(f, (ulonglong)m_row.m_identity);
+        break;
+
+      case  3:/* COUNT_STAR */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
+        break;
+      case  4:/* SUM_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
+        break;
+      case  5: /* MIN_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
+        break;
+      case  6: /* AVG_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
+        break;
+      case  7: /* MAX_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
+        break;
+
+      case  8: /* COUNT_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
+        break;
+      case  9: /* SUM_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
+        break;
+      case 10: /* MIN_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
+        break;
+      case 11: /* AVG_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
+        break;
+      case 12: /* MAX_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
+        break;
+      case 13: /* SUM_NUMBER_OF_BYTES_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
+        break;
+
+      case 14: /* COUNT_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
+        break;
+      case 15: /* SUM_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
+        break;
+      case 16: /* MIN_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
+        break;
+      case 17: /* AVG_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
+        break;
+      case 18: /* MAX_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
+        break;
+      case 19: /* SUM_NUMBER_OF_BYTES_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
+        break;
+
+      case 20: /* COUNT_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
+        break;
+      case 21: /* SUM_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
+        break;
+      case 22: /* MIN_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
+        break;
+      case 23: /* AVG_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
+        break;
+      case 24: /* MAX_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
+        break;
       default:
         DBUG_ASSERT(false);
       }

=== modified file 'storage/perfschema/table_file_summary_by_instance.h'
--- a/storage/perfschema/table_file_summary_by_instance.h	2011-09-02 20:03:36 +0000
+++ b/storage/perfschema/table_file_summary_by_instance.h	2011-10-12 20:15:19 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2011 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

=== modified file 'storage/perfschema/table_socket_summary_by_event_name.cc'
--- a/storage/perfschema/table_socket_summary_by_event_name.cc	2011-03-28 23:37:10 +0000
+++ b/storage/perfschema/table_socket_summary_by_event_name.cc	2011-10-06 17:15:47 +0000
@@ -1,348 +1,348 @@
-/* Copyright (c) 2008, 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 */
-
-/**
-  @file storage/perfschema/table_socket_summary_by_event_name.cc
-  Table SOCKET_EVENT_NAMES (implementation).
-*/
-
-#include "my_global.h"
-#include "my_pthread.h"
-#include "pfs_instr.h"
-#include "pfs_column_types.h"
-#include "pfs_column_values.h"
-#include "table_socket_summary_by_event_name.h"
-#include "pfs_global.h"
-#include "pfs_visitor.h"
-
-THR_LOCK table_socket_summary_by_event_name::m_table_lock;
-
-static const TABLE_FIELD_TYPE field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("EVENT_NAME") },
-    { C_STRING_WITH_LEN("varchar(128)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_STAR") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Read */
-  {
-    { C_STRING_WITH_LEN("COUNT_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Write */
-  {
-    { C_STRING_WITH_LEN("COUNT_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Misc */
-  {
-    { C_STRING_WITH_LEN("COUNT_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_socket_summary_by_event_name::m_field_def=
-{ 23, field_types };
-
-PFS_engine_table_share
-table_socket_summary_by_event_name::m_share=
-{
-  { C_STRING_WITH_LEN("socket_summary_by_event_name") },
-  &pfs_readonly_acl,
-  &table_socket_summary_by_event_name::create,
-  NULL, /* write_row */
-  table_socket_summary_by_event_name::delete_all_rows,
-  NULL, /* get_row_count */
-  1000, /* records */
-  sizeof(PFS_simple_index),
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_socket_summary_by_event_name::create(void)
-{
-  return new table_socket_summary_by_event_name();
-}
-
-table_socket_summary_by_event_name::table_socket_summary_by_event_name()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_row_exists(false), m_pos(1), m_next_pos(1)
-{}
-
-int table_socket_summary_by_event_name::delete_all_rows(void)
-{
-  reset_socket_instance_io();
-  reset_socket_class_io();
-  return 0;
-}
-
-void table_socket_summary_by_event_name::reset_position(void)
-{
-  m_pos.m_index= 1;
-  m_next_pos.m_index= 1;
-}
-
-int table_socket_summary_by_event_name::rnd_next(void)
-{
-  PFS_socket_class *socket_class;
-
-  m_pos.set_at(&m_next_pos);
-
-  socket_class= find_socket_class(m_pos.m_index);
-  if (socket_class)
-  {
-    make_row(socket_class);
-    m_next_pos.set_after(&m_pos);
-    return 0;
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_socket_summary_by_event_name::rnd_pos(const void *pos)
-{
-  PFS_socket_class *socket_class;
-
-  set_position(pos);
-
-  socket_class= find_socket_class(m_pos.m_index);
-  if (socket_class)
-  {
-    make_row(socket_class);
-    return 0;
-  }
-
-  return HA_ERR_RECORD_DELETED;
-}
-
-void table_socket_summary_by_event_name::make_row(PFS_socket_class *socket_class)
-{
-  m_row.m_event_name.make_row(socket_class);
-
-  PFS_instance_socket_io_stat_visitor visitor;
-  PFS_instance_iterator::visit_socket_instances(socket_class, &visitor);
-
-  time_normalizer *normalizer= time_normalizer::get(wait_timer);
-  
-  /* Collect timer and byte count stats */
-  m_row.m_io_stat.set(normalizer, &visitor.m_socket_io_stat);
-  m_row_exists= true;
-}
-
-int table_socket_summary_by_event_name::read_row_values(TABLE *table,
-                                          unsigned char *,
-                                          Field **fields,
-                                          bool read_all)
-{
-  Field *f;
-
-  if (unlikely(!m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case  0: /* EVENT_NAME */
-        m_row.m_event_name.set_field(f);
-        break;
-      case  1: /* COUNT_STAR */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
-        break;
-      case  2: /* SUM_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
-        break;
-      case  3: /* MIN_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
-        break;
-      case  4: /* AVG_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
-        break;
-      case  5: /* MAX_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
-        break;
-
-      case  6: /* COUNT_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
-        break;
-      case  7: /* SUM_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
-        break;
-      case  8: /* MIN_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
-        break;
-      case  9: /* AVG_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
-        break;
-      case 10: /* MAX_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
-        break;
-      case 11: /* SUM_NUMBER_OF_BYTES_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
-        break;
-
-      case 12: /* COUNT_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
-        break;
-      case 13: /* SUM_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
-        break;
-      case 14: /* MIN_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
-        break;
-      case 15: /* AVG_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
-        break;
-      case 16: /* MAX_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
-        break;
-      case 17: /* SUM_NUMBER_OF_BYTES_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
-        break;
-
-      case 18: /* COUNT_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
-        break;
-      case 19: /* SUM_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
-        break;
-      case 20: /* MIN_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
-        break;
-      case 21: /* AVG_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
-        break;
-      case 22: /* MAX_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
-        break;
-
-      default:
-        DBUG_ASSERT(false);
-        break;
-      }
-    } // if
-  } // for
-
-  return 0;
-}
-
+/* Copyright (c) 2008, 2011, 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 */
+
+/**
+  @file storage/perfschema/table_socket_summary_by_event_name.cc
+  Table SOCKET_EVENT_NAMES (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "table_socket_summary_by_event_name.h"
+#include "pfs_global.h"
+#include "pfs_visitor.h"
+
+THR_LOCK table_socket_summary_by_event_name::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("EVENT_NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_STAR") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Read */
+  {
+    { C_STRING_WITH_LEN("COUNT_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Write */
+  {
+    { C_STRING_WITH_LEN("COUNT_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Misc */
+  {
+    { C_STRING_WITH_LEN("COUNT_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_socket_summary_by_event_name::m_field_def=
+{ 23, field_types };
+
+PFS_engine_table_share
+table_socket_summary_by_event_name::m_share=
+{
+  { C_STRING_WITH_LEN("socket_summary_by_event_name") },
+  &pfs_readonly_acl,
+  &table_socket_summary_by_event_name::create,
+  NULL, /* write_row */
+  table_socket_summary_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
+  1000, /* records */
+  sizeof(PFS_simple_index),
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_socket_summary_by_event_name::create(void)
+{
+  return new table_socket_summary_by_event_name();
+}
+
+table_socket_summary_by_event_name::table_socket_summary_by_event_name()
+  : PFS_engine_table(&m_share, &m_pos),
+  m_row_exists(false), m_pos(1), m_next_pos(1)
+{}
+
+int table_socket_summary_by_event_name::delete_all_rows(void)
+{
+  reset_socket_instance_io();
+  reset_socket_class_io();
+  return 0;
+}
+
+void table_socket_summary_by_event_name::reset_position(void)
+{
+  m_pos.m_index= 1;
+  m_next_pos.m_index= 1;
+}
+
+int table_socket_summary_by_event_name::rnd_next(void)
+{
+  PFS_socket_class *socket_class;
+
+  m_pos.set_at(&m_next_pos);
+
+  socket_class= find_socket_class(m_pos.m_index);
+  if (socket_class)
+  {
+    make_row(socket_class);
+    m_next_pos.set_after(&m_pos);
+    return 0;
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_socket_summary_by_event_name::rnd_pos(const void *pos)
+{
+  PFS_socket_class *socket_class;
+
+  set_position(pos);
+
+  socket_class= find_socket_class(m_pos.m_index);
+  if (socket_class)
+  {
+    make_row(socket_class);
+    return 0;
+  }
+
+  return HA_ERR_RECORD_DELETED;
+}
+
+void table_socket_summary_by_event_name::make_row(PFS_socket_class *socket_class)
+{
+  m_row.m_event_name.make_row(socket_class);
+
+  PFS_instance_socket_io_stat_visitor visitor;
+  PFS_instance_iterator::visit_socket_instances(socket_class, &visitor);
+
+  time_normalizer *normalizer= time_normalizer::get(wait_timer);
+  
+  /* Collect timer and byte count stats */
+  m_row.m_io_stat.set(normalizer, &visitor.m_socket_io_stat);
+  m_row_exists= true;
+}
+
+int table_socket_summary_by_event_name::read_row_values(TABLE *table,
+                                          unsigned char *,
+                                          Field **fields,
+                                          bool read_all)
+{
+  Field *f;
+
+  if (unlikely(!m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 0);
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case  0: /* EVENT_NAME */
+        m_row.m_event_name.set_field(f);
+        break;
+      case  1: /* COUNT_STAR */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
+        break;
+      case  2: /* SUM_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
+        break;
+      case  3: /* MIN_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
+        break;
+      case  4: /* AVG_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
+        break;
+      case  5: /* MAX_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
+        break;
+
+      case  6: /* COUNT_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
+        break;
+      case  7: /* SUM_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
+        break;
+      case  8: /* MIN_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
+        break;
+      case  9: /* AVG_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
+        break;
+      case 10: /* MAX_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
+        break;
+      case 11: /* SUM_NUMBER_OF_BYTES_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
+        break;
+
+      case 12: /* COUNT_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
+        break;
+      case 13: /* SUM_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
+        break;
+      case 14: /* MIN_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
+        break;
+      case 15: /* AVG_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
+        break;
+      case 16: /* MAX_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
+        break;
+      case 17: /* SUM_NUMBER_OF_BYTES_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
+        break;
+
+      case 18: /* COUNT_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
+        break;
+      case 19: /* SUM_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
+        break;
+      case 20: /* MIN_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
+        break;
+      case 21: /* AVG_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
+        break;
+      case 22: /* MAX_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
+        break;
+
+      default:
+        DBUG_ASSERT(false);
+        break;
+      }
+    } // if
+  } // for
+
+  return 0;
+}
+

=== modified file 'storage/perfschema/table_socket_summary_by_instance.cc'
--- a/storage/perfschema/table_socket_summary_by_instance.cc	2011-09-02 20:03:36 +0000
+++ b/storage/perfschema/table_socket_summary_by_instance.cc	2011-10-12 19:56:06 +0000
@@ -1,370 +1,369 @@
-/* Copyright (c) 2008, 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 */
-
-/**
-  @file storage/perfschema/table_socket_summary_by_instance.cc
-  Table SOCKET_SUMMARY_BY_INSTANCE (implementation).
-*/
-
-#include "my_global.h"
-#include "my_pthread.h"
-#include "pfs_instr.h"
-#include "pfs_column_types.h"
-#include "pfs_column_values.h"
-#include "table_socket_summary_by_instance.h"
-#include "pfs_global.h"
-
-THR_LOCK table_socket_summary_by_instance::m_table_lock;
-
-static const TABLE_FIELD_TYPE field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("EVENT_NAME") },
-    { C_STRING_WITH_LEN("varchar(128)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_STAR") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Read */
-  {
-    { C_STRING_WITH_LEN("COUNT_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Write */
-  {
-    { C_STRING_WITH_LEN("COUNT_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-
-  /** Misc */
-  {
-    { C_STRING_WITH_LEN("COUNT_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_socket_summary_by_instance::m_field_def=
-{ 24, field_types };
-
-PFS_engine_table_share
-table_socket_summary_by_instance::m_share=
-{
-  { C_STRING_WITH_LEN("socket_summary_by_instance") },
-  &pfs_readonly_acl,
-  &table_socket_summary_by_instance::create,
-  NULL, /* write_row */
-  table_socket_summary_by_instance::delete_all_rows,
-  NULL, /* get_row_count */
-  1000, /* records */
-  sizeof(PFS_simple_index),
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_socket_summary_by_instance::create(void)
-{
-  return new table_socket_summary_by_instance();
-}
-
-table_socket_summary_by_instance::table_socket_summary_by_instance()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_row_exists(false), m_pos(0), m_next_pos(0)
-{}
-
-int table_socket_summary_by_instance::delete_all_rows(void)
-{
-  reset_socket_instance_io();
-  return 0;
-}
-
-void table_socket_summary_by_instance::reset_position(void)
-{
-  m_pos.m_index= 0;
-  m_next_pos.m_index= 0;
-}
-
-int table_socket_summary_by_instance::rnd_next(void)
-{
-  PFS_socket *pfs;
-
-  for (m_pos.set_at(&m_next_pos);
-       m_pos.m_index < socket_max;
-       m_pos.next())
-  {
-    pfs= &socket_array[m_pos.m_index];
-    if (pfs->m_lock.is_populated())
-    {
-      make_row(pfs);
-      m_next_pos.set_after(&m_pos);
-      return 0;
-    }
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_socket_summary_by_instance::rnd_pos(const void *pos)
-{
-  PFS_socket *pfs;
-
-  set_position(pos);
-  DBUG_ASSERT(m_pos.m_index < socket_max);
-  pfs= &socket_array[m_pos.m_index];
-
-  if (! pfs->m_lock.is_populated())
-    return HA_ERR_RECORD_DELETED;
-
-  make_row(pfs);
-  return 0;
-}
-
-void table_socket_summary_by_instance::make_row(PFS_socket *pfs)
-{
-  pfs_lock lock;
-  PFS_socket_class *safe_class;
-
-  m_row_exists= false;
-
-  /* Protect this reader against a socket delete */
-  pfs->m_lock.begin_optimistic_lock(&lock);
-
-  safe_class= sanitize_socket_class(pfs->m_class);
-  if (unlikely(safe_class == NULL))
-    return;
-
-  m_row.m_event_name.make_row(safe_class);
-  m_row.m_identity= pfs->m_identity;
-
-  time_normalizer *normalizer= time_normalizer::get(wait_timer);
-
-  /* Collect timer and byte count stats */
-  m_row.m_io_stat.set(normalizer, &pfs->m_socket_stat.m_io_stat);
-
-  if (!pfs->m_lock.end_optimistic_lock(&lock))
-    return;
-
-  m_row_exists= true;
-}
-
-int table_socket_summary_by_instance::read_row_values(TABLE *table,
-                                          unsigned char *,
-                                          Field **fields,
-                                          bool read_all)
-{
-  Field *f;
-
-  if (unlikely(!m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case  0: /* EVENT_NAME */
-        m_row.m_event_name.set_field(f);
-        break;
-      case  1: /* OBJECT_INSTANCE */
-        set_field_ulonglong(f, (ulonglong)m_row.m_identity);
-        break;
-
-      case  2:/* COUNT_STAR */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
-        break;
-      case  3:/* SUM_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
-        break;
-      case  4: /* MIN_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
-        break;
-      case  5: /* AVG_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
-        break;
-      case  6: /* MAX_TIMER_WAIT */
-        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
-        break;
-
-      case  7: /* COUNT_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
-        break;
-      case  8: /* SUM_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
-        break;
-      case  9: /* MIN_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
-        break;
-      case 10: /* AVG_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
-        break;
-      case 11: /* MAX_TIMER_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
-        break;
-      case 12: /* SUM_NUMBER_OF_BYTES_READ */
-        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
-        break;
-
-      case 13: /* COUNT_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
-        break;
-      case 14: /* SUM_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
-        break;
-      case 15: /* MIN_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
-        break;
-      case 16: /* AVG_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
-        break;
-      case 17: /* MAX_TIMER_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
-        break;
-      case 18: /* SUM_NUMBER_OF_BYTES_WRITE */
-        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
-        break;
-
-      case 19: /* COUNT_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
-        break;
-      case 20: /* SUM_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
-        break;
-      case 21: /* MIN_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
-        break;
-      case 22: /* AVG_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
-        break;
-      case 23: /* MAX_TIMER_MISC */
-        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
-        break;
-      default:
-        DBUG_ASSERT(false);
-        break;
-      }
-    }
-  }
-
-  return 0;
-}
-
+/* Copyright (c) 2008, 2011, 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 */
+
+/**
+  @file storage/perfschema/table_socket_summary_by_instance.cc
+  Table SOCKET_SUMMARY_BY_INSTANCE (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "table_socket_summary_by_instance.h"
+#include "pfs_global.h"
+
+THR_LOCK table_socket_summary_by_instance::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("EVENT_NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_STAR") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Read */
+  {
+    { C_STRING_WITH_LEN("COUNT_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Write */
+  {
+    { C_STRING_WITH_LEN("COUNT_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Misc */
+  {
+    { C_STRING_WITH_LEN("COUNT_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_socket_summary_by_instance::m_field_def=
+{ 24, field_types };
+
+PFS_engine_table_share
+table_socket_summary_by_instance::m_share=
+{
+  { C_STRING_WITH_LEN("socket_summary_by_instance") },
+  &pfs_readonly_acl,
+  &table_socket_summary_by_instance::create,
+  NULL, /* write_row */
+  table_socket_summary_by_instance::delete_all_rows,
+  NULL, /* get_row_count */
+  1000, /* records */
+  sizeof(PFS_simple_index),
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_socket_summary_by_instance::create(void)
+{
+  return new table_socket_summary_by_instance();
+}
+
+table_socket_summary_by_instance::table_socket_summary_by_instance()
+  : PFS_engine_table(&m_share, &m_pos),
+  m_row_exists(false), m_pos(0), m_next_pos(0)
+{}
+
+int table_socket_summary_by_instance::delete_all_rows(void)
+{
+  reset_socket_instance_io();
+  return 0;
+}
+
+void table_socket_summary_by_instance::reset_position(void)
+{
+  m_pos.m_index= 0;
+  m_next_pos.m_index= 0;
+}
+
+int table_socket_summary_by_instance::rnd_next(void)
+{
+  PFS_socket *pfs;
+
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.m_index < socket_max;
+       m_pos.next())
+  {
+    pfs= &socket_array[m_pos.m_index];
+    if (pfs->m_lock.is_populated())
+    {
+      make_row(pfs);
+      m_next_pos.set_after(&m_pos);
+      return 0;
+    }
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_socket_summary_by_instance::rnd_pos(const void *pos)
+{
+  PFS_socket *pfs;
+
+  set_position(pos);
+  DBUG_ASSERT(m_pos.m_index < socket_max);
+  pfs= &socket_array[m_pos.m_index];
+
+  if (! pfs->m_lock.is_populated())
+    return HA_ERR_RECORD_DELETED;
+
+  make_row(pfs);
+  return 0;
+}
+
+void table_socket_summary_by_instance::make_row(PFS_socket *pfs)
+{
+  pfs_lock lock;
+  PFS_socket_class *safe_class;
+
+  m_row_exists= false;
+
+  /* Protect this reader against a socket delete */
+  pfs->m_lock.begin_optimistic_lock(&lock);
+
+  safe_class= sanitize_socket_class(pfs->m_class);
+  if (unlikely(safe_class == NULL))
+    return;
+
+  m_row.m_event_name.make_row(safe_class);
+  m_row.m_identity= pfs->m_identity;
+
+  time_normalizer *normalizer= time_normalizer::get(wait_timer);
+
+  /* Collect timer and byte count stats */
+  m_row.m_io_stat.set(normalizer, &pfs->m_socket_stat.m_io_stat);
+
+  if (!pfs->m_lock.end_optimistic_lock(&lock))
+    return;
+
+  m_row_exists= true;
+}
+
+int table_socket_summary_by_instance::read_row_values(TABLE *table,
+                                          unsigned char *,
+                                          Field **fields,
+                                          bool read_all)
+{
+  Field *f;
+
+  if (unlikely(!m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 0);
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case  0: /* EVENT_NAME */
+        m_row.m_event_name.set_field(f);
+        break;
+      case  1: /* OBJECT_INSTANCE */
+        set_field_ulonglong(f, (ulonglong)m_row.m_identity);
+        break;
+
+      case  2:/* COUNT_STAR */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
+        break;
+      case  3:/* SUM_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
+        break;
+      case  4: /* MIN_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
+        break;
+      case  5: /* AVG_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
+        break;
+      case  6: /* MAX_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
+        break;
+
+      case  7: /* COUNT_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
+        break;
+      case  8: /* SUM_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
+        break;
+      case  9: /* MIN_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
+        break;
+      case 10: /* AVG_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
+        break;
+      case 11: /* MAX_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
+        break;
+      case 12: /* SUM_NUMBER_OF_BYTES_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
+        break;
+
+      case 13: /* COUNT_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
+        break;
+      case 14: /* SUM_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
+        break;
+      case 15: /* MIN_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
+        break;
+      case 16: /* AVG_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
+        break;
+      case 17: /* MAX_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
+        break;
+      case 18: /* SUM_NUMBER_OF_BYTES_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
+        break;
+
+      case 19: /* COUNT_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
+        break;
+      case 20: /* SUM_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
+        break;
+      case 21: /* MIN_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
+        break;
+      case 22: /* AVG_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
+        break;
+      case 23: /* MAX_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
+        break;
+      default:
+        DBUG_ASSERT(false);
+        break;
+      }
+    }
+  }
+
+  return 0;
+}

=== modified file 'storage/perfschema/table_socket_summary_by_instance.h'
--- a/storage/perfschema/table_socket_summary_by_instance.h	2011-02-25 21:12:43 +0000
+++ b/storage/perfschema/table_socket_summary_by_instance.h	2011-10-06 17:15:47 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2011, 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

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5908 branch (chris.powers:3425 to 3427) WL#5908Christopher Powers13 Oct