List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:April 20 2012 2:25pm
Subject:bzr push into mysql-trunk branch (mikael.ronstrom:3879 to 3882)
View as plain text  
 3882 Mikael Ronstrom	2012-04-20
      fix

    modified:
      sql/sql_base.cc
 3881 Mikael Ronstrom	2012-04-20 [merge]
      merge

    added:
      mysql-test/r/bug12427262.result
      mysql-test/r/myisam_row_rpl.result
      mysql-test/r/mysql_embedded_client_test.result
      mysql-test/suite/innodb/r/innodb-alter-discard.result
      mysql-test/suite/innodb/t/innodb-alter-discard.test
      mysql-test/suite/innodb_fts/r/innodb_fts_opt.result
      mysql-test/suite/innodb_fts/t/innodb_fts_opt.test
      mysql-test/t/bug12427262.test
      mysql-test/t/myisam_row_rpl-master.opt
      mysql-test/t/myisam_row_rpl-slave.opt
      mysql-test/t/myisam_row_rpl.test
      mysql-test/t/mysql_embedded_client_test.test
    modified:
      CMakeLists.txt
      README
      VERSION
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqladmin.cc
      client/mysqlbinlog.cc
      client/mysqlcheck.c
      client/mysqldump.c
      client/mysqlimport.c
      client/mysqlshow.c
      client/mysqlslap.c
      client/mysqltest.cc
      cmake/os/Windows.cmake
      config.h.cmake
      extra/innochecksum.cc
      extra/perror.c
      include/ft_global.h
      include/mysql/thread_pool_priv.h
      include/mysql_com.h
      include/welcome_copyright_notice.h
      mysql-test/collections/default.experimental
      mysql-test/collections/default.push
      mysql-test/extra/rpl_tests/rpl_loaddata.test
      mysql-test/include/assert_command_output.inc
      mysql-test/lib/My/CoreDump.pm
      mysql-test/r/derived.result
      mysql-test/r/log_tables.result
      mysql-test/r/rewrite_general_log.result
      mysql-test/r/tablespace.result
      mysql-test/r/type_temporal_fractional.result
      mysql-test/suite/binlog/r/binlog_grant.result
      mysql-test/suite/binlog/r/binlog_multi_engine.result
      mysql-test/suite/binlog/t/binlog_grant.test
      mysql-test/suite/engines/funcs/t/crash_manytables_number.test
      mysql-test/suite/engines/funcs/t/ld_all_number_string_calendar_types.test
      mysql-test/suite/engines/funcs/t/se_join_cross.test
      mysql-test/suite/engines/funcs/t/se_join_default.test
      mysql-test/suite/engines/funcs/t/se_join_inner.test
      mysql-test/suite/engines/funcs/t/se_join_left.test
      mysql-test/suite/engines/funcs/t/se_join_natural_left.test
      mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test
      mysql-test/suite/engines/funcs/t/se_join_natural_right.test
      mysql-test/suite/engines/funcs/t/se_join_natural_right_outer.test
      mysql-test/suite/engines/funcs/t/se_join_right.test
      mysql-test/suite/engines/funcs/t/se_join_right_outer.test
      mysql-test/suite/engines/funcs/t/se_join_straight.test
      mysql-test/suite/engines/funcs/t/se_string_limit.test
      mysql-test/suite/engines/iuds/t/update_delete_number.test
      mysql-test/suite/innodb/r/innodb-index-online.result
      mysql-test/suite/innodb/t/innodb-index-online.test
      mysql-test/suite/innodb/t/innodb_bug30423.test
      mysql-test/suite/innodb/t/innodb_bug53290.test
      mysql-test/suite/innodb_fts/r/innodb_fts_misc.result
      mysql-test/suite/innodb_fts/t/innodb_fts_misc.test
      mysql-test/suite/parts/t/partition_float_myisam.test
      mysql-test/suite/perfschema/r/digest_table_full.result
      mysql-test/suite/perfschema/r/statement_digest.result
      mysql-test/suite/perfschema/r/statement_digest_consumers.result
      mysql-test/suite/perfschema/r/statement_digest_long_query.result
      mysql-test/suite/rpl/r/rpl_binlog_index.result
      mysql-test/suite/rpl/r/rpl_corruption.result
      mysql-test/suite/rpl/r/rpl_gtid_mode.result
      mysql-test/suite/rpl/r/rpl_loaddata.result
      mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
      mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
      mysql-test/suite/rpl/t/rpl_binlog_index.test
      mysql-test/suite/rpl/t/rpl_corruption.test
      mysql-test/suite/rpl/t/rpl_gtid_mode.test
      mysql-test/suite/rpl/t/rpl_innodb_bug28430.test
      mysql-test/suite/rpl/t/rpl_parallel_change_master.test
      mysql-test/suite/rpl/t/rpl_parallel_innodb.test
      mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
      mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test
      mysql-test/suite/rpl/t/rpl_row_img_blobs.test
      mysql-test/suite/rpl/t/rpl_row_img_eng_full.test
      mysql-test/suite/rpl/t/rpl_row_img_idx_full.test
      mysql-test/suite/rpl/t/rpl_stop_slave.test
      mysql-test/suite/rpl/t/rpl_typeconv.test
      mysql-test/t/derived.test
      mysql-test/t/disabled.def
      mysql-test/t/index_merge_innodb.test
      mysql-test/t/innodb_explain_json_non_select_all.test
      mysql-test/t/innodb_explain_non_select_all.test
      mysql-test/t/innodb_explain_non_select_none.test
      mysql-test/t/mysql_client_test_embedded.test
      mysql-test/t/rewrite_general_log.test
      mysql-test/t/tablespace.test
      mysql-test/t/type_temporal_fractional.test
      packaging/WiX/custom_ui.wxs
      sql/field.h
      sql/gen_lex_hash.cc
      sql/ha_ndbcluster_binlog.cc
      sql/handler.cc
      sql/handler.h
      sql/item.cc
      sql/item.h
      sql/item_create.cc
      sql/item_func.cc
      sql/item_func.h
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/item_subselect.cc
      sql/item_xmlfunc.cc
      sql/lex.h
      sql/log_event.cc
      sql/log_event.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/opt_sum.cc
      sql/rpl_info_file.cc
      sql/rpl_mi.cc
      sql/scheduler.cc
      sql/set_var.cc
      sql/sp_head.cc
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_derived.cc
      sql/sql_executor.cc
      sql/sql_optimizer.cc
      sql/sql_optimizer.h
      sql/sql_parse.cc
      sql/sql_select.cc
      sql/sql_show.cc
      sql/sql_show.h
      sql/sql_string.h
      sql/sql_table.cc
      sql/sql_yacc.yy
      sql/table.cc
      sql/unireg.cc
      storage/innobase/btr/btr0cur.cc
      storage/innobase/buf/buf0flu.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innobase/handler/handler0alter.cc
      storage/innobase/include/btr0btr.h
      storage/innobase/include/btr0pcur.ic
      storage/innobase/log/log0recv.cc
      storage/innobase/pars/lexyy.cc
      storage/innobase/pars/pars0lex.l
      storage/innobase/trx/trx0trx.cc
      storage/myisam/ha_myisam.cc
      storage/perfschema/gen_pfs_lex_token.cc
      strings/decimal.c
 3880 Mikael Ronstrom	2012-04-20
      More work to complete LOCK_open split

    modified:
      sql/sql_base.cc
      sql/sql_class.h
 3879 Mikael Ronstrom	2012-04-20 [merge]
      merge

    removed:
      mysql-test/suite/rpl/t/rpl_report_port-slave.opt
    added:
      mysql-test/r/partition_locking_4.result
      mysql-test/suite/binlog/r/binlog_gtid_cache.result
      mysql-test/suite/binlog/t/binlog_gtid_cache-master.opt
      mysql-test/suite/binlog/t/binlog_gtid_cache.test
      mysql-test/suite/perfschema/r/statement_digest_charset.result
      mysql-test/suite/perfschema/t/statement_digest_charset.test
      mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog-master.opt
      mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog-slave.opt
      mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog-master.opt
      mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog-slave.opt
      mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog-master.opt
      mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog-slave.opt
      mysql-test/suite/sys_vars/r/transaction_allow_batching_basic.result
      mysql-test/suite/sys_vars/t/transaction_allow_batching_basic.test
      mysql-test/t/partition_locking_4.test
    modified:
      CMakeLists.txt
      cmake/build_configurations/compiler_options.cmake
      cmake/libutils.cmake
      cmd-line-utils/libedit/map.c
      cmd-line-utils/libedit/tty.c
      configure.cmake
      extra/yassl/src/buffer.cpp
      include/mysql/psi/mysql_statement.h
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      libmysqld/CMakeLists.txt
      libmysqld/lib_sql.cc
      mysql-test/collections/default.push
      mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
      mysql-test/extra/rpl_tests/rpl_loaddata.test
      mysql-test/extra/rpl_tests/rpl_mixing_engines.inc
      mysql-test/extra/rpl_tests/rpl_mixing_engines.test
      mysql-test/extra/rpl_tests/rpl_mts_crash_safe.inc
      mysql-test/extra/rpl_tests/rpl_row_basic.test
      mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
      mysql-test/include/function_defaults.inc
      mysql-test/include/show_events.inc
      mysql-test/mysql-test-run.pl
      mysql-test/r/alter_table.result
      mysql-test/r/explain.result
      mysql-test/r/function_defaults.result
      mysql-test/r/get_diagnostics.result
      mysql-test/r/help.result
      mysql-test/r/innodb_explain_json_non_select_all.result
      mysql-test/r/innodb_explain_json_non_select_none.result
      mysql-test/r/innodb_explain_non_select_all.result
      mysql-test/r/innodb_explain_non_select_none.result
      mysql-test/r/myisam_explain_json_non_select_all.result
      mysql-test/r/myisam_explain_json_non_select_none.result
      mysql-test/r/myisam_explain_non_select_all.result
      mysql-test/r/myisam_explain_non_select_none.result
      mysql-test/r/partition_cache.result
      mysql-test/r/partition_error.result
      mysql-test/r/partition_exchange.result
      mysql-test/r/read_only_innodb.result
      mysql-test/r/show_check.result
      mysql-test/r/sp-destruct.result
      mysql-test/r/sp-threads.result
      mysql-test/r/type_time.result
      mysql-test/r/variables.result
      mysql-test/suite/binlog/r/binlog_rewrite.result
      mysql-test/suite/funcs_1/datadict/processlist_priv.inc
      mysql-test/suite/funcs_1/datadict/processlist_val.inc
      mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
      mysql-test/suite/funcs_1/r/processlist_priv_ps.result
      mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
      mysql-test/suite/funcs_1/r/processlist_val_ps.result
      mysql-test/suite/innodb/r/innodb-index-online.result
      mysql-test/suite/innodb/t/innodb-index-online.test
      mysql-test/suite/innodb_fts/r/innodb_fts_misc.result
      mysql-test/suite/innodb_fts/t/innodb_fts_misc.test
      mysql-test/suite/parts/r/partition_exch_qa_12.result
      mysql-test/suite/parts/t/partition_exch_qa_12.test
      mysql-test/suite/perfschema/include/digest_cleanup.inc
      mysql-test/suite/perfschema/include/digest_execution.inc
      mysql-test/suite/perfschema/include/digest_setup.inc
      mysql-test/suite/perfschema/r/digest_table_full.result
      mysql-test/suite/perfschema/r/dml_setup_instruments.result
      mysql-test/suite/perfschema/r/start_server_no_digests.result
      mysql-test/suite/perfschema/r/statement_digest.result
      mysql-test/suite/perfschema/r/statement_digest_consumers.result
      mysql-test/suite/perfschema/r/statement_digest_consumers2.result
      mysql-test/suite/perfschema/r/statement_digest_long_query.result
      mysql-test/suite/perfschema/t/dml_setup_instruments.test
      mysql-test/suite/rpl/r/rpl_alter_repository.result
      mysql-test/suite/rpl/r/rpl_corruption.result
      mysql-test/suite/rpl/r/rpl_loaddata.result
      mysql-test/suite/rpl/r/rpl_master_pos_wait.result
      mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result
      mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_mixed_mts_crash_safe.result
      mysql-test/suite/rpl/r/rpl_mixed_mts_rec_crash_safe.result
      mysql-test/suite/rpl/r/rpl_mixed_mts_rec_crash_safe_checksum.result
      mysql-test/suite/rpl/r/rpl_mts_debug.result
      mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
      mysql-test/suite/rpl/r/rpl_report_port.result
      mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
      mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
      mysql-test/suite/rpl/r/rpl_row_basic_allow_batching.result
      mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_row_crash_safe.result
      mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result
      mysql-test/suite/rpl/r/rpl_row_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_row_mts_crash_safe.result
      mysql-test/suite/rpl/r/rpl_row_mts_rec_crash_safe.result
      mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
      mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result
      mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
      mysql-test/suite/rpl/r/rpl_stm_mixed_crash_safe.result
      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
      mysql-test/suite/rpl/r/rpl_stm_mts_crash_safe.result
      mysql-test/suite/rpl/r/rpl_stm_mts_rec_crash_safe.result
      mysql-test/suite/rpl/t/rpl_alter_repository.test
      mysql-test/suite/rpl/t/rpl_corruption.test
      mysql-test/suite/rpl/t/rpl_master_pos_wait.test
      mysql-test/suite/rpl/t/rpl_mixed_implicit_commit_binlog.test
      mysql-test/suite/rpl/t/rpl_mts_debug.test
      mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
      mysql-test/suite/rpl/t/rpl_report_port.test
      mysql-test/suite/rpl/t/rpl_row_crash_safe.test
      mysql-test/suite/rpl/t/rpl_row_implicit_commit_binlog.test
      mysql-test/suite/rpl/t/rpl_stm_implicit_commit_binlog.test
      mysql-test/suite/rpl/t/rpl_stm_mixed_crash_safe.test
      mysql-test/suite/rpl/t/rpl_stm_until.test
      mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
      mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
      mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test
      mysql-test/t/alter_table.test
      mysql-test/t/disabled.def
      mysql-test/t/help.test
      mysql-test/t/partition_cache.test
      mysql-test/t/partition_exchange.test
      mysql-test/t/show_check.test
      mysql-test/t/sp-threads.test
      mysys/psi_noop.c
      sql/CMakeLists.txt
      sql/binlog.cc
      sql/event_scheduler.cc
      sql/field.cc
      sql/field.h
      sql/field_conv.cc
      sql/global_threads.h
      sql/handler.cc
      sql/handler.h
      sql/item.cc
      sql/item.h
      sql/item_func.cc
      sql/item_func.h
      sql/item_timefunc.h
      sql/item_xmlfunc.cc
      sql/lex.h
      sql/log.h
      sql/log_event.cc
      sql/md5.cc
      sql/mysqld.cc
      sql/mysqld.h
      sql/opt_explain_json.cc
      sql/rpl_info_dummy.cc
      sql/rpl_info_dummy.h
      sql/rpl_info_factory.cc
      sql/rpl_info_factory.h
      sql/rpl_info_file.cc
      sql/rpl_info_file.h
      sql/rpl_info_handler.h
      sql/rpl_info_table.cc
      sql/rpl_info_table.h
      sql/rpl_master.cc
      sql/rpl_mi.cc
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_rli_pdb.cc
      sql/rpl_rli_pdb.h
      sql/rpl_slave.cc
      sql/rpl_slave.h
      sql/scheduler.cc
      sql/share/errmsg-utf8.txt
      sql/signal_handler.cc
      sql/sp_head.cc
      sql/sql_analyse.cc
      sql/sql_base.cc
      sql/sql_base.h
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_executor.cc
      sql/sql_insert.cc
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_partition_admin.cc
      sql/sql_plugin.cc
      sql/sql_reload.cc
      sql/sql_show.cc
      sql/sql_show.h
      sql/sql_string.h
      sql/sql_table.cc
      sql/sql_test.cc
      sql/sql_update.cc
      sql/sql_view.cc
      sql/sql_yacc.yy
      sql/sys_vars.cc
      sql/table.cc
      sql/table.h
      storage/example/ha_example.cc
      storage/innobase/api/api0api.cc
      storage/innobase/api/api0misc.cc
      storage/innobase/btr/btr0btr.cc
      storage/innobase/btr/btr0cur.cc
      storage/innobase/buf/buf0buf.cc
      storage/innobase/buf/buf0dump.cc
      storage/innobase/buf/buf0flu.cc
      storage/innobase/buf/buf0rea.cc
      storage/innobase/dict/dict0boot.cc
      storage/innobase/dict/dict0crea.cc
      storage/innobase/dict/dict0dict.cc
      storage/innobase/dict/dict0load.cc
      storage/innobase/dict/dict0stats.cc
      storage/innobase/fil/fil0fil.cc
      storage/innobase/fts/fts0ast.cc
      storage/innobase/fts/fts0blex.cc
      storage/innobase/fts/fts0blex.l
      storage/innobase/fts/fts0config.cc
      storage/innobase/fts/fts0fts.cc
      storage/innobase/fts/fts0opt.cc
      storage/innobase/fts/fts0que.cc
      storage/innobase/fts/fts0sql.cc
      storage/innobase/fts/fts0tlex.cc
      storage/innobase/fts/fts0tlex.l
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innobase/handler/handler0alter.cc
      storage/innobase/ibuf/ibuf0ibuf.cc
      storage/innobase/include/api0api.h
      storage/innobase/include/api0misc.h
      storage/innobase/include/btr0cur.h
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0types.h
      storage/innobase/include/db0err.h
      storage/innobase/include/dict0crea.h
      storage/innobase/include/dict0dict.h
      storage/innobase/include/dict0load.h
      storage/innobase/include/dict0stats.h
      storage/innobase/include/fil0fil.h
      storage/innobase/include/fts0ast.h
      storage/innobase/include/fts0fts.h
      storage/innobase/include/fts0priv.h
      storage/innobase/include/ha_prototypes.h
      storage/innobase/include/lock0lock.h
      storage/innobase/include/log0recv.h
      storage/innobase/include/que0que.h
      storage/innobase/include/read0read.h
      storage/innobase/include/read0read.ic
      storage/innobase/include/row0ftsort.h
      storage/innobase/include/row0ins.h
      storage/innobase/include/row0log.h
      storage/innobase/include/row0merge.h
      storage/innobase/include/row0mysql.h
      storage/innobase/include/row0sel.h
      storage/innobase/include/row0uins.h
      storage/innobase/include/row0umod.h
      storage/innobase/include/row0upd.h
      storage/innobase/include/row0vers.h
      storage/innobase/include/srv0srv.h
      storage/innobase/include/srv0start.h
      storage/innobase/include/trx0rec.h
      storage/innobase/include/trx0roll.h
      storage/innobase/include/trx0sys.h
      storage/innobase/include/trx0trx.h
      storage/innobase/include/trx0undo.h
      storage/innobase/include/ut0ut.h
      storage/innobase/include/ut0vec.ic
      storage/innobase/lock/lock0lock.cc
      storage/innobase/log/log0recv.cc
      storage/innobase/os/os0file.cc
      storage/innobase/que/que0que.cc
      storage/innobase/row/row0ftsort.cc
      storage/innobase/row/row0ins.cc
      storage/innobase/row/row0log.cc
      storage/innobase/row/row0merge.cc
      storage/innobase/row/row0mysql.cc
      storage/innobase/row/row0purge.cc
      storage/innobase/row/row0sel.cc
      storage/innobase/row/row0uins.cc
      storage/innobase/row/row0umod.cc
      storage/innobase/row/row0undo.cc
      storage/innobase/row/row0upd.cc
      storage/innobase/row/row0vers.cc
      storage/innobase/srv/srv0conc.cc
      storage/innobase/srv/srv0srv.cc
      storage/innobase/srv/srv0start.cc
      storage/innobase/trx/trx0i_s.cc
      storage/innobase/trx/trx0rec.cc
      storage/innobase/trx/trx0roll.cc
      storage/innobase/trx/trx0sys.cc
      storage/innobase/trx/trx0trx.cc
      storage/innobase/trx/trx0undo.cc
      storage/innobase/ut/ut0ut.cc
      storage/myisam/ha_myisam.cc
      storage/ndb/compile-cluster
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_check.cc
      storage/perfschema/pfs_digest.cc
      storage/perfschema/pfs_digest.h
      unittest/gunit/alignment-t.cc
      unittest/gunit/fake_table.h
      unittest/gunit/field-t.cc
      unittest/gunit/field_timestamp-t.cc
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/CMakeLists.txt	revid:mikael.ronstrom@stripped
@@ -103,6 +103,10 @@ IF(BUILD_CONFIG)
   ${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)
 ENDIF()
 
+#cmake on 64 bit windows doesn't set CMAKE_SYSTEM_PROCESSOR correctly
+SET(MYSQL_MACHINE_TYPE ${CMAKE_SYSTEM_PROCESSOR})
+
+
 # Include the platform-specific file. To allow exceptions, this code
 # looks for files in order of how specific they are. If there is, for
 # example, a generic Linux.cmake and a version-specific

=== modified file 'README'
--- a/README	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/README	revid:mikael.ronstrom@stripped
@@ -5,7 +5,7 @@ For the avoidance of doubt, this particu
 is released under the version 2 of the GNU General Public License. 
 MySQL is brought to you by Oracle.
 
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
 
 License information can be found in the COPYING file.
 

=== modified file 'VERSION'
--- a/VERSION	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/VERSION	revid:mikael.ronstrom@stripped
@@ -1,4 +1,4 @@
 MYSQL_VERSION_MAJOR=5
 MYSQL_VERSION_MINOR=6
 MYSQL_VERSION_PATCH=6
-MYSQL_VERSION_EXTRA=-m8
+MYSQL_VERSION_EXTRA=-m9

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysql.cc	revid:mikael.ronstrom@stripped
@@ -1297,7 +1297,7 @@ int main(int argc,char *argv[])
 	  mysql_thread_id(&mysql), server_version_string(&mysql));
   put_info((char*) glob_buffer.ptr(),INFO_INFO);
 
-  put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"), INFO_INFO);
+  put_info(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"), INFO_INFO);
 
 #ifdef HAVE_READLINE
   initialize_readline((char*) my_progname);
@@ -1727,7 +1727,7 @@ static void usage(int version)
 
   if (version)
     return;
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   printf("Usage: %s [OPTIONS] [database]\n", my_progname);
   my_print_help(my_long_options);
   print_defaults("my", load_default_groups);

=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysql_upgrade.c	revid:mikael.ronstrom@stripped
@@ -246,7 +246,7 @@ get_one_option(int optid, const struct m
   case '?':
     printf("%s  Ver %s Distrib %s, for %s (%s)\n",
            my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
-    puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
+    puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
     puts("MySQL utility for upgrading databases to new MySQL versions.\n");
     my_print_help(my_long_options);
     exit(0);

=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqladmin.cc	revid:mikael.ronstrom@stripped
@@ -703,7 +703,7 @@ static int execute_commands(MYSQL *mysql
     case ADMIN_VER:
       new_line=1;
       print_version();
-      puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+      puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
       printf("Server version\t\t%s\n", mysql_get_server_info(mysql));
       printf("Protocol version\t%d\n", mysql_get_proto_info(mysql));
       printf("Connection\t\t%s\n",mysql_get_host_info(mysql));
@@ -1101,7 +1101,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   puts("Administration program for the mysqld daemon.");
   printf("Usage: %s [OPTIONS] command command....\n", my_progname);
   my_print_help(my_long_options);

=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqlbinlog.cc	revid:mikael.ronstrom@stripped
@@ -1475,7 +1475,7 @@ static void print_version()
 static void usage()
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   printf("\
 Dumps a MySQL binary log in a format usable for viewing or for piping to\n\
 the mysql command line client.\n\n");

=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqlcheck.c	revid:mikael.ronstrom@stripped
@@ -228,7 +228,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   puts("This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),");
   puts("or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be");
   puts("used at the same time. Not all options are supported by all storage engines.");

=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqldump.c	revid:mikael.ronstrom@stripped
@@ -612,7 +612,7 @@ static void short_usage_sub(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   puts("Dumping structure and contents of MySQL databases and tables.");
   short_usage_sub();
   print_defaults("my",load_default_groups);

=== modified file 'client/mysqlimport.c'
--- a/client/mysqlimport.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqlimport.c	revid:mikael.ronstrom@stripped
@@ -203,7 +203,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   printf("\
 Loads tables from text files in various formats.  The base name of the\n\
 text file must be the name of the table that should be used.\n\

=== modified file 'client/mysqlshow.c'
--- a/client/mysqlshow.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqlshow.c	revid:mikael.ronstrom@stripped
@@ -277,7 +277,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011)"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012)"));
   puts("Shows the structure of a MySQL database (databases, tables, and columns).\n");
   printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname);
   puts("\n\

=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqlslap.c	revid:mikael.ronstrom@stripped
@@ -708,7 +708,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005, 2010"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2005, 2012"));
   puts("Run a query multiple times against the server.\n");
   printf("Usage: %s [OPTIONS]\n",my_progname);
   print_defaults("my",load_default_groups);

=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/client/mysqltest.cc	revid:mikael.ronstrom@stripped
@@ -6564,7 +6564,7 @@ void print_version(void)
 void usage()
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   printf("Runs a test against the mysql server and compares output with a results file.\n\n");
   printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname);
   my_print_help(my_long_options);

=== modified file 'cmake/os/Windows.cmake'
--- a/cmake/os/Windows.cmake	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/cmake/os/Windows.cmake	revid:mikael.ronstrom@stripped
@@ -40,6 +40,7 @@ INCLUDE(${_SCRIPT_DIR}/WindowsCache.cmak
 # Used by the test suite to ignore bugs on some platforms, 
 IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
   SET(SYSTEM_TYPE "Win64")
+  SET(MYSQL_MACHINE_TYPE "x86_64")
 ELSE()
   SET(SYSTEM_TYPE "Win32")
 ENDIF()

=== modified file 'config.h.cmake'
--- a/config.h.cmake	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/config.h.cmake	revid:mikael.ronstrom@stripped
@@ -489,7 +489,7 @@
 #cmakedefine STACK_DIRECTION @STACK_DIRECTION@
 
 #define SYSTEM_TYPE "@SYSTEM_TYPE@"
-#define MACHINE_TYPE "@CMAKE_SYSTEM_PROCESSOR@"
+#define MACHINE_TYPE "@MYSQL_MACHINE_TYPE@"
 #cmakedefine HAVE_DTRACE 1
 
 #cmakedefine SIGNAL_WITH_VIO_CLOSE 1

=== modified file 'extra/innochecksum.cc'
--- a/extra/innochecksum.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/extra/innochecksum.cc	revid:mikael.ronstrom@stripped
@@ -152,7 +152,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   printf("InnoDB offline file checksum utility.\n");
   printf("Usage: %s [-c] [-s <start page>] [-e <end page>] [-p <page>] [-v] [-d] <filename>\n", my_progname);
   my_print_help(innochecksum_options);

=== modified file 'extra/perror.c'
--- a/extra/perror.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/extra/perror.c	revid:mikael.ronstrom@stripped
@@ -84,7 +84,7 @@ static void print_version(void)
 static void usage(void)
 {
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   printf("Print a description for a system error code or a MySQL error code.\n");
   printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n");
   printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname);

=== modified file 'include/ft_global.h'
--- a/include/ft_global.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/include/ft_global.h	revid:mikael.ronstrom@stripped
@@ -40,11 +40,32 @@ struct _ft_vft
   void      (*reinit_search)(FT_INFO *);
 };
 
+typedef struct st_ft_info_ext FT_INFO_EXT;
+struct _ft_vft_ext
+{
+  uint      (*get_version)();        // Extended API version
+  ulonglong (*get_flags)();
+  ulonglong (*get_docid)(FT_INFO_EXT *);
+  ulonglong (*count_matches)(FT_INFO_EXT *);
+};
+
+/* Flags for extended FT API */
+#define FTS_ORDERED_RESULT                (LL(1) << 1)
+#define FTS_DOCID_IN_RESULT               (LL(1) << 2)
+
+#define FTS_DOC_ID_COL_NAME "FTS_DOC_ID"
+
 #ifndef FT_CORE
 struct st_ft_info
 {
   struct _ft_vft *please; /* INTERCAL style :-) */
 };
+
+struct st_ft_info_ext
+{
+  struct _ft_vft     *please; /* INTERCAL style :-) */
+  struct _ft_vft_ext *could_you;
+};
 #endif
 
 extern const char *ft_stopword_file;

=== modified file 'include/mysql/thread_pool_priv.h'
--- a/include/mysql/thread_pool_priv.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/include/mysql/thread_pool_priv.h	revid:mikael.ronstrom@stripped
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2010, 2012, 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
@@ -99,7 +99,9 @@ void thd_cleanup(THD *thd);
 /* Decrement connection counter */
 void dec_connection_count();
 /* Destroy THD object */
-void delete_thd(THD *thd);
+void destroy_thd(THD *thd);
+/* Remove the THD from the set of global threads. */
+void remove_global_thread(THD *thd);
 
 /*
   thread_created is maintained by thread pool when activated since

=== modified file 'include/mysql_com.h'
--- a/include/mysql_com.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/include/mysql_com.h	revid:mikael.ronstrom@stripped
@@ -119,10 +119,10 @@ enum enum_server_command
   Was part of old online ALTER API, flag is now unused.
 */
 #define FIELD_IS_RENAMED (1<< 21)       /* Intern: Field is being renamed */
-#define FIELD_FLAGS_STORAGE_MEDIA 22    /* Field storage media, bit 22-23,
-                                           reserved by MySQL Cluster */
-#define FIELD_FLAGS_COLUMN_FORMAT 24    /* Field column format, bit 24-25,
-                                           reserved by MySQL Cluster */
+#define FIELD_FLAGS_STORAGE_MEDIA 22    /* Field storage media, bit 22-23 */
+#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
+#define FIELD_FLAGS_COLUMN_FORMAT 24    /* Field column format, bit 24-25 */
+#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
 
 #define REFRESH_GRANT		1	/* Refresh grant tables */
 #define REFRESH_LOG		2	/* Start on new log file */

=== modified file 'include/welcome_copyright_notice.h'
--- a/include/welcome_copyright_notice.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/include/welcome_copyright_notice.h	revid:mikael.ronstrom@stripped
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2012, 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 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/collections/default.experimental	revid:mikael.ronstrom@stripped
@@ -13,6 +13,7 @@ main.sp @solaris                        
 main.bug33509 @solaris                   # Bug#11753919 2012-02-16 didrik Several test cases fail on Solaris with error Thread stack overrun
 
 main.kill @freebsd                       # Bug#12619719 2011-08-04 Occasional failure in PB2
+main.bug12427262 @windows                # Bug#12427262 2012-04-20 Hemant Fails on mysql-trunk on Windows after Mayank push
 
 innodb.innodb_monitor                    # Bug#12320827 2011-08-04 Occasional failure in PB2
 

=== modified file 'mysql-test/collections/default.push'
--- a/mysql-test/collections/default.push	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/collections/default.push	revid:mikael.ronstrom@stripped
@@ -3,4 +3,5 @@ perl mysql-test-run.pl --timer --force -
 perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_embedded --vardir=var-main_emebbed  --suite=main --embedded --experimental=collections/default.experimental --skip-ndb
 perl mysql-test-run.pl --timer --force --parallel=auto --comment=innodb_4k_size --vardir=var-innodb-4k --experimental=collections/default.experimental --skip-ndb --suite=innodb --mysqld=--innodb-page-size=4k
 perl mysql-test-run.pl --timer --force --comment=explain-json --vardir=var-explain-json  --suite=explain_json_validate
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts      --suite=parts 
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts      --suite=parts
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_n_mix_MTS --vardir=var-mts-rpl-binlog-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb  --unit-tests --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --suite=rpl 

=== modified file 'mysql-test/extra/rpl_tests/rpl_loaddata.test'
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test	revid:mikael.ronstrom@stripped
@@ -161,7 +161,7 @@ if (`SELECT @@global.binlog_format != 'R
   # Query causes error on master but not on slave. This causes the slave to
   # stop with error code 0 (which is wrong: see BUG#57287)
   # ER_MTS_INCONSISTENT_DATA
-  --let $slave_sql_errno= 0,1754
+  --let $slave_sql_errno= 0,1755
   --source include/wait_for_slave_sql_error.inc
   drop table t1, t2;
 }

=== modified file 'mysql-test/include/assert_command_output.inc'
--- a/mysql-test/include/assert_command_output.inc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/include/assert_command_output.inc	revid:mikael.ronstrom@stripped
@@ -20,6 +20,7 @@ if ($rpl_debug)
 --let _ASSERT_STATUS= $assert_status
 --let $_assert_suffix= `SELECT UUID()`
 --let _ASSERT_ERROR_FILE= $MYSQLTEST_VARDIR/tmp/_assert_$_assert_suffix.inc
+--let _ASSERT_DEBUG= $rpl_debug
 
 if ($rpl_debug)
 {
@@ -31,6 +32,7 @@ perl;
   my $positive= $ENV{'_ASSERT_NEGATED'} ? 0 : 1;
   my $regex= $ENV{'_ASSERT_REGEX'};
   my $status= $ENV{'_ASSERT_STATUS'};
+  my $debug= $ENV{'_ASSERT_DEBUG'};
   my $output= `$cmd`;
   my $error= 0;
   $status= 0 if $status eq '';
@@ -46,8 +48,6 @@ perl;
     print "ERROR: Command: '$cmd'\n";
     print "ERROR: Output expected to " . ($positive?'':'not '). "match " .
       "perl regex: '$regex'\n";
-    print "======== BEGIN output ========\n$output\n" .
-      "======== END OUTPUT ========\n";
     $error= 1;
   }
   if (!$error)
@@ -57,6 +57,11 @@ perl;
     print FILE "X" or die "Error writing to $file: $!";
     close FILE or die "Error closing $file: $!";
   }
+  if ($error || $debug)
+  {
+    print "======== BEGIN output ========\n$output\n" .
+      "======== END OUTPUT ========\n";
+  }
 EOF
 
 --file_exists $_ASSERT_ERROR_FILE

=== modified file 'mysql-test/lib/My/CoreDump.pm'
--- a/mysql-test/lib/My/CoreDump.pm	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/lib/My/CoreDump.pm	revid:mikael.ronstrom@stripped
@@ -1,5 +1,5 @@
 # -*- cperl -*-
-# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 2012, 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
@@ -158,7 +158,6 @@ sub cdb_check {
 
 sub _cdb {
   my ($core_name)= @_;
-  print localtime() . " cdb debug A\n";
   print "\nTrying 'cdb' to get a backtrace\n";
   return unless -f $core_name;
   
@@ -184,7 +183,6 @@ sub _cdb {
   # build symbol path (required by cdb if executable was built on 
   # different machine)
   my $tmp_name= $core_name.".cdb_lmv";
-  print localtime() . " cdb debug B\n";
   `cdb -z $core_name -c \"lmv;q\" > $tmp_name 2>&1`;
   print localtime() . " cdb debug C\n";
   if ($? >> 8)
@@ -195,7 +193,7 @@ sub _cdb {
     cdb_check();
     return;
   }
-  
+  print localtime() . " cdb debug E\n";
   open(temp,"< $tmp_name");
   my %dirhash=();
   while(<temp>)
@@ -211,7 +209,7 @@ sub _cdb {
   }
   close(temp);
   unlink($tmp_name);
-  
+  print localtime() . " cdb debug F\n";
   my $image_path= join(";", (keys %dirhash),".");
 
   # For better callstacks, setup _NT_SYMBOL_PATH to include
@@ -242,6 +240,7 @@ sub _cdb {
   my $cdb_output=
     `cdb -c "$cdb_cmd" -z $core_name -i "$image_path" -y "$symbol_path" -t 0 -lines 2>&1`;
   return if $? >> 8;
+  print localtime() . " cdb debug G\n";
   return unless $cdb_output;
   
   # Remove comments (lines starting with *), stack pointer and frame 

=== added file 'mysql-test/r/bug12427262.result'
--- a/mysql-test/r/bug12427262.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug12427262.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,53 @@
+#
+# Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE. 
+#
+create database show_table_db;
+use show_table_db;
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+create table t4 (c1 int);
+create table t5 (c1 int);
+create table t6 (c1 int);
+create table t7 (c1 int);
+create table t8 (c1 int);
+create table t9 (c1 int);
+create table t10 (c1 int);
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME 
+like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_before;
+show tables;
+Tables_in_show_table_db
+t1
+t10
+t2
+t3
+t4
+t5
+t6
+t7
+t8
+t9
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME 
+like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
+select @count_read_after-@count_read_before;
+@count_read_after-@count_read_before
+0.000000000000000000000000000000
+show full tables;
+Tables_in_show_table_db	Table_type
+t1	BASE TABLE
+t10	BASE TABLE
+t2	BASE TABLE
+t3	BASE TABLE
+t4	BASE TABLE
+t5	BASE TABLE
+t6	BASE TABLE
+t7	BASE TABLE
+t8	BASE TABLE
+t9	BASE TABLE
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME 
+like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
+select @count_read_after-@count_read_before;
+@count_read_after-@count_read_before
+10.000000000000000000000000000000
+drop table t1;
+drop database show_table_db;

=== modified file 'mysql-test/r/derived.result'
--- a/mysql-test/r/derived.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/r/derived.result	revid:mikael.ronstrom@stripped
@@ -1962,3 +1962,14 @@ id	select_type	table	type	possible_keys	
 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 2	DERIVED	t2	ALL	NULL	NULL	NULL	NULL	1	NULL
 DROP TABLE t1,t2;
+#
+# Bug #13801019 ASSERTION `0' FAILED IN CREATE_MYISAM_TMP_TABLE
+#
+CREATE TABLE t1 (a INT, b BLOB) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT);
+CREATE TABLE t3 (d INT);
+INSERT INTO t3 VALUES (0);
+SELECT * FROM (SELECT * FROM t1) AS a1 RIGHT JOIN t3 LEFT JOIN t2 ON d=c ON a=c;
+a	b	d	c
+NULL	NULL	0	NULL
+DROP TABLE t1, t2, t3;

=== modified file 'mysql-test/r/log_tables.result'
--- a/mysql-test/r/log_tables.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/r/log_tables.result	revid:mikael.ronstrom@stripped
@@ -675,7 +675,7 @@ set global general_log = off;
 select command_type, argument from mysql.general_log where thread_id = @thread_id;
 command_type	argument
 Query	SET GLOBAL general_log='ON'
-Query	SET (@lparam:='000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 018 019020 021 022 023 024 025 026 027 028 029030 031 032 033 034 035 036 037 038 039040 041 042 043 044 045 046 047 048 049050 051 052 053 054 055 056 057 058 059060 061 062 063 064 065 066 067 068 069070 071 072 073 074 075 076 077 078 079080 081 082 083 084 085 086 087 088 089090 091 092 093 094 095 096 097 098 099100 101 102 103 104 105 106 107 108 109110 111 112 113 114 115 116 117 118 119120 121 122 123 124 125 126 127 128 129130 131 132 133 134 135 136 137 138 139140 141 142 143 144 145 146 147 148 149150 151 152 153 154 155 156 157 158 159160 161 162 163 164 165 166 167 168 169170 171 172 173 174 175 176 177 178 179180 181 182 183 184 185 186 187 188 189190 191 192 193 194 195 196 197 198 199200 201 202 203 204 205 206 207 208 209210 211 212 213 214 215 216 217 218 219220 221 222 223 224 225 226 227 228 229230 231 232 233 234 235 236 237 238 239240 241 242 243 244 245 246 247!
  248 249250 251 252 253 254 255 256 257 258 259260 261 262 263 264 265 266 267 268 269270 271 272 273 274 275 276 277 278 279280 281 282 283 284 285 286 287 288 289290 291 292 293 294 295 296 297 298 299300 301 302 303 304 305 306 307 308 309310 311 312 313 314 315 316 317 318 319320 321 322 323 324 325 326 327 328 329330 331 332 333 334 335 336 337 338 339340 341 342 343 344 345 346 347 348 349350 351 352 353 354 355 356 357 358 359360 361 362 363 364 365 366 367 368 369370 371 372 373 374 375 376 377 378 379380 381 382 383 384 385 386 387 388 389390 391 392 393 394 395 396 397 398 399400 401 402 403 404 405 406 407 408 409410 411 412 413 414 415 416 417 418 419420 421 422 423 424 425 426 427 428 429430 431 432 433 434 435 436 437 438 439440 441 442 443 444 445 446 447 448 449450 451 452 453 454 455 456 457 458 459460 461 462 463 464 465 466 467 468 469470 471 472 473 474 475 476 477 478 479480 481 482 483 484 485 486 487 488 489490 491 492 493 494 495 496 497 498 499500 5!
 01 502 503 504 505 506 507 508 509510 511 512 513 514 515 516 !
 517 518 519520 521 522 523 524 525 526 527 528 529530 531 532 533 534 535 536 537 538 539540 541 542 543 544 545 546 547 548 549550 551 552 553 554 555 556 557 558 559560 561 562 563 564 565 566 567 568 569570 571 572 573 574 575 576 577 578 579580 581 582 583 584 585 586 587 588 589590 591 592 593 594 595 596 597 598 599600 601 602 603 604 605 606 607 608 609610 611 612 613 614 615 616 617 618 619620 621 622 623 624 625 626 627 628 629630 631 632 633 634 635 636 637 638 639640 641 642 643 644 645 646 647 648 649650 651 652 653 654 655 656 657 658 659660 661 662 663 664 665 666 667 668 669670 671 672 673 674 675 676 677 678 679680 681 682 683 684 685 686 687 688 689690 691 692 693 694 695 696 697 698 699700 701 702 703 704 705 706 707 708 709710 711 712 713 714 715 716 717 718 719720 721 722 723 724 725 726 727 728 729730 731 732 733 734 735 736 737 738 739740 741 742 743 744 745 746 747 748 749750 751 752 753 754 755 756 757 758 759760 761 762 763 764 765 766 767 768 76977!
 0 771 772 773 774 775 776 777 778 779780 781 782 783 784 785 786 787 788 789790 791 792 793 794 795 796 797 798 799800 801 802 803 804 805 806 807 808 809810 811 812 813 814 815 816 817 818 819820 821 822 823 824 825 826 827 828 829830 831 832 833 834 835 836 837 838 839840 841 842 843 844 845 846 847 848 849850 851 852 853 854 855 856 857 858 859860 861 862 863 864 865 866 867 868 869870 871 872 873 874 875 876 877 878 879880 881 882 883 884 885 886 887 888 889890 891 892 893 894 895 896 897 898 899900 901 902 903 904 905 906 907 908 909910 911 912 913 914 915 916 917 918 919920 921 922 923 924 925 926 927 928 929930 931 932 933 934 935 936 937 938 939940 941 942 943 944 945 946 947 948 949950 951 952 953 954 955 956 957 958 959960 961 962 963 964 965 966 967 968 969970 971 972 973 974 975 976 977 978 979980 981 982 983 984 985 986 987 988 989990 991 992 993 994 995 996 997 998 999')
+Query	SET @lparam:='000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 018 019020 021 022 023 024 025 026 027 028 029030 031 032 033 034 035 036 037 038 039040 041 042 043 044 045 046 047 048 049050 051 052 053 054 055 056 057 058 059060 061 062 063 064 065 066 067 068 069070 071 072 073 074 075 076 077 078 079080 081 082 083 084 085 086 087 088 089090 091 092 093 094 095 096 097 098 099100 101 102 103 104 105 106 107 108 109110 111 112 113 114 115 116 117 118 119120 121 122 123 124 125 126 127 128 129130 131 132 133 134 135 136 137 138 139140 141 142 143 144 145 146 147 148 149150 151 152 153 154 155 156 157 158 159160 161 162 163 164 165 166 167 168 169170 171 172 173 174 175 176 177 178 179180 181 182 183 184 185 186 187 188 189190 191 192 193 194 195 196 197 198 199200 201 202 203 204 205 206 207 208 209210 211 212 213 214 215 216 217 218 219220 221 222 223 224 225 226 227 228 229230 231 232 233 234 235 236 237 238 239240 241 242 243 244 245 246 247 !
 248 249250 251 252 253 254 255 256 257 258 259260 261 262 263 264 265 266 267 268 269270 271 272 273 274 275 276 277 278 279280 281 282 283 284 285 286 287 288 289290 291 292 293 294 295 296 297 298 299300 301 302 303 304 305 306 307 308 309310 311 312 313 314 315 316 317 318 319320 321 322 323 324 325 326 327 328 329330 331 332 333 334 335 336 337 338 339340 341 342 343 344 345 346 347 348 349350 351 352 353 354 355 356 357 358 359360 361 362 363 364 365 366 367 368 369370 371 372 373 374 375 376 377 378 379380 381 382 383 384 385 386 387 388 389390 391 392 393 394 395 396 397 398 399400 401 402 403 404 405 406 407 408 409410 411 412 413 414 415 416 417 418 419420 421 422 423 424 425 426 427 428 429430 431 432 433 434 435 436 437 438 439440 441 442 443 444 445 446 447 448 449450 451 452 453 454 455 456 457 458 459460 461 462 463 464 465 466 467 468 469470 471 472 473 474 475 476 477 478 479480 481 482 483 484 485 486 487 488 489490 491 492 493 494 495 496 497 498 499500 50!
 1 502 503 504 505 506 507 508 509510 511 512 513 514 515 516 5!
 17 518 519520 521 522 523 524 525 526 527 528 529530 531 532 533 534 535 536 537 538 539540 541 542 543 544 545 546 547 548 549550 551 552 553 554 555 556 557 558 559560 561 562 563 564 565 566 567 568 569570 571 572 573 574 575 576 577 578 579580 581 582 583 584 585 586 587 588 589590 591 592 593 594 595 596 597 598 599600 601 602 603 604 605 606 607 608 609610 611 612 613 614 615 616 617 618 619620 621 622 623 624 625 626 627 628 629630 631 632 633 634 635 636 637 638 639640 641 642 643 644 645 646 647 648 649650 651 652 653 654 655 656 657 658 659660 661 662 663 664 665 666 667 668 669670 671 672 673 674 675 676 677 678 679680 681 682 683 684 685 686 687 688 689690 691 692 693 694 695 696 697 698 699700 701 702 703 704 705 706 707 708 709710 711 712 713 714 715 716 717 718 719720 721 722 723 724 725 726 727 728 729730 731 732 733 734 735 736 737 738 739740 741 742 743 744 745 746 747 748 749750 751 752 753 754 755 756 757 758 759760 761 762 763 764 765 766 767 768 769770!
  771 772 773 774 775 776 777 778 779780 781 782 783 784 785 786 787 788 789790 791 792 793 794 795 796 797 798 799800 801 802 803 804 805 806 807 808 809810 811 812 813 814 815 816 817 818 819820 821 822 823 824 825 826 827 828 829830 831 832 833 834 835 836 837 838 839840 841 842 843 844 845 846 847 848 849850 851 852 853 854 855 856 857 858 859860 861 862 863 864 865 866 867 868 869870 871 872 873 874 875 876 877 878 879880 881 882 883 884 885 886 887 888 889890 891 892 893 894 895 896 897 898 899900 901 902 903 904 905 906 907 908 909910 911 912 913 914 915 916 917 918 919920 921 922 923 924 925 926 927 928 929930 931 932 933 934 935 936 937 938 939940 941 942 943 944 945 946 947 948 949950 951 952 953 954 955 956 957 958 959960 961 962 963 964 965 966 967 968 969970 971 972 973 974 975 976 977 978 979980 981 982 983 984 985 986 987 988 989990 991 992 993 994 995 996 997 998 999'
 Query	prepare long_query from "select ? as long_query"
 Prepare	select ? as long_query
 Query	execute long_query using @lparam

=== added file 'mysql-test/r/myisam_row_rpl.result'
--- a/mysql-test/r/myisam_row_rpl.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/myisam_row_rpl.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,60 @@
+include/master-slave.inc
+Warnings:
+Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note	####	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
+[connection master]
+#
+# Bug#11940249: RBR: MYISAM TABLE CORRUPTION AFTER FIRST LARGE INSERT
+#               ON SLAVE
+#
+# Must have > 100 rows in the first rpl event (to trigger bulk_insert
+# optimization for insert into an empty table, by disable all non-unique
+# indexes and recreate them afterwards.)
+# and then it must be a second rpl event for the same insert (i.e.
+# during the same lock).
+# Note that --binlog-row-event-max-size=1024 is set in the .opt files
+# to enforce the default size.
+CREATE TABLE tmp (a VARCHAR(10), b INT) ENGINE=Memory;
+INSERT INTO tmp VALUES ('aZa', 1), ('zAz', 2), ('M', 3);
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+INSERT INTO tmp SELECT * FROM tmp;
+CREATE TABLE t
+(a VARCHAR(10),
+b INT,
+KEY a (a))
+ENGINE = MyISAM;
+INSERT INTO t SELECT * FROM tmp;
+# on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+COUNT(*)
+192
+# on master:
+include/show_binlog_events.inc
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t)
+master-bin.000001	#	Write_rows	#	#	table_id: #
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	COMMIT
+RENAME TABLE t to t_2;
+RENAME TABLE t_2 to t;
+# on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+COUNT(*)
+192
+CHECK TABLE t;
+Table	Op	Msg_type	Msg_text
+test.t	check	status	OK
+REPAIR TABLE t;
+Table	Op	Msg_type	Msg_text
+test.t	repair	status	OK
+SELECT COUNT(*) FROM t WHERE b > -1;
+COUNT(*)
+192
+include/diff_tables.inc [master:t, slave:t]
+DROP TABLE t, tmp;
+include/rpl_end.inc

=== added file 'mysql-test/r/mysql_embedded_client_test.result'
--- a/mysql-test/r/mysql_embedded_client_test.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/mysql_embedded_client_test.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,5 @@
+#
+# Bug#13541194 : MTR TEST TO RUN EMBEDDED SERVER CLIENT TESTS IN MYSQL_CLIENT_TEST.C.
+#
+stopped the current server
+# 7. Restart the server and cleanup

=== modified file 'mysql-test/r/rewrite_general_log.result'
--- a/mysql-test/r/rewrite_general_log.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/r/rewrite_general_log.result	revid:mikael.ronstrom@stripped
@@ -48,13 +48,19 @@ SET PASSWORD FOR `test_user4`@`localhost
 SELECT argument FROM mysql.general_log WHERE argument LIKE 'SET CHARACTER SET %';
 argument
 SET CHARACTER SET 'hebrew'
-SET CHARACTER SET DEFAULT,(@dummy:='A')
+SET CHARACTER SET DEFAULT,@dummy:='A'
 SELECT argument FROM mysql.general_log WHERE argument LIKE 'SET NAMES %';
 argument
-SET NAMES 'latin1',(@dummy:='B')
+SET NAMES 'latin1',@dummy:='B'
 SET NAMES 'latin1' COLLATE 'latin1_german2_ci'
-SET NAMES DEFAULT,(@dummy:='c')
+SET NAMES DEFAULT,@dummy:='c'
 ------ done ------ see log_tables.test for more proof! :)
+Bug#13958454 -- show we print SET @a:=5, but SELECT (@a:=5)
+EXPLAIN EXTENDED SELECT @a=5,@b:=10,@c:=20,@d:=40+5,(@e:=80)+5;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+Warnings:
+Note	1003	/* select#1 */ select ((@a) = 5) AS `@a=5`,(@b:=10) AS `@b:=10`,(@c:=20) AS `@c:=20`,(@d:=(40 + 5)) AS `@d:=40+5`,((@e:=80) + 5) AS `(@e:=80)+5`
 DROP TABLE test_log;
 SET GLOBAL general_log_file=  @old_general_log_file;
 SET GLOBAL general_log=       @old_general_log;

=== modified file 'mysql-test/r/tablespace.result'
--- a/mysql-test/r/tablespace.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/r/tablespace.result	revid:mikael.ronstrom@stripped
@@ -98,15 +98,144 @@ Table	Create Table
 t1	CREATE TABLE `t1` (
   `a` int(11) NOT NULL,
   `b` int(11) DEFAULT NULL,
-  `c` int(11) DEFAULT NULL,
-  `d` int(11) NOT NULL,
-  `e` int(11) DEFAULT NULL,
-  `f` int(11) DEFAULT NULL,
+  `c` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL,
+  `d` int(11) NOT NULL /*!50606 STORAGE MEMORY */,
+  `e` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `f` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
   `g` int(11) DEFAULT NULL,
-  `h` int(11) NOT NULL,
-  `i` int(11) DEFAULT NULL,
-  `j` int(11) DEFAULT NULL,
-  `k` int(11) DEFAULT NULL,
+  `h` int(11) NOT NULL /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT DYNAMIC */,
+  `i` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `j` int(11) /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `k` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
   PRIMARY KEY (`a`)
 ) /*!50100 TABLESPACE the_tablespacename STORAGE DISK */ ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1;
+#
+# WL#3627 Add COLUMN_FORMAT and STORAGE for fields
+#
+CREATE TABLE t1 (
+a int STORAGE DISK,
+b int STORAGE MEMORY NOT NULL,
+c int COLUMN_FORMAT DYNAMIC,
+d int COLUMN_FORMAT FIXED,
+e int COLUMN_FORMAT DEFAULT,
+f int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+g int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+h int STORAGE DISK COLUMN_FORMAT FIXED,
+i int STORAGE MEMORY COLUMN_FORMAT FIXED
+);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL,
+  `b` int(11) NOT NULL /*!50606 STORAGE MEMORY */,
+  `c` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `d` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `e` int(11) DEFAULT NULL,
+  `f` int(11) NOT NULL /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT DYNAMIC */,
+  `g` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `h` int(11) /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `i` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1
+ADD COLUMN j int STORAGE DISK,
+ADD COLUMN k int STORAGE MEMORY NOT NULL,
+ADD COLUMN l int COLUMN_FORMAT DYNAMIC,
+ADD COLUMN m int COLUMN_FORMAT FIXED,
+ADD COLUMN n int COLUMN_FORMAT DEFAULT,
+ADD COLUMN o int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+ADD COLUMN p int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+ADD COLUMN q int STORAGE DISK COLUMN_FORMAT FIXED,
+ADD COLUMN r int STORAGE MEMORY COLUMN_FORMAT FIXED;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL,
+  `b` int(11) NOT NULL /*!50606 STORAGE MEMORY */,
+  `c` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `d` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `e` int(11) DEFAULT NULL,
+  `f` int(11) NOT NULL /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT DYNAMIC */,
+  `g` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `h` int(11) /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `i` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `j` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL,
+  `k` int(11) NOT NULL /*!50606 STORAGE MEMORY */,
+  `l` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `m` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `n` int(11) DEFAULT NULL,
+  `o` int(11) NOT NULL /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT DYNAMIC */,
+  `p` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `q` int(11) /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `r` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1
+MODIFY COLUMN j int STORAGE MEMORY NOT NULL,
+MODIFY COLUMN k int COLUMN_FORMAT DYNAMIC,
+MODIFY COLUMN l int COLUMN_FORMAT FIXED,
+MODIFY COLUMN m int COLUMN_FORMAT DEFAULT,
+MODIFY COLUMN n int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+MODIFY COLUMN o int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+MODIFY COLUMN p int STORAGE DISK COLUMN_FORMAT FIXED,
+MODIFY COLUMN q int STORAGE MEMORY COLUMN_FORMAT FIXED,
+MODIFY COLUMN r int STORAGE DISK;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL,
+  `b` int(11) NOT NULL /*!50606 STORAGE MEMORY */,
+  `c` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `d` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `e` int(11) DEFAULT NULL,
+  `f` int(11) NOT NULL /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT DYNAMIC */,
+  `g` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `h` int(11) /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `i` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `j` int(11) NOT NULL /*!50606 STORAGE MEMORY */,
+  `k` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `l` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `m` int(11) DEFAULT NULL,
+  `n` int(11) NOT NULL /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT DYNAMIC */,
+  `o` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `p` int(11) /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `q` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `r` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1
+MODIFY COLUMN h int COLUMN_FORMAT DYNAMIC COLUMN_FORMAT FIXED,
+MODIFY COLUMN i int COLUMN_FORMAT DYNAMIC COLUMN_FORMAT DEFAULT,
+MODIFY COLUMN j int COLUMN_FORMAT FIXED COLUMN_FORMAT DYNAMIC,
+MODIFY COLUMN k int COLUMN_FORMAT FIXED COLUMN_FORMAT DEFAULT,
+MODIFY COLUMN l int STORAGE DISK STORAGE MEMORY,
+MODIFY COLUMN m int STORAGE DISK STORAGE DEFAULT,
+MODIFY COLUMN n int STORAGE MEMORY STORAGE DISK,
+MODIFY COLUMN o int STORAGE MEMORY STORAGE DEFAULT,
+MODIFY COLUMN p int STORAGE DISK STORAGE MEMORY
+COLUMN_FORMAT FIXED COLUMN_FORMAT DYNAMIC,
+MODIFY COLUMN q int STORAGE DISK STORAGE MEMORY STORAGE DEFAULT
+COLUMN_FORMAT FIXED COLUMN_FORMAT DYNAMIC COLUMN_FORMAT DEFAULT,
+MODIFY COLUMN r int STORAGE DEFAULT STORAGE DEFAULT STORAGE MEMORY
+STORAGE DISK STORAGE MEMORY STORAGE DISK STORAGE DISK;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL,
+  `b` int(11) NOT NULL /*!50606 STORAGE MEMORY */,
+  `c` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `d` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `e` int(11) DEFAULT NULL,
+  `f` int(11) NOT NULL /*!50606 STORAGE DISK */ /*!50606 COLUMN_FORMAT DYNAMIC */,
+  `g` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `h` int(11) /*!50606 COLUMN_FORMAT FIXED */ DEFAULT NULL,
+  `i` int(11) DEFAULT NULL,
+  `j` int(11) /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `k` int(11) DEFAULT NULL,
+  `l` int(11) /*!50606 STORAGE MEMORY */ DEFAULT NULL,
+  `m` int(11) DEFAULT NULL,
+  `n` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL,
+  `o` int(11) DEFAULT NULL,
+  `p` int(11) /*!50606 STORAGE MEMORY */ /*!50606 COLUMN_FORMAT DYNAMIC */ DEFAULT NULL,
+  `q` int(11) DEFAULT NULL,
+  `r` int(11) /*!50606 STORAGE DISK */ DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;

=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/r/type_temporal_fractional.result	revid:mikael.ronstrom@stripped
@@ -17256,4 +17256,16 @@ SELECT GREATEST(a,10), LEAST(a,10) FROM 
 GREATEST(a,10)	LEAST(a,10)
 20010101010101.123456	10.000000
 DROP TABLE t1;
+#
+# Bug#13976233 ASSERTION FAILED: !CHECK_TIME_MMSSFF_RANGE(LTIME), FILE SQL_TIME.CC, LINE 304
+#
+SELECT SECOND(4.99999999991e0);
+SECOND(4.99999999991e0)
+5
+SELECT SECOND(-4.99999999991e0);
+SECOND(-4.99999999991e0)
+5
+SELECT SECOND(TRUNCATE('5',180));
+SECOND(TRUNCATE('5',180))
+5
 # End of 5.6 tests

=== modified file 'mysql-test/suite/binlog/r/binlog_grant.result'
--- a/mysql-test/suite/binlog/r/binlog_grant.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/binlog/r/binlog_grant.result	revid:mikael.ronstrom@stripped
@@ -22,3 +22,7 @@ ERROR 42000: Access denied; you need (at
 **** Clean up ****
 set global binlog_format = @saved_binlog_format;
 drop user mysqltest_1@localhost;
+GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
+SHOW MASTER LOGS;
+SHOW BINARY LOGS;
+DROP USER 'mysqltest_1'@'localhost';

=== modified file 'mysql-test/suite/binlog/r/binlog_multi_engine.result'
--- a/mysql-test/suite/binlog/r/binlog_multi_engine.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result	revid:mikael.ronstrom@stripped
@@ -19,7 +19,7 @@ COMMIT;
 TRUNCATE t1m;
 TRUNCATE t1b;
 TRUNCATE t1n;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 mysqld-bin.000001	#	Query	#	#	BEGIN
 mysqld-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
@@ -52,7 +52,7 @@ ERROR HY000: Cannot execute statement: i
 TRUNCATE t1m;
 TRUNCATE t1b;
 TRUNCATE t1n;
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 mysqld-bin.000001	#	Query	#	#	BEGIN
 mysqld-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
@@ -81,7 +81,7 @@ UPDATE t1m, t1n SET m = 2, e = 3 WHERE n
 ERROR HY000: Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging.
 UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
 ERROR HY000: Cannot execute statement: impossible to write to binary log since more than one engine is involved and at least one engine is self-logging.
-show binlog events from <binlog_start>;
+include/show_binlog_events.inc
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 mysqld-bin.000001	#	Query	#	#	BEGIN
 mysqld-bin.000001	#	Table_map	#	#	table_id: # (test.t1m)

=== modified file 'mysql-test/suite/binlog/t/binlog_grant.test'
--- a/mysql-test/suite/binlog/t/binlog_grant.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/binlog/t/binlog_grant.test	revid:mikael.ronstrom@stripped
@@ -54,3 +54,22 @@ disconnect root;
 connection default;
 set global binlog_format = @saved_binlog_format;
 drop user mysqltest_1@localhost;
+
+
+# Testing if REPLICATION CLIENT privilege is enough to execute
+# SHOW MASTER LOGS and SHOW BINARY.
+GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
+--connect(rpl,localhost,mysqltest_1,,)
+
+--connection rpl
+# We are only interested if the following commands succeed and not on
+# their output.
+--disable_result_log
+SHOW MASTER LOGS;
+SHOW BINARY LOGS;
+--enable_result_log
+
+# clean up
+--disconnect rpl
+connection default;
+DROP USER 'mysqltest_1'@'localhost';

=== modified file 'mysql-test/suite/engines/funcs/t/crash_manytables_number.test'
--- a/mysql-test/suite/engines/funcs/t/crash_manytables_number.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/crash_manytables_number.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/ld_all_number_string_calendar_types.test'
--- a/mysql-test/suite/engines/funcs/t/ld_all_number_string_calendar_types.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/ld_all_number_string_calendar_types.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_cross.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_cross.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_cross.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_default.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_default.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_default.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_inner.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_inner.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_inner.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_left.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_left.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_left.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_natural_left.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_natural_left.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_natural_left.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_natural_left_outer.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_natural_right.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_natural_right.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_natural_right.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_natural_right_outer.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_natural_right_outer.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_natural_right_outer.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_right.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_right.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_right.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_right_outer.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_right_outer.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_right_outer.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_join_straight.test'
--- a/mysql-test/suite/engines/funcs/t/se_join_straight.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_join_straight.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/funcs/t/se_string_limit.test'
--- a/mysql-test/suite/engines/funcs/t/se_string_limit.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/funcs/t/se_string_limit.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 --disable_warnings
 DROP TABLE IF EXISTS t1;
 --enable_warnings

=== modified file 'mysql-test/suite/engines/iuds/t/update_delete_number.test'
--- a/mysql-test/suite/engines/iuds/t/update_delete_number.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/engines/iuds/t/update_delete_number.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 --disable_warnings
 DROP TABLE IF EXISTS t1,t2;
 --enable_warnings

=== added file 'mysql-test/suite/innodb/r/innodb-alter-discard.result'
--- a/mysql-test/suite/innodb/r/innodb-alter-discard.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb-alter-discard.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,15 @@
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t(a INT)ENGINE=InnoDB;
+call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
+call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
+call mtr.add_suppression("InnoDB: Error: table 'test/t'$");
+SELECT * FROM t;
+ERROR 42S02: Table 'test.t' doesn't exist
+ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
+ERROR 42S02: Table 'test.t' doesn't exist
+ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
+ERROR 42S02: Table 'test.t1' doesn't exist
+call mtr.add_suppression("InnoDB: (Error|Warning): cannot delete tablespace ");
+ALTER TABLE t DISCARD TABLESPACE;
+ERROR HY000: Got error -1 from storage engine
+DROP TABLE t;

=== modified file 'mysql-test/suite/innodb/r/innodb-index-online.result'
--- a/mysql-test/suite/innodb/r/innodb-index-online.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result	revid:mikael.ronstrom@stripped
@@ -4,6 +4,9 @@ SET DEBUG='d,query,debug_sync_exec:i:t:A
 call mtr.add_suppression("InnoDB: Warning: Small buffer pool size");
 call mtr.add_suppression("Cannot find index .*c2 in InnoDB index translation table");
 call mtr.add_suppression("Find index .*c2 in InnoDB index list but not its MySQL index number");
+call mtr.add_suppression("InnoDB: Error: table 'test/t1'");
+call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd file for");
+SET GLOBAL innodb_file_per_table=on;
 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, c3 INT) ENGINE=InnoDB;
 INSERT INTO t1 VALUES (1,1,0),(2,2,0),(3,3,0),(4,4,0),(5,5,0);
 SET GLOBAL innodb_monitor_enable=module_ddl;
@@ -257,6 +260,31 @@ COUNT(c2)
 CHECK TABLE t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
+SET DEBUG_SYNC='row_log_apply_before SIGNAL c2g_created WAIT_FOR dml4_done';
+SET lock_wait_timeout=1;
+ALTER TABLE t1 DROP INDEX c2f, ADD INDEX c2g(c2);
+SET DEBUG_SYNC='now WAIT_FOR c2g_created';
+SET lock_wait_timeout=10;
+ALTER TABLE t1 DISCARD TABLESPACE;
+SET DEBUG_SYNC='now SIGNAL dml4_done';
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) NOT NULL,
+  `c2` int(11) DEFAULT NULL,
+  `c3` int(11) DEFAULT NULL,
+  PRIMARY KEY (`c1`),
+  KEY `c2d` (`c2`),
+  KEY `c2f` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='testing if c2e will be dropped'
+ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f;
+ERROR 42S02: Table 'test.t1' doesn't exist
+ALTER TABLE t1 ADD INDEX c2h(c2), ALGORITHM=INPLACE;
+ERROR 42S02: Table 'test.t1' doesn't exist
+ALTER TABLE t1 ADD INDEX c2h(c2), ALGORITHM=COPY;
+ERROR 42S02: Table 'test.t1' doesn't exist
+SET GLOBAL innodb_file_per_table=0;
 SET DEBUG_SYNC='RESET';
 SET DEBUG='-d,debug_sync_abort_on_timeout';
 SET DEBUG='';

=== added file 'mysql-test/suite/innodb/t/innodb-alter-discard.test'
--- a/mysql-test/suite/innodb/t/innodb-alter-discard.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb-alter-discard.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,43 @@
+#Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING OR DISCARDED TABLESPACES
+
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+
+let $MYSQLD_DATADIR=`select @@datadir`;
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t(a INT)ENGINE=InnoDB;
+
+# Shut down the server
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+-- shutdown_server
+-- source include/wait_until_disconnected.inc
+
+# Remove the tablespace file.
+let IBD=$MYSQLD_DATADIR/test/t.ibd;
+perl;
+unlink "$ENV{IBD}" || die "Unable to unlink $ENV{IBD}\n";
+EOF
+
+# Restart the server.
+-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+-- enable_reconnect
+-- source include/wait_until_connected_again.inc
+
+call mtr.add_suppression("InnoDB: Error: trying to open a table, but could not$");
+call mtr.add_suppression("MySQL is trying to open a table handle but the \.ibd file for$");
+call mtr.add_suppression("InnoDB: Error: table 'test/t'$");
+
+# The ER_NO_SUCH_TABLE is being thrown by ha_innobase::open().
+# The table does exist, only the tablespace does not exist.
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t;
+
+--error ER_NO_SUCH_TABLE
+ALTER TABLE t ADD INDEX (a), ALGORITHM=INPLACE;
+--error ER_NO_SUCH_TABLE
+ALTER TABLE t1 ADD INDEX (a), ALGORITHM=COPY;
+
+call mtr.add_suppression("InnoDB: (Error|Warning): cannot delete tablespace ");
+--error ER_GET_ERRNO
+ALTER TABLE t DISCARD TABLESPACE;
+DROP TABLE t;

=== modified file 'mysql-test/suite/innodb/t/innodb-index-online.test'
--- a/mysql-test/suite/innodb/t/innodb-index-online.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/innodb/t/innodb-index-online.test	revid:mikael.ronstrom@stripped
@@ -9,6 +9,13 @@ call mtr.add_suppression("InnoDB: Warnin
 # These will be triggered by INSERT INTO t1 VALUES(6,3,1);
 call mtr.add_suppression("Cannot find index .*c2 in InnoDB index translation table");
 call mtr.add_suppression("Find index .*c2 in InnoDB index list but not its MySQL index number");
+# these will be triggered by DISCARD TABLESPACE
+call mtr.add_suppression("InnoDB: Error: table 'test/t1'");
+call mtr.add_suppression("MySQL is trying to open a table handle but the .ibd file for");
+
+# DISCARD TABLESPACE needs file-per-table
+let $per_table=`select @@innodb_file_per_table`;
+SET GLOBAL innodb_file_per_table=on;
 
 # Save the initial number of concurrent sessions.
 --source include/count_sessions.inc
@@ -256,10 +263,51 @@ SELECT name,count FROM INFORMATION_SCHEM
 SELECT COUNT(c2) FROM t1;
 CHECK TABLE t1;
 
-disconnect con1;
+connection default;
+SET DEBUG_SYNC='row_log_apply_before SIGNAL c2g_created WAIT_FOR dml4_done';
+# The lock upgrade at the end of the ALTER will conflict with the DISCARD.
+SET lock_wait_timeout=1;
+--send
+ALTER TABLE t1 DROP INDEX c2f, ADD INDEX c2g(c2);
+
+connection con1;
+SET DEBUG_SYNC='now WAIT_FOR c2g_created';
+
+connect (con2,localhost,root,,);
+connection con2;
+
+# This will conflict with the ALTER in connection default, above.
+SET lock_wait_timeout=10;
+--send
+ALTER TABLE t1 DISCARD TABLESPACE;
+
+connection con1;
+let $wait_condition=
+  SELECT COUNT(*) = 1 FROM information_schema.processlist
+  WHERE state = 'Waiting for table level lock' and
+        info = 'ALTER TABLE t1 DISCARD TABLESPACE';
+--source include/wait_condition.inc
 
+SET DEBUG_SYNC='now SIGNAL dml4_done';
+disconnect con1;
+connection con2;
+reap;
+disconnect con2;
 connection default;
+--error ER_LOCK_WAIT_TIMEOUT
+reap;
+
+SHOW CREATE TABLE t1;
+# The ER_NO_SUCH_TABLE is being thrown by ha_innobase::open().
+# The table does exist, only the tablespace does not exist.
+--error ER_NO_SUCH_TABLE
+ALTER TABLE t1 DROP INDEX c2d, DROP INDEX c2f;
+--error ER_NO_SUCH_TABLE
+ALTER TABLE t1 ADD INDEX c2h(c2), ALGORITHM=INPLACE;
+--error ER_NO_SUCH_TABLE
+ALTER TABLE t1 ADD INDEX c2h(c2), ALGORITHM=COPY;
 
+eval SET GLOBAL innodb_file_per_table=$per_table;
 SET DEBUG_SYNC='RESET';
 SET DEBUG='-d,debug_sync_abort_on_timeout';
 SET DEBUG='';

=== modified file 'mysql-test/suite/innodb/t/innodb_bug30423.test'
--- a/mysql-test/suite/innodb/t/innodb_bug30423.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/innodb/t/innodb_bug30423.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 # Test for Bug #30423, InnoDBs treatment of NULL in index stats causes
 # bad "rows examined" estimates.
 # Implemented InnoDB system variable "innodb_stats_method" with

=== modified file 'mysql-test/suite/innodb/t/innodb_bug53290.test'
--- a/mysql-test/suite/innodb/t/innodb_bug53290.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/innodb/t/innodb_bug53290.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 -- source include/have_innodb.inc
 
 create table bug53290 (x bigint) engine=innodb;

=== modified file 'mysql-test/suite/innodb_fts/r/innodb_fts_misc.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc.result	revid:mikael.ronstrom@stripped
@@ -890,3 +890,66 @@ FTS_DOC_ID	title	body
 select * from t1 where match(title,body) against('%%%%');
 FTS_DOC_ID	title	body
 drop table t1;
+CREATE DATABASE `benu database`;
+USE `benu database`;
+CREATE TABLE t1 (
+id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+a VARCHAR(200),
+b TEXT
+) ENGINE = InnoDB;
+INSERT INTO t1 (a,b) VALUES
+('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...');
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+Warnings:
+Warning	124	InnoDB rebuilding table to add column FTS_DOC_ID
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `a` varchar(200) DEFAULT NULL,
+  `b` text,
+  PRIMARY KEY (`id`),
+  FULLTEXT KEY `idx` (`a`,`b`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+INSERT INTO t1 (a,b) VALUES
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+SELECT id FROM t1 WHERE MATCH (a,b)
+AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+id
+1
+3
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+id
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+id	x
+1	0
+2	0
+3	0
+4	0
+5	0
+6	0
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+id
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+id
+DROP DATABASE `benu database`;

=== added file 'mysql-test/suite/innodb_fts/r/innodb_fts_opt.result'
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_opt.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_opt.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,825 @@
+CREATE TABLE wp(
+FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+title VARCHAR(255) NOT NULL DEFAULT '',
+text MEDIUMTEXT NOT NULL,
+dummy INTEGER,
+PRIMARY KEY (FTS_DOC_ID),
+UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+FULLTEXT KEY idx (title,text) 
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO wp (title, text) VALUES
+('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+('How To Use MySQL Well','After you went through a ...'),
+('Optimizing MySQL','In this tutorial we will show ...'),
+('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+('MySQL vs. YourSQL','In the following database to database comparison ...'),
+('MySQL Security','When configured properly, MySQL ...');
+CREATE TABLE t1 (i INTEGER);
+INSERT INTO t1 SELECT FTS_DOC_ID FROM wp;
+SELECT FTS_DOC_ID, title, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp;
+FTS_DOC_ID	title	score1	score2
+1	MySQL Tutorial	0.22764469683170319	0.000000003771856604828372
+2	How To Use MySQL Well	0	0.000000001885928302414186
+3	Optimizing MySQL	0	0.000000001885928302414186
+4	1001 MySQL Tricks	0	0.000000001885928302414186
+5	MySQL vs. YourSQL	0.45528939366340637	0.000000001885928302414186
+6	MySQL Security	0	0.000000003771856604828372
+No sorting for this query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+No sorting for this query even if MATCH is part of an expression
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') > 0.1
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+No sorting even if there are several MATCH expressions as long as the
+right one is used in ORDER BY
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score1 DESC;
+title	score1	score2
+MySQL vs. YourSQL	0.45528939366340637	0.000000001885928302414186
+MySQL Tutorial	0.22764469683170319	0.000000003771856604828372
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+Sorting since it is not a single table query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID = t1.i
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting since there is no WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+Optimizing MySQL	0
+1001 MySQL Tricks	0
+MySQL Security	0
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	6
+Sorting since ordering on multiple columns
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC, FTS_DOC_ID;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting since ordering is not descending
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score ASC;
+title	score
+MySQL Tutorial	0.22764469683170319
+MySQL vs. YourSQL	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting because one is ordering on a different MATCH expression
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('mysql') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title	score
+MySQL Tutorial	0.000000003771856604828372
+MySQL vs. YourSQL	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+No sorting for this query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+Revert to table scan and sorting for this query since not
+enough matching rows to satisfy LIMIT clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 3;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	1
+Handler_read_key	4
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	3
+Handler_read_rnd_next	7
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	3
+Sorting since no LIMIT clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+Optimizing MySQL	0
+1001 MySQL Tricks	0
+MySQL Security	0
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	6
+Sorting since there is a WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp
+WHERE dummy IS NULL
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+Sorting since ordering is not on a simple MATCH expressions
+FLUSH STATUS;
+SELECT title, (MATCH(title, text) AGAINST ('database')) * 100 AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	45.52893936634064
+MySQL Tutorial	22.76446968317032
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+Variable_name	Value
+Sort_rows	2
+No ordinary handler accesses when only accessing FTS_DOC_ID and MATCH
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score
+5	0.45528939366340637
+1	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Still no handler accesses when adding FTS_DOC_ID to WHERE clause
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID > 2;
+docid	score
+5	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Still no handler accesses when ordering by MATCH expression
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score;
+docid	score
+1	0.22764469683170319
+5	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	2
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+Optimization is disabled when ordering on FTS_DOC_ID
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY 1 DESC;
+docid	score
+5	0.45528939366340637
+1	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	2
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+Optimization also work with several MATCH expressions
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score1	score2
+5	0.45528939366340637	0.000000001885928302414186
+1	0.22764469683170319	0.000000003771856604828372
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Optimization does not apply if sorting on a different MATCH expressions
+from the one used to access the 
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score2 DESC;
+docid	score1	score2
+1	0.22764469683170319	0.000000003771856604828372
+5	0.45528939366340637	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	2
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+FLUSH STATUS;
+Optimization does not apply for GROUP BY
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database') AS score
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+GROUP BY score;
+FTS_DOC_ID	score
+1	0.22764469683170319
+5	0.45528939366340637
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	3
+No sorting and no table access with LIMIT clause and only information
+from FTS result
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+5	0.45528939366340637
+1	0.22764469683170319
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+If count optimization applies, EXPLAIN shows 
+"Select tables optimized away."
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+Verify that there was no table access
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+Optimization applies also to COUNT(expr) as long as expr is not nullable
+EXPLAIN SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(title)
+2
+Optimization does not apply if not a single table query.
+EXPLAIN SELECT count(*)
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database');
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	6	NULL
+SELECT count(*)
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database');
+count(*)
+12
+Optimization does not apply if MATCH is part of an expression
+EXPLAIN SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+COUNT(title)
+2
+Optimization does not apply if MATCH is part of an expression
+EXPLAIN SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+COUNT(title)
+2
+Optimization does not apply if COUNT expression is nullable
+EXPLAIN SELECT COUNT(dummy) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+SELECT COUNT(dummy) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(dummy)
+0
+FLUSH STATUS;
+SELECT title, 
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	2.2718474864959717
+MySQL Tutorial	1.6663280725479126
+Optimizing MySQL	0.22764469683170319
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+1001 MySQL Tricks	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	2.2718474864959717
+MySQL Tutorial	1.6663280725479126
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score
+5	2.2718474864959717
+1	1.6663280725479126
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+5	2.2718474864959717
+1	1.6663280725479126
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+COUNT(*)
+6
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT title, 
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE)
+ORDER BY score DESC;
+title	score
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+Optimizing MySQL	0.000000001885928302414186
+1001 MySQL Tricks	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database');
+docid	score
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+6	0.000000003771856604828372
+2	0.000000001885928302414186
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+COUNT(*)
+4
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT title, 
+MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE)
+ORDER BY score DESC;
+title	score
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT title,
+MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 1;
+title	score
+MySQL Tutorial	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@10');
+docid	score
+1	0.22764469683170319
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 1;
+docid	score
+1	0.22764469683170319
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	0
+Sort_rows	0
+Sort_scan	0
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE);
+COUNT(*)
+1
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+SELECT title, 
+MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.45528939366340637
+MySQL Tutorial	0.22764469683170319
+How To Use MySQL Well	0
+Optimizing MySQL	0
+1001 MySQL Tricks	0
+MySQL Security	0
+SELECT title, 
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('MySQL database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+title	score
+MySQL Security	0.000000003771856604828372
+How To Use MySQL Well	0.000000001885928302414186
+Optimizing MySQL	0.000000001885928302414186
+1001 MySQL Tricks	0.000000001885928302414186
+MySQL Tutorial	0
+MySQL vs. YourSQL	0
+SELECT title, 
+MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE)
+ORDER BY score DESC;
+title	score
+MySQL Tutorial	0
+ALTER TABLE wp ENGINE=myisam;
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+title	score
+MySQL vs. YourSQL	0.9562782645225525
+MySQL Tutorial	0.5756555199623108
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	1
+Sort_rows	2
+Sort_scan	0
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+title	score
+MySQL vs. YourSQL	0.9562782645225525
+MySQL Tutorial	0.5756555199623108
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	1
+Sort_rows	2
+Sort_scan	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+docid	score
+5	0.9562782645225525
+1	0.5756555199623108
+SHOW SESSION STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	3
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+docid	score
+5	0.9562782645225525
+1	0.5756555199623108
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	3
+Handler_read_prev	0
+Handler_read_rnd	2
+Handler_read_rnd_next	0
+SHOW SESSION STATUS LIKE 'Sort%';
+Variable_name	Value
+Sort_merge_passes	0
+Sort_range	1
+Sort_rows	2
+Sort_scan	0
+EXPLAIN SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	wp	fulltext	idx	idx	0	NULL	1	Using where
+FLUSH STATUS;
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+COUNT(*)
+2
+SHOW STATUS LIKE 'Handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	3
+Handler_read_prev	0
+Handler_read_rnd	0
+Handler_read_rnd_next	0
+DROP TABLE wp, t1;

=== modified file 'mysql-test/suite/innodb_fts/t/innodb_fts_misc.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc.test	revid:mikael.ronstrom@stripped
@@ -813,7 +813,7 @@ SELECT * FROM articles
 
 DROP TABLE articles;
 
-# Test for bug Bug 13940669 - 64901: INNODB: ASSERTION FAILURE IN
+# Test for Bug 13940669 - 64901: INNODB: ASSERTION FAILURE IN
 # THREAD 34387022112 IN FILE REM0CMP.CC LINE 5
 
 drop table if exists t1;
@@ -830,3 +830,49 @@ select * from t1 where match(title,body)
 select * from t1 where match(title,body) against('%%%%');
 
 drop table t1;
+
+# Test for Bug 13881758 - 64745: CREATE FULLTEXT INDEX CAUSES CRASH
+# Create a database with empty space in its name
+CREATE DATABASE `benu database`;
+
+USE `benu database`;
+
+# Create FTS table
+CREATE TABLE t1 (
+        id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+        a VARCHAR(200),
+        b TEXT
+        ) ENGINE = InnoDB;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('MySQL Tutorial','DBMS stands for DataBase ...')  ,
+        ('How To Use MySQL Well','After you went through a ...'),
+        ('Optimizing MySQL','In this tutorial we will show ...');
+
+# Create the FTS index Using Alter Table
+ALTER TABLE t1 ADD FULLTEXT INDEX idx (a,b);
+EVAL SHOW CREATE TABLE t1;
+
+# Insert rows
+INSERT INTO t1 (a,b) VALUES
+        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+        ('MySQL vs. YourSQL','In the following database comparison ...'),
+        ('MySQL Security','When configured properly, MySQL ...');
+
+# Select word "tutorial" in the table
+SELECT id FROM t1 WHERE MATCH (a,b)
+        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
+
+# boolean mode
+select id from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search +(support vector)" IN BOOLEAN MODE);
+select id from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
+select id, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
+select id, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
+select id from t1 where MATCH a,b AGAINST ("+call* +coll*" IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"support now"' IN BOOLEAN MODE);
+select id from t1 where MATCH a,b AGAINST ('"Now sUPPort"' IN BOOLEAN MODE);
+
+DROP DATABASE `benu database`;

=== added file 'mysql-test/suite/innodb_fts/t/innodb_fts_opt.test'
--- a/mysql-test/suite/innodb_fts/t/innodb_fts_opt.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_fts/t/innodb_fts_opt.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,534 @@
+#  
+# Tests for optimizations for InnoDB fulltext search (WL#6043)
+#
+
+CREATE TABLE wp(
+  FTS_DOC_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+  title VARCHAR(255) NOT NULL DEFAULT '',
+  text MEDIUMTEXT NOT NULL,
+  dummy INTEGER,
+  PRIMARY KEY (FTS_DOC_ID),
+  UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
+  FULLTEXT KEY idx (title,text) 
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;  
+
+INSERT INTO wp (title, text) VALUES
+  ('MySQL Tutorial','DBMS stands for MySQL DataBase ...'),
+  ('How To Use MySQL Well','After you went through a ...'),
+  ('Optimizing MySQL','In this tutorial we will show ...'),
+  ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
+  ('MySQL vs. YourSQL','In the following database to database comparison ...'),
+  ('MySQL Security','When configured properly, MySQL ...');      
+
+CREATE TABLE t1 (i INTEGER);
+INSERT INTO t1 SELECT FTS_DOC_ID FROM wp;
+
+#
+#  Show results of MATCH expressions for reference
+#
+SELECT FTS_DOC_ID, title, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp;
+
+#
+# Test that filesort is not used if ordering on same match expression
+# as where clause
+#
+--echo No sorting for this query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo No sorting for this query even if MATCH is part of an expression
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') > 0.1
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo No sorting even if there are several MATCH expressions as long as the
+--echo right one is used in ORDER BY
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score1 DESC;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo Sorting since it is not a single table query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID = t1.i
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since there is no WHERE clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering on multiple columns
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC, FTS_DOC_ID;
+  
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering is not descending
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score ASC;
+  
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting because one is ordering on a different MATCH expression
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('mysql') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+  
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+#
+#  Tests for ORDER BY/LIMIT optimzation
+#
+--echo No sorting for this query
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort%';
+
+--echo Revert to table scan and sorting for this query since not
+--echo enough matching rows to satisfy LIMIT clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 3;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since no LIMIT clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since there is a WHERE clause
+FLUSH STATUS;
+
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp
+WHERE dummy IS NULL
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+--echo Sorting since ordering is not on a simple MATCH expressions
+FLUSH STATUS;
+
+SELECT title, (MATCH(title, text) AGAINST ('database')) * 100 AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+
+SHOW SESSION STATUS LIKE 'Sort_rows%';
+
+#
+#  Test that there is no row accesses if all necessary information is
+#  available in FTS result
+#
+--echo No ordinary handler accesses when only accessing FTS_DOC_ID and MATCH
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Still no handler accesses when adding FTS_DOC_ID to WHERE clause
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database') AND FTS_DOC_ID > 2;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Still no handler accesses when ordering by MATCH expression
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization is disabled when ordering on FTS_DOC_ID
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY 1 DESC;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization also work with several MATCH expressions
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+--echo Optimization does not apply if sorting on a different MATCH expressions
+--echo from the one used to access the 
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score1,
+       MATCH(title, text) AGAINST ('mysql') AS score2 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score2 DESC;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+FLUSH STATUS;
+
+--echo Optimization does not apply for GROUP BY
+SELECT FTS_DOC_ID, MATCH(title, text) AGAINST ('database') AS score
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+GROUP BY score;
+
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+#
+#  Putting all three optimizations together
+#
+--echo No sorting and no table access with LIMIT clause and only information
+--echo from FTS result
+FLUSH STATUS;
+
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+#
+# Count optimization
+#
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo If count optimization applies, EXPLAIN shows 
+--echo "Select tables optimized away."
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+--echo Verify that there was no table access
+SHOW STATUS LIKE 'Handler_read%';
+
+let $query = 
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo Optimization applies also to COUNT(expr) as long as expr is not nullable
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT count(*)
+FROM wp, t1 
+WHERE MATCH(title, text) AGAINST ('database');
+
+--echo Optimization does not apply if not a single table query.
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+
+--echo Optimization does not apply if MATCH is part of an expression
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT COUNT(title) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE) > 0;
+
+--echo Optimization does not apply if MATCH is part of an expression
+eval EXPLAIN $query;
+eval $query;
+
+let $query = 
+SELECT COUNT(dummy) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+
+--echo Optimization does not apply if COUNT expression is nullable
+eval EXPLAIN $query;
+eval $query;
+
+#
+#  Verify that the queries optimized for InnoDB works with QUERY EXPANSION
+#
+
+# Query will also avoid sorting when query expansion is used
+FLUSH STATUS;
+SELECT title, 
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+       MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' WITH QUERY EXPANSION);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+#
+#  Verify that the queries optimized for InnoDB works with BOOLEAN MODE
+#
+
+# Query will also avoid sorting when Boolean mode is used
+FLUSH STATUS;
+SELECT title, 
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('+MySQL -database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('+MySQL -database' IN BOOLEAN MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+
+#
+#  Verify that the queries optimized for InnoDB works with 
+#  BOOLEAN proximity search
+#
+
+# Query will also avoid sorting when Boolean mode is used
+FLUSH STATUS;
+SELECT title, 
+       MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE)
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title,
+       MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 1;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, 
+       MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@10');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid,
+       MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE) AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 1;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+#
+# Check that nothing goes wrong when combining different modes
+#
+SELECT title, 
+       MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+
+SELECT title, 
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('MySQL database' WITH QUERY EXPANSION)
+ORDER BY score DESC;
+
+SELECT title, 
+       MATCH(title, text) AGAINST ('+MySQL -database' IN BOOLEAN MODE) AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('"MySQL database"@10' IN BOOLEAN MODE)
+ORDER BY score DESC;
+
+
+#
+#  Verify that the queries optimized for InnoDB still works with MyISAM
+#
+ALTER TABLE wp ENGINE=myisam;
+
+# Check avoid sorting query
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database')
+ORDER BY score DESC;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check ORDER BY/LIMIT query with no WHERE clause
+FLUSH STATUS;
+SELECT title, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check query where FTS result is "covering"
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+WHERE MATCH(title, text) AGAINST ('database');
+SHOW SESSION STATUS LIKE 'Handler_read%';
+
+# Check the combination of all three
+FLUSH STATUS;
+SELECT FTS_DOC_ID docid, MATCH(title, text) AGAINST ('database') AS score 
+FROM wp 
+ORDER BY score DESC LIMIT 2;
+SHOW STATUS LIKE 'Handler_read%';
+SHOW SESSION STATUS LIKE 'Sort%';
+
+# Check the count optimization
+let $query = 
+SELECT COUNT(*) 
+FROM wp 
+WHERE MATCH(title,text) AGAINST ('database' IN NATURAL LANGUAGE MODE);
+eval EXPLAIN $query;
+FLUSH STATUS;
+eval $query;
+SHOW STATUS LIKE 'Handler_read%';
+
+
+DROP TABLE wp, t1;
+
+

=== modified file 'mysql-test/suite/parts/t/partition_float_myisam.test'
--- a/mysql-test/suite/parts/t/partition_float_myisam.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/parts/t/partition_float_myisam.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 ################################################################################
 # t/partition_float_myisam.test                                                #
 #                                                                              #

=== modified file 'mysql-test/suite/perfschema/r/digest_table_full.result'
--- a/mysql-test/suite/perfschema/r/digest_table_full.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/perfschema/r/digest_table_full.result	revid:mikael.ronstrom@stripped
@@ -86,7 +86,7 @@ SELECT DIGEST, DIGEST_TEXT, COUNT_STAR, 
 SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
 DIGEST	DIGEST_TEXT	COUNT_STAR	SUM_ROWS_AFFECTED	SUM_WARNINGS	SUM_ERRORS
 NULL	NULL	38	30	1	2
-a938a1f31256fd2ec1bc3cda9b7a8519	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  	1	0	0	0
+70ecd9c9e447fe343322f29d53fe454f	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  	1	0	0	0
 SHOW VARIABLES LIKE "performance_schema_digests_size";
 Variable_name	Value
 performance_schema_digests_size	2

=== modified file 'mysql-test/suite/perfschema/r/statement_digest.result'
--- a/mysql-test/suite/perfschema/r/statement_digest.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/perfschema/r/statement_digest.result	revid:mikael.ronstrom@stripped
@@ -85,30 +85,30 @@ Warning	1265	Data truncated for column '
 SELECT DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
 SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
 DIGEST	DIGEST_TEXT	COUNT_STAR	SUM_ROWS_AFFECTED	SUM_WARNINGS	SUM_ERRORS
-a938a1f31256fd2ec1bc3cda9b7a8519	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  	1	0	0	0
-e7f8dc15f1156f57978116e457cc7488	SELECT ? FROM t1  	1	0	0	0
-29c3f8abab7962fe1f664a51fca9effc	SELECT ? FROM `t1`  	1	0	0	0
-ca50ee9fccc00a2c95e44ef3feea866a	SELECT ?, ... FROM t1  	2	0	0	0
-3b8d5477aa795a19c9e9183e4ad04e6b	SELECT ? FROM t2  	1	0	0	0
-8067bb511c3620aac5388c5674b328a0	SELECT ?, ... FROM t2  	2	0	0	0
-a58cc957ffdd32c2cffeffa65b6c9324	INSERT INTO t1 VALUES (?)  	1	1	0	0
-439869529508fe62007c6f97890a43ae	INSERT INTO t2 VALUES (?)  	1	1	0	0
-a9f32e4c511753d7317a014630050274	INSERT INTO t3 VALUES (...)  	4	4	0	0
-55351862b4cc299bfd9958920936dc34	INSERT INTO t4 VALUES (...)  	1	1	0	0
-976ba1912e3bf2d29fb0eefed75c9f89	INSERT INTO t5 VALUES (...)  	1	1	0	0
-de71aea3aaab6826e52c690197c28a42	INSERT INTO t1 VALUES (?) /* , ... */  	2	7	0	0
-51a351f92e6fd34cef43add51eef65fe	INSERT INTO t3 VALUES (...) /* , ... */  	1	3	0	0
-85ec05195fd87103b8e751c559abe9d4	INSERT INTO t5 VALUES (...) /* , ... */  	1	3	0	0
-c72a99dab537b00f123fcb1c87c74115	INSERT INTO t1 VALUES ( NULL )  	1	1	0	0
-799c87eedbd26b27146c7f01cf275a9a	INSERT INTO t6 VALUES (...)  	5	5	0	0
-e50a377fe96a344be8496148bcd60407	SELECT ? + ?  	3	0	0	0
-08bcb063d9c3c6ac9e150ec7c727eea7	SELECT ?  	1	0	0	0
-30046d97cfdc44c95bdaa7f3987d0a20	CREATE SCHEMA statements_digest_temp  	2	2	0	0
-8e40e6461f3ab4454ddb8f21b5cda3ba	DROP SCHEMA statements_digest_temp  	2	0	0	0
-2fb7a70cbcfbc2e1900375406b9e4fca	SELECT ? FROM t11  	1	0	0	1
-1cfadd74d3e5f992ae8ae694c86fc9ec	CREATE TABLE t11 ( c CHARACTER (?) )  	2	0	0	1
-367c6d0eb00c1a6e553deddc195a6061	INSERT INTO t11 VALUES (?)  	1	1	1	0
-756f25d54bb3daf92c54903b6584586c	SHOW WARNINGS  	1	0	0	0
+70ecd9c9e447fe343322f29d53fe454f	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  	1	0	0	0
+5d495852490f30472a5e451973f373c1	SELECT ? FROM t1  	1	0	0	0
+cb0826a38cf1d9e8c77eba5d7d6fb875	SELECT ? FROM `t1`  	1	0	0	0
+e4473381b53762af1eb5c12614374f7c	SELECT ?, ... FROM t1  	2	0	0	0
+ceee8936a87a0f5175734f5f10e7057c	SELECT ? FROM t2  	1	0	0	0
+a7830790d49ef281f87e24d71515aab4	SELECT ?, ... FROM t2  	2	0	0	0
+80aecfb2707101fc47d6e7fb2de6832f	INSERT INTO t1 VALUES (?)  	1	1	0	0
+3dd3e7bef876fec44fb2a896978ecde9	INSERT INTO t2 VALUES (?)  	1	1	0	0
+9fed5893f1e2c272b47f1790acf6d3a1	INSERT INTO t3 VALUES (...)  	4	4	0	0
+3d4ff83706c001cbc58741e4583d7b0f	INSERT INTO t4 VALUES (...)  	1	1	0	0
+d5c4d8be8f940d3eba1c0c5ae1dc512d	INSERT INTO t5 VALUES (...)  	1	1	0	0
+672215bee7346eba333bf643cfd85563	INSERT INTO t1 VALUES (?) /* , ... */  	2	7	0	0
+af4f2ef1970475437400e5742e5ec4ed	INSERT INTO t3 VALUES (...) /* , ... */  	1	3	0	0
+c8c6cea379a59bd54868aa6a02988de5	INSERT INTO t5 VALUES (...) /* , ... */  	1	3	0	0
+ae280d97097bae4d293c1a986ed28418	INSERT INTO t1 VALUES ( NULL )  	1	1	0	0
+ebbe3cb851969592e6fc25921fa7b53b	INSERT INTO t6 VALUES (...)  	5	5	0	0
+7f07c2f5d5254f45a3365d0a98015862	SELECT ? + ?  	3	0	0	0
+70d3e4d0f131fc5324edc990fbed3bd8	SELECT ?  	1	0	0	0
+fb40aece1f68b5c3fbaf220bc21ad353	CREATE SCHEMA statements_digest_temp  	2	2	0	0
+622ef9323ed99ee165d79477219a693b	DROP SCHEMA statements_digest_temp  	2	0	0	0
+cc0ef8eb2f92a6ddf2e93fef99044c92	SELECT ? FROM t11  	1	0	0	1
+48730227c5e53dfb6ee765c251930bc6	CREATE TABLE t11 ( c CHARACTER (?) )  	2	0	0	1
+5426115bb326553db15da35d0c520b2b	INSERT INTO t11 VALUES (?)  	1	1	1	0
+9e23973ea6beef1737da28d6372eebdc	SHOW WARNINGS  	1	0	0	0
 ####################################
 # CLEANUP
 ####################################

=== modified file 'mysql-test/suite/perfschema/r/statement_digest_consumers.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result	revid:mikael.ronstrom@stripped
@@ -98,30 +98,30 @@ Warning	1265	Data truncated for column '
 ####################################
 SELECT digest, digest_text, count_star FROM performance_schema.events_statements_summary_by_digest;
 digest	digest_text	count_star
-a938a1f31256fd2ec1bc3cda9b7a8519	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  	1
-e7f8dc15f1156f57978116e457cc7488	SELECT ? FROM t1  	1
-29c3f8abab7962fe1f664a51fca9effc	SELECT ? FROM `t1`  	1
-ca50ee9fccc00a2c95e44ef3feea866a	SELECT ?, ... FROM t1  	2
-3b8d5477aa795a19c9e9183e4ad04e6b	SELECT ? FROM t2  	1
-8067bb511c3620aac5388c5674b328a0	SELECT ?, ... FROM t2  	2
-a58cc957ffdd32c2cffeffa65b6c9324	INSERT INTO t1 VALUES (?)  	1
-439869529508fe62007c6f97890a43ae	INSERT INTO t2 VALUES (?)  	1
-a9f32e4c511753d7317a014630050274	INSERT INTO t3 VALUES (...)  	4
-55351862b4cc299bfd9958920936dc34	INSERT INTO t4 VALUES (...)  	1
-976ba1912e3bf2d29fb0eefed75c9f89	INSERT INTO t5 VALUES (...)  	1
-de71aea3aaab6826e52c690197c28a42	INSERT INTO t1 VALUES (?) /* , ... */  	2
-51a351f92e6fd34cef43add51eef65fe	INSERT INTO t3 VALUES (...) /* , ... */  	1
-85ec05195fd87103b8e751c559abe9d4	INSERT INTO t5 VALUES (...) /* , ... */  	1
-c72a99dab537b00f123fcb1c87c74115	INSERT INTO t1 VALUES ( NULL )  	1
-799c87eedbd26b27146c7f01cf275a9a	INSERT INTO t6 VALUES (...)  	5
-e50a377fe96a344be8496148bcd60407	SELECT ? + ?  	3
-08bcb063d9c3c6ac9e150ec7c727eea7	SELECT ?  	1
-30046d97cfdc44c95bdaa7f3987d0a20	CREATE SCHEMA statements_digest_temp  	2
-8e40e6461f3ab4454ddb8f21b5cda3ba	DROP SCHEMA statements_digest_temp  	2
-2fb7a70cbcfbc2e1900375406b9e4fca	SELECT ? FROM t11  	1
-1cfadd74d3e5f992ae8ae694c86fc9ec	CREATE TABLE t11 ( c CHARACTER (?) )  	2
-367c6d0eb00c1a6e553deddc195a6061	INSERT INTO t11 VALUES (?)  	1
-756f25d54bb3daf92c54903b6584586c	SHOW WARNINGS  	1
+70ecd9c9e447fe343322f29d53fe454f	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  	1
+5d495852490f30472a5e451973f373c1	SELECT ? FROM t1  	1
+cb0826a38cf1d9e8c77eba5d7d6fb875	SELECT ? FROM `t1`  	1
+e4473381b53762af1eb5c12614374f7c	SELECT ?, ... FROM t1  	2
+ceee8936a87a0f5175734f5f10e7057c	SELECT ? FROM t2  	1
+a7830790d49ef281f87e24d71515aab4	SELECT ?, ... FROM t2  	2
+80aecfb2707101fc47d6e7fb2de6832f	INSERT INTO t1 VALUES (?)  	1
+3dd3e7bef876fec44fb2a896978ecde9	INSERT INTO t2 VALUES (?)  	1
+9fed5893f1e2c272b47f1790acf6d3a1	INSERT INTO t3 VALUES (...)  	4
+3d4ff83706c001cbc58741e4583d7b0f	INSERT INTO t4 VALUES (...)  	1
+d5c4d8be8f940d3eba1c0c5ae1dc512d	INSERT INTO t5 VALUES (...)  	1
+672215bee7346eba333bf643cfd85563	INSERT INTO t1 VALUES (?) /* , ... */  	2
+af4f2ef1970475437400e5742e5ec4ed	INSERT INTO t3 VALUES (...) /* , ... */  	1
+c8c6cea379a59bd54868aa6a02988de5	INSERT INTO t5 VALUES (...) /* , ... */  	1
+ae280d97097bae4d293c1a986ed28418	INSERT INTO t1 VALUES ( NULL )  	1
+ebbe3cb851969592e6fc25921fa7b53b	INSERT INTO t6 VALUES (...)  	5
+7f07c2f5d5254f45a3365d0a98015862	SELECT ? + ?  	3
+70d3e4d0f131fc5324edc990fbed3bd8	SELECT ?  	1
+fb40aece1f68b5c3fbaf220bc21ad353	CREATE SCHEMA statements_digest_temp  	2
+622ef9323ed99ee165d79477219a693b	DROP SCHEMA statements_digest_temp  	2
+cc0ef8eb2f92a6ddf2e93fef99044c92	SELECT ? FROM t11  	1
+48730227c5e53dfb6ee765c251930bc6	CREATE TABLE t11 ( c CHARACTER (?) )  	2
+5426115bb326553db15da35d0c520b2b	INSERT INTO t11 VALUES (?)  	1
+9e23973ea6beef1737da28d6372eebdc	SHOW WARNINGS  	1
 SELECT digest, digest_text FROM performance_schema.events_statements_current;
 digest	digest_text
 ####################################

=== modified file 'mysql-test/suite/perfschema/r/statement_digest_long_query.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_long_query.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/perfschema/r/statement_digest_long_query.result	revid:mikael.ronstrom@stripped
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
 ####################################
 SELECT digest, digest_text, count_star FROM events_statements_summary_by_digest;
 digest	digest_text	count_star
-04926b9f44daeaf022a8c35932cb6e77	TRUNCATE TABLE events_statements_summary_by_digest  	1
-431eaac14d752b504e8f6c0bb5ad3afe	SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + !
 ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ...	1
+68753a29989b66b65ff59b8c601dc6a7	TRUNCATE TABLE events_statements_summary_by_digest  	1
+e7705259dae33df48399104e0222ad91	SELECT ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + !
 ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ...	1

=== modified file 'mysql-test/suite/rpl/r/rpl_binlog_index.result'
--- a/mysql-test/suite/rpl/r/rpl_binlog_index.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/r/rpl_binlog_index.result	revid:mikael.ronstrom@stripped
@@ -6,20 +6,22 @@ Note	####	Storing MySQL user name or pas
 CREATE TABLE t1 (a INT);
 FLUSH BINARY LOGS;
 INSERT INTO t1 VALUES (1);
+include/stop_slave.inc
 # Shutdown master
 include/rpl_stop_server.inc [server_number=1]
 # Move the master binlog files and the index file to a new place
 # Restart master with log-bin option set to the new path
 # Master has restarted successfully
+include/start_slave.inc
 # Create the master-bin.index file with the old format
+include/stop_slave.inc
 # Shutdown master
 include/rpl_stop_server.inc [server_number=1]
 # Move back the master binlog files
 # Remove the unneeded master-bin.index file
 # Restart master with log-bin option set to default
 # Master has restarted successfully
-# stop slave
-include/stop_slave.inc
+include/start_slave.inc
 include/rpl_stop_server.inc [server_number=2]
 # relocate  binlogs
 # relocate  relay logs

=== modified file 'mysql-test/suite/rpl/r/rpl_corruption.result'
--- a/mysql-test/suite/rpl/r/rpl_corruption.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/r/rpl_corruption.result	revid:mikael.ronstrom@stripped
@@ -26,13 +26,13 @@ include/wait_for_slave_io_error.inc [err
 SET GLOBAL master_verify_checksum=0;
 SET GLOBAL debug="d,corrupt_read_log_event";
 START SLAVE IO_THREAD;
-include/wait_for_slave_io_error.inc [errno=1595,1741]
+include/wait_for_slave_io_error.inc [errno=1595,1742]
 SET GLOBAL debug="";
 SET GLOBAL master_verify_checksum=1;
 # 5. Slave. Corruption in network
 SET GLOBAL debug="d,corrupt_queue_event";
 START SLAVE IO_THREAD;
-include/wait_for_slave_io_error.inc [errno=1595,1741]
+include/wait_for_slave_io_error.inc [errno=1595,1742]
 # 6. Slave. Corruption in relay log
 SET GLOBAL debug="d,corrupt_read_log_event_char";
 START SLAVE SQL_THREAD;

=== modified file 'mysql-test/suite/rpl/r/rpl_gtid_mode.result'
--- a/mysql-test/suite/rpl/r/rpl_gtid_mode.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/r/rpl_gtid_mode.result	revid:mikael.ronstrom@stripped
@@ -3,6 +3,9 @@ include/master-slave.inc
 call mtr.add_suppression("Slave I/O: The slave IO thread stops because the master has GTID_MODE");
 call mtr.add_suppression("Error reading packet from server: Lost connection to MySQL");
 call mtr.add_suppression("Aborting");
+call mtr.add_suppression(".* CHANGE MASTER TO MASTER_AUTO_POSITION = 1 can only be executed when GTID_MODE = ON.");
+call mtr.add_suppression(".* Found a Gtid_log_event or Previous_gtids_log_event when GTID_MODE = OFF.");
+call mtr.add_suppression(".* Failed to initialize the master info structure");
 include/stop_slave.inc
 ==== Master and slave have GTID_MODE = OFF ====
 ---- Default value for GTID_MODE ----
@@ -93,9 +96,11 @@ INSERT INTO t1 VALUES (3);
 include/stop_slave.inc
 ==== Checks performed at server start when GTID_MODE = OFF ====
 include/rpl_stop_server.inc [server_number=2]
----- Fail to start with GTID_MODE = OFF and GTIDs in binlog/relay log ----
-include/assert_command_output.inc
-include/rpl_start_server.inc [server_number=2 gtids=on]
+---- Fail to start replication with GTID_MODE = OFF and GTIDs in binlog/relay log ----
+include/rpl_start_server.inc [server_number=2]
+START SLAVE;
+ERROR HY000: CHANGE MASTER TO MASTER_AUTO_POSITION = 1 can only be executed when GTID_MODE = ON.
+include/rpl_restart_server.inc [server_number=2 gtids=on]
 RESET SLAVE;
 RESET MASTER;
 ==== Master has GTID_MODE = ON, slave has GTID_MODE = OFF ====

=== modified file 'mysql-test/suite/rpl/r/rpl_loaddata.result'
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result	revid:mikael.ronstrom@stripped
@@ -82,7 +82,7 @@ load data infile '../../std_data/rpl_loa
 terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
 '\n##\n' starting by '>' ignore 1 lines;
 ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
-include/wait_for_slave_sql_error.inc [errno=0,1754]
+include/wait_for_slave_sql_error.inc [errno=0,1755]
 drop table t1, t2;
 drop table t1, t2;
 CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;

=== modified file 'mysql-test/suite/rpl/r/rpl_parallel_start_stop.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result	revid:mikael.ronstrom@stripped
@@ -90,10 +90,6 @@ start slave until sql_after_mts_gaps mas
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'master_log_pos=0' at line 1
 start slave until sql_after_mts_gaps SQL_BEFORE_GTIDS='dummy';
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SQL_BEFORE_GTIDS='dummy'' at line 1
-start slave until sql_after_mts_gaps;
-show warnings;
-Level	Code	Message
-Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SQL_BEFORE_GTIDS='dummy'' at line 1
 call mtr.add_suppression('Slave SQL: Could not execute Update_rows event on table d1.t1; Deadlock found when trying to get lock');
 include/start_slave.inc
 create database d1;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result	revid:mikael.ronstrom@stripped
@@ -98,7 +98,7 @@ load data CONCURRENT infile '../../std_d
 terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
 '\n##\n' starting by '>' ignore 1 lines;
 ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
-include/wait_for_slave_sql_error.inc [errno=0,1754]
+include/wait_for_slave_sql_error.inc [errno=0,1755]
 drop table t1, t2;
 drop table t1, t2;
 CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;

=== modified file 'mysql-test/suite/rpl/t/rpl_binlog_index.test'
--- a/mysql-test/suite/rpl/t/rpl_binlog_index.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_binlog_index.test	revid:mikael.ronstrom@stripped
@@ -43,7 +43,7 @@ FLUSH BINARY LOGS;
 INSERT INTO t1 VALUES (1);
 
 sync_slave_with_master;
-
+--source include/stop_slave.inc
 #
 # Test on master
 #
@@ -64,7 +64,9 @@ source include/rpl_start_server.inc;
 --let $include_silent=0
 
 --echo # Master has restarted successfully
-
+--connection slave
+--source include/start_slave.inc
+--connection master
 #
 # Test master can handle old format with directory path in index file
 #
@@ -85,6 +87,9 @@ if (!$is_windows)
 --disable_query_log
 source include/write_var_to_file.inc;
 --enable_query_log
+--sync_slave_with_master
+--source include/stop_slave.inc
+--connection master
 
 --echo # Shutdown master
 --let $rpl_server_number=1
@@ -106,9 +111,10 @@ source include/rpl_start_server.inc;
 
 --echo # Master has restarted successfully
 
-connection slave;
---echo # stop slave
---source include/stop_slave.inc
+--connection slave
+--source include/start_slave.inc
+--sync_with_master
+--connection master
 --let $rpl_server_number= 2
 --source include/rpl_stop_server.inc
 

=== modified file 'mysql-test/suite/rpl/t/rpl_corruption.test'
--- a/mysql-test/suite/rpl/t/rpl_corruption.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_corruption.test	revid:mikael.ronstrom@stripped
@@ -91,7 +91,7 @@ SET GLOBAL master_verify_checksum=0;
 SET GLOBAL debug="d,corrupt_read_log_event";
 --connection slave
 START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1741; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
+let $slave_io_errno= 1595,1742; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
 --source include/wait_for_slave_io_error.inc
 --connection master
 SET GLOBAL debug="";
@@ -102,7 +102,7 @@ SET GLOBAL master_verify_checksum=1;
 --connection slave
 SET GLOBAL debug="d,corrupt_queue_event";
 START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1741; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
+let $slave_io_errno= 1595,1742; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
 --source include/wait_for_slave_io_error.inc
 
 # Emulate corruption in relay log

=== modified file 'mysql-test/suite/rpl/t/rpl_gtid_mode.test'
--- a/mysql-test/suite/rpl/t/rpl_gtid_mode.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_gtid_mode.test	revid:mikael.ronstrom@stripped
@@ -55,6 +55,9 @@
 call mtr.add_suppression("Slave I/O: The slave IO thread stops because the master has GTID_MODE");
 call mtr.add_suppression("Error reading packet from server: Lost connection to MySQL");
 call mtr.add_suppression("Aborting");
+call mtr.add_suppression(".* CHANGE MASTER TO MASTER_AUTO_POSITION = 1 can only be executed when GTID_MODE = ON.");
+call mtr.add_suppression(".* Found a Gtid_log_event or Previous_gtids_log_event when GTID_MODE = OFF.");
+call mtr.add_suppression(".* Failed to initialize the master info structure");
 
 --sync_slave_with_master
 --source include/stop_slave.inc
@@ -268,23 +271,18 @@ INSERT INTO t1 VALUES (3);
 
 --echo ==== Checks performed at server start when GTID_MODE = OFF ====
 
---connection master
 --let $rpl_server_number= 2
 --source include/rpl_stop_server.inc
-
---echo ---- Fail to start with GTID_MODE = OFF and GTIDs in binlog/relay log ----
-
---let $assert_regex= Found a Gtid_log_event or Previous_gtids_log_event when GTID_MODE = OFF.
---let $assert_command= $server2_cmd 2>&1
---source include/assert_command_output.inc
---error 0,1
---remove_file $datadir/master.info
---error 0,1
---remove_file $datadir/relay.info
-
+--echo ---- Fail to start replication with GTID_MODE = OFF and GTIDs in binlog/relay log ----
 --let $rpl_server_number= 2
---let $rpl_skip_start_slave= 1
+--let $rpl_start_with_gtids= 0
 --source include/rpl_start_server.inc
+--error ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON
+START SLAVE;
+--let $rpl_server_number= 2
+--let $rpl_skip_start_slave= 1
+--let $rpl_start_with_gtids= 1
+--source include/rpl_restart_server.inc
 --connection slave
 RESET SLAVE;
 RESET MASTER;

=== modified file 'mysql-test/suite/rpl/t/rpl_innodb_bug28430.test'
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 --source include/have_innodb.inc
 --source include/have_partition.inc
 --source include/have_binlog_format_mixed_or_row.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_change_master.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_parallel_change_master.test	revid:mikael.ronstrom@stripped
@@ -68,11 +68,18 @@ INSERT INTO d1.t1 VALUES (13); # to caus
 INSERT INTO d1.t1 VALUES (6);
 INSERT INTO d2.t1 VALUES (7);
 INSERT INTO d1.t1 VALUES (13);
-INSERT INTO d2.t1 VALUES (8);
+INSERT INTO d2.t1 VALUES (8);  # this worker will race over one inserting (13)
 INSERT INTO d2.t1 VALUES (9);
 
 --connection slave
-COMMIT; # worker executing (13) errors out
+# make sure workers doing d2.t1 raced the one that occupied  with d1.t1
+--let $count= 1
+--let $table= d2.t1
+--let $wait_condition= select count(*) = 1 from $table where a = 8
+--source include/wait_condition.inc
+
+# make worker executing (13) to error out
+COMMIT; 
 
 --let $slave_sql_errno= 1062
 --source include/wait_for_slave_sql_error.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_innodb.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_innodb.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_parallel_innodb.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 #
 # WL#5569 MTS
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_start_stop.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	revid:mikael.ronstrom@stripped
@@ -310,10 +310,6 @@ start slave until sql_after_mts_gaps mas
 --error 1064
 start slave until sql_after_mts_gaps SQL_BEFORE_GTIDS='dummy';
 
-# check out a "blank" run which leaves an info line into error-log
-start slave until sql_after_mts_gaps;
-
-show warnings;
 call mtr.add_suppression('Slave SQL: Could not execute Update_rows event on table d1.t1; Deadlock found when trying to get lock');
 
 # regular start now

=== modified file 'mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test'
--- a/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 #
 # Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_row_img_blobs.test'
--- a/mysql-test/suite/rpl/t/rpl_row_img_blobs.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_row_img_blobs.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 #
 # This file contains tests for WL#5096.
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_row_img_eng_full.test'
--- a/mysql-test/suite/rpl/t/rpl_row_img_eng_full.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_row_img_eng_full.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 #
 # This file contains tests for WL#5096 and bug fixes. 
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_row_img_idx_full.test'
--- a/mysql-test/suite/rpl/t/rpl_row_img_idx_full.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_row_img_idx_full.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 #
 # This file contains tests for WL#5096.
 #

=== modified file 'mysql-test/suite/rpl/t/rpl_stop_slave.test'
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 source include/master-slave.inc;
 source include/have_innodb.inc;
 source include/have_debug.inc;

=== modified file 'mysql-test/suite/rpl/t/rpl_typeconv.test'
--- a/mysql-test/suite/rpl/t/rpl_typeconv.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/suite/rpl/t/rpl_typeconv.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 --source include/have_binlog_format_row.inc
 --source include/master-slave.inc
 

=== added file 'mysql-test/t/bug12427262.test'
--- a/mysql-test/t/bug12427262.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug12427262.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,48 @@
+--echo #
+--echo # Bug#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE. 
+--echo #
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+--disable_warnings
+create database show_table_db;
+use show_table_db;
+create table t1 (c1 int);
+create table t2 (c1 int);
+create table t3 (c1 int);
+create table t4 (c1 int);
+create table t5 (c1 int);
+create table t6 (c1 int);
+create table t7 (c1 int);
+create table t8 (c1 int);
+create table t9 (c1 int);
+create table t10 (c1 int);
+--enable_warnings
+
+# Query PS to know initial read count for frm file.
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME 
+like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_before;
+
+show tables;
+
+# Query PS to know read count for frm file after above query. It should
+# not be changed as FRM file will not be opened for above query.
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME 
+like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
+
+select @count_read_after-@count_read_before;
+
+show full tables;
+
+# Query PS to know read count for frm file after above query. COUNT_READ
+# will be incremented by 1 as FRM file will be opened for above query.
+select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME 
+like "%show_table_db/%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after;
+
+select @count_read_after-@count_read_before;
+
+--disable_warnings
+drop table t1;
+drop database show_table_db;
+--enable_warnings

=== modified file 'mysql-test/t/derived.test'
--- a/mysql-test/t/derived.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/derived.test	revid:mikael.ronstrom@stripped
@@ -1317,4 +1317,15 @@ SELECT pk FROM ( SELECT col_blob, pk FRO
 EXPLAIN SELECT pk FROM ( SELECT col_blob, pk FROM t2 ) AS A NATURAL JOIN t1;
 DROP TABLE t1,t2;
 
+--echo #
+--echo # Bug #13801019 ASSERTION `0' FAILED IN CREATE_MYISAM_TMP_TABLE
+--echo #
 
+CREATE TABLE t1 (a INT, b BLOB) ENGINE=InnoDB;
+CREATE TABLE t2 (c INT);
+CREATE TABLE t3 (d INT);
+INSERT INTO t3 VALUES (0);
+
+SELECT * FROM (SELECT * FROM t1) AS a1 RIGHT JOIN t3 LEFT JOIN t2 ON d=c ON a=c;
+
+DROP TABLE t1, t2, t3;

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/disabled.def	revid:mikael.ronstrom@stripped
@@ -16,3 +16,4 @@ archive-big              : Bug#11817185 
 log_tables-big           : Bug#11756699 2010-11-15 mattiasj report already exists
 ds_mrr-big @solaris      : Hemant disabled since this leads to timeout on Solaris on slow sparc servers
 partition_locking_4	 : Bug#13924750 2012-04-04 lost connection.
+mysql_embedded_client_test	: Bug#13964673 2012-04-16 amitbha since most of the test cases are failing

=== modified file 'mysql-test/t/index_merge_innodb.test'
--- a/mysql-test/t/index_merge_innodb.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/index_merge_innodb.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 # t/index_merge_innodb.test
 #
 # Index merge tests

=== modified file 'mysql-test/t/innodb_explain_json_non_select_all.test'
--- a/mysql-test/t/innodb_explain_json_non_select_all.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/innodb_explain_json_non_select_all.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 # 
 # Run explain_non_select.inc on InnoDB with all of the so-called 6.0 features.
 #

=== modified file 'mysql-test/t/innodb_explain_non_select_all.test'
--- a/mysql-test/t/innodb_explain_non_select_all.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/innodb_explain_non_select_all.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 # 
 # Run explain_non_select.inc on InnoDB with all of the so-called 6.0 features.
 #

=== modified file 'mysql-test/t/innodb_explain_non_select_none.test'
--- a/mysql-test/t/innodb_explain_non_select_none.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/innodb_explain_non_select_none.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,5 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
 # 
 # Run explain_non_select.inc on InnoDB without any of the socalled 6.0 features.
 #

=== added file 'mysql-test/t/myisam_row_rpl-master.opt'
--- a/mysql-test/t/myisam_row_rpl-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/myisam_row_rpl-master.opt	revid:mikael.ronstrom@stripped
@@ -0,0 +1 @@
+--binlog-format=row --binlog-row-event-max-size=1024

=== added file 'mysql-test/t/myisam_row_rpl-slave.opt'
--- a/mysql-test/t/myisam_row_rpl-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/myisam_row_rpl-slave.opt	revid:mikael.ronstrom@stripped
@@ -0,0 +1 @@
+--binlog-format=row --binlog-row-event-max-size=1024

=== added file 'mysql-test/t/myisam_row_rpl.test'
--- a/mysql-test/t/myisam_row_rpl.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/myisam_row_rpl.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,67 @@
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # Bug#11940249: RBR: MYISAM TABLE CORRUPTION AFTER FIRST LARGE INSERT
+--echo #               ON SLAVE
+--echo #
+
+--echo # Must have > 100 rows in the first rpl event (to trigger bulk_insert
+--echo # optimization for insert into an empty table, by disable all non-unique
+--echo # indexes and recreate them afterwards.)
+--echo # and then it must be a second rpl event for the same insert (i.e.
+--echo # during the same lock).
+--echo # Note that --binlog-row-event-max-size=1024 is set in the .opt files
+--echo # to enforce the default size.
+
+CREATE TABLE tmp (a VARCHAR(10), b INT) ENGINE=Memory;
+INSERT INTO tmp VALUES ('aZa', 1), ('zAz', 2), ('M', 3);
+# 6 rows
+INSERT INTO tmp SELECT * FROM tmp;
+# 12 rows
+INSERT INTO tmp SELECT * FROM tmp;
+# 24
+INSERT INTO tmp SELECT * FROM tmp;
+# 48
+INSERT INTO tmp SELECT * FROM tmp;
+# 96
+INSERT INTO tmp SELECT * FROM tmp;
+# 192 rows
+INSERT INTO tmp SELECT * FROM tmp;
+
+CREATE TABLE t
+(a VARCHAR(10),
+ b INT,
+ KEY a (a))
+ENGINE = MyISAM;
+
+--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
+--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
+INSERT INTO t SELECT * FROM tmp;
+
+--sync_slave_with_master
+--connection slave
+--echo # on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+--connection master
+--echo # on master:
+--source include/show_binlog_events.inc
+
+RENAME TABLE t to t_2;
+RENAME TABLE t_2 to t;
+
+--sync_slave_with_master
+--connection slave
+--echo # on slave:
+SELECT COUNT(*) FROM t WHERE b > -1;
+CHECK TABLE t;
+REPAIR TABLE t;
+SELECT COUNT(*) FROM t WHERE b > -1;
+--let $diff_tables= master:t, slave:t
+--source include/diff_tables.inc
+
+--connection master
+DROP TABLE t, tmp;
+--sync_slave_with_master
+
+--source include/rpl_end.inc

=== modified file 'mysql-test/t/mysql_client_test_embedded.test'
--- a/mysql-test/t/mysql_client_test_embedded.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/mysql_client_test_embedded.test	revid:mikael.ronstrom@stripped
@@ -1,3 +1,6 @@
+#Want to skip this test from daily Valgrind execution
+--source include/no_valgrind_without_big.inc
+
 --source include/is_embedded.inc
 
 --echo # Run the start/stop test 17 times (* 64 = 1088 restarts)

=== added file 'mysql-test/t/mysql_embedded_client_test.test'
--- a/mysql-test/t/mysql_embedded_client_test.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/mysql_embedded_client_test.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,50 @@
+-- source include/not_embedded.inc
+
+--echo #
+--echo # Bug#13541194 : MTR TEST TO RUN EMBEDDED SERVER CLIENT TESTS IN MYSQL_CLIENT_TEST.C.
+--echo #
+
+# Stop the server
+let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
+--exec echo "wait" > $restart_file
+--shutdown_server 10
+--source include/wait_until_disconnected.inc
+--echo stopped the current server
+
+perl;
+my $cli_string = $ENV{'MYSQL_CLIENT_TEST'};
+my $filestring = 'file';
+$cli_string =~ s/mysql_client_test/mysql_client_test_embedded/;
+if ($cli_string =~ /(.+?)\s/) {
+$filestring = $1;
+}
+my $emb_cli = 0;
+if (-e $filestring){
+  open (ISLINK, ">" . $ENV{'MYSQL_TMP_DIR'} . "/embedded_cli");
+  $emb_cli = 1;
+  print ISLINK "let \$emb_client = $cli_string;\n";
+  print ISLINK "let \$emb_cli_exists = $emb_cli;\n";
+  close ISLINK;
+}
+else {
+  open (ISLINK, ">" . $ENV{'MYSQL_TMP_DIR'} . "/embedded_cli");
+  print ISLINK "let \$emb_client = $cli_string;\n";
+  close ISLINK;
+}
+
+EOF
+
+--source $MYSQL_TMP_DIR/embedded_cli
+--remove_file $MYSQL_TMP_DIR/embedded_cli
+
+if (! $emb_cli_exists){
+  --skip Test only works with embedded server
+}
+
+--exec $emb_client --silent >> $MYSQLTEST_VARDIR/log/mysql_embedded_client_test.out.log 2>&1
+
+--echo # 7. Restart the server and cleanup
+#-----------------------------------------
+--enable_reconnect
+--exec echo "restart" > $restart_file
+--source include/wait_until_connected_again.inc

=== modified file 'mysql-test/t/rewrite_general_log.test'
--- a/mysql-test/t/rewrite_general_log.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/rewrite_general_log.test	revid:mikael.ronstrom@stripped
@@ -74,6 +74,12 @@ SELECT argument FROM mysql.general_log W
 SELECT argument FROM mysql.general_log WHERE argument LIKE 'SET NAMES %';
 --echo ------ done ------ see log_tables.test for more proof! :)
 
+--echo Bug#13958454 -- show we print SET @a:=5, but SELECT (@a:=5)
+# We need the () in EXPLAIN extended, for (@e:=80)+5.
+# In SET however, they'd break syntax.
+# VIEWs do not accepted variables at this time.
+EXPLAIN EXTENDED SELECT @a=5,@b:=10,@c:=20,@d:=40+5,(@e:=80)+5;
+
 DROP TABLE test_log;
 
 --remove_file $MYSQLTEST_VARDIR/log/rewrite_general.log

=== modified file 'mysql-test/t/tablespace.test'
--- a/mysql-test/t/tablespace.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/tablespace.test	revid:mikael.ronstrom@stripped
@@ -107,10 +107,6 @@ DROP TABLE t1;
 #   k int STORAGE MEMORY COLUMN_FORMAT FIXED
 # ) STORAGE DISK TABLESPACE the_tablespacename ENGINE=MyISAM;
 #
-# NOTE! The column level properties will not yet show up
-# in SHOW CREATE TABLE of MySQL Server(although they are
-# visible in .trace file)
-#
 
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 copy_file std_data/cluster_7022_table.frm $MYSQLD_DATADIR/test/t1.frm;
@@ -121,3 +117,69 @@ SHOW CREATE TABLE t1;
 
 DROP TABLE t1;
 
+--echo #
+--echo # WL#3627 Add COLUMN_FORMAT and STORAGE for fields
+--echo #
+
+CREATE TABLE t1 (
+ a int STORAGE DISK,
+ b int STORAGE MEMORY NOT NULL,
+ c int COLUMN_FORMAT DYNAMIC,
+ d int COLUMN_FORMAT FIXED,
+ e int COLUMN_FORMAT DEFAULT,
+ f int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+ g int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+ h int STORAGE DISK COLUMN_FORMAT FIXED,
+ i int STORAGE MEMORY COLUMN_FORMAT FIXED
+);
+SHOW CREATE TABLE t1;
+
+# Add new columns with all variations of the new column
+# level attributes
+ALTER TABLE t1
+  ADD COLUMN j int STORAGE DISK,
+  ADD COLUMN k int STORAGE MEMORY NOT NULL,
+  ADD COLUMN l int COLUMN_FORMAT DYNAMIC,
+  ADD COLUMN m int COLUMN_FORMAT FIXED,
+  ADD COLUMN n int COLUMN_FORMAT DEFAULT,
+  ADD COLUMN o int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+  ADD COLUMN p int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+  ADD COLUMN q int STORAGE DISK COLUMN_FORMAT FIXED,
+  ADD COLUMN r int STORAGE MEMORY COLUMN_FORMAT FIXED;
+SHOW CREATE TABLE t1;
+
+# Use MODIFY COLUMN to "shift" all new attributes to the next column
+ALTER TABLE t1
+  MODIFY COLUMN j int STORAGE MEMORY NOT NULL,
+  MODIFY COLUMN k int COLUMN_FORMAT DYNAMIC,
+  MODIFY COLUMN l int COLUMN_FORMAT FIXED,
+  MODIFY COLUMN m int COLUMN_FORMAT DEFAULT,
+  MODIFY COLUMN n int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL,
+  MODIFY COLUMN o int STORAGE MEMORY COLUMN_FORMAT DYNAMIC,
+  MODIFY COLUMN p int STORAGE DISK COLUMN_FORMAT FIXED,
+  MODIFY COLUMN q int STORAGE MEMORY COLUMN_FORMAT FIXED,
+  MODIFY COLUMN r int STORAGE DISK;
+SHOW CREATE TABLE t1;
+
+# Check behaviour of multiple COLUMN_FORMAT and/or STORAGE definitions
+ALTER TABLE t1
+  MODIFY COLUMN h int COLUMN_FORMAT DYNAMIC COLUMN_FORMAT FIXED,
+  MODIFY COLUMN i int COLUMN_FORMAT DYNAMIC COLUMN_FORMAT DEFAULT,
+  MODIFY COLUMN j int COLUMN_FORMAT FIXED COLUMN_FORMAT DYNAMIC,
+  MODIFY COLUMN k int COLUMN_FORMAT FIXED COLUMN_FORMAT DEFAULT,
+  MODIFY COLUMN l int STORAGE DISK STORAGE MEMORY,
+  MODIFY COLUMN m int STORAGE DISK STORAGE DEFAULT,
+  MODIFY COLUMN n int STORAGE MEMORY STORAGE DISK,
+  MODIFY COLUMN o int STORAGE MEMORY STORAGE DEFAULT,
+  MODIFY COLUMN p int STORAGE DISK STORAGE MEMORY
+                      COLUMN_FORMAT FIXED COLUMN_FORMAT DYNAMIC,
+  MODIFY COLUMN q int STORAGE DISK STORAGE MEMORY STORAGE DEFAULT
+                      COLUMN_FORMAT FIXED COLUMN_FORMAT DYNAMIC COLUMN_FORMAT DEFAULT,
+  MODIFY COLUMN r int STORAGE DEFAULT STORAGE DEFAULT STORAGE MEMORY
+                      STORAGE DISK STORAGE MEMORY STORAGE DISK STORAGE DISK;
+SHOW CREATE TABLE t1;
+
+
+
+DROP TABLE t1;
+

=== modified file 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/mysql-test/t/type_temporal_fractional.test	revid:mikael.ronstrom@stripped
@@ -7665,4 +7665,12 @@ INSERT INTO t1 VALUES ('2001-01-01 01:01
 SELECT GREATEST(a,10), LEAST(a,10) FROM t1;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#13976233 ASSERTION FAILED: !CHECK_TIME_MMSSFF_RANGE(LTIME), FILE SQL_TIME.CC, LINE 304
+--echo #
+SELECT SECOND(4.99999999991e0);
+SELECT SECOND(-4.99999999991e0);
+SELECT SECOND(TRUNCATE('5',180));
+
+
 --echo # End of 5.6 tests

=== modified file 'packaging/WiX/custom_ui.wxs'
--- a/packaging/WiX/custom_ui.wxs	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/packaging/WiX/custom_ui.wxs	revid:mikael.ronstrom@stripped
@@ -2,7 +2,7 @@
          xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
 
 <!--
-   Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+   Copyright (c) 2010, 2012, 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
@@ -30,7 +30,7 @@
       <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />
       <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />
       <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
-      <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved." />
+      <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved." />
       <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
       <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
     </Dialog>

=== modified file 'sql/field.h'
--- a/sql/field.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/field.h	revid:mikael.ronstrom@stripped
@@ -1018,6 +1018,30 @@ public:
   }
 #endif
 
+  ha_storage_media field_storage_type() const
+  {
+    return (ha_storage_media)
+      ((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3);
+  }
+
+  void set_storage_type(ha_storage_media storage_type_arg)
+  {
+    DBUG_ASSERT(field_storage_type() == HA_SM_DEFAULT);
+    flags |= (storage_type_arg << FIELD_FLAGS_STORAGE_MEDIA);
+  }
+
+  column_format_type column_format() const
+  {
+    return (column_format_type)
+      ((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3);
+  }
+
+  void set_column_format(column_format_type column_format_arg)
+  {
+    DBUG_ASSERT(column_format() == COLUMN_FORMAT_TYPE_DEFAULT);
+    flags |= (column_format_arg << FIELD_FLAGS_COLUMN_FORMAT);
+  }
+
   /* Hash value */
   virtual void hash(ulong *nr, ulong *nr2);
   friend int cre_myisam(char * name, register TABLE *form, uint options,
@@ -3485,6 +3509,18 @@ public:
   {
     return (flags & (BINCMP_FLAG | BINARY_FLAG)) != 0;
   }
+
+  ha_storage_media field_storage_type() const
+  {
+    return (ha_storage_media)
+      ((flags >> FIELD_FLAGS_STORAGE_MEDIA) & 3);
+  }
+
+  column_format_type column_format() const
+  {
+    return (column_format_type)
+      ((flags >> FIELD_FLAGS_COLUMN_FORMAT) & 3);
+  }
 };
 
 

=== modified file 'sql/gen_lex_hash.cc'
--- a/sql/gen_lex_hash.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/gen_lex_hash.cc	revid:mikael.ronstrom@stripped
@@ -377,7 +377,7 @@ int main(int argc,char **argv)
   printf("/*\n\n  Do " "not " "edit " "this " "file " "directly!\n\n*/\n");
 
   puts("/*");
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   puts("*/");
 
   /* Broken up to indicate that it's not advice to you, gentle reader. */

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/ha_ndbcluster_binlog.cc	revid:mikael.ronstrom@stripped
@@ -6449,7 +6449,7 @@ ndb_binlog_thread_func(void *arg)
   pthread_detach_this_thread();
   thd->real_id= pthread_self();
   mysql_mutex_lock(&LOCK_thread_count);
-  threads.push_front(thd);
+  add_global_thread(thd);
   mysql_mutex_unlock(&LOCK_thread_count);
   thd->lex->start_transaction_opt= 0;
 

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/handler.cc	revid:mikael.ronstrom@stripped
@@ -1826,9 +1826,9 @@ bool mysql_xa_recover(THD *thd)
   XID_STATE *xs;
   DBUG_ENTER("mysql_xa_recover");
 
-  field_list.push_back(new Item_int("formatID", 0, MY_INT32_NUM_DECIMAL_DIGITS));
-  field_list.push_back(new Item_int("gtrid_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
-  field_list.push_back(new Item_int("bqual_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_int(NAME_STRING("formatID"), 0, MY_INT32_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_int(NAME_STRING("gtrid_length"), 0, MY_INT32_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_int(NAME_STRING("bqual_length"), 0, MY_INT32_NUM_DECIMAL_DIGITS));
   field_list.push_back(new Item_empty_string("data",XIDDATASIZE));
 
   if (protocol->send_result_set_metadata(&field_list,

=== modified file 'sql/handler.h'
--- a/sql/handler.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/handler.h	revid:mikael.ronstrom@stripped
@@ -189,6 +189,11 @@ enum enum_alter_inplace_result {
 */
 #define HA_READ_BEFORE_WRITE_REMOVAL  (LL(1) << 38)
 
+/*
+  Engine supports extended fulltext API
+ */
+#define HA_CAN_FULLTEXT_EXT              (LL(1) << 39)
+
 /* bits in index_flags(index_number) for what you can do with index */
 #define HA_READ_NEXT            1       /* TODO really use this flag */
 #define HA_READ_PREV            2       /* supports ::index_prev */
@@ -347,6 +352,13 @@ enum row_type { ROW_TYPE_NOT_USED=-1, RO
                 /** Unused. Reserved for future versions. */
                 ROW_TYPE_PAGE };
 
+/* Specifies data storage format for individual columns */
+enum column_format_type {
+  COLUMN_FORMAT_TYPE_DEFAULT=   0, /* Not specified (use engine default) */
+  COLUMN_FORMAT_TYPE_FIXED=     1, /* FIXED format */
+  COLUMN_FORMAT_TYPE_DYNAMIC=   2  /* DYNAMIC format */
+};
+
 enum enum_binlog_func {
   BFN_RESET_LOGS=        1,
   BFN_RESET_SLAVE=       2,
@@ -1069,6 +1081,12 @@ public:
   // Table is renamed
   static const HA_ALTER_FLAGS ALTER_RENAME               = 1L << 18;
 
+  // Change the storage type of column 
+  static const HA_ALTER_FLAGS ALTER_COLUMN_STORAGE_TYPE = 1L << 19;
+
+  // Change the column format of column
+  static const HA_ALTER_FLAGS ALTER_COLUMN_COLUMN_FORMAT = 1L << 20;
+
   /**
     Create options (like MAX_ROWS) for the new version of table.
 

=== modified file 'sql/item.cc'
--- a/sql/item.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item.cc	revid:mikael.ronstrom@stripped
@@ -958,10 +958,10 @@ bool Item::check_cols(uint c)
 }
 
 
-NameString null_name_string(NULL, 0);
+const NameString null_name_string(NULL, 0);
 
 
-void NameString::copy(const char *str, uint length, const CHARSET_INFO *cs)
+void NameString::copy(const char *str, size_t length, const CHARSET_INFO *cs)
 {
   if (!length)
   {
@@ -997,7 +997,7 @@ void NameString::copy(const char *str, u
 }
 
 
-void ItemNameString::copy(const char *str_arg, uint length_arg,
+void ItemNameString::copy(const char *str_arg, size_t length_arg,
                           const CHARSET_INFO *cs_arg,
                           bool is_autogenerated_arg)
 {
@@ -1005,7 +1005,7 @@ void ItemNameString::copy(const char *st
   copy(str_arg, length_arg, cs_arg);
   if (length_arg > length() && !is_autogenerated())
   {
-    ErrConvString tmp(str_arg, length_arg, cs_arg);
+    ErrConvString tmp(str_arg, static_cast<uint>(length_arg), cs_arg);
     if (length() == 0)
       push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
                           ER_NAME_BECOMES_EMPTY, ER(ER_NAME_BECOMES_EMPTY),
@@ -2997,20 +2997,6 @@ void Item_int::print(String *str, enum_q
 }
 
 
-Item_uint::Item_uint(const char *str_arg, uint length):
-  Item_int(str_arg, length)
-{
-  unsigned_flag= 1;
-}
-
-
-Item_uint::Item_uint(const char *str_arg, longlong i, uint length):
-  Item_int(str_arg, i, length)
-{
-  unsigned_flag= 1;
-}
-
-
 String *Item_uint::val_str(String *str)
 {
   // following assert is redundant, because fixed=1 assigned in constructor
@@ -3065,11 +3051,12 @@ Item_decimal::Item_decimal(double val, i
 }
 
 
-Item_decimal::Item_decimal(const char *str, const my_decimal *val_arg,
+Item_decimal::Item_decimal(const NameString &name_arg,
+                           const my_decimal *val_arg,
                            uint decimal_par, uint length)
 {
   my_decimal2decimal(val_arg, &decimal_value);
-  item_name.set(str);
+  item_name= name_arg;
   decimals= (uint8) decimal_par;
   max_length= length;
   fixed= 1;
@@ -3996,13 +3983,13 @@ Item_param::clone_item()
   /* see comments in the header file */
   switch (state) {
   case NULL_VALUE:
-    return new Item_null(item_name.ptr());
+    return new Item_null(item_name);
   case INT_VALUE:
     return (unsigned_flag ?
-            new Item_uint(item_name.ptr(), value.integer, max_length) :
-            new Item_int(item_name.ptr(), value.integer, max_length));
+            new Item_uint(item_name, value.integer, max_length) :
+            new Item_int(item_name, value.integer, max_length));
   case REAL_VALUE:
-    return new Item_float(item_name.ptr(), value.real, decimals, max_length);
+    return new Item_float(item_name, value.real, decimals, max_length);
   case STRING_VALUE:
   case LONG_DATA_VALUE:
     return new Item_string(item_name, str_value.c_ptr_quick(), str_value.length(),
@@ -6253,8 +6240,8 @@ Item *Item_int_with_ref::clone_item()
     parameter markers.
   */
   return (ref->unsigned_flag ?
-          new Item_uint(ref->item_name.ptr(), ref->val_int(), ref->max_length) :
-          new Item_int(ref->item_name.ptr(), ref->val_int(), ref->max_length));
+          new Item_uint(ref->item_name, ref->val_int(), ref->max_length) :
+          new Item_int(ref->item_name, ref->val_int(), ref->max_length));
 }
 
 
@@ -6265,7 +6252,7 @@ Item *Item_time_with_ref::clone_item()
     We need to evaluate the constant to make sure it works with
     parameter markers.
   */
-  return new Item_temporal(MYSQL_TYPE_TIME, ref->item_name.ptr(),
+  return new Item_temporal(MYSQL_TYPE_TIME, ref->item_name,
                            ref->val_time_temporal(), ref->max_length);
 }
 
@@ -6277,7 +6264,7 @@ Item *Item_datetime_with_ref::clone_item
     We need to evaluate the constant to make sure it works with
     parameter markers.
   */
-  return new Item_temporal(MYSQL_TYPE_DATETIME, ref->item_name.ptr(),
+  return new Item_temporal(MYSQL_TYPE_DATETIME, ref->item_name,
                            ref->val_date_temporal(), ref->max_length);
 }
 
@@ -6800,6 +6787,25 @@ Item* Item::cache_const_expr_transformer
 }
 
 
+bool Item_field::item_field_by_name_analyzer(uchar **arg)
+{
+  const char *name= reinterpret_cast<char*>(*arg);
+  
+  if (strcmp(field_name, name) == 0)
+    return true;
+  else
+    return false;
+}
+
+
+Item* Item_field::item_field_by_name_transformer(uchar *arg)
+{
+  Item *item= reinterpret_cast<Item*>(arg);
+  item->item_name= item_name;
+  return item;
+}
+
+
 bool Item_field::send(Protocol *protocol, String *buffer)
 {
   return protocol->store(result_field);
@@ -8163,8 +8169,6 @@ void resolve_const_item(THD *thd, Item *
     return;                                     // Can't be better
   Item_result res_type=item_cmp_type(comp_item->result_type(),
 				     item->result_type());
-  const char *name= item->item_name.ptr(); // Alloced by sql_alloc
-
   switch (res_type) {
   case STRING_RESULT:
   {
@@ -8172,7 +8176,7 @@ void resolve_const_item(THD *thd, Item *
     String tmp(buff,sizeof(buff),&my_charset_bin),*result;
     result=item->val_str(&tmp);
     if (item->null_value)
-      new_item= new Item_null(name);
+      new_item= new Item_null(item->item_name);
     else if (item->is_temporal())
     {
       enum_field_types type= item->field_type() == MYSQL_TYPE_TIMESTAMP ?
@@ -8193,8 +8197,8 @@ void resolve_const_item(THD *thd, Item *
     longlong result=item->val_int();
     uint length=item->max_length;
     bool null_value=item->null_value;
-    new_item= (null_value ? (Item*) new Item_null(name) :
-               (Item*) new Item_int(name, result, length));
+    new_item= (null_value ? (Item*) new Item_null(item->item_name) :
+               (Item*) new Item_int(item->item_name, result, length));
     break;
   }
   case ROW_RESULT:
@@ -8232,19 +8236,19 @@ void resolve_const_item(THD *thd, Item *
     double result= item->val_real();
     uint length=item->max_length,decimals=item->decimals;
     bool null_value=item->null_value;
-    new_item= (null_value ? (Item*) new Item_null(name) : (Item*)
-               new Item_float(name, result, decimals, length));
+    new_item= (null_value ? (Item*) new Item_null(item->item_name) : (Item*)
+               new Item_float(item->item_name, result, decimals, length));
     break;
   }
   case DECIMAL_RESULT:
   {
     my_decimal decimal_value;
     my_decimal *result= item->val_decimal(&decimal_value);
-    uint length= item->max_length, decimals= item->decimals;
     bool null_value= item->null_value;
     new_item= (null_value ?
-               (Item*) new Item_null(name) :
-               (Item*) new Item_decimal(name, result, length, decimals));
+               (Item*) new Item_null(item->item_name) :
+               (Item*) new Item_decimal(item->item_name, result,
+                                        item->max_length, item->decimals));
     break;
   }
   default:

=== modified file 'sql/item.h'
--- a/sql/item.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item.h	revid:mikael.ronstrom@stripped
@@ -147,11 +147,16 @@ public:
 /**
   Storage for name strings.
   Enpowers SimpleCString with allocation routines from the sql_strmake family.
+
+  This class must stay as small as possible as we often 
+  pass it into functions using call-by-value evaluation.
+
+  Don't add new members or virual methods into this class!
 */
 class NameString: public SimpleCString
 {
 private:
-  void set_or_copy(const char *str, uint length, bool is_null_terminated)
+  void set_or_copy(const char *str, size_t length, bool is_null_terminated)
   {
     if (is_null_terminated)
       set(str, length);
@@ -160,10 +165,15 @@ private:
   }
 public:
   NameString(): SimpleCString() {}
-  NameString(const char *str, uint length):
+  /*
+    Please do NOT add constructor NameString(const char *str) !
+    It will involve hidden strlen() call, which can affect
+    performance negatively. Use NameString(str, len) instead.
+  */
+  NameString(const char *str, size_t length):
     SimpleCString(str, length) {}
   NameString(const LEX_STRING str): SimpleCString(str) {}
-  NameString(const char *str, uint length, bool is_null_terminated):
+  NameString(const char *str, size_t length, bool is_null_terminated):
     SimpleCString()
   {
     set_or_copy(str, length, is_null_terminated);
@@ -176,17 +186,17 @@ public:
   /**
     Allocate space using sql_strmake() or sql_strmake_with_convert().
   */
-  void copy(const char *str, uint length, const CHARSET_INFO *cs);
+  void copy(const char *str, size_t length, const CHARSET_INFO *cs);
   /**
     Variants for copy(), for various argument combinations.
   */
-  void copy(const char *str, uint length)
+  void copy(const char *str, size_t length)
   {
     copy(str, length, system_charset_info);
   }
   void copy(const char *str)
   {
-    copy(str, (uint) (str ? strlen(str) : 0), system_charset_info);
+    copy(str, (str ? strlen(str) : 0), system_charset_info);
   }
   void copy(const LEX_STRING lex)
   {
@@ -226,7 +236,10 @@ public:
 };
 
 
-extern NameString null_name_string;
+#define NAME_STRING(x)  NameString(C_STRING_WITH_LEN(x))
+
+
+extern const NameString null_name_string;
 
 
 /**
@@ -260,7 +273,7 @@ public:
     Copy name together with autogenerated flag.
     Produce a warning if name was cut.
   */
-  void copy(const char *str_arg, uint length_arg, const CHARSET_INFO *cs_arg,
+  void copy(const char *str_arg, size_t length_arg, const CHARSET_INFO *cs_arg,
            bool is_autogenerated_arg);
 };
 
@@ -1372,6 +1385,28 @@ public:
 
   virtual bool cache_const_expr_analyzer(uchar **arg);
   virtual Item* cache_const_expr_transformer(uchar *arg);
+
+  /**
+     Analyzer for finding Item_field by name
+     
+     @param arg  Field name to search for
+     
+     @return TRUE Go deeper in item tree.  (Found Item or not an Item_field)
+     @return FALSE Don't go deeper in item tree. (Item_field with other name)
+  */
+  virtual bool item_field_by_name_analyzer(uchar **arg) { return true; };
+
+  /**
+     Simple transformer that returns the argument if this is an Item_field.
+     The new item will inherit it's name to maintain aliases.
+
+     @param arg Item to replace Item_field
+
+     @return argument if this is an Item_field
+     @return this otherwise.
+  */
+  virtual Item* item_field_by_name_transformer(uchar *arg) { return this; };
+  
   /*
     Check if a partition function is allowed
     SYNOPSIS
@@ -2161,6 +2196,8 @@ public:
   Item *safe_charset_converter(const CHARSET_INFO *tocs);
   int fix_outer_field(THD *thd, Field **field, Item **reference);
   virtual Item *update_value_transformer(uchar *select_arg);
+  virtual bool item_field_by_name_analyzer(uchar **arg);
+  virtual Item* item_field_by_name_transformer(uchar *arg);
   virtual void print(String *str, enum_query_type query_type);
   bool is_outer_field() const
   {
@@ -2211,15 +2248,24 @@ public:
 
 class Item_null :public Item_basic_constant
 {
-public:
-  Item_null(const char *name_par=0)
+  void init()
   {
     maybe_null= null_value= TRUE;
     max_length= 0;
-    item_name.copy(name_par ? name_par : (char*) "NULL");
     fixed= 1;
     collation.set(&my_charset_bin, DERIVATION_IGNORABLE);
   }
+public:
+  Item_null()
+  {
+    init();
+    item_name= NAME_STRING("NULL");
+  }
+  Item_null(const NameString &name_par)
+  {
+    init();
+    item_name= name_par;
+  }
   enum Type type() const { return NULL_ITEM; }
   bool eq(const Item *item, bool binary_cmp) const;
   double val_real();
@@ -2242,7 +2288,7 @@ public:
   enum Item_result result_type () const { return STRING_RESULT; }
   enum_field_types field_type() const   { return MYSQL_TYPE_NULL; }
   bool basic_const_item() const { return 1; }
-  Item *clone_item() { return new Item_null(item_name.ptr()); }
+  Item *clone_item() { return new Item_null(item_name); }
   bool is_null() { return 1; }
 
   virtual inline void print(String *str, enum_query_type query_type)
@@ -2450,10 +2496,10 @@ public:
     max_length= item_arg->max_length;
     fixed= 1;
   }
-  Item_int(const char *str_arg,longlong i,uint length) :value(i)
+  Item_int(const NameString &name_arg, longlong i, uint length) :value(i)
   {
     max_length= length;
-    item_name.set(str_arg);
+    item_name= name_arg;
     fixed= 1;
   }
   Item_int(const char *str_arg, uint length);
@@ -2484,6 +2530,16 @@ public:
 };
 
 
+/**
+  Item_int with value==0 and length==1
+*/
+class Item_int_0 :public Item_int
+{
+public:
+  Item_int_0() :Item_int(NAME_STRING("0"), 0, 1) {}
+};
+
+
 /*
   Item_temporal is used to store numeric representation
   of time/date/datetime values for queries like:
@@ -2503,13 +2559,13 @@ public:
   {
     DBUG_ASSERT(is_temporal_type(field_type_arg));
   }
-  Item_temporal(enum_field_types field_type_arg,
-                const char *str_arg, longlong i, uint length): Item_int(i),
+  Item_temporal(enum_field_types field_type_arg, const NameString &name_arg,
+                longlong i, uint length): Item_int(i),
     cached_field_type(field_type_arg)
   {
     DBUG_ASSERT(is_temporal_type(field_type_arg));
     max_length= length;
-    item_name.set(str_arg);
+    item_name= name_arg;
     fixed= 1;
   }
   Item *clone_item() { return new Item_temporal(field_type(), value); }
@@ -2536,13 +2592,15 @@ public:
 class Item_uint :public Item_int
 {
 public:
-  Item_uint(const char *str_arg, uint length);
+  Item_uint(const char *str_arg, uint length)
+    :Item_int(str_arg, length) { unsigned_flag= 1; }
   Item_uint(ulonglong i) :Item_int((ulonglong) i, 10) {}
-  Item_uint(const char *str_arg, longlong i, uint length);
+  Item_uint(const NameString &name_arg, longlong i, uint length)
+    :Item_int(name_arg, i, length) { unsigned_flag= 1; }
   double val_real()
     { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
   String *val_str(String*);
-  Item *clone_item() { return new Item_uint(item_name.ptr(), value, max_length); }
+  Item *clone_item() { return new Item_uint(item_name, value, max_length); }
   int save_in_field(Field *field, bool no_conversions);
   virtual void print(String *str, enum_query_type query_type);
   Item_num *neg ();
@@ -2558,8 +2616,8 @@ protected:
   my_decimal decimal_value;
 public:
   Item_decimal(const char *str_arg, uint length, const CHARSET_INFO *charset);
-  Item_decimal(const char *str, const my_decimal *val_arg,
-               uint decimal_par, uint length);
+  Item_decimal(const NameString &name_arg,
+               const my_decimal *val_arg, uint decimal_par, uint length);
   Item_decimal(my_decimal *value_par);
   Item_decimal(longlong val, bool unsig);
   Item_decimal(double val, int precision, int scale);
@@ -2584,7 +2642,7 @@ public:
   bool basic_const_item() const { return 1; }
   Item *clone_item()
   {
-    return new Item_decimal(item_name.ptr(), &decimal_value, decimals, max_length);
+    return new Item_decimal(item_name, &decimal_value, decimals, max_length);
   }
   virtual void print(String *str, enum_query_type query_type);
   Item_num *neg()
@@ -2607,13 +2665,14 @@ public:
   double value;
   // Item_real() :value(0) {}
   Item_float(const char *str_arg, uint length);
-  Item_float(const char *str,double val_arg,uint decimal_par,uint length)
+  Item_float(const NameString name_arg,
+             double val_arg, uint decimal_par, uint length)
     :value(val_arg)
   {
-    presentation.set(str);
-    item_name.set(str);
-    decimals=(uint8) decimal_par;
-    max_length=length;
+    presentation= name_arg;
+    item_name= name_arg;
+    decimals= (uint8) decimal_par;
+    max_length= length;
     fixed= 1;
   }
   Item_float(double value_par, uint decimal_par) :value(value_par)
@@ -2650,7 +2709,7 @@ public:
   }
   bool basic_const_item() const { return 1; }
   Item *clone_item()
-  { return new Item_float(item_name.ptr(), value, decimals, max_length); }
+  { return new Item_float(item_name, value, decimals, max_length); }
   Item_num *neg() { value= -value; return this; }
   virtual void print(String *str, enum_query_type query_type);
   bool eq(const Item *, bool binary_cmp) const;
@@ -2659,11 +2718,12 @@ public:
 
 class Item_static_float_func :public Item_float
 {
-  const char *func_name;
+  const NameString func_name;
 public:
-  Item_static_float_func(const char *str, double val_arg, uint decimal_par,
-                        uint length)
-    :Item_float(NullS, val_arg, decimal_par, length), func_name(str)
+  Item_static_float_func(const NameString &name_arg,
+                         double val_arg, uint decimal_par, uint length)
+    :Item_float(null_name_string,
+                val_arg, decimal_par, length), func_name(name_arg)
   {}
 
   virtual inline void print(String *str, enum_query_type query_type)
@@ -2761,7 +2821,7 @@ public:
   bool eq(const Item *item, bool binary_cmp) const;
   Item *clone_item() 
   {
-    return new Item_string((NameString) item_name, str_value.ptr(), 
+    return new Item_string(static_cast<NameString>(item_name), str_value.ptr(), 
     			   str_value.length(), collation.collation);
   }
   Item *safe_charset_converter(const CHARSET_INFO *tocs);
@@ -2827,10 +2887,10 @@ double_from_string_with_check (const CHA
 
 class Item_static_string_func :public Item_string
 {
-  const char *func_name;
+  const NameString func_name;
 public:
-  Item_static_string_func(const char *name_par, const char *str, uint length,
-                          const CHARSET_INFO *cs,
+  Item_static_string_func(const NameString &name_par,
+                          const char *str, uint length, const CHARSET_INFO *cs,
                           Derivation dv= DERIVATION_COERCIBLE)
     :Item_string(null_name_string, str, length, cs, dv), func_name(name_par)
   {}
@@ -2863,7 +2923,7 @@ class Item_return_date_time :public Item
   enum_field_types date_time_field_type;
 public:
   Item_return_date_time(const char *name_arg, enum_field_types field_type_arg)
-    :Item_partition_func_safe_string(NameString((char *) name_arg, strlen(name_arg)),
+    :Item_partition_func_safe_string(NameString(name_arg, strlen(name_arg)),
                                      0, &my_charset_bin),
      date_time_field_type(field_type_arg)
   { decimals= 0; }
@@ -2875,7 +2935,7 @@ class Item_blob :public Item_partition_f
 {
 public:
   Item_blob(const char *name, uint length) :
-    Item_partition_func_safe_string(NameString((char *) name, strlen(name)),
+    Item_partition_func_safe_string(NameString(name, strlen(name)),
                                     length, &my_charset_bin)
   { }
   enum Type type() const { return TYPE_HOLDER; }
@@ -2894,7 +2954,7 @@ class Item_empty_string :public Item_par
 public:
   Item_empty_string(const char *header, uint length,
                     const CHARSET_INFO *cs= NULL) :
-    Item_partition_func_safe_string(NameString((char *)header, strlen(header)),
+    Item_partition_func_safe_string(NameString(header, strlen(header)),
                                     0, cs ? cs : &my_charset_utf8_general_ci)
     {
       max_length= length * collation.collation->mbmaxlen;
@@ -2909,7 +2969,8 @@ class Item_return_int :public Item_int
 public:
   Item_return_int(const char *name_arg, uint length,
 		  enum_field_types field_type_arg, longlong value= 0)
-    :Item_int(name_arg, value, length), int_field_type(field_type_arg)
+    :Item_int(NameString(name_arg, name_arg ? strlen(name_arg) : 0),
+              value, length), int_field_type(field_type_arg)
   {
     unsigned_flag=1;
   }

=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item_create.cc	revid:mikael.ronstrom@stripped
@@ -4700,7 +4700,8 @@ Create_func_pi Create_func_pi::s_singlet
 Item*
 Create_func_pi::create(THD *thd)
 {
-  return new (thd->mem_root) Item_static_float_func("pi()", M_PI, 6, 8);
+  return new (thd->mem_root) Item_static_float_func(NAME_STRING("pi()"),
+                                                    M_PI, 6, 8);
 }
 
 
@@ -4827,7 +4828,7 @@ Create_func_round::create_native(THD *th
   case 1:
   {
     Item *param_1= item_list->pop();
-    Item *i0 = new (thd->mem_root) Item_int((char*)"0", 0, 1);
+    Item *i0 = new (thd->mem_root) Item_int_0();
     func= new (thd->mem_root) Item_func_round(param_1, i0, 0);
     break;
   }
@@ -5186,7 +5187,7 @@ Item*
 Create_func_version::create(THD *thd)
 {
   thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
-  return new (thd->mem_root) Item_static_string_func("version()",
+  return new (thd->mem_root) Item_static_string_func(NAME_STRING("version()"),
                                                      server_version,
                                                      (uint) strlen(server_version),
                                                      system_charset_info,
@@ -5208,7 +5209,7 @@ Create_func_weekofyear Create_func_weeko
 Item*
 Create_func_weekofyear::create(THD *thd, Item *arg1)
 {
-  Item *i1= new (thd->mem_root) Item_int((char*) "0", 3, 1);
+  Item *i1= new (thd->mem_root) Item_int(NAME_STRING("0"), 3, 1);
   return new (thd->mem_root) Item_func_week(arg1, i1);
 }
 
@@ -5291,7 +5292,7 @@ Create_func_year_week::create_native(THD
   case 1:
   {
     Item *param_1= item_list->pop();
-    Item *i0= new (thd->mem_root) Item_int((char*) "0", 0, 1);
+    Item *i0= new (thd->mem_root) Item_int_0();
     func= new (thd->mem_root) Item_func_yearweek(param_1, i0);
     break;
   }

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item_func.cc	revid:mikael.ronstrom@stripped
@@ -5158,25 +5158,22 @@ bool Item_func_set_user_var::is_null_res
   return is_null();
 }
 
-
-void Item_func_set_user_var::print(String *str, enum_query_type query_type)
+// just the assignment, for use in "SET @a:=5" type self-prints
+void Item_func_set_user_var::print_assignment(String *str,
+                                              enum_query_type query_type)
 {
-  str->append(STRING_WITH_LEN("(@"));
+  str->append(STRING_WITH_LEN("@"));
   str->append(name);
   str->append(STRING_WITH_LEN(":="));
   args[0]->print(str, query_type);
-  str->append(')');
 }
 
-
-void Item_func_set_user_var::print_as_stmt(String *str,
-                                           enum_query_type query_type)
+// parenthesize assignment for use in "EXPLAIN EXTENDED SELECT (@e:=80)+5"
+void Item_func_set_user_var::print(String *str, enum_query_type query_type)
 {
-  str->append(STRING_WITH_LEN("set @"));
-  str->append(name);
-  str->append(STRING_WITH_LEN(":="));
-  args[0]->print(str, query_type);
-  str->append(')');
+  str->append(STRING_WITH_LEN("("));
+  print_assignment(str, query_type);
+  str->append(STRING_WITH_LEN(")"));
 }
 
 bool Item_func_set_user_var::send(Protocol *protocol, String *str_arg)
@@ -5763,7 +5760,7 @@ void Item_func_get_system_var::fix_lengt
 
 void Item_func_get_system_var::print(String *str, enum_query_type query_type)
 {
-  str->append(item_name.ptr(), item_name.length());
+  str->append(item_name);
 }
 
 
@@ -6326,9 +6323,11 @@ err:
 
 bool Item_func_match::eq(const Item *item, bool binary_cmp) const
 {
+  /* We ignore FT_SORTED flag when checking for equality since result is
+     equvialent regardless of sorting */
   if (item->type() != FUNC_ITEM ||
       ((Item_func*)item)->functype() != FT_FUNC ||
-      flags != ((Item_func_match*)item)->flags)
+      (flags | FT_SORTED) != (((Item_func_match*)item)->flags | FT_SORTED))
     return 0;
 
   Item_func_match *ifm=(Item_func_match*) item;

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item_func.h	revid:mikael.ronstrom@stripped
@@ -1667,7 +1667,7 @@ public:
   bool fix_fields(THD *thd, Item **ref);
   void fix_length_and_dec();
   virtual void print(String *str, enum_query_type query_type);
-  void print_as_stmt(String *str, enum_query_type query_type);
+  void print_assignment(String *str, enum_query_type query_type);
   const char *func_name() const { return "set_user_var"; }
   int save_in_field(Field *field, bool no_conversions,
                     bool can_use_result_field);
@@ -1855,8 +1855,91 @@ public:
 
   bool fix_index();
   void init_search(bool no_order);
+
+  /**
+     Get number of matching rows from FT handler.
+
+     @note Requires that FT handler supports the extended API
+
+     @return Number of matching rows in result 
+   */
+  ulonglong get_count()
+  {
+    DBUG_ASSERT(ft_handler);
+    DBUG_ASSERT(table->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT);
+
+    return ((FT_INFO_EXT *)ft_handler)->could_you->
+      count_matches((FT_INFO_EXT *)ft_handler);
+  }
+
+  /**
+     Check whether FT result is ordered on rank
+
+     @return true if result is ordered
+     @return false otherwise
+   */
+  bool ordered_result()
+  {
+    if (flags & FT_SORTED)
+      return true;
+
+    if ((table->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT) == 0)
+      return false;
+
+    DBUG_ASSERT(ft_handler);
+    return ((FT_INFO_EXT *)ft_handler)->could_you->get_flags() & 
+      FTS_ORDERED_RESULT;
+  }
+
+  /**
+     Check whether FT result contains the document ID
+
+     @return true if document ID is available
+     @return false otherwise
+   */
+  bool docid_in_result()
+  {
+    DBUG_ASSERT(ft_handler);
+
+    if ((table->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT) == 0)
+      return false;
+
+    return ((FT_INFO_EXT *)ft_handler)->could_you->get_flags() & 
+      FTS_DOCID_IN_RESULT;
+  }
 };
 
+/**
+   Item_func class used to fetch document ID from FTS result.  This
+   class is used to replace Item_field objects in order to fetch
+   document ID from FTS result instead of table.
+ */
+class Item_func_docid : public Item_int_func
+{
+  FT_INFO_EXT *ft_handler;
+public:
+  Item_func_docid(FT_INFO_EXT *handler) : ft_handler(handler) 
+  { 
+    max_length= 21;
+    maybe_null= false; 
+    unsigned_flag= true;
+  } 
+
+  const char *func_name() const { return "docid"; }
+
+  void update_used_tables()
+  {
+    Item_int_func::update_used_tables();
+    used_tables_cache|= RAND_TABLE_BIT;
+    const_item_cache= false;
+  }
+
+  longlong val_int() 
+  { 
+    DBUG_ASSERT(ft_handler);
+    return ft_handler->could_you->get_docid(ft_handler);
+  }
+};
 
 class Item_func_bit_xor : public Item_func_bit
 {

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item_strfunc.cc	revid:mikael.ronstrom@stripped
@@ -2081,7 +2081,7 @@ Item *Item_func_sysconst::safe_charset_c
   String tmp, cstr, *ostr= val_str(&tmp);
   if (null_value)
   {
-    Item *null_item= new Item_null((char *) fully_qualified_func_name());
+    Item *null_item= new Item_null(fully_qualified_func_name());
     null_item->collation.set (tocs);
     return null_item;
   }

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item_strfunc.h	revid:mikael.ronstrom@stripped
@@ -464,7 +464,7 @@ public:
     safe_charset_converter, return string representation of this function
     call
   */
-  virtual const char *fully_qualified_func_name() const = 0;
+  virtual const NameString fully_qualified_func_name() const = 0;
 };
 
 
@@ -479,7 +479,8 @@ public:
     maybe_null=1;
   }
   const char *func_name() const { return "database"; }
-  const char *fully_qualified_func_name() const { return "database()"; }
+  const NameString fully_qualified_func_name() const
+  { return NAME_STRING("database()"); }
 };
 
 
@@ -505,7 +506,8 @@ public:
                  (HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN);
   }
   const char *func_name() const { return "user"; }
-  const char *fully_qualified_func_name() const { return "user()"; }
+  const NameString fully_qualified_func_name() const
+  { return NAME_STRING("user()"); }
   int save_in_field(Field *field, bool no_conversions)
   {
     return save_str_value_in_field(field, &str_value);
@@ -522,7 +524,8 @@ public:
     : context(context_arg) {}
   bool fix_fields(THD *thd, Item **ref);
   const char *func_name() const { return "current_user"; }
-  const char *fully_qualified_func_name() const { return "current_user()"; }
+  const NameString fully_qualified_func_name() const
+  { return NAME_STRING("current_user()"); }
 };
 
 

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item_subselect.cc	revid:mikael.ronstrom@stripped
@@ -1495,7 +1495,7 @@ Item_in_subselect::single_value_in_to_ex
       bool tmp;
       Item *having= item, *orig_item= item;
       select_lex->item_list.empty();
-      select_lex->item_list.push_back(new Item_int("Not_used",
+      select_lex->item_list.push_back(new Item_int(NAME_STRING("Not_used"),
                                                    (longlong) 1,
                                                    MY_INT64_NUM_DECIMAL_DIGITS));
       join->ref_ptrs[0]= select_lex->item_list.head();

=== modified file 'sql/item_xmlfunc.cc'
--- a/sql/item_xmlfunc.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/item_xmlfunc.cc	revid:mikael.ronstrom@stripped
@@ -1167,7 +1167,7 @@ static Item *create_func_string_length(M
 
 static Item *create_func_round(MY_XPATH *xpath, Item **args, uint nargs)
 {
-  return new Item_func_round(args[0], new Item_int((char*)"0",0,1),0);
+  return new Item_func_round(args[0], new Item_int_0(), 0);
 }
 
 

=== modified file 'sql/lex.h'
--- a/sql/lex.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/lex.h	revid:mikael.ronstrom@stripped
@@ -117,6 +117,7 @@ static SYMBOL symbols[] = {
   { "COLLATE",		SYM(COLLATE_SYM)},
   { "COLLATION",	SYM(COLLATION_SYM)},
   { "COLUMN",		SYM(COLUMN_SYM)},
+  { "COLUMN_FORMAT",	SYM(COLUMN_FORMAT_SYM)},
   { "COLUMN_NAME",      SYM(COLUMN_NAME_SYM)},
   { "COLUMNS",		SYM(COLUMNS)},
   { "COMMENT",		SYM(COMMENT_SYM)},

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/log_event.cc	revid:mikael.ronstrom@stripped
@@ -5067,6 +5067,9 @@ Format_description_log_event(uint8 binlo
       post_header_len[HEARTBEAT_LOG_EVENT-1]= 0;
       post_header_len[IGNORABLE_LOG_EVENT-1]= IGNORABLE_HEADER_LEN;
       post_header_len[ROWS_QUERY_LOG_EVENT-1]= IGNORABLE_HEADER_LEN;
+      post_header_len[RESERVED_EVENT_NUM_1-1]= RESERVED_HEADER_LEN;
+      post_header_len[RESERVED_EVENT_NUM_2-1]= RESERVED_HEADER_LEN;
+      post_header_len[RESERVED_EVENT_NUM_3-1]= RESERVED_HEADER_LEN;
       post_header_len[GTID_LOG_EVENT-1]=
         post_header_len[ANONYMOUS_GTID_LOG_EVENT-1]=
         Gtid_log_event::POST_HEADER_LENGTH;
@@ -6917,6 +6920,12 @@ bool Xid_log_event::do_commit(THD *thd)
     error |= gtid_empty_group_log_and_cleanup(thd);
   }
 
+  /*
+    Increment the global status commit count variable
+  */
+  if (!error)
+    status_var_increment(thd->status_var.com_stat[SQLCOM_COMMIT]);
+
   return error;
 }
 
@@ -7027,12 +7036,6 @@ err:
   mysql_cond_broadcast(&rli_ptr->data_cond);
   mysql_mutex_unlock(&rli_ptr->data_lock);
 
-  /*
-    Increment the global status commit count variable
-  */
-  if (!error)
-    status_var_increment(thd->status_var.com_stat[SQLCOM_COMMIT]);
-
   return error;
 }
 

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/log_event.h	revid:mikael.ronstrom@stripped
@@ -269,6 +269,7 @@ struct sql_ex_info
 #define INCIDENT_HEADER_LEN    2
 #define HEARTBEAT_HEADER_LEN   0
 #define IGNORABLE_HEADER_LEN   0
+#define RESERVED_HEADER_LEN    0
 
 /*
    The maximum number of updated databases that a status of
@@ -691,10 +692,15 @@ enum Log_event_type
   IGNORABLE_LOG_EVENT= 28,
   ROWS_QUERY_LOG_EVENT= 29,
 
-  GTID_LOG_EVENT= 30,
-  ANONYMOUS_GTID_LOG_EVENT= 31,
+  /* Following event numbers reserved for WL#5917 */
+  RESERVED_EVENT_NUM_1 = 30,
+  RESERVED_EVENT_NUM_2 = 31,
+  RESERVED_EVENT_NUM_3 = 32,
 
-  PREVIOUS_GTIDS_LOG_EVENT= 32,
+  GTID_LOG_EVENT= 33,
+  ANONYMOUS_GTID_LOG_EVENT= 34,
+
+  PREVIOUS_GTIDS_LOG_EVENT= 35,
   /*
     Add new events here - right above this comment!
     Existing events (except ENUM_END_EVENT) should never change their numbers

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/mysqld.cc	revid:mikael.ronstrom@stripped
@@ -2368,18 +2368,12 @@ void dec_connection_count()
 }
 
 
-/*
-  Delete the THD object and decrease number of threads
-
-  SYNOPSIS
-    delete_thd()
-    thd    Thread handler
-*/
-
-void delete_thd(THD *thd)
+/**
+  Delete the THD object.
+ */
+void destroy_thd(THD *thd)
 {
-  mysql_mutex_assert_owner(&LOCK_thread_count);
-  remove_global_thread(thd);
+  mysql_mutex_assert_not_owner(&LOCK_thread_count);
   delete thd;
 }
 
@@ -5213,9 +5207,7 @@ int mysqld_main(int argc, char **argv)
     init_slave() must be called after the thread keys are created.
   */
   if (server_id != 0 && init_slave() && active_mi == NULL)
-  {
     unireg_abort(1);
-  }
 
 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
   initialize_performance_schema_acl(opt_bootstrap);
@@ -7527,7 +7519,7 @@ static void usage(void)
   if (!default_collation_name)
     default_collation_name= (char*) default_charset_info->name;
   print_version();
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2012"));
   puts("Starts the MySQL database server.\n");
   printf("Usage: %s [OPTIONS]\n", my_progname);
   if (!opt_verbose)

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/mysqld.h	revid:mikael.ronstrom@stripped
@@ -68,7 +68,7 @@ void kill_mysql(void);
 void close_connection(THD *thd, uint sql_errno= 0);
 void handle_connection_in_main_thread(THD *thd);
 void create_thread_to_handle_connection(THD *thd);
-void delete_thd(THD *thd);
+void destroy_thd(THD *thd);
 bool one_thread_per_connection_end(THD *thd, bool block_pthread);
 void kill_blocked_pthreads();
 void refresh_status(THD *thd);

=== modified file 'sql/opt_sum.cc'
--- a/sql/opt_sum.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/opt_sum.cc	revid:mikael.ronstrom@stripped
@@ -239,7 +239,7 @@ int opt_sum_query(THD *thd,
 {
   List_iterator_fast<Item> it(all_fields);
   int const_result= 1;
-  bool recalc_const_item= 0;
+  bool recalc_const_item= false;
   ulonglong count= 1;
   bool is_exact_count= TRUE, maybe_exact_count= TRUE;
   table_map removed_tables= 0, outer_tables= 0, used_tables= 0;
@@ -348,11 +348,37 @@ int opt_sum_query(THD *thd,
             }
             is_exact_count= 1;                  // count is now exact
           }
-          ((Item_sum_count*) item)->make_const((longlong) count);
-          recalc_const_item= 1;
+        }
+        /* For result count of full-text search: If
+           1. it is a single table query,
+           2. the WHERE condition is a single MATCH expresssion,
+           3. the table engine can provide the row count from FTS result, and
+           4. the expr in COUNT(expr) can not be NULL,
+           we do the full-text search now, and replace with the actual count.
+
+           Note: Item_func_match::init_search() will be called again
+                 later in the optimization phase by init_fts_funcs(),
+                 but search will still only be done once.
+        */
+        else if (tables->next_leaf == NULL &&                             // 1 
+                 conds && conds->type() == Item::FUNC_ITEM && 
+                 ((Item_func*)conds)->functype() == Item_func::FT_FUNC && // 2
+                 (tables->table->file->ha_table_flags() &
+                  HA_CAN_FULLTEXT_EXT) &&                                 // 3
+                 !((Item_sum_count*) item)->get_arg(0)->maybe_null)       // 4
+        {
+          Item_func_match* fts_item= static_cast<Item_func_match*>(conds); 
+          fts_item->init_search(true);
+          count= fts_item->get_count();
         }
         else
           const_result= 0;
+
+        if (const_result == 1) {
+          ((Item_sum_count*) item)->make_const((longlong) count);
+          recalc_const_item= true;
+        }
+          
         break;
       case Item_sum::MIN_FUNC:
       case Item_sum::MAX_FUNC:

=== modified file 'sql/rpl_info_file.cc'
--- a/sql/rpl_info_file.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/rpl_info_file.cc	revid:mikael.ronstrom@stripped
@@ -197,38 +197,29 @@ int Rpl_info_file::do_reset_info(const i
   uint i= 0;
   struct st_my_dir *dir_info= NULL;
   struct fileinfo *file_info= NULL;
-  char dir_name[FN_REFLEN];
-  size_t dir_size= 0;
-  char* file_name= NULL;
-  size_t file_size= 0;
+  const char* file_name= NULL;
+  size_t file_len= 0;
   int error= FALSE;
-  Rpl_info_file* info= NULL;
 
   DBUG_ENTER("Rpl_info_file::do_reset_info");
 
-  if (!(info= new Rpl_info_file(nparam, param_info_fname)))
+  file_name= param_info_fname;
+  file_len= strlen(file_name);
+  if (!(dir_info= my_dir(mysql_data_home, MYF(MY_DONT_SORT))))
     DBUG_RETURN(TRUE);
 
-  file_name= info->info_fname + dirname_part(dir_name, info->info_fname, &dir_size);
-  file_size= strlen(file_name);
-
-  if (!(dir_info= my_dir(dir_name, MYF(MY_DONT_SORT))))
-  {
-    delete info;
-    DBUG_RETURN(TRUE);
-  }
-
   file_info= dir_info->dir_entry;
   for (i= dir_info->number_off_files ; i-- ; file_info++)
   {
-    if (!strncmp(file_info->name, file_name, file_size) &&
-        strlen(file_info->name) == file_size &&
-        my_delete(file_info->name, MYF(MY_WME)))
-      error= TRUE;
+    if (!strncmp(file_info->name, file_name, file_len))
+    {
+      DBUG_PRINT("info", ("Deleting %s\n", file_info->name));
+      if (my_delete(file_info->name, MYF(MY_WME)))
+        error= TRUE;
+    }
   }
   my_dirend(dir_info);
  
-  delete info;
   DBUG_RETURN(error);
 }
 

=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/rpl_mi.cc	revid:mikael.ronstrom@stripped
@@ -317,7 +317,7 @@ int Master_info::init_info()
   DBUG_RETURN(0);
 
 err:
-  // todo: handler->end_info(uidx, nidx);
+  handler->end_info(uidx, nidx);
   inited= 0;
   sql_print_error("Error reading master configuration.");
   DBUG_RETURN(1);
@@ -478,7 +478,7 @@ bool Master_info::read_info(Rpl_info_han
 
   if (auto_position != 0 && gtid_mode != 3)
   {
-    sql_print_error("%s", ER(ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON));
+    my_error(ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON, MYF(0));
     DBUG_RETURN(true);
   }
 

=== modified file 'sql/scheduler.cc'
--- a/sql/scheduler.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/scheduler.cc	revid:mikael.ronstrom@stripped
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2007, 2012, 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
@@ -35,10 +35,11 @@ static bool no_threads_end(THD *thd, boo
   thd_cleanup(thd);
   dec_connection_count();
 
-  // THD is an incomplete type here, so use delete_thd() to delete it.
+  // THD is an incomplete type here, so use destroy_thd() to delete it.
   mysql_mutex_lock(&LOCK_thread_count);
-  delete_thd(thd);
+  remove_global_thread(thd);
   mysql_mutex_unlock(&LOCK_thread_count);
+  destroy_thd(thd);
 
   return 1;                                     // Abort handle_one_connection
 }

=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/set_var.cc	revid:mikael.ronstrom@stripped
@@ -747,7 +747,7 @@ int set_var_user::update(THD *thd)
 
 void set_var_user::print(THD *thd, String *str)
 {
-  user_var_item->print(str, QT_ORDINARY);
+  user_var_item->print_assignment(str, QT_ORDINARY);
 }
 
 

=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sp_head.cc	revid:mikael.ronstrom@stripped
@@ -2815,7 +2815,7 @@ sp_head::show_routine_code(THD *thd)
   if (check_show_routine_access(thd, this, &full_access) || !full_access)
     DBUG_RETURN(1);
 
-  field_list.push_back(new Item_uint("Pos", 0, 9));
+  field_list.push_back(new Item_uint(NAME_STRING("Pos"), 0, 9));
   // 1024 is for not to confuse old clients
   field_list.push_back(new Item_empty_string("Instruction",
                                              max(buffer.length(), 1024U)));

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_base.cc	revid:mikael.ronstrom@stripped
@@ -192,7 +192,9 @@ mysql_mutex_t LOCK_open;
 
 #ifdef HAVE_PSI_INTERFACE
 static PSI_mutex_key key_LOCK_open;
+static PSI_mutex_key key_LOCK_table_cache;
 static PSI_mutex_info all_tdc_mutexes[]= {
+  { &key_LOCK_table_cache, "LOCK_table_cache", 0},
   { &key_LOCK_open, "LOCK_open", PSI_FLAG_GLOBAL }
 };
 
@@ -225,7 +227,6 @@ static void modify_slave_open_temp_table
   }
 }
 
-/* RONM TODO: Add handling of performance schema for new mutexes */
 Table_cache table_cache[64];
 
 Table_cache*
@@ -252,7 +253,7 @@ table_cache_free_entry(Table_cache_eleme
 bool Table_cache::init()
 {
   int ret_code;
-  mysql_mutex_init(NULL, &lock, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_LOCK_table_cache, &lock, MY_MUTEX_INIT_FAST);
   unused_tables= NULL;
   table_count= 0;
 
@@ -276,7 +277,7 @@ void Table_cache::destroy()
 
 uint cached_open_tables(void)
 {
-  uint result;
+  uint result= 0;
   uint i;
   
   for (i= 0; i < table_cache_instances; i++)
@@ -1233,6 +1234,7 @@ bool close_cached_tables(THD *thd, TABLE
   bool found= TRUE;
   struct timespec abstime;
   uint i;
+  uint free_cache_entries= 0;
   DBUG_ENTER("close_cached_tables");
   DBUG_ASSERT(thd || (!wait_for_refresh && !tables));
 
@@ -1261,7 +1263,10 @@ bool close_cached_tables(THD *thd, TABLE
     {
       Table_cache *tc= &table_cache[i];
       while (tc->unused_tables)
+      {
         free_cache_entry(tc, tc->unused_tables);
+        free_cache_entries++;
+      }
     }
     /* Free table shares which were not freed implicitly by loop above. */
     while (oldest_unused_share->next)
@@ -1289,6 +1294,7 @@ bool close_cached_tables(THD *thd, TABLE
 
   mysql_mutex_unlock(&LOCK_open);
   unlock_all_table_caches();
+  thd->status_var.table_open_cache_overflows+= free_cache_entries;
 
   if (!wait_for_refresh)
     DBUG_RETURN(result);
@@ -1797,6 +1803,7 @@ bool close_thread_table(THD *thd, TABLE 
   Table_cache *tc;
   bool found_old_table= 0;
   TABLE *table= *table_ptr;
+  uint free_cache_entries= 0;
   DBUG_ENTER("close_thread_table");
   DBUG_ASSERT(table->key_read == 0);
   DBUG_ASSERT(!table->file || table->file->inited == handler::NONE);
@@ -1837,6 +1844,7 @@ bool close_thread_table(THD *thd, TABLE 
     mysql_mutex_lock(&LOCK_open);
     free_cache_entry(tc, table);
     mysql_mutex_unlock(&LOCK_open);
+    free_cache_entries++;
     found_old_table= 1;
   }
   else
@@ -1852,9 +1860,11 @@ bool close_thread_table(THD *thd, TABLE 
       mysql_mutex_lock(&LOCK_open);
       free_cache_entry(tc, tc->unused_tables);
       mysql_mutex_unlock(&LOCK_open);
+      free_cache_entries++;
     }
   }
   unlock_table_cache(thd->thread_id);
+  thd->status_var.table_open_cache_overflows+= free_cache_entries;
   DBUG_RETURN(found_old_table);
 }
 
@@ -2910,6 +2920,7 @@ bool open_table(THD *thd, TABLE_LIST *ta
   uint flags= ot_ctx->get_flags();
   MDL_ticket *mdl_ticket;
   int error;
+  uint free_cache_entries= 0;
   TABLE_SHARE *share;
   my_hash_value_type hash_value;
   bool recycled_free_table;
@@ -3202,6 +3213,7 @@ retry_share:
         table_el_use_table(thd, tc, el, table);
         unlock_table_cache(thd->thread_id);
         recycled_free_table= true;
+        thd->status_var.table_open_cache_hits++;
         goto table_found;
       }
       else
@@ -3392,8 +3404,12 @@ share_found:
                                   hash_value, (uchar*) key, key_length)))
     {
       el= new Table_cache_element(share);
-      my_hash_insert(&tc->cache, (uchar*)el);
-      // RONM TODO FIXME error handling.
+      if (my_hash_insert(&tc->cache, (uchar*)el))
+      {
+        delete el;
+        unlock_table_cache(thd->thread_id);
+        goto err_lock;
+      }
     }
     /* Add table to the used tables list */
     table_el_add_used_table(thd, tc, el, table);
@@ -3406,12 +3422,15 @@ share_found:
              tc->unused_tables)
       {
         free_cache_entry(tc, tc->unused_tables);
+        free_cache_entries++;
       }
       mysql_mutex_unlock(&LOCK_open);
     }
     unlock_table_cache(thd->thread_id);
   }
   recycled_free_table= false;
+  thd->status_var.table_open_cache_misses++;
+  thd->status_var.table_open_cache_overflows+= free_cache_entries;
 
 table_found:
   /* Call rebind_psi outside of the LOCK_open critical section. */
@@ -8419,7 +8438,7 @@ int setup_wild(THD *thd, TABLE_LIST *tab
 
           Item_int do not need fix_fields() because it is basic constant.
         */
-        it.replace(new Item_int("Not_used", (longlong) 1,
+        it.replace(new Item_int(NAME_STRING("Not_used"), (longlong) 1,
                                 MY_INT64_NUM_DECIMAL_DIGITS));
       }
       else if (insert_fields(thd, ((Item_field*) item)->context,
@@ -9451,7 +9470,13 @@ void tdc_flush_unused_tables()
     mysql_mutex_lock(&table_cache[i].lock);
     mysql_mutex_lock(&LOCK_open);
     while (table_cache[i].unused_tables)
+    {
+      /**
+       * We will ignore to keep track of removed unused tables here
+       * since we don't have a THD object to report it on.
+       */
       free_cache_entry(&table_cache[i], table_cache[i].unused_tables);
+    }
     mysql_mutex_unlock(&LOCK_open);
     mysql_mutex_unlock(&table_cache[i].lock);
   }
@@ -9497,6 +9522,7 @@ void tdc_remove_table(THD *thd, enum_tdc
   TABLE *table;
   TABLE_SHARE *share;
   uint i;
+  uint free_cache_entries= 0;
 
   if (! has_lock)
   {
@@ -9561,7 +9587,10 @@ void tdc_remove_table(THD *thd, enum_tdc
 #endif
 
           while ((table= it++))
+          {
             free_cache_entry(&table_cache[i], table);
+            free_cache_entries++;
+          }
         }
       }
     }
@@ -9574,6 +9603,7 @@ void tdc_remove_table(THD *thd, enum_tdc
     mysql_mutex_unlock(&LOCK_open);
     unlock_all_table_caches();
   }
+  thd->status_var.table_open_cache_overflows+= free_cache_entries;
 }
 
 

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_class.cc	revid:mikael.ronstrom@stripped
@@ -1402,14 +1402,19 @@ void THD::cleanup(void)
 
 THD::~THD()
 {
+  mysql_mutex_assert_not_owner(&LOCK_thread_count);
   THD_CHECK_SENTRY(this);
   DBUG_ENTER("~THD()");
   DBUG_PRINT("info", ("THD dtor, this %p", this));
+
   /* Ensure that no one is using THD */
   mysql_mutex_lock(&LOCK_thd_data);
   mysys_var=0;					// Safety (shouldn't be needed)
   mysql_mutex_unlock(&LOCK_thd_data);
+
+  mysql_mutex_lock(&LOCK_status);
   add_to_status(&global_status_var, &status_var);
+  mysql_mutex_unlock(&LOCK_status);
 
   /* Close connection */
 #ifndef EMBEDDED_LIBRARY
@@ -2084,7 +2089,8 @@ int THD::send_explain_fields(select_resu
   item->maybe_null= 1;
   if (lex->describe & DESCRIBE_EXTENDED)
   {
-    field_list.push_back(item= new Item_float("filtered", 0.1234, 2, 4));
+    field_list.push_back(item= new Item_float(NAME_STRING("filtered"),
+                                              0.1234, 2, 4));
     item->maybe_null=1;
   }
   field_list.push_back(new Item_empty_string("Extra", 255, cs));

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_class.h	revid:mikael.ronstrom@stripped
@@ -869,6 +869,9 @@ typedef struct system_status_var
   ulonglong ha_external_lock_count;
   ulonglong opened_tables;
   ulonglong opened_shares;
+  ulonglong table_open_cache_hits;
+  ulonglong table_open_cache_misses;
+  ulonglong table_open_cache_overflows;
   ulonglong select_full_join_count;
   ulonglong select_full_range_join_count;
   ulonglong select_range_count;

=== modified file 'sql/sql_derived.cc'
--- a/sql/sql_derived.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_derived.cc	revid:mikael.ronstrom@stripped
@@ -338,9 +338,21 @@ bool mysql_derived_create(THD *thd, LEX 
    *) Some commands, like show table status, doesn't prepare views/derived
       tables => no need to create result table also.
    *) Table is already created.
+   *) Table is a constant one with all NULL values.
   */
-  if (!derived->uses_materialization() || !table || table->created)
+  if (!derived->uses_materialization() || !table || table->created ||
+      (derived->select_lex->join != NULL &&
+       (derived->select_lex->join->const_table_map & table->map)))
+  {
+    /*
+      At this point, JT_CONST derived tables should be null rows. Otherwise they
+      would have been materialized already.
+    */
+    DBUG_ASSERT(table == NULL || table->reginfo.join_tab == NULL ||
+                table->reginfo.join_tab->type != JT_CONST ||
+                table->null_row == 1);
     DBUG_RETURN(FALSE);
+  }
   /* create tmp table */
   select_union *result= (select_union*)unit->get_result();
 

=== modified file 'sql/sql_executor.cc'
--- a/sql/sql_executor.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_executor.cc	revid:mikael.ronstrom@stripped
@@ -3145,6 +3145,18 @@ int join_init_read_record(JOIN_TAB *tab)
   if (init_read_record(&tab->read_record, tab->join->thd, tab->table,
                        tab->select, 1, 1, FALSE))
     return 1;
+  /*
+    set keyread to TRUE if quick index is covering.
+    @todo: Call set_keyread only from access functions. Currently this is
+    also done in make_join_readinfo.
+  */
+  if (tab->select && tab->select->quick)
+  {
+    TABLE *table= tab->table;
+    if(!table->no_keyread && tab->select->quick->index != MAX_KEY //not index merge
+       && table->covering_keys.is_set(tab->select->quick->index))
+      table->set_keyread(true);
+  }
   return (*tab->read_record.read_record)(&tab->read_record);
 }
 

=== modified file 'sql/sql_optimizer.cc'
--- a/sql/sql_optimizer.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_optimizer.cc	revid:mikael.ronstrom@stripped
@@ -276,6 +276,8 @@ JOIN::optimize()
   }
 #endif
 
+  optimize_fts_limit_query();
+
   /* 
      Try to optimize count(*), min() and max() to const fields if
      there is implicit grouping (aggregate functions but no
@@ -732,7 +734,10 @@ JOIN::optimize()
 
   /* Perform FULLTEXT search before all regular searches */
   if (!(select_options & SELECT_DESCRIBE))
+  {
     init_ftfuncs(thd, select_lex, test(order));
+    optimize_fts_query();
+  }
 
   /* Create all structures needed for materialized subquery execution. */
   if (setup_subquery_materialization())
@@ -6801,7 +6806,7 @@ bool JOIN::generate_derived_keys()
 
 void JOIN::drop_unused_derived_keys()
 {
-  for (uint i= const_tables ; i < tables ; i++)
+  for (uint i= 0 ; i < tables ; i++)
   {
     JOIN_TAB *tab= join_tab + i;
     TABLE *table= tab->table;
@@ -6875,6 +6880,31 @@ bool JOIN::cache_const_exprs()
 }
 
 
+void JOIN::replace_item_field(const char* field_name, Item* new_item)
+{
+  if (conds)
+  {
+    conds= conds->compile(&Item::item_field_by_name_analyzer, 
+                          (uchar **)&field_name,
+                          &Item::item_field_by_name_transformer,
+                          (uchar *)new_item);
+    conds->update_used_tables();
+  }
+
+  List_iterator<Item> it(fields_list);
+  Item *item;
+  while ((item= it++))
+  {
+    item= item->compile(&Item::item_field_by_name_analyzer,
+                        (uchar **)&field_name,
+                        &Item::item_field_by_name_transformer,
+                        (uchar *)new_item);
+    it.replace(item);
+    item->update_used_tables();
+  }
+}
+
+
 /**
   Extract a condition that can be checked after reading given table
   
@@ -8299,7 +8329,7 @@ remove_eq_conds(THD *thd, Item *cond, It
 #endif
 	Item *new_cond;
 	if ((new_cond= new Item_func_eq(args[0],
-					new Item_int("last_insert_id()",
+					new Item_int(NAME_STRING("last_insert_id()"),
                                                      thd->read_first_successful_insert_id_in_prev_stmt(),
                                                      MY_INT64_NUM_DECIMAL_DIGITS))))
 	{
@@ -8784,6 +8814,159 @@ static void optimize_keyuse(JOIN *join, 
 }
 
 
+void JOIN::optimize_fts_query()
+{
+  if (tables > 1)
+    return;    // We only optimize single table FTS queries
+
+  JOIN_TAB * const tab= &(join_tab[0]);
+  if (tab->type != JT_FT)
+    return;    // Access is not using FTS result
+
+  if ((tab->table->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT) == 0)
+    return;    // Optimizations requires extended FTS support by table engine
+
+  Item_func_match* fts_result= static_cast<Item_func_match*>(tab->keyuse->val);
+
+  /* If we are ordering on the rank of the same result as is used for access,
+     and the table engine deliver result ordered by rank, we can drop ordering.
+   */
+  if (order != NULL 
+      && order->next == NULL &&             
+      order->direction == ORDER::ORDER_DESC && 
+      fts_result->eq(*(order->item), true))
+  {
+    Item_func_match* fts_item= 
+      static_cast<Item_func_match*>(*(order->item)); 
+
+    /* If we applied the LIMIT optimization @see optimize_fts_limit_query,
+       check that the number of matching rows is sufficient.
+       Otherwise, revert this optimization and use table scan instead.
+    */
+    if (min_ft_matches != HA_POS_ERROR && 
+        min_ft_matches > fts_item->get_count())
+    {
+      // revert to table scan, do things make_join_readinfo would have done
+      tab->type= JT_ALL;
+      tab->read_first_record= join_init_read_record;
+      tab->use_quick= QS_NONE;
+      tab->ref.key= -1;
+
+      // Reset join condition
+      tab->select->cond= NULL;
+      conds= NULL;
+
+      thd->set_status_no_index_used();
+      // make_join_readinfo only calls inc_status_select_scan()
+      // when this is not SELECT_DESCRIBE
+      DBUG_ASSERT((select_options & SELECT_DESCRIBE) == 0);
+      thd->inc_status_select_scan();
+
+      return;
+    }
+    else if (fts_item->ordered_result())
+      order= NULL;
+  }
+  
+  /* Check whether the FTS result is covering.  If only document id
+     and rank is needed, there is no need to access table rows.
+  */
+  List_iterator<Item> it(all_fields);
+  Item *item;
+  // This optimization does not work with filesort nor GROUP BY
+  bool covering= (!order && !group);
+  bool docid_found= false;
+  while (covering && (item= it++))
+  {
+    switch (item->type()) {
+    case Item::FIELD_ITEM:
+    {
+      Item_field *item_field= static_cast<Item_field*>(item);
+      if (strcmp(item_field->field_name, FTS_DOC_ID_COL_NAME) == 0)
+      {
+        docid_found= true;
+        covering= fts_result->docid_in_result();
+      }
+      else
+        covering= false;
+      break;
+    }
+    case Item::FUNC_ITEM:
+      if (static_cast<Item_func*>(item)->functype() == Item_func::FT_FUNC)
+      {
+        Item_func_match* fts_item= static_cast<Item_func_match*>(item); 
+        if (fts_item->eq(fts_result, true))
+          break;
+      }
+      // Fall-through when not an equivalent MATCH expression
+    default:
+      covering= false;
+    }
+  }
+
+  if (covering) 
+  {
+    if (docid_found)
+    {
+      replace_item_field(FTS_DOC_ID_COL_NAME, 
+                         new Item_func_docid(reinterpret_cast<FT_INFO_EXT*>
+                                             (fts_result->ft_handler)));
+    }
+    
+    // Tell storage engine that row access is not necessary
+    fts_result->table->set_keyread(true);
+    fts_result->table->covering_keys.set_bit(fts_result->key);
+  }
+}
+
+
+  /**
+     Optimize FTS queries with ORDER BY/LIMIT, but no WHERE clause.
+
+     If MATCH expression is not in WHERE clause, but in ORDER BY,
+     JT_FT access will not apply. However, if we are ordering on rank and
+     there is a limit, normally, only the top ranking rows are needed
+     returned, and one would benefit from the optimizations associated
+     with JT_FT acess (@see optimize_fts_query).  To get JT_FT access we
+     will add the MATCH expression to the WHERE clause.
+
+     @note This optimization will only be applied to single table
+           queries with no existing WHERE clause.
+     @note This transformation is not correct if number of matches 
+           is less than the number of rows requested by limit.
+           If this turns out to be the case, the transformation will
+           be reverted @see optimize_fts_query()
+   */
+void 
+JOIN::optimize_fts_limit_query()
+{
+  /* 
+     Only do this optimization if
+     1. It is a single table query
+     2. There is no WHERE condition
+     3. There is a single ORDER BY element
+     4. Ordering is descending
+     5. There is a LIMIT clause
+     6. Ordering is on a MATCH expression
+   */
+  if (tables == 1 &&                                // 1
+      conds == NULL &&                              // 2
+      order && order->next == NULL &&     // 3
+      order->direction == ORDER::ORDER_DESC && // 4
+      m_select_limit != HA_POS_ERROR)               // 5
+  {
+    DBUG_ASSERT(order->item);
+    Item* item= *order->item;
+    DBUG_ASSERT(item);
+
+    if (item->type() == Item::FUNC_ITEM &&
+        static_cast<Item_func*>(item)->functype() == Item_func::FT_FUNC)  // 6
+    {
+      conds= item;
+      min_ft_matches= m_select_limit;
+    }
+  }
+}
 
 /**
   @} (end of group Query_Optimizer)

=== modified file 'sql/sql_optimizer.h'
--- a/sql/sql_optimizer.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_optimizer.h	revid:mikael.ronstrom@stripped
@@ -105,6 +105,13 @@ public:
       - on each fetch iteration we add num_rows to fetch to fetch_limit
   */
   ha_rows  fetch_limit;
+
+  /**
+     Minimum number of matches that is needed to use JT_FT access.
+     @see optimize_fts_limit_query
+  */
+  ha_rows  min_ft_matches;
+
   /* Finally picked QEP. This is result of join optimization */
   POSITION *best_positions;
 
@@ -295,6 +302,8 @@ public:
     operator       ORDER *()       { return order; }
     operator const ORDER *() const { return order; }
 
+    ORDER* operator->() const { return order; }
+ 
     void clean() { order= NULL; src= ESC_none; flags= ESP_none; }
 
     void set_flag(Explain_sort_property flag)
@@ -409,6 +418,7 @@ public:
     all_tables= 0;
     tables= 0;
     const_tables= 0;
+    const_table_map= 0;
     join_list= 0;
     implicit_grouping= FALSE;
     sort_and_group= 0;
@@ -417,6 +427,7 @@ public:
     send_records= 0;
     found_records= 0;
     fetch_limit= HA_POS_ERROR;
+    min_ft_matches= HA_POS_ERROR;
     examined_rows= 0;
     exec_tmp_table1= 0;
     exec_tmp_table2= 0;
@@ -620,6 +631,39 @@ private:
   */
   void optimize_distinct();
 
+  /** 
+      Optimize FTS queries where JT_FT access has been selected.
+
+      The following optimization is may be applied:
+      1. Skip filesort if FTS result is ordered
+      2. Skip accessing table rows if FTS result contains necessary information
+      Also verifize that LIMIT optimization was sound.
+
+      @note Optimizations are restricted to single table queries, and the table
+            engine needs to support the extended FTS API.
+   */
+  void optimize_fts_query();
+
+
+  /**
+     Optimize FTS queries with ORDER BY/LIMIT, but no WHERE clause.
+   */
+  void optimize_fts_limit_query();
+
+  /**
+     Replace all Item_field objects with the given field name with the
+     given item in all parts of the query.
+
+     @todo So far this function only handles SELECT list and WHERE clause,
+           For more general use, ON clause, ORDER BY list, GROUP BY list and
+	   HAVING clause also needs to be handled.
+
+     @param field_name Name of the field to search for
+     @param new_item Replacement item
+  */
+  void replace_item_field(const char* field_name, Item* new_item);
+
+
   /**
     TRUE if the query contains an aggregate function but has no GROUP
     BY clause. 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_parse.cc	revid:mikael.ronstrom@stripped
@@ -801,16 +801,22 @@ end:
   net_end(&thd->net);
   thd->cleanup();
 
+  if (thd_added)
+  {
+    mysql_mutex_lock(&LOCK_thread_count);
+    remove_global_thread(thd);
+    mysql_mutex_unlock(&LOCK_thread_count);
+  }
   /*
-    Here we delete the thd while holding the LOCK_thread_count.
+    We need to delete the thd before signalling that bootstrap is done.
     The reason is that we have to call ha_close_connection(thd)
     before shutting down InnoDB (this is done by THD::~THD())
   */
+  delete thd;
+
   mysql_mutex_lock(&LOCK_thread_count);
-  if (thd_added)
-    remove_global_thread(thd);
   in_bootstrap= FALSE;
-  delete thd;
+  mysql_cond_broadcast(&COND_thread_count);
   mysql_mutex_unlock(&LOCK_thread_count);
 
 #ifndef EMBEDDED_LIBRARY
@@ -3042,7 +3048,7 @@ end_with_restore_list:
     goto error;
 #else
     {
-      if (check_global_access(thd, SUPER_ACL))
+      if (check_global_access(thd, SUPER_ACL | REPL_CLIENT_ACL))
 	goto error;
       res = show_binlogs(thd);
       break;
@@ -7621,7 +7627,7 @@ Item *negate_expression(THD *thd, Item *
       if it is not boolean function then we have to emulate value of
       not(not(a)), it will be a != 0
     */
-    return new Item_func_ne(arg, new Item_int((char*) "0", 0, 1));
+    return new Item_func_ne(arg, new Item_int_0());
   }
 
   if ((negated= expr->neg_transformer(thd)) != 0)

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_select.cc	revid:mikael.ronstrom@stripped
@@ -3974,17 +3974,12 @@ check_reverse_order:                  
       bool quick_created= 
         (select && select->quick && select->quick!=save_quick);
 
-      /* 
-         If 'best_key' has changed from  prev. 'ref_key':
-         Update strategy for using index tree reading only
-         ('Using index' in EXPLAIN)
+      /*
+        If ref_key used index tree reading only ('Using index' in EXPLAIN),
+        and best_key doesn't, then revert the decision.
       */
-      if (best_key != ref_key)
-      {
-        const bool using_index= 
-          (table->covering_keys.is_set(best_key) && !table->no_keyread);
-        table->set_keyread(using_index);
-      }
+      if(!table->covering_keys.is_set(best_key))
+        table->set_keyread(false);
       if (!quick_created)
       {
         if (select)                  // Throw any existing quick select

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_show.cc	revid:mikael.ronstrom@stripped
@@ -1543,6 +1543,34 @@ int store_create_info(THD *thd, TABLE_LI
       packet->append(STRING_WITH_LEN(" NULL"));
     }
 
+    switch(field->field_storage_type()){
+    case HA_SM_DEFAULT:
+      break;
+    case HA_SM_DISK:
+      packet->append(STRING_WITH_LEN(" /*!50606 STORAGE DISK */"));
+      break;
+    case HA_SM_MEMORY:
+      packet->append(STRING_WITH_LEN(" /*!50606 STORAGE MEMORY */"));
+      break;
+    default:
+      DBUG_ASSERT(0);
+      break;
+    }
+
+    switch(field->column_format()){
+    case COLUMN_FORMAT_TYPE_DEFAULT:
+      break;
+    case COLUMN_FORMAT_TYPE_FIXED:
+      packet->append(STRING_WITH_LEN(" /*!50606 COLUMN_FORMAT FIXED */"));
+      break;
+    case COLUMN_FORMAT_TYPE_DYNAMIC:
+      packet->append(STRING_WITH_LEN(" /*!50606 COLUMN_FORMAT DYNAMIC */"));
+      break;
+    default:
+      DBUG_ASSERT(0);
+      break;
+    }
+
     if (print_default_clause(thd, field, &def_value, true))
     {
       packet->append(STRING_WITH_LEN(" DEFAULT "));
@@ -2050,7 +2078,7 @@ void mysqld_list_processes(THD *thd,cons
   Protocol *protocol= thd->protocol;
   DBUG_ENTER("mysqld_list_processes");
 
-  field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_int(NAME_STRING("Id"), 0, MY_INT32_NUM_DECIMAL_DIGITS));
   field_list.push_back(new Item_empty_string("User",16));
   field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN));
   field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
@@ -2619,7 +2647,6 @@ void calc_sum_of_all_status(STATUS_VAR *
 {
   DBUG_ENTER("calc_sum_of_all_status");
 
-  /* Ensure that thread id not killed during loop */
   mysql_mutex_lock(&LOCK_thread_count);
 
   Thread_iterator it= global_thread_list_begin();
@@ -3463,39 +3490,44 @@ end:
 
 static int fill_schema_table_names(THD *thd, TABLE *table,
                                    LEX_STRING *db_name, LEX_STRING *table_name,
-                                   bool with_i_schema)
+                                   bool with_i_schema,
+                                   bool need_table_type)
 {
-  if (with_i_schema)
-  {
-    table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
-                           system_charset_info);
-  }
-  else
+  /* Avoid opening FRM files if table type is not needed. */
+  if (need_table_type)
   {
-    enum legacy_db_type not_used;
-    char path[FN_REFLEN + 1];
-    (void) build_table_filename(path, sizeof(path) - 1, db_name->str, 
-                                table_name->str, reg_ext, 0);
-    switch (dd_frm_type(thd, path, &not_used)) {
-    case FRMTYPE_ERROR:
-      table->field[3]->store(STRING_WITH_LEN("ERROR"),
-                             system_charset_info);
-      break;
-    case FRMTYPE_TABLE:
-      table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
-                             system_charset_info);
-      break;
-    case FRMTYPE_VIEW:
-      table->field[3]->store(STRING_WITH_LEN("VIEW"),
+    if (with_i_schema)
+    {
+      table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
                              system_charset_info);
-      break;
-    default:
-      DBUG_ASSERT(0);
     }
-    if (thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
+    else
     {
-      thd->clear_error();
-      return 0;
+      enum legacy_db_type not_used;
+      char path[FN_REFLEN + 1];
+      (void) build_table_filename(path, sizeof(path) - 1, db_name->str, 
+                                  table_name->str, reg_ext, 0);
+      switch (dd_frm_type(thd, path, &not_used)) {
+      case FRMTYPE_ERROR:
+        table->field[3]->store(STRING_WITH_LEN("ERROR"),
+                               system_charset_info);
+        break;
+      case FRMTYPE_TABLE:
+        table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
+                               system_charset_info);
+        break;
+      case FRMTYPE_VIEW:
+        table->field[3]->store(STRING_WITH_LEN("VIEW"),
+                               system_charset_info);
+        break;
+      default:
+        DBUG_ASSERT(0);
+      }
+    if (thd->is_error() && thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE)
+      {
+        thd->clear_error();
+        return 0;
+      }
     }
   }
   if (schema_table_store_record(thd, table))
@@ -4034,7 +4066,8 @@ int get_all_tables(THD *thd, TABLE_LIST 
           if (schema_table_idx == SCH_TABLE_NAMES)
           {
             if (fill_schema_table_names(thd, tables->table, db_name,
-                                        table_name, with_i_schema))
+                                        table_name, with_i_schema,
+                                        lex->verbose))
               continue;
           }
           else
@@ -6695,10 +6728,14 @@ TABLE *create_schema_table(THD *thd, TAB
       break;
     case MYSQL_TYPE_FLOAT:
     case MYSQL_TYPE_DOUBLE:
-      if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC, 
-                           fields_info->field_length)) == NULL)
+    {
+      const NameString field_name(fields_info->field_name,
+                                  strlen(fields_info->field_name));
+      if ((item= new Item_float(field_name, 0.0, NOT_FIXED_DEC, 
+                                fields_info->field_length)) == NULL)
         DBUG_RETURN(NULL);
       break;
+    }
     case MYSQL_TYPE_DECIMAL:
     case MYSQL_TYPE_NEWDECIMAL:
       if (!(item= new Item_decimal((longlong) fields_info->value, false)))

=== modified file 'sql/sql_show.h'
--- a/sql/sql_show.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_show.h	revid:mikael.ronstrom@stripped
@@ -168,7 +168,7 @@ void append_identifier(THD *thd, String 
 		       uint length);
 inline void append_identifier(THD *thd, String *packet, SimpleCString str)
 {
-  append_identifier(thd, packet, str.ptr(), str.length());
+  append_identifier(thd, packet, str.ptr(), static_cast<uint>(str.length()));
 }
 void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
 bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);

=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_string.h	revid:mikael.ronstrom@stripped
@@ -27,17 +27,23 @@
   A wrapper class for null-terminated constant strings.
   Constructors make sure that the position of the '\0' terminating byte
   in m_str is always in sync with m_length.
+
+  This class must stay as small as possible as we often 
+  pass it and its descendants (such as NameString) into functions
+  using call-by-value evaluation.
+
+  Don't add new members or virual methods into this class!
 */
 class SimpleCString
 {
 private:
   const char *m_str;
-  uint m_length;
+  size_t m_length;
 protected:
   /**
     Initialize from a C string whose length is already known.
   */
-  void set(const char *str_arg, uint length_arg)
+  void set(const char *str_arg, size_t length_arg)
   {
     // NULL is allowed only with length==0
     DBUG_ASSERT(str_arg || length_arg == 0);
@@ -51,7 +57,7 @@ public:
   {
     set(NULL, 0);
   }
-  SimpleCString(const char *str_arg, uint length_arg)
+  SimpleCString(const char *str_arg, size_t length_arg)
   {
     set(str_arg, length_arg);
   }
@@ -81,7 +87,7 @@ public:
   /**
     Return name length.
   */
-  uint length() const { return m_length; }
+  size_t length() const { return m_length; }
   /**
     Compare to another SimpleCString.
   */
@@ -367,11 +373,11 @@ public:
   bool append(const char *s);
   bool append(LEX_STRING *ls)
   {
-    return append(ls->str, ls->length);
+    return append(ls->str, (uint32) ls->length);
   }
   bool append(SimpleCString str)
   {
-    return append(str.ptr(), str.length());
+    return append(str.ptr(), static_cast<uint>(str.length()));
   }
   bool append(const char *s, uint32 arg_length);
   bool append(const char *s, uint32 arg_length, const CHARSET_INFO *cs);

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_table.cc	revid:mikael.ronstrom@stripped
@@ -5362,6 +5362,16 @@ static bool fill_alter_inplace_info(THD 
       */
       if (field->field_index != new_field_index)
         ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_ORDER;
+
+      /* Detect changes in storage type of column */
+      if (new_field->field_storage_type() != field->field_storage_type())
+        ha_alter_info->handler_flags|=
+          Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE;
+
+      /* Detect changes in column format of column */
+      if (new_field->column_format() != field->column_format())
+        ha_alter_info->handler_flags|=
+          Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT;
     }
     else
     {
@@ -7947,7 +7957,8 @@ bool mysql_checksum_table(THD *thd, TABL
 
   field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
   item->maybe_null= 1;
-  field_list.push_back(item= new Item_int("Checksum", (longlong) 1,
+  field_list.push_back(item= new Item_int(NAME_STRING("Checksum"),
+                                          (longlong) 1,
                                           MY_INT64_NUM_DECIMAL_DIGITS));
   item->maybe_null= 1;
   if (protocol->send_result_set_metadata(&field_list,

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/sql_yacc.yy	revid:mikael.ronstrom@stripped
@@ -1085,6 +1085,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
 %token  COLLATION_SYM                 /* SQL-2003-N */
 %token  COLUMNS
 %token  COLUMN_SYM                    /* SQL-2003-R */
+%token  COLUMN_FORMAT_SYM
 %token  COLUMN_NAME_SYM               /* SQL-2003-N */
 %token  COMMENT_SYM
 %token  COMMITTED_SYM                 /* SQL-2003-N */
@@ -6293,6 +6294,39 @@ attribute:
               Lex->charset=$2;
             }
           }
+        | COLUMN_FORMAT_SYM DEFAULT
+          {
+            Lex->type&= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
+            Lex->type|=
+              (COLUMN_FORMAT_TYPE_DEFAULT << FIELD_FLAGS_COLUMN_FORMAT);
+          }
+        | COLUMN_FORMAT_SYM FIXED_SYM
+          {
+            Lex->type&= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
+            Lex->type|=
+              (COLUMN_FORMAT_TYPE_FIXED << FIELD_FLAGS_COLUMN_FORMAT);
+          }
+        | COLUMN_FORMAT_SYM DYNAMIC_SYM
+          {
+            Lex->type&= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
+            Lex->type|=
+              (COLUMN_FORMAT_TYPE_DYNAMIC << FIELD_FLAGS_COLUMN_FORMAT);
+          }
+        | STORAGE_SYM DEFAULT
+          {
+            Lex->type&= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
+            Lex->type|= (HA_SM_DEFAULT << FIELD_FLAGS_STORAGE_MEDIA);
+          }
+        | STORAGE_SYM DISK_SYM
+          {
+            Lex->type&= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
+            Lex->type|= (HA_SM_DISK << FIELD_FLAGS_STORAGE_MEDIA);
+          }
+        | STORAGE_SYM MEMORY_SYM
+          {
+            Lex->type&= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
+            Lex->type|= (HA_SM_MEMORY << FIELD_FLAGS_STORAGE_MEDIA);
+          }
         ;
 
 
@@ -9392,7 +9426,7 @@ function_call_conflict:
         | WEEK_SYM '(' expr ')'
           {
             THD *thd= YYTHD;
-            Item *i1= new (thd->mem_root) Item_int((char*) "0",
+            Item *i1= new (thd->mem_root) Item_int(NAME_STRING("0"),
                                            thd->variables.default_week_format,
                                                    1);
             if (i1 == NULL)
@@ -12745,13 +12779,13 @@ literal:
           }
         | FALSE_SYM
           {
-            $$= new (YYTHD->mem_root) Item_int((char*) "FALSE",0,1);
+            $$= new (YYTHD->mem_root) Item_int(NAME_STRING("FALSE"), 0, 1);
             if ($$ == NULL)
               MYSQL_YYABORT;
           }
         | TRUE_SYM
           {
-            $$= new (YYTHD->mem_root) Item_int((char*) "TRUE",1,1);
+            $$= new (YYTHD->mem_root) Item_int(NAME_STRING("TRUE"), 1, 1);
             if ($$ == NULL)
               MYSQL_YYABORT;
           }
@@ -12831,7 +12865,7 @@ NUM_literal:
           {
             int error;
             $$= new (YYTHD->mem_root)
-                  Item_int($1.str,
+                  Item_int($1,
                            (longlong) my_strtoll10($1.str, NULL, &error),
                            $1.length);
             if ($$ == NULL)
@@ -12841,7 +12875,7 @@ NUM_literal:
           {
             int error;
             $$= new (YYTHD->mem_root)
-                  Item_int($1.str,
+                  Item_int($1,
                            (longlong) my_strtoll10($1.str, NULL, &error),
                            $1.length);
             if ($$ == NULL)
@@ -13484,6 +13518,7 @@ keyword_sp:
         | CODE_SYM                 {}
         | COLLATION_SYM            {}
         | COLUMN_NAME_SYM          {}
+        | COLUMN_FORMAT_SYM        {}
         | COLUMNS                  {}
         | COMMITTED_SYM            {}
         | COMPACT_SYM              {}

=== modified file 'sql/table.cc'
--- a/sql/table.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/table.cc	revid:mikael.ronstrom@stripped
@@ -1578,8 +1578,8 @@ static int open_binary_frm(THD *thd, TAB
         ((field_flags >> COLUMN_FORMAT_SHIFT)& COLUMN_FORMAT_MASK);
       DBUG_PRINT("debug", ("field flags: %u, storage: %u, column_format: %u",
                            field_flags, field_storage, field_column_format));
-      (void)field_storage; /* Reserved by and used in MySQL Cluster */
-      (void)field_column_format; /* Reserved by and used in MySQL Cluster */
+      reg_field->set_storage_type((ha_storage_media)field_storage);
+      reg_field->set_column_format((column_format_type)field_column_format);
     }
   }
   *field_ptr=0;					// End marker

=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/sql/unireg.cc	revid:mikael.ronstrom@stripped
@@ -390,8 +390,8 @@ bool mysql_create_frm(THD *thd, const ch
     List_iterator<Create_field> it(create_fields);
     while ((field=it++))
     {
-      const uchar field_storage= 0; /* Used in MySQL Cluster */
-      const uchar field_column_format= 0; /* Used in MySQL Cluster */
+      const uchar field_storage= field->field_storage_type();
+      const uchar field_column_format= field->column_format();
       const uchar field_flags=
         field_storage + (field_column_format << COLUMN_FORMAT_SHIFT);
       *ptr= field_flags;

=== modified file 'storage/innobase/btr/btr0cur.cc'
--- a/storage/innobase/btr/btr0cur.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/btr/btr0cur.cc	revid:mikael.ronstrom@stripped
@@ -470,12 +470,7 @@ btr_cur_search_to_nth_level(
 	estimate = latch_mode & BTR_ESTIMATE;
 
 	/* Turn the flags unrelated to the latch mode off. */
-	latch_mode &= ~(BTR_INSERT
-			| BTR_DELETE_MARK
-			| BTR_DELETE
-			| BTR_ESTIMATE
-			| BTR_IGNORE_SEC_UNIQUE
-			| BTR_ALREADY_S_LATCHED);
+	latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode);
 
 	ut_ad(!s_latch_by_caller || latch_mode == BTR_SEARCH_LEAF);
 

=== modified file 'storage/innobase/buf/buf0flu.cc'
--- a/storage/innobase/buf/buf0flu.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/buf/buf0flu.cc	revid:mikael.ronstrom@stripped
@@ -1090,75 +1090,7 @@ buf_flush_page_try(
 }
 # endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
 /***********************************************************//**
-Attempts to flush a given neighbor of a page to disk.
-@return	true if flushed. */
-static
-bool
-buf_flush_try_one_neighbor(
-/*=======================*/
-	ulint		space,		/*!< in: space id */
-	ulint		offset,		/*!< in: page offset */
-	ulint		neighbor_offset,/*!< in: neigbor page offset to try */
-	enum buf_flush	flush_type)	/*!< in: BUF_FLUSH_LRU or
-					BUF_FLUSH_LIST */
-{
-	buf_page_t*	bpage;
-	buf_pool_t*	buf_pool = buf_pool_get(space, neighbor_offset);
-
-	ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
-
-	buf_pool_mutex_enter(buf_pool);
-
-	/* We only want to flush pages from this buffer pool. */
-	bpage = buf_page_hash_get(buf_pool, space, neighbor_offset);
-
-	if (!bpage) {
-
-		buf_pool_mutex_exit(buf_pool);
-		/* not contiguous */
-		return(false);
-	}
-
-	ut_a(buf_page_in_file(bpage));
-
-	/* We avoid flushing 'non-old' blocks in an LRU flush,
-	because the flushed blocks are soon freed */
-
-	if (flush_type != BUF_FLUSH_LRU
-	    || neighbor_offset == offset
-	    || buf_page_is_old(bpage)) {
-		mutex_t* block_mutex = buf_page_get_mutex(bpage);
-
-		mutex_enter(block_mutex);
-
-		if (buf_flush_ready_for_flush(bpage, flush_type)
-		    && (neighbor_offset == offset || !bpage->buf_fix_count)) {
-			/* We only try to flush those
-			neighbors != offset where the buf fix
-			count is zero, as we then know that we
-			probably can latch the page without a
-			semaphore wait. Semaphore waits are
-			expensive because we must flush the
-			doublewrite buffer before we start
-			waiting. */
-
-			buf_flush_page(buf_pool, bpage, flush_type);
-			ut_ad(!mutex_own(block_mutex));
-			ut_ad(!buf_pool_mutex_own(buf_pool));
-			/* contiguous */
-			return(true);
-		} else {
-			mutex_exit(block_mutex);
-		}
-	}
-	buf_pool_mutex_exit(buf_pool);
-
-	/* not contiguous */
-	return(false);
-}
-
-/***********************************************************//**
-Flushes to disk contiguous flushable pages within the flush area.
+Flushes to disk all flushable pages within the flush area.
 @return	number of pages flushed */
 static
 ulint
@@ -1180,7 +1112,6 @@ buf_flush_try_neighbors(
 	buf_pool_t*	buf_pool = buf_pool_get(space, offset);
 
 	ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST);
-	ut_ad(n_flushed < n_to_flush);
 
 	if (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN
 	    || !srv_flush_neighbors) {
@@ -1209,26 +1140,71 @@ buf_flush_try_neighbors(
 		high = fil_space_get_size(space);
 	}
 
-	/* Do a backward scan until one of the following becomes true:
-	(1) We reach the end of the extent
-	(2) We have flushed enough pages requested by the caller
-	(3) We reach the end of contiguously present flushable pages */
-
-	for (i = offset;
-	     i >= low
-	     && (count + n_flushed) < n_to_flush
-	     && buf_flush_try_one_neighbor(space, offset, i, flush_type);
-	     i--) {
-		++count;
-	}
-
-	/* Do a forward scan in same way, if need */
-	for (i = offset + 1;
-	     i < high
-	     && (count + n_flushed) < n_to_flush
-	     && buf_flush_try_one_neighbor(space, offset, i, flush_type);
-	     i++) {
-		++count;
+	for (i = low; i < high; i++) {
+
+		buf_page_t*	bpage;
+
+		if ((count + n_flushed) >= n_to_flush) {
+
+			/* We have already flushed enough pages and
+			should call it a day. There is, however, one
+			exception. If the page whose neighbors we
+			are flushing has not been flushed yet then
+			we'll try to flush the victim that we
+			selected originally. */
+			if (i <= offset) {
+				i = offset;
+			} else {
+				break;
+			}
+		}
+
+		buf_pool = buf_pool_get(space, i);
+
+		buf_pool_mutex_enter(buf_pool);
+
+		/* We only want to flush pages from this buffer pool. */
+		bpage = buf_page_hash_get(buf_pool, space, i);
+
+		if (!bpage) {
+
+			buf_pool_mutex_exit(buf_pool);
+			continue;
+		}
+
+		ut_a(buf_page_in_file(bpage));
+
+		/* We avoid flushing 'non-old' blocks in an LRU flush,
+		because the flushed blocks are soon freed */
+
+		if (flush_type != BUF_FLUSH_LRU
+		    || i == offset
+		    || buf_page_is_old(bpage)) {
+			mutex_t* block_mutex = buf_page_get_mutex(bpage);
+
+			mutex_enter(block_mutex);
+
+			if (buf_flush_ready_for_flush(bpage, flush_type)
+			    && (i == offset || !bpage->buf_fix_count)) {
+				/* We only try to flush those
+				neighbors != offset where the buf fix
+				count is zero, as we then know that we
+				probably can latch the page without a
+				semaphore wait. Semaphore waits are
+				expensive because we must flush the
+				doublewrite buffer before we start
+				waiting. */
+
+				buf_flush_page(buf_pool, bpage, flush_type);
+				ut_ad(!mutex_own(block_mutex));
+				ut_ad(!buf_pool_mutex_own(buf_pool));
+				count++;
+				continue;
+			} else {
+				mutex_exit(block_mutex);
+			}
+		}
+		buf_pool_mutex_exit(buf_pool);
 	}
 
 	if (count > 0) {

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/handler/ha_innodb.cc	revid:mikael.ronstrom@stripped
@@ -243,6 +243,11 @@ const struct _ft_vft ft_vft_result = {NU
 				      innobase_fts_retrieve_ranking,
 				      NULL};
 
+const struct _ft_vft_ext ft_vft_ext_result = {innobase_fts_get_version,
+					      innobase_fts_flags,
+					      innobase_fts_retrieve_docid,
+					      innobase_fts_count_matches};
+
 #ifdef HAVE_PSI_INTERFACE
 /* Keys to register pthread mutexes/cond in the current file with
 performance schema */
@@ -2082,7 +2087,8 @@ ha_innobase::ha_innobase(
 		  HA_PRIMARY_KEY_IN_READ_INDEX |
 		  HA_BINLOG_ROW_CAPABLE |
 		  HA_CAN_GEOMETRY | HA_PARTIAL_COLUMN_READ |
-		  HA_TABLE_SCAN_ON_INDEX | HA_CAN_FULLTEXT),
+		  HA_TABLE_SCAN_ON_INDEX | HA_CAN_FULLTEXT |
+		  HA_CAN_FULLTEXT_EXT),
 	start_of_scan(0),
 	num_write_row(0)
 {}
@@ -7726,6 +7732,7 @@ ha_innobase::ft_init_ext(
 						   MYF(0));
 
 		fts_hdl->please = (struct _ft_vft*)(&ft_vft_result);
+		fts_hdl->could_you = (struct _ft_vft_ext*)(&ft_vft_ext_result);
 		fts_hdl->ft_prebuilt = prebuilt;
 		fts_hdl->ft_result = result;
 	}
@@ -7778,6 +7785,13 @@ next_record:
 		dict_index_t*	index;
 		dtuple_t*	tuple = prebuilt->search_tuple;
 
+		/* If we only need information from result we can return
+		   without fetching the table row */
+		if (ft_prebuilt->read_just_key) {
+			table->status= 0;
+			return (0);
+		}
+
 		index = dict_table_get_index_on_name(
 			prebuilt->table, FTS_DOC_ID_INDEX_NAME);
 
@@ -14033,6 +14047,12 @@ innobase_fts_retrieve_ranking(
 
 	ft_prebuilt = ((NEW_FT_INFO*) fts_hdl)->ft_prebuilt;
 
+	if (ft_prebuilt->read_just_key) {
+		fts_ranking_t*  ranking = 
+			rbt_value(fts_ranking_t, result->current);
+		return (ranking->rank);
+	}
+
 	/* Retrieve the ranking value for doc_id with value of
 	prebuilt->fts_doc_id */
 	return(fts_retrieve_ranking(result, ft_prebuilt->fts_doc_id));
@@ -14087,6 +14107,69 @@ innobase_fts_find_ranking(
 	return fts_retrieve_ranking(result, ft_prebuilt->fts_doc_id);
 }
 
+/***********************************************************************
+@return version of the extended FTS API */
+uint
+innobase_fts_get_version()
+{
+	/* Currently this doesn't make much sense as returning
+	HA_CAN_FULLTEXT_EXT automatically mean this version is supported.
+	This supposed to ease future extensions.  */
+	return 2;
+}
+
+/***********************************************************************
+@return Which part of the extended FTS API is supported */
+ulonglong
+innobase_fts_flags()
+{
+	return (FTS_ORDERED_RESULT | FTS_DOCID_IN_RESULT);
+}
+
+
+/***********************************************************************
+Find and Retrieve the FTS doc_id for the current result row
+@return the document ID */
+ulonglong
+innobase_fts_retrieve_docid(
+/*============================*/
+		FT_INFO_EXT * fts_hdl)	/*!< in: FTS handler */
+{
+	row_prebuilt_t* ft_prebuilt;
+	fts_result_t*	result;
+
+	ft_prebuilt = ((NEW_FT_INFO *)fts_hdl)->ft_prebuilt;
+	result = ((NEW_FT_INFO *)fts_hdl)->ft_result;
+
+	if (ft_prebuilt->read_just_key) {
+		fts_ranking_t* ranking = 
+			rbt_value(fts_ranking_t, result->current);
+		return (ranking->doc_id);
+	}
+
+	return(ft_prebuilt->fts_doc_id);
+}
+
+/***********************************************************************
+Find and retrieve the size of the current result
+@return number of matching rows */
+ulonglong
+innobase_fts_count_matches(
+/*============================*/
+		FT_INFO_EXT * fts_hdl)	/*!< in: FTS handler */
+{
+	row_prebuilt_t* ft_prebuilt;
+
+	ft_prebuilt = ((NEW_FT_INFO *)fts_hdl)->ft_prebuilt;
+
+	if (ft_prebuilt->result->rankings_by_id != NULL) {
+		return rbt_size(ft_prebuilt->result->rankings_by_id);
+	} else {
+		return(0);
+	}
+}
+
+
 /* These variables are never read by InnoDB or changed. They are a kind of
 dummies that are needed by the MySQL infrastructure to call
 buffer_pool_dump_now(), buffer_pool_load_now() and buffer_pool_load_abort()

=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/handler/ha_innodb.h	revid:mikael.ronstrom@stripped
@@ -444,6 +444,7 @@ extern const struct _ft_vft ft_vft_resul
 typedef struct new_ft_info
 {
 	struct _ft_vft		*please;
+	struct _ft_vft_ext	*could_you;
 	row_prebuilt_t*		ft_prebuilt;
 	fts_result_t*		ft_result;
 } NEW_FT_INFO;
@@ -566,6 +567,32 @@ innobase_fts_check_doc_id_index_in_def(
 	const KEY*	key_info)	/*!< in: Key definitions */
 	__attribute__((nonnull, warn_unused_result));
 
+/***********************************************************************
+@return version of the extended FTS API */
+uint
+innobase_fts_get_version();
+
+/***********************************************************************
+@return Which part of the extended FTS API is supported */
+ulonglong
+innobase_fts_flags();
+
+/***********************************************************************
+Find and Retrieve the FTS doc_id for the current result row
+@return the document ID */
+ulonglong
+innobase_fts_retrieve_docid(
+/*============================*/
+	FT_INFO_EXT*	fts_hdl);	/*!< in: FTS handler */
+
+/***********************************************************************
+Find and retrieve the size of the current result
+@return number of matching rows */
+ulonglong
+innobase_fts_count_matches(
+/*============================*/
+	FT_INFO_EXT*	fts_hdl);	/*!< in: FTS handler */
+
 /** "GEN_CLUST_INDEX" is the name reserved for InnoDB default
 system clustered index when there is no primary key. */
 extern const char innobase_index_reserve_name[];

=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/handler/handler0alter.cc	revid:mikael.ronstrom@stripped
@@ -151,6 +151,10 @@ ha_innobase::check_if_supported_inplace_
 {
 	DBUG_ENTER("check_if_supported_inplace_alter");
 
+	if (srv_created_new_raw || srv_force_recovery) {
+		DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
+	}
+
 	HA_CREATE_INFO* create_info = ha_alter_info->create_info;
 
 	if (ha_alter_info->handler_flags
@@ -186,6 +190,7 @@ ha_innobase::check_if_supported_inplace_
 	}
 
 	update_thd();
+	trx_search_latch_release_if_reserved(prebuilt->trx);
 
 	/* Fix the key parts. */
 	for (KEY* new_key = ha_alter_info->key_info_buffer;
@@ -1625,7 +1630,9 @@ col_fail:
 		log is unnecessary. */
 		if (!num_fts_index
 		    && !(ha_alter_info->handler_flags
-			 & ~INNOBASE_ONLINE_OPERATIONS)) {
+			 & ~INNOBASE_ONLINE_OPERATIONS)
+		    && !user_table->ibd_file_missing
+		    && !user_table->tablespace_discarded) {
 			DBUG_EXECUTE_IF("innodb_OOM_prepare_inplace_alter",
 					error = DB_OUT_OF_MEMORY;
 					goto error_handling;);
@@ -1825,19 +1832,11 @@ ha_innobase::prepare_inplace_alter_table
 		goto func_exit;
 	}
 
-	if (srv_created_new_raw || srv_force_recovery) {
-		my_error(ER_OPEN_AS_READONLY, MYF(0),
-			 table->s->table_name.str);
-		DBUG_RETURN(true);
-	}
-
 	ut_d(mutex_enter(&dict_sys->mutex));
 	ut_d(dict_table_check_for_dup_indexes(
 		     prebuilt->table, CHECK_ABORTED_OK));
 	ut_d(mutex_exit(&dict_sys->mutex));
 
-	update_thd();
-
 	/* In case MySQL calls this in the middle of a SELECT query, release
 	possible adaptive hash latch to avoid deadlocks of threads. */
 	trx_search_latch_release_if_reserved(prebuilt->trx);
@@ -2116,9 +2115,6 @@ ha_innobase::inplace_alter_table(
 		DBUG_RETURN(false);
 	}
 
-	update_thd();
-	trx_search_latch_release_if_reserved(prebuilt->trx);
-
 	class ha_innobase_inplace_ctx*	ctx
 		= static_cast<class ha_innobase_inplace_ctx*>
 		(ha_alter_info->handler_ctx);
@@ -2126,6 +2122,11 @@ ha_innobase::inplace_alter_table(
 	DBUG_ASSERT(ctx);
 	DBUG_ASSERT(ctx->trx);
 
+	if (prebuilt->table->ibd_file_missing
+	    || prebuilt->table->tablespace_discarded) {
+		goto all_done;
+	}
+
 	/* Read the clustered index of the table and build
 	indexes based on this information using temporary
 	files and merge sort. */
@@ -2145,6 +2146,7 @@ oom:
 
 	switch (error) {
 		KEY*	dup_key;
+	all_done:
 	case DB_SUCCESS:
 		ut_d(mutex_enter(&dict_sys->mutex));
 		ut_d(dict_table_check_for_dup_indexes(

=== modified file 'storage/innobase/include/btr0btr.h'
--- a/storage/innobase/include/btr0btr.h	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/include/btr0btr.h	revid:mikael.ronstrom@stripped
@@ -100,6 +100,14 @@ buffer when the record is not in the buf
 on the index tree */
 #define BTR_ALREADY_S_LATCHED	16384
 
+#define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode)	\
+	((latch_mode) & ~(BTR_INSERT			\
+			  | BTR_DELETE_MARK		\
+			  | BTR_DELETE			\
+			  | BTR_ESTIMATE		\
+			  | BTR_IGNORE_SEC_UNIQUE	\
+			  | BTR_ALREADY_S_LATCHED))
+
 /**************************************************************//**
 Report that an index page is corrupted. */
 UNIV_INTERN

=== modified file 'storage/innobase/include/btr0pcur.ic'
--- a/storage/innobase/include/btr0pcur.ic	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/include/btr0pcur.ic	revid:mikael.ronstrom@stripped
@@ -429,7 +429,7 @@ btr_pcur_open_low(
 
 	btr_pcur_init(cursor);
 
-	cursor->latch_mode = latch_mode;
+	cursor->latch_mode = BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode);
 	cursor->search_mode = mode;
 
 	/* Search with the tree cursor */

=== modified file 'storage/innobase/log/log0recv.cc'
--- a/storage/innobase/log/log0recv.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/log/log0recv.cc	revid:mikael.ronstrom@stripped
@@ -2894,7 +2894,7 @@ recv_recovery_from_checkpoint_start_func
 	lsn_t		checkpoint_lsn;
 	ib_uint64_t	checkpoint_no;
 	lsn_t		old_scanned_lsn;
-	lsn_t		group_scanned_lsn;
+	lsn_t		group_scanned_lsn = 0;
 	lsn_t		contiguous_lsn;
 #ifdef UNIV_LOG_ARCHIVE
 	lsn_t		archived_lsn;

=== modified file 'storage/innobase/pars/lexyy.cc'
--- a/storage/innobase/pars/lexyy.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/pars/lexyy.cc	revid:mikael.ronstrom@stripped
@@ -35,7 +35,7 @@
 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types. 
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -55,7 +55,6 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -86,6 +85,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -142,7 +143,15 @@ typedef unsigned int flex_uint32_t;
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
 #define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
@@ -276,7 +285,7 @@ static yy_size_t yy_n_chars;		/* number 
 yy_size_t yyleng;
 
 /* Points to current character in buffer. */
-static char *yy_c_buf_p = (char*) 0;
+static char *yy_c_buf_p = (char *) 0;
 static int yy_init = 0;		/* whether we need to initialize */
 static int yy_start = 0;	/* start state number */
 
@@ -338,7 +347,7 @@ void yyfree (void *  );
 
 typedef unsigned char YY_CHAR;
 
-FILE *yyin = (FILE*) 0, *yyout = (FILE*) 0;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
 
 typedef int yy_state_type;
 
@@ -373,7 +382,7 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static yyconst flex_int16_t yy_accept[424] =
+static yyconst flex_int16_t yy_accept[425] =
     {   0,
         0,    0,  119,  119,    0,    0,    0,    0,  125,  123,
       122,  122,    8,  123,  114,    5,  103,  109,  112,  110,
@@ -382,46 +391,46 @@ static yyconst flex_int16_t yy_accept[42
        96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
       115,  116,  119,  120,    6,    7,    9,   10,  122,    4,
        98,  118,    2,    1,    3,   99,  100,  102,  101,    0,
-       96,   96,   96,   96,   96,   96,   44,   96,   96,   96,
+       96,    0,   96,   96,   96,   96,   96,   44,   96,   96,
        96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
-       96,   96,   96,   28,   17,   25,   96,   96,   96,   96,
+       96,   96,   96,   96,   28,   17,   25,   96,   96,   96,
 
-       96,   96,   54,   63,   96,   14,   96,   96,   96,   96,
-       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
-       96,   96,   96,   96,  119,  120,  120,  121,    6,    7,
-        9,   10,    2,    0,   97,   13,   45,   96,   96,   96,
+       96,   96,   96,   54,   63,   96,   14,   96,   96,   96,
        96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
-       96,   96,   96,   96,   96,   96,   27,   96,   96,   96,
-       41,   96,   96,   96,   96,   21,   96,   96,   96,   96,
-       96,   15,   96,   96,   96,   18,   96,   96,   96,   96,
-       96,   82,   96,   96,   96,   51,   96,   12,   96,   36,
-       96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
-
-       96,    0,   97,   96,   96,   96,   96,   20,   96,   24,
+       96,   96,   96,   96,   96,  119,  120,  120,  121,    6,
+        7,    9,   10,    2,    0,   97,   13,   45,   96,   96,
        96,   96,   96,   96,   96,   96,   96,   96,   96,   96,
-       96,   46,   96,   96,   30,   96,   89,   96,   96,   39,
-       96,   96,   96,   96,   96,   48,   96,   94,   91,   32,
-       93,   96,   11,   66,   96,   96,   96,   42,   96,   96,
-       96,   96,   96,   96,   96,   96,   96,   96,   29,   96,
-       96,   96,   96,   96,   96,   96,   96,   96,   87,    0,
-       96,   26,   96,   96,   96,   68,   96,   96,   96,   96,
-       37,   96,   96,   96,   96,   96,   96,   96,   31,   67,
-       23,   96,   59,   96,   77,   96,   96,   96,   43,   96,
-
-       96,   96,   96,   96,   96,   96,   96,   92,   96,   96,
-       56,   96,   96,   96,   96,   96,   96,   96,   40,   33,
-        0,   81,   95,   19,   96,   96,   85,   96,   76,   55,
-       96,   65,   96,   52,   96,   96,   96,   47,   96,   78,
-       96,   80,   96,   96,   34,   96,   96,   96,   35,   74,
-       96,   96,   96,   96,   60,   96,   50,   49,   96,   96,
-       96,   57,   53,   64,   96,   96,   96,   22,   96,   96,
-       75,   83,   96,   96,   79,   96,   70,   96,   96,   96,
-       96,   96,   38,   96,   90,   69,   96,   86,   96,   96,
-       96,   88,   96,   96,   61,   96,   16,   96,   72,   71,
-
-       96,   58,   96,   84,   96,   96,   96,   96,   96,   96,
-       96,   96,   96,   96,   73,   96,   96,   96,   96,   96,
-       96,   62,    0
+       96,   96,   96,   96,   96,   96,   96,   27,   96,   96,
+       96,   41,   96,   96,   96,   96,   21,   96,   96,   96,
+       96,   96,   15,   96,   96,   96,   18,   96,   96,   96,
+       96,   96,   82,   96,   96,   96,   51,   96,   12,   96,
+       36,   96,   96,   96,   96,   96,   96,   96,   96,   96,
+
+       96,   96,    0,   97,   96,   96,   96,   96,   20,   96,
+       24,   96,   96,   96,   96,   96,   96,   96,   96,   96,
+       96,   96,   46,   96,   96,   30,   96,   89,   96,   96,
+       39,   96,   96,   96,   96,   96,   48,   96,   94,   91,
+       32,   93,   96,   11,   66,   96,   96,   96,   42,   96,
+       96,   96,   96,   96,   96,   96,   96,   96,   96,   29,
+       96,   96,   96,   96,   96,   96,   96,   96,   96,   87,
+        0,   96,   26,   96,   96,   96,   68,   96,   96,   96,
+       96,   37,   96,   96,   96,   96,   96,   96,   96,   31,
+       67,   23,   96,   59,   96,   77,   96,   96,   96,   43,
+
+       96,   96,   96,   96,   96,   96,   96,   96,   92,   96,
+       96,   56,   96,   96,   96,   96,   96,   96,   96,   40,
+       33,    0,   81,   95,   19,   96,   96,   85,   96,   76,
+       55,   96,   65,   96,   52,   96,   96,   96,   47,   96,
+       78,   96,   80,   96,   96,   34,   96,   96,   96,   35,
+       74,   96,   96,   96,   96,   60,   96,   50,   49,   96,
+       96,   96,   57,   53,   64,   96,   96,   96,   22,   96,
+       96,   75,   83,   96,   96,   79,   96,   70,   96,   96,
+       96,   96,   96,   38,   96,   90,   69,   96,   86,   96,
+       96,   96,   88,   96,   96,   61,   96,   16,   96,   72,
+
+       71,   96,   58,   96,   84,   96,   96,   96,   96,   96,
+       96,   96,   96,   96,   96,   73,   96,   96,   96,   96,
+       96,   96,   62,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -432,14 +441,14 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    2,    1,    4,    5,    6,    7,    1,    8,    9,
        10,   11,   12,   13,   14,   15,   16,   17,   17,   17,
        17,   17,   17,   17,   17,   17,   17,   18,   19,   20,
-       21,   22,   23,    1,   24,   25,   26,   27,   28,   29,
-       30,   31,   32,   33,   34,   35,   36,   37,   38,   39,
-       40,   41,   42,   43,   44,   45,   46,   47,   48,   49,
-        1,    1,    1,    1,   50,    1,   33,   33,   33,   33,
-
-       33,   33,   33,   33,   33,   33,   33,   51,   33,   33,
-       33,   33,   52,   33,   53,   33,   33,   33,   33,   33,
-       33,   33,   54,    1,   55,    1,    1,    1,    1,    1,
+       21,   22,   23,   24,   25,   26,   27,   28,   29,   30,
+       31,   32,   33,   34,   35,   36,   37,   38,   39,   40,
+       41,   42,   43,   44,   45,   46,   47,   48,   49,   50,
+        1,    1,    1,    1,   51,    1,   34,   34,   34,   34,
+
+       34,   34,   34,   34,   34,   34,   34,   52,   34,   34,
+       34,   34,   53,   34,   54,   34,   34,   34,   34,   34,
+       34,   34,   55,    1,   56,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -456,328 +465,438 @@ static yyconst flex_int32_t yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst flex_int32_t yy_meta[56] =
+static yyconst flex_int32_t yy_meta[57] =
     {   0,
         1,    1,    1,    2,    3,    1,    1,    4,    1,    1,
         5,    1,    1,    1,    1,    6,    7,    1,    1,    1,
-        8,    1,    1,    9,    9,    9,    9,    9,    9,    9,
+        8,    1,    1,    6,    9,    9,    9,    9,    9,    9,
         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
-        9,    9,    9,    1,    1
+        9,    9,    9,    9,    1,    1
     } ;
 
-static yyconst flex_int16_t yy_base[436] =
+static yyconst flex_int16_t yy_base[438] =
     {   0,
-        0,    0,  849,  848,  850,  849,  852,  851,  854,  861,
-       54,   56,  861,    0,  861,  861,  861,  861,  861,  861,
-      861,  861,  838,  841,   45,  830,  861,   42,  861,  829,
-      861,   45,   49,   54,   58,   56,   72,  833,   83,   86,
-       63,   67,   90,   53,  105,  107,  106,  120,   51,  101,
-      861,  861,    0,   55,    0,  840,    0,  843,  106,    0,
-      861,  861,  829,   61,  824,  861,  861,  861,  861,  839,
-      827,   88,  124,  130,  132,  125,  826,  129,  133,  136,
-       52,  138,  148,  140,  142,  145,  149,  152,  151,  159,
-      162,  169,  165,  825,  172,  824,  173,  170,  175,  179,
-
-      176,  177,  823,  822,  180,  182,  184,  200,  201,  195,
-      189,  202,  204,  207,  205,  210,  218,  220,  213,  215,
-      223,  230,  238,  217,    0,  240,  244,  861,    0,  829,
-        0,  832,  818,  781,    0,  817,  816,  233,  237,  243,
-      248,  251,  246,  252,  255,  257,  258,  262,  264,  263,
-      265,  267,  266,  269,  273,  270,  815,  274,  275,  287,
-      814,  290,  292,  291,  293,  294,  297,  300,  304,  298,
-      307,  313,  308,  309,  317,  813,  314,  315,  323,  318,
-      324,  328,  331,  332,  333,  812,  336,  811,  338,  810,
-      340,  339,  342,  344,  343,  341,  347,  346,  348,  349,
-
-      359,  773,    0,  356,  369,  370,  360,  808,  371,  807,
-      372,  375,  376,  378,  379,  380,  382,  383,  388,  393,
-      394,  806,  396,  397,  805,  398,  804,  399,  400,  803,
-      403,  404,  408,  413,  405,  802,  415,  801,  800,  799,
-      798,  406,  797,  796,  416,  417,  420,  795,  422,  418,
-      423,  425,  424,  426,  439,  429,  437,  440,  794,  446,
-      450,  453,  454,  455,  457,  458,  459,  460,  793,  757,
-      461,  791,  463,  464,  466,  790,  467,  468,  473,  474,
-      789,  475,  476,  477,  478,  480,  485,  486,  788,  787,
-      786,  489,  785,  491,  784,  498,  493,  494,  783,  499,
-
-      504,  509,  511,  513,  516,  514,  517,  782,  520,  519,
-      781,  521,  523,  527,  525,  528,  526,  529,  780,  779,
-      780,  776,  773,  530,  533,  535,  772,  534,  771,  770,
-      541,  769,  550,  760,  543,  548,  551,  753,  552,  736,
-      554,  730,  556,  557,  723,  558,  566,  563,  693,  692,
-      569,  572,  565,  578,  691,  574,  690,  689,  567,  585,
-      588,  688,  687,  685,  571,  589,  591,  683,  592,  593,
-      681,  680,  595,  596,  679,  597,  678,  599,  604,  602,
-      605,  608,  676,  606,  675,  674,  609,  673,  607,  610,
-      614,  670,  620,  623,  668,  628,  667,  630,  665,  664,
-
-      625,  663,  629,  112,  627,  626,  631,  632,  647,  633,
-      636,  637,  644,  650,  110,  652,  659,  657,  660,  661,
-      662,   57,  861,  710,  719,  728,  731,  734,  738,  747,
-      756,  765,  774,  781,  784
+        0,    0,  293,  287,  284,  281,  272,  256,  254, 1357,
+       55,   57, 1357,    0, 1357, 1357, 1357, 1357, 1357, 1357,
+     1357, 1357,  238,  227,   46,  205, 1357,   43, 1357,  203,
+     1357,   46,   50,   56,   52,   66,   64,   51,   81,   92,
+       91,   94,   96,  111,  113,  116,  130,  134,   53,  143,
+     1357, 1357,    0,  106,    0,  212,    0,  210,  141,    0,
+     1357, 1357,  192,   56,  173, 1357, 1357, 1357, 1357,  168,
+      140,  150,  152,  154,  155,  161,  167,  171,  177,  172,
+      184,  174,  188,  189,  191,  194,  203,  212,  215,  217,
+      219,  221,  226,  228,  231,  240,  233,  235,  246,  251,
+
+      258,  253,  255,  256,  269,  271,  278,  272,  285,  283,
+      287,  289,  296,  305,  298,  315,  319,  321,  322,  326,
+      332,  333,  342,  339,  343,    0,  112,  173, 1357,    0,
+      155,    0,  156,  132,   93,    0,  355,  357,  358,  360,
+      364,  367,  374,  370,  379,  380,  389,  383,  390,  392,
+      395,  408,  411,  409,  415,  418,  425,  427,  429,  436,
+      431,  441,  446,  448,  450,  452,  453,  462,  471,  464,
+      473,  474,  478,  485,  488,  490,  491,  494,  500,  501,
+      504,  506,  507,  517,  518,  519,  520,  521,  522,  523,
+      533,  536,  538,  543,  549,  554,  555,  561,  556,  566,
+
+      567,  576,   60,    0,  573,  578,  580,  582,  583,  593,
+      589,  596,  598,  603,  605,  607,  610,  617,  619,  621,
+      622,  628,  633,  634,  635,  639,  640,  649,  650,  652,
+      653,  655,  659,  664,  668,  669,  665,  671,  674,  678,
+      681,  685,  687,  688,  692,  697,  698,  701,  703,  704,
+      707,  708,  717,  713,  728,  730,  724,  740,  734,  745,
+      746,  750,  751,  756,  757,  760,  761,  762,  771,  773,
+       42,  778,  782,  783,  787,  789,  792,  794,  793,  804,
+      805,  808,  809,  810,  819,  823,  826,  828,  829,  830,
+      835,  840,  844,  846,  847,  856,  857,  858,  859,  860,
+
+      863,  872,  873,  878,  879,  882,  885,  889,  894,  895,
+      896,  898,  905,  910,  908,  912,  914,  915,  926,  930,
+      931,   73,  932,  933,  935,  937,  942,  944,  946,  947,
+      948,  949,  951,  958,  961,  965,  967,  972,  978,  979,
+      981,  984,  983,  985,  994,  988,  999, 1000, 1001, 1004,
+     1013, 1015, 1022, 1016, 1019, 1026, 1032, 1033, 1035, 1036,
+     1038, 1039, 1048, 1049, 1050, 1051, 1053, 1054, 1060, 1063,
+     1065, 1066, 1069, 1070, 1072, 1082, 1084, 1085, 1087, 1096,
+     1097, 1098, 1099, 1101, 1113, 1114, 1115, 1116, 1117, 1118,
+     1119, 1128, 1130, 1131, 1134, 1133, 1135, 1137, 1150, 1151,
+
+     1153, 1155, 1157, 1162, 1160, 1167, 1172, 1173, 1174, 1176,
+     1185, 1190, 1183, 1187, 1189, 1199, 1204, 1206, 1208, 1210,
+     1215, 1220, 1222, 1357, 1269, 1278, 1287, 1290, 1293, 1297,
+     1306, 1315, 1324, 1333, 1340, 1344, 1347
     } ;
 
-static yyconst flex_int16_t yy_def[436] =
+static yyconst flex_int16_t yy_def[438] =
     {   0,
-      423,    1,  424,  424,  425,  425,  426,  426,  423,  423,
-      423,  423,  423,  427,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  428,  423,  423,  423,  423,
-      423,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      423,  423,  430,  431,  432,  423,  433,  423,  423,  427,
-      423,  423,  423,  423,  428,  423,  423,  423,  423,  434,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  430,  431,  431,  423,  432,  423,
-      433,  423,  423,  423,  435,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-
-      429,  423,  435,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  423,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      423,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,  429,  429,  429,  429,  429,  429,  429,  429,
-      429,  429,    0,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423
+      424,    1,  425,  425,  426,  426,  427,  427,  424,  424,
+      424,  424,  424,  428,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  429,  424,  424,  424,  424,
+      424,  430,  430,  430,  430,  430,   34,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      424,  424,  431,  432,  433,  424,  434,  424,  424,  428,
+      424,  424,  424,  424,  429,  424,  424,  424,  424,  435,
+      430,  436,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  431,  432,  432,  424,  433,
+      424,  434,  424,  424,  424,  437,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+
+      430,  430,  424,  437,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      424,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  424,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,  430,  430,  430,  430,  430,  430,  430,
+      430,  430,  430,    0,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424
     } ;
 
-static yyconst flex_int16_t yy_nxt[917] =
+static yyconst flex_int16_t yy_nxt[1414] =
     {   0,
        10,   11,   12,   13,   10,   14,   15,   16,   17,   18,
        19,   20,   21,   22,   23,   24,   25,   26,   27,   28,
-       29,   30,   31,   32,   33,   34,   35,   36,   37,   38,
-       38,   39,   38,   38,   40,   41,   42,   43,   44,   38,
-       45,   46,   47,   48,   49,   50,   38,   38,   38,   38,
-       38,   38,   38,   51,   52,   59,   59,   59,   59,   63,
-       70,   64,   67,   68,   70,  127,   70,   70,   70,   70,
-      128,   70,   70,   70,  122,   63,   74,   64,   70,  149,
-       75,   72,   70,   76,   78,   83,   73,   70,   79,   84,
-       86,   80,   87,  108,   81,   85,   77,   82,   70,   89,
-
-      100,   70,   88,   70,  101,   70,   90,   59,   59,   91,
-      102,   94,   92,   97,  136,   93,   70,   98,  103,   95,
-       70,   70,   70,   99,   96,   70,  104,   70,  105,  117,
-      106,  123,  109,  107,  112,   70,  118,  113,  124,   70,
-       70,  110,  111,  119,   70,   70,  114,   70,   70,  137,
-      115,   70,  143,   70,  116,   70,  120,   70,  121,  139,
-       70,  140,  142,   70,   70,  138,   70,   70,  141,  155,
-      144,  146,  147,  151,   70,  157,  145,   70,  150,  148,
-       70,  154,  152,  158,   70,   70,  156,   70,   70,  153,
-       70,   70,   70,  159,   70,   70,  160,   70,  164,   70,
-
-      169,  163,  161,  168,   70,  171,  162,  174,  175,  167,
-       70,  173,  170,  165,  166,   70,   70,   70,  172,   70,
-       70,  182,   70,  183,  179,   70,  176,  187,   70,  189,
-       70,  177,   70,   70,  184,   70,  185,  178,   70,  180,
-      190,  188,  192,  181,  186,   70,  195,  193,   70,  197,
-      423,  191,   70,   70,  127,  423,  196,  201,   70,  128,
-      204,   70,  194,   70,  198,  199,   70,   70,  205,  200,
-       70,  207,   70,   70,  206,  208,  209,   70,   70,   70,
-       70,   70,   70,  215,   70,   70,  210,  217,   70,   70,
-       70,  222,  213,  211,  221,  214,  212,  225,  216,  220,
-
-      228,  226,   70,  218,  219,   70,   70,   70,   70,   70,
-      229,  223,   70,   70,  224,   70,  227,  231,  232,   70,
-      233,  235,   70,   70,   70,  230,  237,  238,   70,   70,
-       70,  236,   70,   70,  241,  234,  240,  239,   70,   70,
-      247,  242,  243,   70,  245,  244,   70,   70,   70,  248,
-      246,   70,  249,   70,   70,   70,   70,   70,   70,   70,
-      254,   70,   70,   70,   70,  252,  257,  250,  260,  261,
-      265,   70,  264,  258,   70,   70,  255,  251,  259,  256,
-      262,  253,  263,  268,   70,   70,   70,   70,  267,  266,
-       70,   70,  269,   70,   70,   70,  271,   70,   70,  276,
-
-      274,  279,  280,   70,  275,  272,  273,  278,   70,   70,
-      283,   70,   70,   70,   70,   70,  285,  277,   70,   70,
-       70,   70,  281,   70,  282,  284,  289,  287,   70,  290,
-       70,   70,   70,   70,  296,   70,  286,   70,   70,   70,
-       70,   70,  291,  298,   70,  292,  288,  301,  294,  305,
-      293,  307,   70,  295,   70,   70,  299,  297,  303,  300,
-      310,   70,  306,  302,  304,   70,  308,  311,   70,   70,
-       70,  309,   70,   70,   70,   70,   70,  312,   70,   70,
-      313,   70,   70,   70,  316,  318,  319,  320,   70,   70,
-       70,   70,   70,   70,  326,   70,  314,  315,  328,  317,
-
-       70,   70,  330,  322,   70,  323,   70,  334,   70,   70,
-      327,  324,  331,   70,   70,  325,  329,  332,  333,   70,
-      337,  335,  336,  340,   70,  339,   70,  342,   70,   70,
-      343,   70,   70,  338,   70,   70,   70,  341,   70,  347,
-       70,   70,   70,   70,   70,   70,  353,  345,   70,   70,
-       70,  344,  355,  357,  348,  346,   70,  352,   70,  349,
-      350,  351,  354,   70,  356,   70,   70,   70,  365,   70,
-      358,   70,   70,   70,  360,  361,  362,  364,   70,  359,
-       70,   70,   70,  363,   70,  366,   70,   70,  367,   70,
-      369,  373,  368,   70,  374,  376,  375,  371,  372,  370,
-
-       70,  379,  378,   70,   70,  377,   70,   70,   70,  380,
-       70,   70,   70,  383,   70,  382,  381,   70,  386,   70,
-       70,   70,   70,   70,   70,   70,  391,  385,  388,   70,
-      392,  384,  389,  387,  395,   70,  397,  390,   70,  393,
-       70,   70,   70,   70,   70,   70,   70,   70,   70,  398,
-      402,   70,   70,  394,  400,  396,  403,  399,  404,   70,
-      406,  405,   70,  413,  412,   70,  409,   70,  408,  401,
-      407,  411,   70,  414,   70,   70,   70,   70,   70,   70,
-       70,  410,   70,   70,  415,   70,  418,  417,   70,   70,
-       70,   70,  419,   70,   70,   70,   70,  420,   70,  416,
-
-       70,  421,   70,   70,   70,   70,   70,   70,   70,  422,
-       53,   53,   53,   53,   53,   53,   53,   53,   53,   55,
-       55,   55,   55,   55,   55,   55,   55,   55,   57,   57,
-       57,   57,   57,   57,   57,   57,   57,   60,   70,   60,
-       65,   65,   65,   71,   71,   70,   71,  125,  125,  125,
-      125,   70,  125,  125,  125,  125,  126,  126,  126,  126,
-      126,  126,  126,  126,  126,  129,  129,  129,   70,  129,
-      129,  129,  129,  129,  131,   70,  131,  131,  131,  131,
-      131,  131,  131,  135,   70,   70,   70,   70,   70,  135,
-      203,   70,  203,  135,   70,   70,   70,   70,   70,   70,
-
-       70,   70,   70,   70,   70,   70,   70,  321,   70,   70,
-       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
-       70,   70,   70,   70,  270,   70,   70,   70,   70,   70,
-       70,   70,   70,  202,  133,  132,  130,   70,   70,   70,
-       70,   70,   70,  134,  423,  133,  132,  130,   70,   69,
-       66,   62,   61,  423,   58,   58,   56,   56,   54,   54,
-        9,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
+       29,   30,   31,   10,   32,   33,   34,   35,   36,   37,
+       38,   38,   39,   38,   38,   40,   41,   42,   43,   44,
+       38,   45,   46,   47,   48,   49,   50,   38,   38,   38,
+       38,   38,   38,   38,   51,   52,   59,   59,   59,   59,
+       63,   70,   64,   67,   68,   70,   70,   70,   70,   72,
+       63,   70,   64,   72,   72,   72,   72,  123,   75,   72,
+       84,   70,   76,   73,   85,   77,  136,   79,   74,   72,
+       86,   80,   90,  322,   81,   71,   70,   82,   78,   91,
+
+       83,   87,   92,   88,   72,   93,   70,   70,   94,   70,
+       95,   70,  271,   89,   72,   72,  128,   72,   96,   72,
+       98,  129,  424,   97,   99,  104,   70,  424,   70,  101,
+      100,   70,  102,  105,   72,  106,   72,  107,  103,   72,
+      108,  110,   59,   59,  113,   70,  203,  114,  134,   70,
+      111,  112,  109,   72,  118,   70,  115,   72,   70,  133,
+      116,  119,  131,   72,  117,   70,   72,   70,  120,   70,
+       70,  121,  135,  122,  124,   72,   70,   72,   72,  137,
+      138,  125,   70,  128,   72,  140,   70,   70,  129,   70,
+       72,  141,   70,  424,   72,   72,  139,   72,  142,   70,
+
+       72,  144,  150,   70,   70,  143,   70,   72,  134,   70,
+      145,   72,   72,  133,   72,  152,  146,   72,   70,  131,
+      147,  148,  156,   69,  153,   66,   72,   70,  149,  151,
+       70,  154,   70,  155,   70,   72,   70,   62,   72,  158,
+       72,   70,   72,   70,   72,  157,   70,  159,   70,   72,
+       70,   72,   61,  424,   72,   70,   72,  161,   72,   58,
+      160,   70,  162,   72,  163,  164,   70,  165,   70,   72,
+       70,   70,  168,   70,   72,   58,   72,  170,   72,   72,
+      169,   72,  166,  167,   70,  172,   70,   70,   56,  171,
+      174,   56,   72,   70,   72,   72,  173,   54,   70,  175,
+
+       70,   72,   70,   54,   70,  176,   72,  180,   72,  424,
+       72,   70,   72,   70,  183,  177,  424,  178,  424,   72,
+       70,   72,  181,  179,  184,  424,  182,  424,   72,  188,
+       70,  186,  424,  189,   70,  185,   70,   70,   72,  187,
+      190,   70,   72,  424,   72,   72,  193,   70,   70,   72,
+      194,  191,  424,  424,   70,   72,   72,   70,   70,  424,
+      198,  192,   72,  424,  196,   72,   72,  200,  424,  424,
+       70,  201,   70,   70,  197,   70,  195,  199,   72,   70,
+       72,   72,   70,   72,  202,   70,  205,   72,  424,   70,
+       72,  208,  206,   72,   70,   70,  207,   72,   70,  209,
+
+      210,  424,   72,   72,   70,   70,   72,   70,  424,  216,
+       70,  211,   72,   72,  424,   72,  218,  424,   72,  424,
+      424,  212,  213,   70,   70,  214,   70,  217,  215,  424,
+       70,   72,   72,   70,   72,  223,  219,  220,   72,  222,
+       70,   72,   70,  221,   70,  424,   70,  424,   72,  424,
+       72,   70,   72,  226,   72,  230,   70,  227,  224,   72,
+      225,   70,  229,   70,   72,   70,  424,   70,   70,   72,
+      424,   72,  228,   72,  232,   72,   72,   70,  233,   70,
+      234,  236,  231,  424,  424,   72,   70,   72,   70,   70,
+      424,  237,  238,   70,   72,  235,   72,   72,  240,  239,
+
+       70,   72,  242,   70,  424,   70,   70,  243,   72,   70,
+      424,   72,  241,   72,   72,   70,   70,   72,  246,   70,
+      244,   70,   70,   72,   72,  245,  248,   72,  249,   72,
+       72,  247,   70,   70,   70,   70,   70,   70,   70,  250,
+       72,   72,   72,   72,   72,   72,   72,  255,   70,  424,
+      251,   70,  253,   70,  424,  424,   72,  252,   70,   72,
+      424,   72,  256,  258,   70,  257,   72,  424,  254,   70,
+       70,   70,   72,  259,  261,  262,   70,   72,   72,   72,
+      260,   70,   70,  424,   72,  266,  263,  265,   70,   72,
+       72,   70,  424,   70,  264,   70,   72,   70,   70,   72,
+
+      267,   72,  269,   72,   70,   72,   72,  268,   70,  424,
+      270,   70,   72,   70,  272,  273,   72,  274,   70,   72,
+       70,   72,   70,  275,  277,   70,   72,  276,   72,  280,
+       72,  281,   70,   72,   70,  279,   70,   70,  424,  424,
+       72,  278,   72,   70,   72,   72,  286,  284,   70,   70,
+       70,   72,  424,  282,   70,   70,   72,   72,   72,  285,
+      283,  424,   72,   72,   70,   70,  288,   70,   70,  290,
+       70,  287,   72,   72,   70,   72,   72,  424,   72,   70,
+       70,  291,   72,   70,   70,  289,   70,   72,   72,   70,
+      424,   72,   72,   70,   72,  292,   70,   72,  293,  297,
+
+       70,   72,   70,   70,   72,  295,  294,   70,   72,  296,
+       72,   72,   70,   70,  298,   72,   70,  424,   70,   70,
+       72,   72,   70,   70,   72,  299,   72,   72,   70,  302,
+       72,   72,   70,  424,  424,  424,   72,  424,  300,   70,
+       72,  301,  306,   70,  424,   70,  303,   72,  304,   70,
+      305,   72,  307,   72,  308,   70,  424,   72,  309,  424,
+       70,   70,  312,   72,  311,   70,   70,  310,   72,   72,
+      424,   70,   70,   72,   72,   70,   70,   70,  313,   72,
+       72,  314,  424,   72,   72,   72,   70,  317,   70,  319,
+      320,  424,  424,   70,   72,  315,   72,   70,   70,  321,
+
+      316,   72,   70,  318,   70,   72,   72,   70,   70,   70,
+       72,  424,   72,  424,  424,   72,   72,   72,  424,   70,
+       70,  323,  327,   70,   70,   70,  324,   72,   72,  424,
+      329,   72,   72,   72,   70,  325,  328,  331,   70,  326,
+      424,   70,   72,   70,   70,   70,   72,  332,  330,   72,
+       70,   72,   72,   72,  335,   70,  424,  424,   72,   70,
+      333,   70,   70,   72,  334,  336,  337,   72,  424,   72,
+       72,   70,   70,   70,   70,   70,  338,  424,   70,   72,
+       72,   72,   72,   72,  424,  340,   72,   70,   70,  341,
+      339,  424,  343,   70,   70,   72,   72,   70,  424,  344,
+
+       70,   72,   72,  342,   70,   72,  348,  424,   72,   70,
+       70,   70,   72,   70,  424,  346,  345,   72,   72,   72,
+       70,   72,  347,   70,  424,   70,  349,   70,   72,   70,
+       70,   72,  350,   72,  354,   72,  351,   72,   72,  352,
+      356,   70,  353,  358,  355,   70,   70,   70,   70,   72,
+       70,  357,   70,   72,   72,   72,   72,   70,   72,   70,
+       72,   70,   70,   70,   70,   72,   70,   72,  359,   72,
+       72,   72,   72,   70,   72,  424,   70,  424,  424,  361,
+       70,   72,   70,  362,   72,  360,  365,   70,   72,  363,
+       72,  366,  364,   70,   70,   72,   70,  424,   70,   70,
+
+       70,   72,   72,   70,   72,  367,   72,   72,   72,   70,
+      368,   72,  424,  424,   70,   70,   70,   72,  424,   70,
+      369,  370,   72,   72,   72,  424,  374,   72,   70,  371,
+       70,   70,  424,  375,   70,  372,   72,   70,   72,   72,
+      373,   70,   72,  376,  379,   72,  377,   70,   70,   72,
+       70,   70,  424,   70,   70,   72,   72,  378,   72,   72,
+      380,   72,   72,   70,   70,   70,   70,  383,   70,   70,
+      382,   72,   72,   72,   72,   70,   72,   72,   70,  381,
+       70,   70,  424,   72,   70,   70,   72,   70,   72,   72,
+      387,  386,   72,   72,  384,   72,  385,   70,  424,   70,
+
+       70,  424,   70,  424,  389,   72,  388,   72,   72,  390,
+       72,   70,   70,   70,   70,  392,   70,  424,  424,   72,
+       72,   72,   72,  393,   72,  391,  396,  424,   70,   70,
+       70,   70,   70,   70,   70,  394,   72,   72,   72,   72,
+       72,   72,   72,   70,  398,   70,   70,  395,   70,   70,
+       70,   72,   70,   72,   72,  424,   72,   72,   72,  424,
+       72,  399,  403,  397,  404,   70,   70,  400,   70,  401,
+       70,  424,   70,   72,   72,   70,   72,   70,   72,  405,
+       72,  402,   70,   72,  424,   72,  424,   70,   70,   70,
+       72,   70,  406,  424,  407,   72,   72,   72,   70,   72,
+
+       70,  412,   70,  424,   70,   70,   72,  424,   72,  410,
+       72,  408,   72,   72,   70,  409,  424,  413,  414,   70,
+      415,   70,   72,   70,  411,   70,  424,   72,  416,   72,
+       70,   72,  424,   72,  419,   70,  424,   70,   72,  417,
+      418,  424,  424,   72,  420,   72,  424,  424,  421,  424,
+      424,  424,  424,  424,  424,  424,  422,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  423,   53,
+       53,   53,   53,   53,   53,   53,   53,   53,   55,   55,
+       55,   55,   55,   55,   55,   55,   55,   57,   57,   57,
+       57,   57,   57,   57,   57,   57,   60,  424,   60,   65,
+
+       65,   65,   71,   71,  424,   71,  126,  126,  126,  126,
+      424,  126,  126,  126,  126,  127,  127,  127,  127,  127,
+      127,  127,  127,  127,  130,  130,  130,  424,  130,  130,
+      130,  130,  130,  132,  424,  132,  132,  132,  132,  132,
+      132,  132,  136,  424,  424,  424,  424,  424,  136,   72,
+       72,  424,   72,  204,  424,  204,    9,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
 
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424
     } ;
 
-static yyconst flex_int16_t yy_chk[917] =
+static yyconst flex_int16_t yy_chk[1414] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,   11,   11,   12,   12,   25,
-       32,   25,   28,   28,   33,   54,   49,   81,   44,   34,
-       54,   36,  422,   35,   49,   64,   33,   64,   41,   81,
-       33,   32,   42,   33,   34,   35,   32,   37,   34,   35,
-       36,   34,   36,   44,   34,   35,   33,   34,   39,   37,
-
-       41,   40,   36,   72,   42,   43,   37,   59,   59,   37,
-       42,   39,   37,   40,   72,   37,   50,   40,   43,   39,
-       45,   47,   46,   40,   39,  415,   43,  404,   43,   47,
-       43,   50,   45,   43,   46,   48,   47,   46,   50,   73,
-       76,   45,   45,   47,   78,   74,   46,   75,   79,   73,
-       46,   80,   78,   82,   46,   84,   48,   85,   48,   74,
-       86,   75,   76,   83,   87,   73,   89,   88,   75,   85,
-       79,   80,   80,   83,   90,   87,   79,   91,   82,   80,
-       93,   84,   83,   88,   92,   98,   86,   95,   97,   83,
-       99,  101,  102,   89,  100,  105,   90,  106,   95,  107,
-
-       99,   93,   91,   98,  111,  100,   92,  105,  106,   97,
-      110,  102,   99,   95,   95,  108,  109,  112,  101,  113,
-      115,  110,  114,  111,  109,  116,  107,  113,  119,  115,
-      120,  108,  124,  117,  111,  118,  112,  108,  121,  109,
-      115,  114,  117,  109,  112,  122,  120,  118,  138,  121,
-      126,  116,  139,  123,  127,  126,  120,  124,  140,  127,
-      138,  143,  119,  141,  122,  123,  142,  144,  139,  123,
-      145,  141,  146,  147,  140,  142,  142,  148,  150,  149,
-      151,  153,  152,  147,  154,  156,  143,  149,  155,  158,
-      159,  153,  146,  144,  152,  146,  145,  156,  148,  151,
-
-      159,  156,  160,  150,  150,  162,  164,  163,  165,  166,
-      160,  154,  167,  170,  155,  168,  158,  163,  164,  169,
-      165,  166,  171,  173,  174,  162,  167,  168,  172,  177,
-      178,  166,  175,  180,  171,  165,  170,  169,  179,  181,
-      178,  172,  173,  182,  175,  174,  183,  184,  185,  179,
-      177,  187,  180,  189,  192,  191,  196,  193,  195,  194,
-      185,  198,  197,  199,  200,  183,  191,  181,  194,  194,
-      197,  204,  196,  192,  201,  207,  187,  182,  193,  189,
-      194,  184,  195,  200,  205,  206,  209,  211,  199,  198,
-      212,  213,  201,  214,  215,  216,  204,  217,  218,  211,
-
-      207,  214,  215,  219,  209,  205,  206,  213,  220,  221,
-      218,  223,  224,  226,  228,  229,  220,  212,  231,  232,
-      235,  242,  216,  233,  217,  219,  226,  223,  234,  228,
-      237,  245,  246,  250,  235,  247,  221,  249,  251,  253,
-      252,  254,  229,  242,  256,  231,  224,  247,  233,  252,
-      232,  254,  257,  234,  255,  258,  245,  237,  250,  246,
-      257,  260,  253,  249,  251,  261,  255,  258,  262,  263,
-      264,  256,  265,  266,  267,  268,  271,  260,  273,  274,
-      261,  275,  277,  278,  264,  266,  267,  268,  279,  280,
-      282,  283,  284,  285,  277,  286,  262,  263,  279,  265,
-
-      287,  288,  282,  271,  292,  273,  294,  286,  297,  298,
-      278,  274,  283,  296,  300,  275,  280,  284,  285,  301,
-      292,  287,  288,  297,  302,  296,  303,  300,  304,  306,
-      301,  305,  307,  294,  310,  309,  312,  298,  313,  305,
-      315,  317,  314,  316,  318,  324,  313,  303,  325,  328,
-      326,  302,  315,  317,  306,  304,  331,  312,  335,  307,
-      309,  310,  314,  336,  316,  333,  337,  339,  335,  341,
-      318,  343,  344,  346,  325,  326,  328,  333,  348,  324,
-      353,  347,  359,  331,  351,  336,  365,  352,  337,  356,
-      341,  347,  339,  354,  348,  352,  351,  344,  346,  343,
-
-      360,  356,  354,  361,  366,  353,  367,  369,  370,  359,
-      373,  374,  376,  365,  378,  361,  360,  380,  369,  379,
-      381,  384,  389,  382,  387,  390,  378,  367,  373,  391,
-      379,  366,  374,  370,  382,  393,  387,  376,  394,  380,
-      401,  406,  405,  396,  403,  398,  407,  408,  410,  389,
-      394,  411,  412,  381,  391,  384,  396,  390,  398,  413,
-      403,  401,  409,  411,  410,  414,  407,  416,  406,  393,
-      405,  409,  418,  412,  417,  419,  420,  421,  402,  400,
-      399,  408,  397,  395,  413,  392,  417,  416,  388,  386,
-      385,  383,  418,  377,  375,  372,  371,  419,  368,  414,
-
-      364,  420,  363,  362,  358,  357,  355,  350,  349,  421,
-      424,  424,  424,  424,  424,  424,  424,  424,  424,  425,
+        1,    1,    1,    1,    1,    1,   11,   11,   12,   12,
+       25,   32,   25,   28,   28,   33,   38,   35,   49,   32,
+       64,   34,   64,   33,   38,   35,   49,   49,   33,   34,
+       35,   36,   33,   32,   35,   33,  322,   34,   32,   36,
+       35,   34,   37,  271,   34,   37,   39,   34,   33,   37,
+
+       34,   36,   37,   36,   39,   37,   41,   40,   37,   42,
+       39,   43,  203,   36,   41,   40,   54,   42,   39,   43,
+       40,   54,  127,   39,   40,   43,   44,  127,   45,   41,
+       40,   46,   42,   43,   44,   43,   45,   43,   42,   46,
+       43,   45,   59,   59,   46,   47,  135,   46,  134,   48,
+       45,   45,   44,   47,   47,   71,   46,   48,   50,  133,
+       46,   47,  131,   71,   46,   72,   50,   73,   47,   74,
+       75,   48,   70,   48,   50,   73,   76,   74,   75,   73,
+       74,   50,   77,  128,   76,   75,   78,   80,  128,   82,
+       77,   76,   79,   65,   78,   80,   74,   82,   76,   81,
+
+       79,   79,   82,   83,   84,   77,   85,   81,   63,   86,
+       80,   83,   84,   58,   85,   84,   80,   86,   87,   56,
+       81,   81,   86,   30,   84,   26,   87,   88,   81,   83,
+       89,   84,   90,   85,   91,   88,   92,   24,   89,   88,
+       90,   93,   91,   94,   92,   87,   95,   89,   97,   93,
+       98,   94,   23,    9,   95,   96,   97,   91,   98,    8,
+       90,   99,   92,   96,   93,   94,  100,   96,  102,   99,
+      103,  104,   98,  101,  100,    7,  102,  100,  103,  104,
+       99,  101,   96,   96,  105,  101,  106,  108,    6,  100,
+      103,    5,  105,  107,  106,  108,  102,    4,  110,  106,
+
+      109,  107,  111,    3,  112,  107,  110,  110,  109,    0,
+      111,  113,  112,  115,  111,  108,    0,  109,    0,  113,
+      114,  115,  110,  109,  112,    0,  110,    0,  114,  114,
+      116,  113,    0,  115,  117,  112,  118,  119,  116,  113,
+      116,  120,  117,    0,  118,  119,  118,  121,  122,  120,
+      119,  116,    0,    0,  124,  121,  122,  123,  125,    0,
+      122,  117,  124,    0,  121,  123,  125,  124,    0,    0,
+      137,  124,  138,  139,  121,  140,  120,  123,  137,  141,
+      138,  139,  142,  140,  125,  144,  139,  141,    0,  143,
+      142,  142,  140,  144,  145,  146,  141,  143,  148,  143,
+
+      143,    0,  145,  146,  147,  149,  148,  150,    0,  148,
+      151,  144,  147,  149,    0,  150,  150,    0,  151,    0,
+        0,  145,  146,  152,  154,  147,  153,  149,  147,    0,
+      155,  152,  154,  156,  153,  154,  151,  151,  155,  153,
+      157,  156,  158,  152,  159,    0,  161,    0,  157,    0,
+      158,  160,  159,  157,  161,  161,  162,  157,  155,  160,
+      156,  163,  160,  164,  162,  165,    0,  166,  167,  163,
+        0,  164,  159,  165,  164,  166,  167,  168,  165,  170,
+      166,  167,  163,    0,    0,  168,  169,  170,  171,  172,
+        0,  167,  168,  173,  169,  166,  171,  172,  170,  169,
+
+      174,  173,  172,  175,    0,  176,  177,  173,  174,  178,
+        0,  175,  171,  176,  177,  179,  180,  178,  176,  181,
+      174,  182,  183,  179,  180,  175,  179,  181,  180,  182,
+      183,  178,  184,  185,  186,  187,  188,  189,  190,  181,
+      184,  185,  186,  187,  188,  189,  190,  186,  191,    0,
+      182,  192,  184,  193,    0,    0,  191,  183,  194,  192,
+        0,  193,  188,  192,  195,  190,  194,    0,  185,  196,
+      197,  199,  195,  193,  195,  195,  198,  196,  197,  199,
+      194,  200,  201,    0,  198,  198,  195,  197,  205,  200,
+      201,  202,    0,  206,  196,  207,  205,  208,  209,  202,
+
+      199,  206,  201,  207,  211,  208,  209,  200,  210,    0,
+      202,  212,  211,  213,  205,  206,  210,  207,  214,  212,
+      215,  213,  216,  208,  212,  217,  214,  210,  215,  215,
+      216,  216,  218,  217,  219,  214,  220,  221,    0,    0,
+      218,  213,  219,  222,  220,  221,  221,  219,  223,  224,
+      225,  222,    0,  217,  226,  227,  223,  224,  225,  220,
+      218,    0,  226,  227,  228,  229,  224,  230,  231,  227,
+      232,  222,  228,  229,  233,  230,  231,    0,  232,  234,
+      237,  229,  233,  235,  236,  225,  238,  234,  237,  239,
+        0,  235,  236,  240,  238,  230,  241,  239,  232,  236,
+
+      242,  240,  243,  244,  241,  234,  233,  245,  242,  235,
+      243,  244,  246,  247,  238,  245,  248,    0,  249,  250,
+      246,  247,  251,  252,  248,  243,  249,  250,  254,  248,
+      251,  252,  253,    0,    0,    0,  254,    0,  246,  257,
+      253,  247,  253,  255,    0,  256,  250,  257,  251,  259,
+      252,  255,  254,  256,  255,  258,    0,  259,  256,    0,
+      260,  261,  259,  258,  258,  262,  263,  257,  260,  261,
+        0,  264,  265,  262,  263,  266,  267,  268,  261,  264,
+      265,  262,    0,  266,  267,  268,  269,  265,  270,  267,
+      268,    0,    0,  272,  269,  263,  270,  273,  274,  269,
+
+      264,  272,  275,  266,  276,  273,  274,  277,  279,  278,
+      275,    0,  276,    0,    0,  277,  279,  278,    0,  280,
+      281,  272,  278,  282,  283,  284,  274,  280,  281,    0,
+      280,  282,  283,  284,  285,  275,  279,  283,  286,  276,
+        0,  287,  285,  288,  289,  290,  286,  284,  281,  287,
+      291,  288,  289,  290,  287,  292,    0,    0,  291,  293,
+      285,  294,  295,  292,  286,  288,  289,  293,    0,  294,
+      295,  296,  297,  298,  299,  300,  293,    0,  301,  296,
+      297,  298,  299,  300,    0,  297,  301,  302,  303,  298,
+      295,    0,  301,  304,  305,  302,  303,  306,    0,  302,
+
+      307,  304,  305,  299,  308,  306,  306,    0,  307,  309,
+      310,  311,  308,  312,    0,  304,  303,  309,  310,  311,
+      313,  312,  305,  315,    0,  314,  307,  316,  313,  317,
+      318,  315,  308,  314,  314,  316,  310,  317,  318,  311,
+      316,  319,  313,  318,  315,  320,  321,  323,  324,  319,
+      325,  317,  326,  320,  321,  323,  324,  327,  325,  328,
+      326,  329,  330,  331,  332,  327,  333,  328,  319,  329,
+      330,  331,  332,  334,  333,    0,  335,    0,    0,  326,
+      336,  334,  337,  327,  335,  325,  334,  338,  336,  329,
+      337,  336,  332,  339,  340,  338,  341,    0,  343,  342,
+
+      344,  339,  340,  346,  341,  337,  343,  342,  344,  345,
+      338,  346,    0,    0,  347,  348,  349,  345,    0,  350,
+      340,  342,  347,  348,  349,    0,  348,  350,  351,  344,
+      352,  354,    0,  349,  355,  345,  351,  353,  352,  354,
+      347,  356,  355,  352,  355,  353,  353,  357,  358,  356,
+      359,  360,    0,  361,  362,  357,  358,  354,  359,  360,
+      357,  361,  362,  363,  364,  365,  366,  362,  367,  368,
+      361,  363,  364,  365,  366,  369,  367,  368,  370,  360,
+      371,  372,    0,  369,  373,  374,  370,  375,  371,  372,
+      370,  368,  373,  374,  366,  375,  367,  376,    0,  377,
+
+      378,    0,  379,    0,  374,  376,  371,  377,  378,  375,
+      379,  380,  381,  382,  383,  379,  384,    0,    0,  380,
+      381,  382,  383,  380,  384,  377,  383,    0,  385,  386,
+      387,  388,  389,  390,  391,  381,  385,  386,  387,  388,
+      389,  390,  391,  392,  388,  393,  394,  382,  396,  395,
+      397,  392,  398,  393,  394,    0,  396,  395,  397,    0,
+      398,  390,  395,  385,  397,  399,  400,  391,  401,  392,
+      402,    0,  403,  399,  400,  405,  401,  404,  402,  399,
+      403,  394,  406,  405,    0,  404,    0,  407,  408,  409,
+      406,  410,  402,    0,  404,  407,  408,  409,  413,  410,
+
+      411,  410,  414,    0,  415,  412,  413,    0,  411,  408,
+      414,  406,  415,  412,  416,  407,    0,  411,  412,  417,
+      413,  418,  416,  419,  409,  420,    0,  417,  414,  418,
+      421,  419,    0,  420,  418,  422,    0,  423,  421,  415,
+      417,    0,    0,  422,  419,  423,    0,    0,  420,    0,
+        0,    0,    0,    0,    0,    0,  421,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,  422,  425,
       425,  425,  425,  425,  425,  425,  425,  425,  426,  426,
-      426,  426,  426,  426,  426,  426,  426,  427,  345,  427,
-      428,  428,  428,  429,  429,  342,  429,  430,  430,  430,
-      430,  340,  430,  430,  430,  430,  431,  431,  431,  431,
-      431,  431,  431,  431,  431,  432,  432,  432,  338,  432,
-      432,  432,  432,  432,  433,  334,  433,  433,  433,  433,
-      433,  433,  433,  434,  332,  330,  329,  327,  323,  434,
-      435,  322,  435,  321,  320,  319,  311,  308,  299,  295,
-
-      293,  291,  290,  289,  281,  276,  272,  270,  269,  259,
-      248,  244,  243,  241,  240,  239,  238,  236,  230,  227,
-      225,  222,  210,  208,  202,  190,  188,  186,  176,  161,
-      157,  137,  136,  134,  133,  132,  130,  104,  103,   96,
-       94,   77,   71,   70,   65,   63,   58,   56,   38,   30,
-       26,   24,   23,    9,    8,    7,    6,    5,    4,    3,
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
+      426,  426,  426,  426,  426,  426,  426,  427,  427,  427,
+      427,  427,  427,  427,  427,  427,  428,    0,  428,  429,
+
+      429,  429,  430,  430,    0,  430,  431,  431,  431,  431,
+        0,  431,  431,  431,  431,  432,  432,  432,  432,  432,
+      432,  432,  432,  432,  433,  433,  433,    0,  433,  433,
+      433,  433,  433,  434,    0,  434,  434,  434,  434,  434,
+      434,  434,  435,    0,    0,    0,    0,    0,  435,  436,
+      436,    0,  436,  437,    0,  437,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
 
-      423,  423,  423,  423,  423,  423,  423,  423,  423,  423,
-      423,  423,  423,  423,  423,  423
+      424,  424,  424,  424,  424,  424,  424,  424,  424,  424,
+      424,  424,  424
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -847,6 +966,7 @@ Created 12/14/1997 Heikki Tuuri
 #define realloc(P, A)	ut_realloc(P, A)
 #define exit(A) 	ut_error
 
+/* Note: We cast &result to int* from yysize_t* */
 #define YY_INPUT(buf, result, max_size) \
 	(result = pars_get_lex_chars(buf, max_size))
 
@@ -883,7 +1003,7 @@ string_append(
 
 
 
-#line 887 "lexyy.cc"
+#line 1006 "lexyy.cc"
 
 #define INITIAL 0
 #define comment 1
@@ -965,7 +1085,12 @@ static int input (void );
 
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
 #define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -973,7 +1098,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -984,7 +1109,7 @@ static int input (void );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		yy_size_t n; \
+		size_t n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -1069,7 +1194,7 @@ YY_DECL
 #line 112 "pars0lex.l"
 
 
-#line 1073 "lexyy.cc"
+#line 1197 "lexyy.cc"
 
 	if ( !(yy_init) )
 		{
@@ -1122,13 +1247,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 424 )
+				if ( yy_current_state >= 425 )
 					yy_c = yy_meta[(unsigned int) yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 423 );
+		while ( yy_current_state != 424 );
 		yy_cp = (yy_last_accepting_cpos);
 		yy_current_state = (yy_last_accepting_state);
 
@@ -2109,7 +2234,7 @@ YY_RULE_SETUP
 #line 691 "pars0lex.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 2113 "lexyy.cc"
+#line 2237 "lexyy.cc"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(comment):
 case YY_STATE_EOF(quoted):
@@ -2299,7 +2424,7 @@ static int yy_get_next_buffer (void)
 
 	else
 		{
-			yy_size_t num_to_read =
+			int num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
@@ -2313,16 +2438,16 @@ static int yy_get_next_buffer (void)
 
 			if ( b->yy_is_our_buffer )
 				{
-				yy_size_t new_size = b->yy_buf_size * 2;
+				int new_size = b->yy_buf_size * 2;
 
 				if ( new_size <= 0 )
 					b->yy_buf_size += b->yy_buf_size / 8;
 				else
 					b->yy_buf_size *= 2;
 
-				b->yy_ch_buf = (char*)
+				b->yy_ch_buf = (char *)
 					/* Include room in for 2 EOB chars. */
-					yyrealloc((void*) b->yy_ch_buf,b->yy_buf_size + 2  );
+					yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
 				}
 			else
 				/* Can't grow it, we don't own it. */
@@ -2344,7 +2469,7 @@ static int yy_get_next_buffer (void)
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), num_to_read );
+			(yy_n_chars), (size_t) num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -2371,7 +2496,7 @@ static int yy_get_next_buffer (void)
 	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 		/* Extend the array by 50%, plus the number we really need. */
 		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
-		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char*) yyrealloc((void*) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
 	}
@@ -2387,7 +2512,7 @@ static int yy_get_next_buffer (void)
 
 /* yy_get_previous_state - get the state just before the EOB char was reached */
 
-    static yy_state_type yy_get_previous_state (void)
+     yy_state_type yy_get_previous_state (void)
 {
 	register yy_state_type yy_current_state;
 	register char *yy_cp;
@@ -2405,7 +2530,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 424 )
+			if ( yy_current_state >= 425 )
 				yy_c = yy_meta[(unsigned int) yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2419,7 +2544,7 @@ static int yy_get_next_buffer (void)
  * synopsis
  *	next_state = yy_try_NUL_trans( current_state );
  */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 {
 	register int yy_is_jam;
     	register char *yy_cp = (yy_c_buf_p);
@@ -2433,11 +2558,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 424 )
+		if ( yy_current_state >= 425 )
 			yy_c = yy_meta[(unsigned int) yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 423);
+	yy_is_jam = (yy_current_state == 424);
 
 	return yy_is_jam ? 0 : yy_current_state;
 }
@@ -2466,7 +2591,7 @@ static int yy_get_next_buffer (void)
 
 		else
 			{ /* need more input */
-			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+			int offset = (int)((yy_c_buf_p) - (yytext_ptr));
 			++(yy_c_buf_p);
 
 			switch ( yy_get_next_buffer(  ) )
@@ -2490,7 +2615,7 @@ static int yy_get_next_buffer (void)
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( yywrap( ) )
-						return 0;
+						return EOF;
 
 					if ( ! (yy_did_buffer_switch_on_eof) )
 						YY_NEW_FILE;
@@ -2508,7 +2633,7 @@ static int yy_get_next_buffer (void)
 			}
 		}
 
-	c = *(unsigned char*) (yy_c_buf_p);	/* cast for 8-bit char's */
+	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
 	*(yy_c_buf_p) = '\0';	/* preserve yytext */
 	(yy_hold_char) = *++(yy_c_buf_p);
 
@@ -2518,7 +2643,7 @@ static int yy_get_next_buffer (void)
 
 /** Immediately switch to a different input stream.
  * @param input_file A readable stream.
- *
+ * 
  * @note This function does not reset the start condition to @c INITIAL .
  */
     void yyrestart  (FILE * input_file )
@@ -2536,7 +2661,7 @@ static int yy_get_next_buffer (void)
 
 /** Switch to a different input buffer.
  * @param new_buffer The new input buffer.
- *
+ * 
  */
     __attribute__((unused)) static void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
 {
@@ -2580,7 +2705,7 @@ static void yy_load_buffer_state  (void)
 /** Allocate and initialize an input buffer state.
  * @param file A readable stream.
  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- *
+ * 
  * @return the allocated buffer state.
  */
     static YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
@@ -2596,7 +2721,7 @@ static void yy_load_buffer_state  (void)
 	/* yy_ch_buf has to be 2 characters longer than the size given because
 	 * we need to put in 2 end-of-buffer characters.
 	 */
-	b->yy_ch_buf = (char*) yyalloc(b->yy_buf_size + 2  );
+	b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
 	if ( ! b->yy_ch_buf )
 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
@@ -2609,9 +2734,9 @@ static void yy_load_buffer_state  (void)
 
 /** Destroy the buffer.
  * @param b a buffer created with yy_create_buffer()
- *
+ * 
  */
-    void yy_delete_buffer (YY_BUFFER_STATE  b )
+     void yy_delete_buffer (YY_BUFFER_STATE  b )
 {
 
 	if ( ! b )
@@ -2621,20 +2746,20 @@ static void yy_load_buffer_state  (void)
 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
 	if ( b->yy_is_our_buffer )
-		yyfree((void*) b->yy_ch_buf  );
+		yyfree((void *) b->yy_ch_buf  );
 
-	yyfree((void*) b  );
+	yyfree((void *) b  );
 }
 
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a yyrestart() or at EOF.
  */
-    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
+     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
 {
 	int oerrno = errno;
-
+ 
 	yy_flush_buffer(b );
 
 	b->yy_input_file = file;
@@ -2650,13 +2775,13 @@ static void yy_load_buffer_state  (void)
     }
 
         b->yy_is_interactive = 0;
-
+    
 	errno = oerrno;
 }
 
 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- *
+ * 
  */
     void yy_flush_buffer (YY_BUFFER_STATE  b )
 {
@@ -2685,7 +2810,7 @@ static void yy_load_buffer_state  (void)
  *  the current state. This function will allocate the stack
  *  if necessary.
  *  @param new_buffer The new state.
- *
+ *  
  */
 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
 {
@@ -2715,7 +2840,7 @@ void yypush_buffer_state (YY_BUFFER_STAT
 
 /** Removes and deletes the top of the stack, if present.
  *  The next element becomes the new top.
- *
+ *  
  */
 void yypop_buffer_state (void)
 {
@@ -2738,8 +2863,8 @@ void yypop_buffer_state (void)
  */
 static void yyensure_buffer_stack (void)
 {
-	yy_size_t num_to_alloc;
-
+	int num_to_alloc;
+    
 	if (!(yy_buffer_stack)) {
 
 		/* First allocation is just for 2 elements, since we don't know if this
@@ -2747,7 +2872,7 @@ static void yyensure_buffer_stack (void)
 		 * immediate realloc on the next call.
          */
 		num_to_alloc = 1;
-		(yy_buffer_stack) = (struct yy_buffer_state**) yyalloc
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
 								(num_to_alloc * sizeof(struct yy_buffer_state*)
 								);
 		if ( ! (yy_buffer_stack) )
@@ -2766,7 +2891,7 @@ static void yyensure_buffer_stack (void)
 		int grow_size = 8 /* arbitrary grow size */;
 
 		num_to_alloc = (yy_buffer_stack_max) + grow_size;
-		(yy_buffer_stack) = (struct yy_buffer_state**) yyrealloc
+		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
 								((yy_buffer_stack),
 								num_to_alloc * sizeof(struct yy_buffer_state*)
 								);
@@ -2809,7 +2934,7 @@ static void yy_fatal_error (yyconst char
 /* Accessor  methods (get/set functions) to struct members. */
 
 /** Get the current line number.
- *
+ * 
  */
 int yyget_lineno  (void)
 {
@@ -2818,7 +2943,7 @@ int yyget_lineno  (void)
 }
 
 /** Get the input stream.
- *
+ * 
  */
 FILE *yyget_in  (void)
 {
@@ -2826,7 +2951,7 @@ FILE *yyget_in  (void)
 }
 
 /** Get the output stream.
- *
+ * 
  */
 FILE *yyget_out  (void)
 {
@@ -2834,7 +2959,7 @@ FILE *yyget_out  (void)
 }
 
 /** Get the length of the current token.
- *
+ * 
  */
 yy_size_t yyget_leng  (void)
 {
@@ -2842,7 +2967,7 @@ yy_size_t yyget_leng  (void)
 }
 
 /** Get the current token.
- *
+ * 
  */
 
 char *yyget_text  (void)
@@ -2852,18 +2977,18 @@ char *yyget_text  (void)
 
 /** Set the current line number.
  * @param line_number
- *
+ * 
  */
 void yyset_lineno (int  line_number )
 {
-
+ 
     yylineno = line_number;
 }
 
 /** Set the input stream. This does not discard the current
  * input buffer.
  * @param in_str A readable stream.
- *
+ * 
  * @see yy_switch_to_buffer
  */
 void yyset_in (FILE *  in_str )
@@ -2895,7 +3020,7 @@ static int yy_init_globals (void)
     (yy_buffer_stack) = 0;
     (yy_buffer_stack_top) = 0;
     (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = (char*) 0;
+    (yy_c_buf_p) = (char *) 0;
     (yy_init) = 0;
     (yy_start) = 0;
 
@@ -2904,8 +3029,8 @@ static int yy_init_globals (void)
     yyin = stdin;
     yyout = stdout;
 #else
-    yyin = (FILE*) 0;
-    yyout = (FILE*) 0;
+    yyin = (FILE *) 0;
+    yyout = (FILE *) 0;
 #endif
 
     /* For future reference: Set errno on error, since we are called by
@@ -2917,7 +3042,7 @@ static int yy_init_globals (void)
 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
 __attribute__((unused)) static int yylex_destroy  (void)
 {
-
+ 
     /* Pop the buffer stack, destroying each element. */
 	while(YY_CURRENT_BUFFER){
 		yy_delete_buffer(YY_CURRENT_BUFFER  );
@@ -2962,24 +3087,24 @@ static int yy_flex_strlen (yyconst char 
 
 void *yyalloc (yy_size_t  size )
 {
-	return (void*) malloc( size );
+	return (void *) malloc( size );
 }
 
 void *yyrealloc  (void * ptr, yy_size_t  size )
 {
-	/* The cast to (char*) in the following accommodates both
+	/* The cast to (char *) in the following accommodates both
 	 * implementations that use char* generic pointers, and those
 	 * that use void* generic pointers.  It works with the latter
 	 * because both ANSI C and C++ allow castless assignment from
 	 * any pointer type to void*, and deal with argument conversions
 	 * as though doing an assignment.
 	 */
-	return (void*) realloc( (char*) ptr, size );
+	return (void *) realloc( (char *) ptr, size );
 }
 
 void yyfree (void * ptr )
 {
-	free( (char*) ptr );	/* see yyrealloc() for (char*) cast */
+	free( (char*) ptr );	/* see yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"

=== modified file 'storage/innobase/pars/pars0lex.l'
--- a/storage/innobase/pars/pars0lex.l	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/pars/pars0lex.l	revid:mikael.ronstrom@stripped
@@ -102,7 +102,7 @@ string_append(
 
 DIGIT		[0-9]
 ID		[a-z_A-Z][a-z_A-Z0-9]*
-TABLE_NAME	[a-z_A-Z][a-z_A-Z0-9]*\/(#sql-|[a-z_A-Z])[a-z_A-Z0-9]*
+TABLE_NAME	[a-z_A-Z][@a-z_A-Z0-9]*\/(#sql-|[a-z_A-Z])[a-z_A-Z0-9]*
 BOUND_LIT	\:[a-z_A-Z0-9]+
 BOUND_ID	\$[a-z_A-Z0-9]+
 

=== modified file 'storage/innobase/trx/trx0trx.cc'
--- a/storage/innobase/trx/trx0trx.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/innobase/trx/trx0trx.cc	revid:mikael.ronstrom@stripped
@@ -205,6 +205,7 @@ trx_free(
 	ut_a(trx->magic_n == TRX_MAGIC_N);
 	ut_ad(!trx->in_ro_trx_list);
 	ut_ad(!trx->in_rw_trx_list);
+	ut_ad(!trx->in_mysql_trx_list);
 
 	mutex_free(&trx->undo_mutex);
 

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/myisam/ha_myisam.cc	revid:mikael.ronstrom@stripped
@@ -1029,6 +1029,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK
   int error=0;
   uint local_testflag=param.testflag;
   bool optimize_done= !do_optimize, statistics_done=0;
+  bool has_old_locks= thd->locked_tables_mode || file->lock_type != F_UNLCK;
   const char *old_proc_info=thd->proc_info;
   char fixed_name[FN_REFLEN];
   MYISAM_SHARE* share = file->s;
@@ -1047,8 +1048,8 @@ int ha_myisam::repair(THD *thd, MI_CHECK
   // Release latches since this can take a long time
   ha_release_temporary_latches(thd);
 
-  // Don't lock tables if we have used LOCK TABLE
-  if (! thd->locked_tables_mode &&
+  // Don't lock tables if we have used LOCK TABLE or already locked.
+  if (!has_old_locks &&
       mi_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))
   {
     char errbuf[MYSYS_STRERROR_SIZE];
@@ -1176,7 +1177,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK
     update_state_info(&param, file, 0);
   }
   thd_proc_info(thd, old_proc_info);
-  if (! thd->locked_tables_mode)
+  if (!has_old_locks)
     mi_lock_database(file,F_UNLCK);
   DBUG_RETURN(error ? HA_ADMIN_FAILED :
 	      !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK);

=== modified file 'storage/perfschema/gen_pfs_lex_token.cc'
--- a/storage/perfschema/gen_pfs_lex_token.cc	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/storage/perfschema/gen_pfs_lex_token.cc	revid:mikael.ronstrom@stripped
@@ -243,7 +243,7 @@ void print_tokens()
 int main(int argc,char **argv)
 {
   puts("/*");
-  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2011"));
+  puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2011, 2012"));
   puts("*/");
 
   printf("/*\n");

=== modified file 'strings/decimal.c'
--- a/strings/decimal.c	revid:mikael@dator9-20120414142013-g7hii2fn16q9a2ye
+++ b/strings/decimal.c	revid:mikael.ronstrom@stripped
@@ -1167,6 +1167,17 @@ int double2lldiv_t(double nr, lldiv_t *l
   lld->quot= (longlong) (nr > 0 ? floor(nr) : ceil(nr));
   /* Multiply reminder to 10^9 and store into "rem" */
   lld->rem= (longlong) rint((nr - (double) lld->quot) * 1000000000);
+  /*
+    Sometimes the expression "(double) 0.999999999xxx * (double) 10e9"
+    gives 1,000,000,000 instead of 999,999,999 due to lack of double precision.
+    The callers do not expect lld->rem to be greater than 999,999,999.
+    Let's catch this corner case and put the "nanounit" (e.g. nanosecond)
+    value in ldd->rem back into the valid range.
+  */
+  if (lld->rem > 999999999LL)
+    lld->rem= 999999999LL;
+  else if (lld->rem < -999999999LL)
+    lld->rem= -999999999LL;
   return E_DEC_OK;
 }
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (mikael.ronstrom:3879 to 3882) Mikael Ronstrom23 Apr