summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-04-15 15:09:22 +0200
committerSergei Golubchik <sergii@pisem.net>2013-04-15 15:09:22 +0200
commita9035be5b7a7b3865ddb4ef34a5d0cfc65dfc254 (patch)
treea9df7341e91623f62fe37cd47fce139d8888fc95
parent3a1c91d87d69ef243b3e78be6089102cafef0a8e (diff)
parentf57ecb7786177e0af3b1e3ec94302720b2e0f967 (diff)
downloadmariadb-git-a9035be5b7a7b3865ddb4ef34a5d0cfc65dfc254.tar.gz
10.0-base merge
-rw-r--r--.bzrignore1
-rw-r--r--CMakeLists.txt6
-rw-r--r--INSTALL-SOURCE8255
-rw-r--r--client/mysql.cc18
-rw-r--r--client/mysqlbinlog.cc171
-rw-r--r--client/mysqldump.c17
-rw-r--r--client/mysqltest.cc12
-rw-r--r--cmake/cpack_rpm.cmake34
-rw-r--r--cmake/install_layout.cmake10
-rw-r--r--cmake/maintainer.cmake4
-rw-r--r--cmake/os/WindowsCache.cmake1
-rw-r--r--cmake/plugin.cmake8
-rw-r--r--config.h.cmake1
-rw-r--r--configure.cmake12
-rw-r--r--extra/my_print_defaults.c48
-rw-r--r--extra/yassl/src/handshake.cpp8
-rw-r--r--include/hash.h12
-rw-r--r--include/maria.h21
-rw-r--r--include/my_base.h6
-rw-r--r--include/my_dir.h5
-rw-r--r--include/my_global.h29
-rw-r--r--include/my_sys.h3
-rw-r--r--include/myisam.h21
-rw-r--r--include/myisamchk.h4
-rw-r--r--include/mysql/plugin_audit.h.pp8
-rw-r--r--include/mysql/plugin_auth.h4
-rw-r--r--include/mysql/plugin_auth.h.pp12
-rw-r--r--include/mysql/plugin_auth_common.h2
-rw-r--r--include/mysql/plugin_ftparser.h.pp8
-rw-r--r--include/mysql/service_my_snprintf.h1
-rw-r--r--include/mysql/service_thread_scheduler.h65
-rw-r--r--include/mysql/services.h4
-rw-r--r--include/mysql_com.h27
-rw-r--r--include/mysqld_default_groups.h8
-rw-r--r--include/probes_mysql_nodtrace.h115
-rw-r--r--include/service_versions.h4
-rw-r--r--include/thread_pool_priv.h1
-rw-r--r--include/violite.h6
-rw-r--r--include/welcome_copyright_notice.h4
-rw-r--r--libmysql/CMakeLists.txt24
-rw-r--r--libmysql/get_password.c33
-rw-r--r--libmysql/libmysql_rpm_version.in16
-rw-r--r--libmysqld/lib_sql.cc2
-rw-r--r--libservices/CMakeLists.txt3
-rw-r--r--libservices/HOWTO2
-rw-r--r--libservices/debug_sync_service.c2
-rw-r--r--libservices/my_thread_scheduler_service.c20
-rw-r--r--libservices/progress_report_service.c2
-rw-r--r--libservices/thd_alloc_service.c2
-rw-r--r--libservices/thd_wait_service.c2
-rw-r--r--mysql-test/CMakeLists.txt6
-rw-r--r--mysql-test/collections/default.daily2
-rw-r--r--mysql-test/collections/default.experimental5
-rw-r--r--mysql-test/collections/default.push11
-rw-r--r--mysql-test/collections/default.release.in8
-rw-r--r--mysql-test/disabled.def2
-rw-r--r--mysql-test/include/get_binlog_dump_thread_id.inc22
-rw-r--r--mysql-test/include/have_debug_sync.inc6
-rw-r--r--mysql-test/include/have_semisync.inc4
-rw-r--r--mysql-test/include/have_semisync.opt4
-rw-r--r--mysql-test/include/have_semisync_plugin.inc15
-rw-r--r--mysql-test/include/mix1.inc7
-rw-r--r--mysql-test/include/support_long_file_names.inc37
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt2
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc15
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.pl166
-rw-r--r--mysql-test/lib/mtr_cases.pm15
-rw-r--r--mysql-test/lib/mtr_report.pm12
-rwxr-xr-xmysql-test/mysql-test-run.pl161
-rw-r--r--mysql-test/r/alter_table.result48
-rw-r--r--mysql-test/r/alter_table_trans.result2
-rw-r--r--mysql-test/r/bug13633383.result10
-rw-r--r--mysql-test/r/cache_temporal_4265.result10
-rw-r--r--mysql-test/r/cast.result20
-rw-r--r--mysql-test/r/create.result37
-rw-r--r--mysql-test/r/date_formats.result2
-rw-r--r--mysql-test/r/ddl_i18n_koi8r.result16
-rw-r--r--mysql-test/r/ddl_i18n_utf8.result16
-rw-r--r--mysql-test/r/derived.result13
-rw-r--r--mysql-test/r/derived_view.result51
-rw-r--r--mysql-test/r/drop.result2
-rw-r--r--mysql-test/r/dyncol.result91
-rw-r--r--mysql-test/r/fulltext.result11
-rw-r--r--mysql-test/r/fulltext_derived_4316.result8
-rw-r--r--mysql-test/r/func_date_add.result6
-rw-r--r--mysql-test/r/func_group.result13
-rw-r--r--mysql-test/r/func_group_innodb.result15
-rw-r--r--mysql-test/r/func_misc.result221
-rw-r--r--mysql-test/r/func_sapdb.result4
-rw-r--r--mysql-test/r/func_str.result40
-rw-r--r--mysql-test/r/func_time.result18
-rw-r--r--mysql-test/r/gis-rtree.result4
-rw-r--r--mysql-test/r/gis.result137
-rw-r--r--mysql-test/r/grant4.result2
-rw-r--r--mysql-test/r/group_by.result244
-rw-r--r--mysql-test/r/group_min_max.result104
-rw-r--r--mysql-test/r/group_min_max_innodb.result2
-rw-r--r--mysql-test/r/having.result4
-rw-r--r--mysql-test/r/information_schema-big.result2
-rw-r--r--mysql-test/r/information_schema.result4
-rw-r--r--mysql-test/r/information_schema_all_engines.result10
-rw-r--r--mysql-test/r/innodb_ext_key.result94
-rw-r--r--mysql-test/r/innodb_mysql_sync.result4
-rw-r--r--mysql-test/r/join.result41
-rw-r--r--mysql-test/r/join_cache.result2
-rw-r--r--mysql-test/r/join_nested.result22
-rw-r--r--mysql-test/r/join_nested_jcl6.result24
-rw-r--r--mysql-test/r/join_outer.result2
-rw-r--r--mysql-test/r/join_outer_innodb.result292
-rw-r--r--mysql-test/r/join_outer_jcl6.result2
-rw-r--r--mysql-test/r/keywords.result6
-rw-r--r--mysql-test/r/log_tables.result2
-rw-r--r--mysql-test/r/lowercase_table2.result2
-rw-r--r--mysql-test/r/mdev316.result2
-rw-r--r--mysql-test/r/mdl_sync.result2
-rw-r--r--mysql-test/r/merge.result209
-rw-r--r--mysql-test/r/multi_update.result53
-rw-r--r--mysql-test/r/myisam-metadata.result12
-rw-r--r--mysql-test/r/myisam-system.result12
-rw-r--r--mysql-test/r/myisam.result31
-rw-r--r--mysql-test/r/mysql.result2
-rw-r--r--mysql-test/r/mysql_client_test.result1
-rw-r--r--mysql-test/r/mysql_client_test_nonblock.result1
-rw-r--r--mysql-test/r/mysqlbinlog-innodb.result4
-rw-r--r--mysql-test/r/mysqlbinlog.result32
-rw-r--r--mysql-test/r/mysqlcheck.result5
-rw-r--r--mysql-test/r/mysqld--help,win.rdiff64
-rw-r--r--mysql-test/r/mysqld--help.result27
-rw-r--r--mysql-test/r/mysqldump.result24
-rw-r--r--mysql-test/r/mysqlslap.result2
-rw-r--r--mysql-test/r/partition.result22
-rw-r--r--mysql-test/r/partition_debug_sync.result7
-rw-r--r--mysql-test/r/partition_disabled.result2
-rw-r--r--mysql-test/r/partition_example.result4
-rw-r--r--mysql-test/r/partition_innodb_plugin.result2
-rw-r--r--mysql-test/r/partition_myisam.result1
-rw-r--r--mysql-test/r/partition_not_windows.result2
-rw-r--r--mysql-test/r/partition_pruning.result3
-rw-r--r--mysql-test/r/plugin.result46
-rw-r--r--mysql-test/r/plugin_auth.result2
-rw-r--r--mysql-test/r/plugin_auth_qa_2.result6
-rw-r--r--mysql-test/r/plugin_auth_qa_3.result2
-rw-r--r--mysql-test/r/ps_11bugs.result2
-rw-r--r--mysql-test/r/ps_1general.result2
-rw-r--r--mysql-test/r/quick_select_4161.result31
-rw-r--r--mysql-test/r/rename.result10
-rw-r--r--mysql-test/r/row.result4
-rw-r--r--mysql-test/r/schema.result2
-rw-r--r--mysql-test/r/select.result20
-rw-r--r--mysql-test/r/select_jcl6.result20
-rw-r--r--mysql-test/r/select_pkeycache.result20
-rw-r--r--mysql-test/r/show_check.result2
-rw-r--r--mysql-test/r/show_explain.result6
-rw-r--r--mysql-test/r/str_to_datetime_457.result4
-rw-r--r--mysql-test/r/subselect.result14
-rw-r--r--mysql-test/r/subselect3.result4
-rw-r--r--mysql-test/r/subselect3_jcl6.result4
-rw-r--r--mysql-test/r/subselect4.result24
-rw-r--r--mysql-test/r/subselect_exists2in.result865
-rw-r--r--mysql-test/r/subselect_exists2in_costmat.result103
-rw-r--r--mysql-test/r/subselect_exists_to_in.result7021
-rw-r--r--mysql-test/r/subselect_innodb.result2
-rw-r--r--mysql-test/r/subselect_mat.result2
-rw-r--r--mysql-test/r/subselect_mat_cost_bugs.result2
-rw-r--r--mysql-test/r/subselect_no_mat.result16
-rw-r--r--mysql-test/r/subselect_no_opts.result8
-rw-r--r--mysql-test/r/subselect_no_scache.result14
-rw-r--r--mysql-test/r/subselect_no_semijoin.result8
-rw-r--r--mysql-test/r/subselect_sj.result38
-rw-r--r--mysql-test/r/subselect_sj2.result2
-rw-r--r--mysql-test/r/subselect_sj2_jcl6.result2
-rw-r--r--mysql-test/r/subselect_sj2_mat.result266
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result38
-rw-r--r--mysql-test/r/subselect_sj_mat.result46
-rw-r--r--mysql-test/r/sum_distinct-big.result58
-rw-r--r--mysql-test/r/temporal_scale_4283.result12
-rw-r--r--mysql-test/r/truncate_badse.result13
-rw-r--r--mysql-test/r/type_date.result2
-rw-r--r--mysql-test/r/type_datetime.result17
-rw-r--r--mysql-test/r/type_enum.result15
-rw-r--r--mysql-test/r/upgrade.result12
-rw-r--r--mysql-test/r/user_var-binlog.result2
-rw-r--r--mysql-test/r/user_var.result38
-rw-r--r--mysql-test/r/variables.result10
-rw-r--r--mysql-test/r/view.result4
-rw-r--r--mysql-test/r/windows.result2
-rw-r--r--mysql-test/suite/archive/archive.result79
-rw-r--r--mysql-test/suite/archive/archive.test57
-rw-r--r--mysql-test/suite/archive/discover.result125
-rw-r--r--mysql-test/suite/archive/discover.test104
-rw-r--r--mysql-test/suite/archive/partition_archive.result5
-rw-r--r--mysql-test/suite/archive/partition_archive.test3
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_checkpoint.result16
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result54
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result8
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result8
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_old_versions.result15
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_annotate.result12
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result2
-rw-r--r--mysql-test/suite/binlog/std_data/ver_5_1-wl2325_r.001bin705 -> 0 bytes
-rw-r--r--mysql-test/suite/binlog/std_data/ver_5_1-wl2325_s.001bin149796 -> 0 bytes
-rw-r--r--mysql-test/suite/binlog/t/binlog_checkpoint.test27
-rw-r--r--mysql-test/suite/binlog/t/binlog_old_versions.test19
-rw-r--r--mysql-test/suite/csv/csv.result2
-rw-r--r--mysql-test/suite/engines/funcs/disabled.def2
-rw-r--r--mysql-test/suite/engines/funcs/r/rpl_row_until.result250
-rw-r--r--mysql-test/suite/engines/funcs/t/rpl_row_until.test170
-rw-r--r--mysql-test/suite/federated/assisted_discovery.result37
-rw-r--r--mysql-test/suite/federated/assisted_discovery.test34
-rw-r--r--mysql-test/suite/federated/federated_archive.result4
-rw-r--r--mysql-test/suite/federated/federated_bug_35333.result10
-rw-r--r--mysql-test/suite/federated/federated_bug_35333.test4
-rw-r--r--mysql-test/suite/federated/federatedx.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result30
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result30
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_is.result46
-rw-r--r--mysql-test/suite/funcs_1/r/is_tables_is_embedded.result46
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result11
-rw-r--r--mysql-test/suite/funcs_1/t/storedproc.test4
-rw-r--r--mysql-test/suite/handler/aria.result2
-rw-r--r--mysql-test/suite/handler/heap.result12
-rw-r--r--mysql-test/suite/handler/innodb.result2
-rw-r--r--mysql-test/suite/handler/interface.result2
-rw-r--r--mysql-test/suite/handler/myisam.result2
-rw-r--r--mysql-test/suite/heap/heap.result39
-rw-r--r--mysql-test/suite/heap/heap.test50
-rw-r--r--mysql-test/suite/innodb/disabled.def3
-rw-r--r--mysql-test/suite/innodb/r/help_url.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-create-options.result120
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result12
-rw-r--r--mysql-test/suite/innodb/r/innodb-zip.result84
-rw-r--r--mysql-test/suite/innodb/r/innodb.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug12400341.result5
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14147491.result17
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14676111.result53
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug46000.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug47777.result4
-rw-r--r--mysql-test/suite/innodb/r/innodb_gis.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result11
-rw-r--r--mysql-test/suite/innodb/t/help_url.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-create-options.test76
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test10
-rw-r--r--mysql-test/suite/innodb/t/innodb-zip.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug12400341.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14147491-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14147491.test75
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14676111.test128
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug47777.test6
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug53591.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test4
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_sjis.result6
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_ucs2.result6
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_ujis.result6
-rw-r--r--mysql-test/suite/jp/r/jp_create_db_utf8.result6
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-dynamic.result58
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-dynamic.test58
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-trans.result58
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree-trans.test58
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree.result58
-rw-r--r--mysql-test/suite/maria/maria-gis-rtree.test58
-rw-r--r--mysql-test/suite/maria/maria-recovery-rtree-ft.result2
-rw-r--r--mysql-test/suite/maria/maria-recovery-rtree-ft.test2
-rw-r--r--mysql-test/suite/maria/maria.result12
-rw-r--r--mysql-test/suite/maria/maria.test4
-rw-r--r--mysql-test/suite/maria/maria3.result2
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_innodb.result48
-rw-r--r--mysql-test/suite/percona/percona_innodb_fake_changes.result2
-rw-r--r--mysql-test/suite/perfschema/r/dml_handler.result98
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate.result595
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a.result451
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result395
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result291
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result235
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_h.result539
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_u.result435
-rw-r--r--mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result379
-rw-r--r--mysql-test/suite/perfschema/r/func_mutex.result44
-rw-r--r--mysql-test/suite/perfschema/r/misc.result4
-rw-r--r--mysql-test/suite/perfschema/r/nesting.result259
-rw-r--r--mysql-test/suite/perfschema/r/privilege.result32
-rw-r--r--mysql-test/suite/perfschema/t/func_mutex.test18
-rw-r--r--mysql-test/suite/perfschema/t/misc.test4
-rw-r--r--mysql-test/suite/plugins/r/audit_null.result4
-rw-r--r--mysql-test/suite/plugins/r/audit_null_debug.result2
-rw-r--r--mysql-test/suite/plugins/r/auth_v0100.result18
-rw-r--r--mysql-test/suite/plugins/r/qc_info.result15
-rw-r--r--mysql-test/suite/plugins/r/qc_info_priv.result23
-rw-r--r--mysql-test/suite/plugins/r/show_all_plugins.result35
-rw-r--r--mysql-test/suite/plugins/t/audit_null_debug.test4
-rw-r--r--mysql-test/suite/plugins/t/auth_v0100.test26
-rw-r--r--mysql-test/suite/plugins/t/qc_info.test8
-rw-r--r--mysql-test/suite/plugins/t/qc_info_init.inc12
-rw-r--r--mysql-test/suite/plugins/t/qc_info_init.opt2
-rw-r--r--mysql-test/suite/plugins/t/qc_info_priv.test15
-rw-r--r--mysql-test/suite/plugins/t/show_all_plugins.test26
-rw-r--r--mysql-test/suite/rpl/disabled.def1
-rw-r--r--mysql-test/suite/rpl/r/replace.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_EE_err.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug31076.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_hrtime.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev359.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev382.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_report_port.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result69
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_event.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_table_options.result2
-rw-r--r--mysql-test/suite/rpl/r/semisync_memleak_4066.result4
-rw-r--r--mysql-test/suite/rpl/t/replace.test24
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug31076.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_err_ignoredtable.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev359.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_report_port.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test128
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync_event.test37
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_000001.test3
-rw-r--r--mysql-test/suite/rpl/t/semisync_memleak_4066.test15
-rw-r--r--mysql-test/suite/sphinx/sphinx.result3
-rw-r--r--mysql-test/suite/sphinx/sphinx.test5
-rw-r--r--mysql-test/suite/storage_engine/1st.result2
-rw-r--r--mysql-test/suite/storage_engine/1st.test6
-rw-r--r--mysql-test/suite/storage_engine/alter_table.result2
-rw-r--r--mysql-test/suite/storage_engine/alter_table.test2
-rw-r--r--mysql-test/suite/storage_engine/alter_tablespace.result6
-rw-r--r--mysql-test/suite/storage_engine/alter_tablespace.test6
-rw-r--r--mysql-test/suite/storage_engine/autoinc_secondary.result6
-rw-r--r--mysql-test/suite/storage_engine/autoinc_secondary.test6
-rw-r--r--mysql-test/suite/storage_engine/autoinc_vars.result8
-rw-r--r--mysql-test/suite/storage_engine/autoinc_vars.test8
-rw-r--r--mysql-test/suite/storage_engine/autoincrement.result16
-rw-r--r--mysql-test/suite/storage_engine/autoincrement.test16
-rw-r--r--mysql-test/suite/storage_engine/col_opt_default.result4
-rw-r--r--mysql-test/suite/storage_engine/col_opt_default.test4
-rw-r--r--mysql-test/suite/storage_engine/col_opt_not_null.result178
-rw-r--r--mysql-test/suite/storage_engine/col_opt_not_null.test2
-rw-r--r--mysql-test/suite/storage_engine/col_opt_null.result176
-rw-r--r--mysql-test/suite/storage_engine/col_opt_unsigned.result78
-rw-r--r--mysql-test/suite/storage_engine/col_opt_unsigned.test6
-rw-r--r--mysql-test/suite/storage_engine/col_opt_zerofill.result78
-rw-r--r--mysql-test/suite/storage_engine/col_opt_zerofill.test6
-rw-r--r--mysql-test/suite/storage_engine/delete.result18
-rw-r--r--mysql-test/suite/storage_engine/delete.test18
-rw-r--r--mysql-test/suite/storage_engine/delete_ignore.result10
-rw-r--r--mysql-test/suite/storage_engine/delete_ignore.test10
-rw-r--r--mysql-test/suite/storage_engine/delete_low_prio.result6
-rw-r--r--mysql-test/suite/storage_engine/delete_low_prio.test6
-rw-r--r--mysql-test/suite/storage_engine/delete_quick.result10
-rw-r--r--mysql-test/suite/storage_engine/delete_quick.test10
-rw-r--r--mysql-test/suite/storage_engine/delete_with_keys.result6
-rw-r--r--mysql-test/suite/storage_engine/delete_with_keys.test6
-rw-r--r--mysql-test/suite/storage_engine/foreign_keys.result8
-rw-r--r--mysql-test/suite/storage_engine/foreign_keys.test9
-rw-r--r--mysql-test/suite/storage_engine/insert.result22
-rw-r--r--mysql-test/suite/storage_engine/insert.test22
-rw-r--r--mysql-test/suite/storage_engine/insert_delayed.result6
-rw-r--r--mysql-test/suite/storage_engine/insert_delayed.test6
-rw-r--r--mysql-test/suite/storage_engine/insert_high_prio.result4
-rw-r--r--mysql-test/suite/storage_engine/insert_high_prio.test4
-rw-r--r--mysql-test/suite/storage_engine/insert_low_prio.result2
-rw-r--r--mysql-test/suite/storage_engine/insert_low_prio.test2
-rw-r--r--mysql-test/suite/storage_engine/insert_with_keys.result14
-rw-r--r--mysql-test/suite/storage_engine/insert_with_keys.test14
-rw-r--r--mysql-test/suite/storage_engine/loaddata.result50
-rw-r--r--mysql-test/suite/storage_engine/loaddata.test48
-rw-r--r--mysql-test/suite/storage_engine/lock.result6
-rw-r--r--mysql-test/suite/storage_engine/lock.test6
-rw-r--r--mysql-test/suite/storage_engine/parts/repair_table.result16
-rw-r--r--mysql-test/suite/storage_engine/parts/repair_table.test4
-rw-r--r--mysql-test/suite/storage_engine/parts/truncate_table.result10
-rw-r--r--mysql-test/suite/storage_engine/parts/truncate_table.test10
-rw-r--r--mysql-test/suite/storage_engine/repair_table.inc4
-rw-r--r--mysql-test/suite/storage_engine/repair_table.result6
-rw-r--r--mysql-test/suite/storage_engine/replace.result8
-rw-r--r--mysql-test/suite/storage_engine/replace.test8
-rw-r--r--mysql-test/suite/storage_engine/select.result24
-rw-r--r--mysql-test/suite/storage_engine/select.test24
-rw-r--r--mysql-test/suite/storage_engine/select_high_prio.result2
-rw-r--r--mysql-test/suite/storage_engine/select_high_prio.test4
-rw-r--r--mysql-test/suite/storage_engine/truncate_table.result4
-rw-r--r--mysql-test/suite/storage_engine/truncate_table.test4
-rw-r--r--mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result2
-rw-r--r--mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result2
-rw-r--r--mysql-test/suite/storage_engine/trx/consistent_snapshot.inc2
-rw-r--r--mysql-test/suite/storage_engine/trx/delete.result6
-rw-r--r--mysql-test/suite/storage_engine/trx/delete.test6
-rw-r--r--mysql-test/suite/storage_engine/trx/insert.result6
-rw-r--r--mysql-test/suite/storage_engine/trx/insert.test6
-rw-r--r--mysql-test/suite/storage_engine/trx/level_read_committed.result22
-rw-r--r--mysql-test/suite/storage_engine/trx/level_read_uncommitted.result22
-rw-r--r--mysql-test/suite/storage_engine/trx/level_repeatable_read.result20
-rw-r--r--mysql-test/suite/storage_engine/trx/level_serializable.result20
-rw-r--r--mysql-test/suite/storage_engine/trx/select_for_update.result10
-rw-r--r--mysql-test/suite/storage_engine/trx/select_for_update.test10
-rw-r--r--mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result10
-rw-r--r--mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test10
-rw-r--r--mysql-test/suite/storage_engine/trx/transaction_isolation.inc20
-rw-r--r--mysql-test/suite/storage_engine/trx/update.result4
-rw-r--r--mysql-test/suite/storage_engine/trx/update.test4
-rw-r--r--mysql-test/suite/storage_engine/trx/xa.result22
-rw-r--r--mysql-test/suite/storage_engine/trx/xa.test22
-rw-r--r--mysql-test/suite/storage_engine/trx/xa_recovery.result2
-rw-r--r--mysql-test/suite/storage_engine/trx/xa_recovery.test2
-rw-r--r--mysql-test/suite/storage_engine/type_binary.inc8
-rw-r--r--mysql-test/suite/storage_engine/type_binary.result8
-rw-r--r--mysql-test/suite/storage_engine/type_binary_indexes.result2
-rw-r--r--mysql-test/suite/storage_engine/type_binary_indexes.test2
-rw-r--r--mysql-test/suite/storage_engine/type_bit.inc14
-rw-r--r--mysql-test/suite/storage_engine/type_bit.result14
-rw-r--r--mysql-test/suite/storage_engine/type_blob.inc4
-rw-r--r--mysql-test/suite/storage_engine/type_blob.result4
-rw-r--r--mysql-test/suite/storage_engine/type_bool.inc28
-rw-r--r--mysql-test/suite/storage_engine/type_bool.result28
-rw-r--r--mysql-test/suite/storage_engine/type_char.inc12
-rw-r--r--mysql-test/suite/storage_engine/type_char.result12
-rw-r--r--mysql-test/suite/storage_engine/type_char_indexes.result8
-rw-r--r--mysql-test/suite/storage_engine/type_char_indexes.test8
-rw-r--r--mysql-test/suite/storage_engine/type_date_time.inc8
-rw-r--r--mysql-test/suite/storage_engine/type_date_time.result8
-rw-r--r--mysql-test/suite/storage_engine/type_enum.inc14
-rw-r--r--mysql-test/suite/storage_engine/type_enum.result14
-rw-r--r--mysql-test/suite/storage_engine/type_fixed.inc28
-rw-r--r--mysql-test/suite/storage_engine/type_fixed.result28
-rw-r--r--mysql-test/suite/storage_engine/type_float.inc22
-rw-r--r--mysql-test/suite/storage_engine/type_float.result22
-rw-r--r--mysql-test/suite/storage_engine/type_int.inc22
-rw-r--r--mysql-test/suite/storage_engine/type_int.result22
-rw-r--r--mysql-test/suite/storage_engine/type_set.inc10
-rw-r--r--mysql-test/suite/storage_engine/type_set.result10
-rw-r--r--mysql-test/suite/storage_engine/type_spatial.inc62
-rw-r--r--mysql-test/suite/storage_engine/type_spatial.result62
-rw-r--r--mysql-test/suite/storage_engine/type_spatial_indexes.result124
-rw-r--r--mysql-test/suite/storage_engine/type_text.inc4
-rw-r--r--mysql-test/suite/storage_engine/type_text.result4
-rw-r--r--mysql-test/suite/storage_engine/type_varchar.inc2
-rw-r--r--mysql-test/suite/storage_engine/type_varchar.result2
-rw-r--r--mysql-test/suite/storage_engine/update.result6
-rw-r--r--mysql-test/suite/storage_engine/update.test6
-rw-r--r--mysql-test/suite/storage_engine/update_ignore.result6
-rw-r--r--mysql-test/suite/storage_engine/update_ignore.test6
-rw-r--r--mysql-test/suite/storage_engine/update_low_prio.result6
-rw-r--r--mysql-test/suite/storage_engine/update_low_prio.test6
-rw-r--r--mysql-test/suite/storage_engine/update_multi.result8
-rw-r--r--mysql-test/suite/storage_engine/update_multi.test8
-rw-r--r--mysql-test/suite/storage_engine/update_with_keys.result8
-rw-r--r--mysql-test/suite/storage_engine/update_with_keys.test8
-rw-r--r--mysql-test/suite/storage_engine/vcol.result8
-rw-r--r--mysql-test/suite/storage_engine/vcol.test8
-rw-r--r--mysql-test/suite/sys_vars/disabled.def1
-rw-r--r--mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result22
-rw-r--r--mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result58
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result (renamed from mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result)0
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_trx_purge_view_update_only_debug_basic.result62
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result21
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result21
-rw-r--r--mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result14
-rw-r--r--mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result14
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_switch_basic.result36
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown1.result2
-rw-r--r--mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown2.result2
-rw-r--r--mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result119
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_semi_sync_master_enabled_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_semi_sync_master_timeout_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_semi_sync_master_trace_level_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_semi_sync_master_wait_no_slave_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_enabled_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_trace_level_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test50
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test (renamed from mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test)0
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test54
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test216
-rw-r--r--mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test216
-rw-r--r--mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test168
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test7
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test7
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test7
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test6
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test7
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test7
-rw-r--r--mysql-test/t/alter_table.test27
-rw-r--r--mysql-test/t/bug13633383.test10
-rw-r--r--mysql-test/t/cache_temporal_4265.test11
-rw-r--r--mysql-test/t/create.test29
-rw-r--r--mysql-test/t/derived.test15
-rw-r--r--mysql-test/t/derived_view.test34
-rw-r--r--mysql-test/t/dyncol.test56
-rw-r--r--mysql-test/t/fulltext.test11
-rw-r--r--mysql-test/t/fulltext_derived_4316.test14
-rw-r--r--mysql-test/t/func_date_add.test12
-rw-r--r--mysql-test/t/func_group.test11
-rw-r--r--mysql-test/t/func_group_innodb.test15
-rw-r--r--mysql-test/t/func_misc.test177
-rw-r--r--mysql-test/t/func_str.test36
-rw-r--r--mysql-test/t/func_time.test12
-rw-r--r--mysql-test/t/gis-rtree.test4
-rw-r--r--mysql-test/t/gis.test116
-rw-r--r--mysql-test/t/grant4.test4
-rw-r--r--mysql-test/t/group_by.test74
-rw-r--r--mysql-test/t/group_min_max.test59
-rw-r--r--mysql-test/t/information_schema_all_engines-master.opt3
-rw-r--r--mysql-test/t/information_schema_all_engines.test2
-rw-r--r--mysql-test/t/innodb_ext_key.test76
-rw-r--r--mysql-test/t/join.test26
-rw-r--r--mysql-test/t/join_cache.test2
-rw-r--r--mysql-test/t/join_outer_innodb.test207
-rw-r--r--mysql-test/t/keywords.test11
-rw-r--r--mysql-test/t/mdl_sync.test2
-rw-r--r--mysql-test/t/merge.test86
-rw-r--r--mysql-test/t/multi_update.test52
-rw-r--r--mysql-test/t/myisam-metadata.test49
-rw-r--r--mysql-test/t/myisam-system.test11
-rw-r--r--mysql-test/t/myisam.test20
-rw-r--r--mysql-test/t/mysql.test9
-rw-r--r--mysql-test/t/mysql_client_test.test2
-rw-r--r--mysql-test/t/mysql_client_test_nonblock.test1
-rw-r--r--mysql-test/t/mysqlcheck.test1
-rw-r--r--mysql-test/t/mysqld--help.test9
-rw-r--r--mysql-test/t/partition.test28
-rw-r--r--mysql-test/t/partition_debug_sync.test11
-rw-r--r--mysql-test/t/partition_disabled.test2
-rw-r--r--mysql-test/t/partition_not_windows.test2
-rw-r--r--mysql-test/t/partition_rename_longfilename.test1
-rw-r--r--mysql-test/t/plugin.test32
-rw-r--r--mysql-test/t/ps_1general.test5
-rw-r--r--mysql-test/t/quick_select_4161.test53
-rw-r--r--mysql-test/t/rename.test10
-rw-r--r--mysql-test/t/select.test19
-rw-r--r--mysql-test/t/show_check.test2
-rw-r--r--mysql-test/t/show_explain.test2
-rw-r--r--mysql-test/t/sp-destruct.test3
-rw-r--r--mysql-test/t/subselect4.test13
-rw-r--r--mysql-test/t/subselect_exists2in.test739
-rw-r--r--mysql-test/t/subselect_exists2in_costmat.test83
-rw-r--r--mysql-test/t/subselect_exists_to_in.test11
-rw-r--r--mysql-test/t/subselect_sj.test9
-rw-r--r--mysql-test/t/subselect_sj2_mat.test226
-rw-r--r--mysql-test/t/sum_distinct-big.test69
-rw-r--r--mysql-test/t/temporal_scale_4283.test13
-rw-r--r--mysql-test/t/truncate_badse.test15
-rw-r--r--mysql-test/t/type_datetime.test10
-rw-r--r--mysql-test/t/type_enum.test15
-rw-r--r--mysql-test/t/upgrade.test7
-rw-r--r--mysql-test/t/user_var.test48
-rw-r--r--mysql-test/t/variables.test16
-rw-r--r--mysys/default.c4
-rw-r--r--mysys/errors.c6
-rw-r--r--mysys/hash.c6
-rw-r--r--mysys/ma_dyncol.c8
-rw-r--r--mysys/mf_pack.c11
-rw-r--r--mysys/my_compress.c2
-rw-r--r--mysys/my_gethwaddr.c10
-rw-r--r--mysys/my_lib.c254
-rw-r--r--mysys/my_rnd.c15
-rw-r--r--mysys/my_uuid.c2
-rw-r--r--mysys/my_write.c16
-rw-r--r--mysys/thr_rwlock.c2
-rw-r--r--mysys/typelib.c3
-rw-r--r--mysys/waiting_threads.c5
-rw-r--r--packaging/WiX/custom_ui.wxs4
-rw-r--r--packaging/rpm-uln/mysql.spec.sh37
-rw-r--r--plugin/audit_null/audit_null.c10
-rw-r--r--plugin/auth_examples/CMakeLists.txt2
-rw-r--r--plugin/auth_examples/auth_0x0100.c91
-rw-r--r--plugin/auth_socket/CMakeLists.txt14
-rw-r--r--plugin/auth_socket/auth_socket.c17
-rw-r--r--plugin/daemon_example/daemon_example.cc17
-rw-r--r--plugin/fulltext/plugin_example.c18
-rw-r--r--plugin/qc_info/CMakeLists.txt4
-rw-r--r--plugin/qc_info/qc_info.cc213
-rw-r--r--plugin/semisync/CMakeLists.txt7
-rw-r--r--plugin/semisync/semisync_master.cc3
-rw-r--r--plugin/semisync/semisync_master.h4
-rw-r--r--plugin/semisync/semisync_master_plugin.cc12
-rw-r--r--plugin/semisync/semisync_slave_plugin.cc11
-rw-r--r--plugin/sql_errlog/sql_errlog.c18
-rw-r--r--scripts/mysql_install_db.sh2
-rw-r--r--scripts/mysqld_multi.sh2
-rw-r--r--scripts/mysqld_safe.sh15
-rw-r--r--scripts/mysqldumpslow.sh2
-rw-r--r--sql-common/client.c13
-rw-r--r--sql-common/my_time.c31
-rw-r--r--sql-common/pack.c6
-rw-r--r--sql/CMakeLists.txt6
-rw-r--r--sql/create_options.cc197
-rw-r--r--sql/create_options.h17
-rw-r--r--sql/datadict.cc118
-rw-r--r--sql/datadict.h22
-rw-r--r--sql/discover.cc178
-rw-r--r--sql/discover.h13
-rw-r--r--sql/event_scheduler.cc26
-rw-r--r--sql/field.cc47
-rw-r--r--sql/field.h11
-rw-r--r--sql/filesort.cc5
-rw-r--r--sql/frm_crypt.cc37
-rw-r--r--sql/frm_crypt.h23
-rw-r--r--sql/ha_partition.cc60
-rw-r--r--sql/ha_partition.h11
-rw-r--r--sql/handler.cc703
-rw-r--r--sql/handler.h340
-rw-r--r--sql/innodb_priv.h2
-rw-r--r--sql/item.cc40
-rw-r--r--sql/item.h30
-rw-r--r--sql/item_cmpfunc.cc192
-rw-r--r--sql/item_cmpfunc.h101
-rw-r--r--sql/item_create.cc3
-rw-r--r--sql/item_func.cc830
-rw-r--r--sql/item_func.h20
-rw-r--r--sql/item_geofunc.cc29
-rw-r--r--sql/item_row.cc4
-rw-r--r--sql/item_strfunc.cc82
-rw-r--r--sql/item_strfunc.h40
-rw-r--r--sql/item_subselect.cc548
-rw-r--r--sql/item_subselect.h96
-rw-r--r--sql/item_sum.cc60
-rw-r--r--sql/item_sum.h7
-rw-r--r--sql/item_timefunc.cc22
-rw-r--r--sql/item_timefunc.h1
-rw-r--r--sql/item_xmlfunc.cc6
-rw-r--r--sql/lock.cc18
-rw-r--r--sql/log.cc83
-rw-r--r--sql/log.h2
-rw-r--r--sql/log_event.cc130
-rw-r--r--sql/log_event.h21
-rw-r--r--sql/mdl.cc126
-rw-r--r--sql/mdl.h52
-rw-r--r--sql/multi_range_read.cc2
-rw-r--r--sql/my_apc.cc3
-rw-r--r--sql/my_apc.h8
-rw-r--r--sql/mysqld.cc324
-rw-r--r--sql/mysqld.h49
-rw-r--r--sql/opt_range.cc131
-rw-r--r--sql/opt_range.h6
-rw-r--r--sql/opt_subselect.cc25
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/partition_info.cc29
-rw-r--r--sql/partition_info.h1
-rw-r--r--sql/rpl_handler.cc20
-rw-r--r--sql/rpl_utility.cc14
-rw-r--r--sql/scheduler.cc51
-rw-r--r--sql/set_var.cc111
-rw-r--r--sql/set_var.h4
-rw-r--r--sql/share/errmsg-utf8.txt313
-rw-r--r--sql/slave.cc6
-rw-r--r--sql/sp_head.cc2
-rw-r--r--sql/spatial.cc127
-rw-r--r--sql/spatial.h12
-rw-r--r--sql/sql_acl.cc68
-rw-r--r--sql/sql_admin.cc47
-rw-r--r--sql/sql_array.h14
-rw-r--r--sql/sql_audit.h95
-rw-r--r--sql/sql_base.cc680
-rw-r--r--sql/sql_base.h85
-rw-r--r--sql/sql_bitmap.h5
-rw-r--r--sql/sql_cache.cc34
-rw-r--r--sql/sql_cache.h12
-rw-r--r--sql/sql_class.cc180
-rw-r--r--sql/sql_class.h124
-rw-r--r--sql/sql_connect.cc6
-rw-r--r--sql/sql_const.h2
-rw-r--r--sql/sql_db.cc44
-rw-r--r--sql/sql_db.h1
-rw-r--r--sql/sql_handler.cc6
-rw-r--r--sql/sql_insert.cc12
-rw-r--r--sql/sql_join_cache.cc2
-rw-r--r--sql/sql_lex.cc8
-rw-r--r--sql/sql_lex.h5
-rw-r--r--sql/sql_list.h4
-rw-r--r--sql/sql_parse.cc95
-rw-r--r--sql/sql_parse.h3
-rw-r--r--sql/sql_partition.cc12
-rw-r--r--sql/sql_partition.h1
-rw-r--r--sql/sql_plugin.cc279
-rw-r--r--sql/sql_plugin.h8
-rw-r--r--sql/sql_plugin_compat.h65
-rw-r--r--sql/sql_plugin_services.h9
-rw-r--r--sql/sql_priv.h10
-rw-r--r--sql/sql_reload.cc1
-rw-r--r--sql/sql_rename.cc108
-rw-r--r--sql/sql_rename.h3
-rw-r--r--sql/sql_repl.cc12
-rw-r--r--sql/sql_select.cc380
-rw-r--r--sql/sql_select.h22
-rw-r--r--sql/sql_show.cc508
-rw-r--r--sql/sql_show.h11
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/sql_table.cc1328
-rw-r--r--sql/sql_table.h55
-rw-r--r--sql/sql_time.cc7
-rw-r--r--sql/sql_trigger.cc5
-rw-r--r--sql/sql_truncate.cc40
-rw-r--r--sql/sql_udf.h4
-rw-r--r--sql/sql_update.cc9
-rw-r--r--sql/sql_view.cc43
-rw-r--r--sql/sql_yacc.yy281
-rw-r--r--sql/strfunc.cc2
-rw-r--r--sql/sys_vars.cc66
-rw-r--r--sql/sys_vars.h3
-rw-r--r--sql/table.cc1258
-rw-r--r--sql/table.h140
-rw-r--r--sql/threadpool_unix.cc17
-rw-r--r--sql/transaction.cc20
-rw-r--r--sql/tztime.cc23
-rw-r--r--sql/unireg.cc705
-rw-r--r--sql/unireg.h55
-rw-r--r--storage/archive/azio.c26
-rw-r--r--storage/archive/azlib.h7
-rw-r--r--storage/archive/ha_archive.cc218
-rw-r--r--storage/archive/ha_archive.h4
-rw-r--r--storage/blackhole/ha_blackhole.cc9
-rw-r--r--storage/blackhole/ha_blackhole.h1
-rw-r--r--storage/cassandra/ha_cassandra.cc24
-rw-r--r--storage/cassandra/ha_cassandra.h5
-rw-r--r--storage/csv/ha_tina.cc49
-rw-r--r--storage/csv/ha_tina.h1
-rw-r--r--storage/example/ha_example.cc61
-rw-r--r--storage/example/ha_example.h5
-rw-r--r--storage/federated/ha_federated.cc15
-rw-r--r--storage/federated/ha_federated.h1
-rw-r--r--storage/federatedx/ha_federatedx.cc122
-rw-r--r--storage/federatedx/ha_federatedx.h3
-rw-r--r--storage/heap/ha_heap.cc10
-rw-r--r--storage/heap/ha_heap.h1
-rw-r--r--storage/heap/hp_delete.c54
-rw-r--r--storage/innobase/btr/btr0btr.cc38
-rw-r--r--storage/innobase/btr/btr0cur.cc8
-rw-r--r--storage/innobase/buf/buf0buf.cc148
-rw-r--r--storage/innobase/buf/buf0flu.cc24
-rw-r--r--storage/innobase/buf/buf0lru.cc42
-rw-r--r--storage/innobase/dict/dict0load.cc3
-rw-r--r--storage/innobase/fil/fil0fil.cc84
-rw-r--r--storage/innobase/handler/ha_innodb.cc199
-rw-r--r--storage/innobase/handler/handler0alter.cc6
-rw-r--r--storage/innobase/include/btr0cur.h5
-rw-r--r--storage/innobase/include/btr0cur.ic13
-rw-r--r--storage/innobase/include/buf0buf.h29
-rw-r--r--storage/innobase/include/buf0buf.ic8
-rw-r--r--storage/innobase/include/buf0lru.h5
-rw-r--r--storage/innobase/include/data0type.ic31
-rw-r--r--storage/innobase/include/fil0fil.h15
-rw-r--r--storage/innobase/include/lock0lock.h12
-rw-r--r--storage/innobase/include/rem0rec.h80
-rw-r--r--storage/innobase/include/row0merge.h2
-rw-r--r--storage/innobase/include/srv0srv.h18
-rw-r--r--storage/innobase/include/univ.i7
-rw-r--r--storage/innobase/lock/lock0lock.cc99
-rw-r--r--storage/innobase/log/log0recv.cc15
-rw-r--r--storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff2
-rw-r--r--storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff6
-rw-r--r--storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff16
-rw-r--r--storage/innobase/mysql-test/storage_engine/repair_table.rdiff6
-rw-r--r--storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff8
-rw-r--r--storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff66
-rw-r--r--storage/innobase/mysql-test/storage_engine/vcol.rdiff8
-rw-r--r--storage/innobase/os/os0file.cc72
-rw-r--r--storage/innobase/rem/rem0rec.cc254
-rw-r--r--storage/innobase/row/row0ins.cc5
-rw-r--r--storage/innobase/row/row0merge.cc114
-rw-r--r--storage/innobase/row/row0mysql.cc7
-rw-r--r--storage/innobase/row/row0umod.cc4
-rw-r--r--storage/innobase/row/row0undo.cc2
-rw-r--r--storage/innobase/srv/srv0srv.cc22
-rw-r--r--storage/innobase/sync/sync0sync.cc4
-rw-r--r--storage/innobase/trx/trx0purge.cc10
-rw-r--r--storage/innobase/trx/trx0rec.cc19
-rw-r--r--storage/maria/ha_maria.cc14
-rw-r--r--storage/maria/ha_maria.h2
-rw-r--r--storage/maria/ma_bitmap.c26
-rw-r--r--storage/maria/ma_blockrec.c4
-rw-r--r--storage/maria/ma_check.c8
-rw-r--r--storage/maria/ma_create.c12
-rw-r--r--storage/maria/ma_init.c2
-rw-r--r--storage/maria/ma_key.c2
-rw-r--r--storage/maria/ma_loghandler.c12
-rw-r--r--storage/maria/ma_loghandler_lsn.h6
-rw-r--r--storage/maria/ma_pagecache.c12
-rw-r--r--storage/maria/ma_recovery.c4
-rw-r--r--storage/maria/ma_test3.c2
-rw-r--r--storage/maria/maria_def.h2
-rw-r--r--storage/maria/maria_pack.c2
-rw-r--r--storage/maria/trnman.h2
-rw-r--r--storage/maria/unittest/ma_control_file-t.c2
-rw-r--r--storage/maria/unittest/ma_maria_log_cleanup.c2
-rw-r--r--storage/maria/unittest/trnman-t.c2
-rw-r--r--storage/myisam/ha_myisam.cc9
-rw-r--r--storage/myisam/ha_myisam.h4
-rw-r--r--storage/myisam/mi_create.c13
-rw-r--r--storage/myisam/mi_open.c6
-rw-r--r--storage/myisam/mi_search.c15
-rw-r--r--storage/myisam/myisamchk.c16
-rw-r--r--storage/myisam/myisampack.c3
-rw-r--r--storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff6
-rw-r--r--storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff8
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff29
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff29
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/delete.rdiff2
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/insert.rdiff4
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff138
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff19
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff149
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff172
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff4
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff2
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/update.rdiff2
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/xa.rdiff8
-rw-r--r--storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff2
-rw-r--r--storage/myisammrg/ha_myisammrg.cc21
-rw-r--r--storage/myisammrg/ha_myisammrg.h1
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff219
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff59
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff56
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff98
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff117
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff0
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff19
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/create_table.rdiff94
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff285
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff292
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/handler.rdiff167
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index.rdiff17
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff50
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff17
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff103
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff40
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/lock.rdiff142
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff59
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff131
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff170
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff348
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff170
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff315
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff186
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff598
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff201
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff234
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff12
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff24
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff27
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff26
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff25
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff24
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff27
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff14
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff83
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff29
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff29
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff84
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff97
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff138
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff19
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff149
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff172
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff90
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff63
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff99
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff123
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff55
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff28
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff15
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff1418
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff2834
-rw-r--r--storage/myisammrg/mysql-test/storage_engine/vcol.rdiff161
-rw-r--r--storage/oqgraph/CMakeLists.txt1
-rw-r--r--storage/oqgraph/ha_oqgraph.cc16
-rw-r--r--storage/oqgraph/ha_oqgraph.h1
-rw-r--r--storage/pbxt/src/discover_xt.cc3
-rw-r--r--storage/perfschema/ha_perfschema.cc9
-rw-r--r--storage/perfschema/ha_perfschema.h2
-rw-r--r--storage/sequence/CMakeLists.txt1
-rw-r--r--storage/sequence/mysql-test/sequence/inc.inc4
-rw-r--r--storage/sequence/mysql-test/sequence/inc.opt2
-rw-r--r--storage/sequence/mysql-test/sequence/simple.result270
-rw-r--r--storage/sequence/mysql-test/sequence/simple.test93
-rw-r--r--storage/sequence/sequence.cc343
-rw-r--r--storage/sphinx/ha_sphinx.cc24
-rw-r--r--storage/sphinx/ha_sphinx.h1
-rw-r--r--storage/test_sql_discovery/CMakeLists.txt2
-rw-r--r--storage/test_sql_discovery/mysql-test/archive/discover.rdiff35
-rw-r--r--storage/test_sql_discovery/mysql-test/archive/discover.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff11
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/create.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/drop.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/plugin.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/main/t/rename.test3
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc4
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt2
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/simple.result199
-rw-r--r--storage/test_sql_discovery/mysql-test/sql_discovery/simple.test133
-rw-r--r--storage/test_sql_discovery/test_sql_discovery.cc175
-rw-r--r--storage/xtradb/btr/btr0btr.c96
-rw-r--r--storage/xtradb/btr/btr0cur.c34
-rw-r--r--storage/xtradb/buf/buf0buf.c194
-rw-r--r--storage/xtradb/buf/buf0flu.c40
-rw-r--r--storage/xtradb/buf/buf0lru.c176
-rw-r--r--storage/xtradb/buf/buf0rea.c3
-rw-r--r--storage/xtradb/dict/dict0dict.c32
-rw-r--r--storage/xtradb/dict/dict0load.c3
-rw-r--r--storage/xtradb/fil/fil0fil.c165
-rw-r--r--storage/xtradb/handler/ha_innodb.cc348
-rw-r--r--storage/xtradb/handler/ha_innodb.h10
-rw-r--r--storage/xtradb/handler/handler0alter.cc14
-rw-r--r--storage/xtradb/handler/i_s.cc53
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.c40
-rw-r--r--storage/xtradb/include/btr0cur.h7
-rw-r--r--storage/xtradb/include/btr0cur.ic13
-rw-r--r--storage/xtradb/include/buf0buf.h53
-rw-r--r--storage/xtradb/include/buf0buf.ic42
-rw-r--r--storage/xtradb/include/buf0lru.h5
-rw-r--r--storage/xtradb/include/data0type.ic32
-rw-r--r--storage/xtradb/include/dict0dict.h2
-rw-r--r--storage/xtradb/include/dict0dict.ic14
-rw-r--r--storage/xtradb/include/dict0mem.h7
-rw-r--r--storage/xtradb/include/fil0fil.h15
-rw-r--r--storage/xtradb/include/lock0lock.h12
-rw-r--r--storage/xtradb/include/log0online.h44
-rw-r--r--storage/xtradb/include/os0file.h2
-rw-r--r--storage/xtradb/include/page0zip.h8
-rw-r--r--storage/xtradb/include/rem0rec.h80
-rw-r--r--storage/xtradb/include/row0undo.h7
-rw-r--r--storage/xtradb/include/row0upd.ic3
-rw-r--r--storage/xtradb/include/srv0srv.h21
-rw-r--r--storage/xtradb/include/sync0sync.h2
-rw-r--r--storage/xtradb/include/univ.i37
-rw-r--r--storage/xtradb/lock/lock0lock.c256
-rw-r--r--storage/xtradb/log/log0online.c319
-rw-r--r--storage/xtradb/log/log0recv.c20
-rw-r--r--storage/xtradb/os/os0file.c95
-rw-r--r--storage/xtradb/page/page0cur.c7
-rw-r--r--storage/xtradb/page/page0page.c24
-rw-r--r--storage/xtradb/page/page0zip.c157
-rw-r--r--storage/xtradb/rem/rem0rec.c257
-rw-r--r--storage/xtradb/row/row0ins.c5
-rw-r--r--storage/xtradb/row/row0merge.c117
-rw-r--r--storage/xtradb/row/row0mysql.c12
-rw-r--r--storage/xtradb/row/row0sel.c33
-rw-r--r--storage/xtradb/row/row0umod.c56
-rw-r--r--storage/xtradb/row/row0undo.c21
-rw-r--r--storage/xtradb/srv/srv0srv.c240
-rw-r--r--storage/xtradb/srv/srv0start.c5
-rw-r--r--storage/xtradb/sync/sync0sync.c4
-rw-r--r--storage/xtradb/trx/trx0purge.c17
-rw-r--r--storage/xtradb/trx/trx0rec.c20
-rw-r--r--storage/xtradb/trx/trx0trx.c6
-rw-r--r--strings/ctype-latin1.c11
-rw-r--r--strings/ctype-ucs2.c10
-rw-r--r--strings/ctype-utf8.c71
-rw-r--r--strings/decimal.c10
-rw-r--r--strings/my_strtoll10.c10
-rw-r--r--support-files/mysql.spec.sh1
-rw-r--r--support-files/rpm/server-postin.sh31
-rw-r--r--tests/mysql_client_test.c19
-rw-r--r--vio/vio.c5
-rw-r--r--vio/viosocket.c6
976 files changed, 38085 insertions, 26743 deletions
diff --git a/.bzrignore b/.bzrignore
index d190c8be0f7..3140ce31c94 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1145,3 +1145,4 @@ sql/db.opt
typescript
storage/perfschema/gen_pfs_lex_token
storage/perfschema/pfs_lex_token.h
+mysql-test/collections/default.release.done
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b29c559415..823bac6b6e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,14 +132,10 @@ IF (NOT CPACK_GENERATOR)
ENDIF(WIN32)
ENDIF(NOT CPACK_GENERATOR)
-IF(DEB)
- SET(INSTALL_LAYOUT "DEB")
-ENDIF(DEB)
-
INCLUDE(mysql_version)
-INCLUDE(cpack_rpm)
INCLUDE(cpack_source_ignore_files)
INCLUDE(install_layout)
+INCLUDE(cpack_rpm)
# Add macros
INCLUDE(character_sets)
diff --git a/INSTALL-SOURCE b/INSTALL-SOURCE
index b6f4fe546c7..32cfa9792a7 100644
--- a/INSTALL-SOURCE
+++ b/INSTALL-SOURCE
@@ -1,8254 +1,3 @@
-Installing and Upgrading MariaDB
+Instructions for building MariaDB can be found at:
+https://kb.askmonty.org/en/compiling-mariadb-from-source/
-This file contains chapter two of the MySQL manual and describes how
-to obtain and install MySQL. The instructions below are generally
-applicable to both MySQL and MariaDB, but differ in some particulars
-(like, for example, the GPG signing key we use is different).
-
-Detailed, MariaDB-specific instructions are available at:
-http://kb.askmonty.org/en/getting-installing-and-upgrading-mariadb/
-
-- - - -
-
-Chapter 2. Installing and Upgrading MySQL
-
- This chapter describes how to obtain and install MySQL. A summary
- of the procedure follows and later sections provide the details.
- If you plan to upgrade an existing version of MySQL to a newer
- version rather than install MySQL for the first time, see Section
- 2.4.1, "Upgrading MySQL," for information about upgrade procedures
- and about issues that you should consider before upgrading.
-
- If you are interested in migrating to MySQL from another database
- system, you may wish to read Section A.8, "MySQL 5.1 FAQ ---
- Migration," which contains answers to some common questions
- concerning migration issues.
-
- 1. Determine whether MySQL runs and is supported on your
- platform.
- Please note that not all platforms are equally suitable for
- running MySQL, and that not all platforms on which MySQL is
- known to run are officially supported by Oracle Corporation:
-
- 2. Choose which distribution to install.
- Several versions of MySQL are available, and most are
- available in several distribution formats. You can choose from
- pre-packaged distributions containing binary (precompiled)
- programs or source code. When in doubt, use a binary
- distribution. We also provide public access to our current
- source tree for those who want to see our most recent
- developments and help us test new code. To determine which
- version and type of distribution you should use, see Section
- 2.1.2, "Choosing Which MySQL Distribution to Install."
-
- 3. Download the distribution that you want to install.
- For instructions, see Section 2.1.3, "How to Get MySQL." To
- verify the integrity of the distribution, use the instructions
- in Section 2.1.4, "Verifying Package Integrity Using MD5
- Checksums or GnuPG."
-
- 4. Install the distribution.
- To install MySQL from a binary distribution, use the
- instructions in Section 2.2, "Installing MySQL from Generic
- Binaries on Unix/Linux."
- To install MySQL from a source distribution or from the
- current development source tree, use the instructions in
- Section 2.3, "MySQL Installation Using a Source Distribution."
-
- 5. Perform any necessary post-installation setup.
- After installing MySQL, read Section 2.13, "Post-Installation
- Setup and Testing." This section contains important
- information about making sure the MySQL server is working
- properly. It also describes how to secure the initial MySQL
- user accounts, which have no passwords until you assign
- passwords. The section applies whether you install MySQL using
- a binary or source distribution.
-
- 6. If you want to run the MySQL benchmark scripts, Perl support
- for MySQL must be available. See Section 2.15, "Perl
- Installation Notes."
-
-2.1. General Installation Guidance
-
- The immediately following sections contain the information
- necessary to choose, download, and verify your distribution. The
- instructions in later sections of the chapter describe how to
- install the distribution that you choose. For binary
- distributions, see the instructions at Section 2.2, "Installing
- MySQL from Generic Binaries on Unix/Linux" or the corresponding
- section for your platform if available. To build MySQL from
- source, use the instructions in Section 2.3, "MySQL Installation
- Using a Source Distribution."
-
-2.1.1. Operating Systems Supported by MySQL Community Server
-
- This section lists the operating systems on which MySQL Community
- Server is known to run.
-
-Important
-
- Oracle Corporation does not necessarily provide official support
- for all the platforms listed in this section. For information
- about those platforms that are officially supported, see
- http://www.mysql.com/support/supportedplatforms.html on the MySQL
- Web site.
-
- We use GNU Autoconf, so it is possible to port MySQL to all modern
- systems that have a C++ compiler and a working implementation of
- POSIX threads. (Thread support is needed for the server. To
- compile only the client code, the only requirement is a C++
- compiler.)
-
- MySQL has been reported to compile successfully on the following
- combinations of operating system and thread package.
-
- * AIX 4.x, 5.x with native threads. See Section 2.12,
- "Installing MySQL on AIX." AIX 5.3 should be upgraded to
- technology level 7 (5300-07).
-
- * FreeBSD 5.x and up with native threads. See Section 2.10,
- "Installing MySQL on FreeBSD."
-
- * HP-UX 11.x with the native threads. See Section 2.11,
- "Installing MySQL on HP-UX."
-
- * Linux, builds on all fairly recent Linux distributions with
- glibc 2.3. See Section 2.6, "Installing MySQL on Linux."
-
- * Mac OS X. See Section 2.7, "Installing MySQL on Mac OS X."
-
- * Solaris 2.8 on SPARC and x86, including support for native
- threads. See Section 2.8.1, "Solaris Notes."
-
- * Windows 2000, Windows XP, Windows Vista, Windows Server 2003,
- and Windows Server 2008. See Section 2.5, "Installing MySQL on
- Windows."
-
- MySQL has also been known to run on other systems in the past. See
- Section 2.1, "General Installation Guidance." Some porting effort
- might be required for current versions of MySQL on these systems.
-
- Not all platforms are equally well-suited for running MySQL. How
- well a certain platform is suited for a high-load mission-critical
- MySQL server is determined by the following factors:
-
- * General stability of the thread library. A platform may have
- an excellent reputation otherwise, but MySQL is only as stable
- as the thread library it calls, even if everything else is
- perfect.
-
- * The capability of the kernel and the thread library to take
- advantage of symmetric multi-processor (SMP) systems. In other
- words, when a process creates a thread, it should be possible
- for that thread to run on a CPU different from the original
- process.
-
- * The capability of the kernel and the thread library to run
- many threads that acquire and release a mutex over a short
- critical region frequently without excessive context switches.
- If the implementation of pthread_mutex_lock() is too anxious
- to yield CPU time, this hurts MySQL tremendously. If this
- issue is not taken care of, adding extra CPUs actually makes
- MySQL slower.
-
- * General file system stability and performance.
-
- * Table size. If your tables are large, performance is affected
- by the ability of the file system to deal with large files and
- dealing with them efficiently.
-
- * Our level of expertise here at Oracle Corporation with the
- platform. If we know a platform well, we enable
- platform-specific optimizations and fixes at compile time. We
- can also provide advice on configuring your system optimally
- for MySQL.
-
- * The amount of testing we have done internally for similar
- configurations.
-
- * The number of users that have run MySQL successfully on the
- platform in similar configurations. If this number is high,
- the likelihood of encountering platform-specific surprises is
- much smaller.
-
-2.1.2. Choosing Which MySQL Distribution to Install
-
- When preparing to install MySQL, you should decide which version
- to use. MySQL development occurs in several release series, and
- you can pick the one that best fits your needs. After deciding
- which version to install, you can choose a distribution format.
- Releases are available in binary or source format.
-
-2.1.2.1. Choosing Which Version of MySQL to Install
-
- The first decision to make is whether you want to use a production
- (stable) release or a development release. In the MySQL
- development process, multiple release series co-exist, each at a
- different stage of maturity:
-
- * MySQL 5.5 is the current development release series.
-
- * MySQL 5.1 is the current General Availability (Production)
- release series. New releases are issued for bugfixes only; no
- new features are being added that could affect stability.
-
- * MySQL 5.0 is the previous stable (production-quality) release
- series. MySQL 5.0 is now at the end of the product lifecycle.
- Active development and support for this version has ended.
- Extended support for MySQL 5.0 remains available. According to
- the http://www.mysql.com/about/legal/lifecycle/, only Security
- and Severity Level 1 issues are still being fixed for MySQL
- 5.0.
-
- * MySQL 4.1, 4.0, and 3.23 are old stable (production-quality)
- release series. Active development and support for these
- versions has ended.
-
- We do not believe in a complete code freeze because this prevents
- us from making bugfixes and other fixes that must be done. By
- "somewhat frozen" we mean that we may add small things that should
- not affect anything that currently works in a production release.
- Naturally, relevant bugfixes from an earlier series propagate to
- later series.
-
- Normally, if you are beginning to use MySQL for the first time or
- trying to port it to some system for which there is no binary
- distribution, go with the General Availability release series.
- Currently, this is MySQL 5.1. All MySQL releases, even those from
- development series, are checked with the MySQL benchmarks and an
- extensive test suite before being issued.
-
- If you are running an older system and want to upgrade, but do not
- want to take the chance of having a nonseamless upgrade, you
- should upgrade to the latest version in the same release series
- you are using (where only the last part of the version number is
- newer than yours). We have tried to fix only fatal bugs and make
- only small, relatively "safe" changes to that version.
-
- If you want to use new features not present in the production
- release series, you can use a version from a development series.
- Note that development releases are not as stable as production
- releases.
-
- If you want to use the very latest sources containing all current
- patches and bugfixes, you can use one of our Bazaar repositories.
- These are not "releases" as such, but are available as previews of
- the code on which future releases are to be based.
-
- The MySQL naming scheme uses release names that consist of three
- numbers and a suffix; for example, mysql-5.0.14-rc. The numbers
- within the release name are interpreted as follows:
-
- * The first number (5) is the major version and describes the
- file format. All MySQL 5 releases have the same file format.
-
- * The second number (0) is the release level. Taken together,
- the major version and release level constitute the release
- series number.
-
- * The third number (14) is the version number within the release
- series. This is incremented for each new release. Usually you
- want the latest version for the series you have chosen.
-
- For each minor update, the last number in the version string is
- incremented. When there are major new features or minor
- incompatibilities with previous versions, the second number in the
- version string is incremented. When the file format changes, the
- first number is increased.
-
- Release names also include a suffix to indicates the stability
- level of the release. Releases within a series progress through a
- set of suffixes to indicate how the stability level improves. The
- possible suffixes are:
-
- * alpha indicates that the release is for preview purposes only.
- Known bugs should be documented in the News section (see
- Appendix C, "MySQL Change History"). Most alpha releases
- implement new commands and extensions. Active development that
- may involve major code changes can occur in an alpha release.
- However, we do conduct testing before issuing a release.
-
- * beta indicates that the release is appropriate for use with
- new development. Within beta releases, the features and
- compatibility should remain consistent. However, beta releases
- may contain numerous and major unaddressed bugs.
- All APIs, externally visible structures, and columns for SQL
- statements will not change during future beta, release
- candidate, or production releases.
-
- * rc indicates a Release Candidate. Release candidates are
- believed to be stable, having passed all of MySQL's internal
- testing, and with all known fatal runtime bugs fixed. However,
- the release has not been in widespread use long enough to know
- for sure that all bugs have been identified. Only minor fixes
- are added. (A release candidate is what formerly was known as
- a gamma release.)
-
- * If there is no suffix, it indicates that the release is a
- General Availability (GA) or Production release. GA releases
- are stable, having successfully passed through all earlier
- release stages and are believed to be reliable, free of
- serious bugs, and suitable for use in production systems. Only
- critical bugfixes are applied to the release.
-
- MySQL uses a naming scheme that is slightly different from most
- other products. In general, it is usually safe to use any version
- that has been out for a couple of weeks without being replaced by
- a new version within the same release series.
-
- All releases of MySQL are run through our standard tests and
- benchmarks to ensure that they are relatively safe to use. Because
- the standard tests are extended over time to check for all
- previously found bugs, the test suite keeps getting better.
-
- All releases have been tested at least with these tools:
-
- * An internal test suite
- The mysql-test directory contains an extensive set of test
- cases. We run these tests for every server binary. See Section
- 22.1.2, "MySQL Test Suite," for more information about this
- test suite.
-
- * The MySQL benchmark suite
- This suite runs a range of common queries. It is also a test
- to determine whether the latest batch of optimizations
- actually made the code faster. See Section 7.1.3, "The MySQL
- Benchmark Suite."
-
- We also test the newest MySQL version in our internal production
- environment, on at least one machine. We have more than 100GB of
- data to work with.
-
-2.1.2.2. Choosing a Distribution Format
-
- After choosing which version of MySQL to install, you should
- decide whether to use a binary distribution or a source
- distribution. In most cases, you should probably use a binary
- distribution, if one exists for your platform. Binary
- distributions are available in native format for many platforms,
- such as RPM files for Linux or PKG package installers for Mac OS X
- or Solaris. Distributions also are available as Zip archives or
- compressed tar files.
-
- Reasons to choose a binary distribution include the following:
-
- * Binary distributions generally are easier to install than
- source distributions.
-
- * To satisfy different user requirements, we provide several
- servers in binary distributions. mysqld is an optimized server
- that is a smaller, faster binary. mysqld-debug is compiled
- with debugging support.
- Each of these servers is compiled from the same source
- distribution, though with different configuration options. All
- native MySQL clients can connect to servers from either MySQL
- version.
-
- Under some circumstances, you may be better off installing MySQL
- from a source distribution:
-
- * You want to install MySQL at some explicit location. The
- standard binary distributions are ready to run at any
- installation location, but you might require even more
- flexibility to place MySQL components where you want.
-
- * You want to configure mysqld to ensure that features are
- available that might not be included in the standard binary
- distributions. Here is a list of the most common extra options
- that you may want to use to ensure feature availability:
-
- + --with-libwrap
-
- + --with-named-z-libs (this is done for some of the
- binaries)
-
- + --with-debug[=full]
-
- * You want to configure mysqld without some features that are
- included in the standard binary distributions. For example,
- distributions normally are compiled with support for all
- character sets. If you want a smaller MySQL server, you can
- recompile it with support for only the character sets you
- need.
-
- * You have a special compiler (such as pgcc) or want to use
- compiler options that are better optimized for your processor.
- Binary distributions are compiled with options that should
- work on a variety of processors from the same processor
- family.
-
- * You want to use the latest sources from one of the Bazaar
- repositories to have access to all current bugfixes. For
- example, if you have found a bug and reported it to the MySQL
- development team, the bugfix is committed to the source
- repository and you can access it there. The bugfix does not
- appear in a release until a release actually is issued.
-
- * You want to read (or modify) the C and C++ code that makes up
- MySQL. For this purpose, you should get a source distribution,
- because the source code is always the ultimate manual.
-
- * Source distributions contain more tests and examples than
- binary distributions.
-
-2.1.2.3. How and When Updates Are Released
-
- MySQL is evolving quite rapidly and we want to share new
- developments with other MySQL users. We try to produce a new
- release whenever we have new and useful features that others also
- seem to have a need for.
-
- We also try to help users who request features that are easy to
- implement. We take note of what our licensed users want, and we
- especially take note of what our support customers want and try to
- help them in this regard.
-
- No one is required to download a new release. The News section
- helps you determine whether the new release has something you
- really want. See Appendix C, "MySQL Change History."
-
- We use the following policy when updating MySQL:
-
- * Enterprise Server releases are meant to appear every 18
- months, supplemented by quarterly service packs and monthly
- rapid updates. Community Server releases are meant to appear
- 2-3 times per year.
-
- * Releases are issued within each series. For each release, the
- last number in the version is one more than the previous
- release within the same series.
-
- * Binary distributions for some platforms are made by us for
- major releases. Other people may make binary distributions for
- other systems, but probably less frequently.
-
- * We make fixes available as soon as we have identified and
- corrected small or noncritical but annoying bugs. The fixes
- are available in source form immediately from our public
- Bazaar repositories, and are included in the next release.
-
- * If by any chance a security vulnerability or critical bug is
- found in a release, our policy is to fix it in a new release
- as soon as possible. (We would like other companies to do
- this, too!)
-
-2.1.3. How to Get MySQL
-
- Check our downloads page at http://dev.mysql.com/downloads/ for
- information about the current version of MySQL and for downloading
- instructions. For a complete up-to-date list of MySQL download
- mirror sites, see http://dev.mysql.com/downloads/mirrors.html. You
- can also find information there about becoming a MySQL mirror site
- and how to report a bad or out-of-date mirror.
-
- Our main mirror is located at http://mirrors.sunsite.dk/mysql/.
-
-2.1.4. Verifying Package Integrity Using MD5 Checksums or GnuPG
-
- After you have downloaded the MySQL package that suits your needs
- and before you attempt to install it, you should make sure that it
- is intact and has not been tampered with. There are three means of
- integrity checking:
-
- * MD5 checksums
-
- * Cryptographic signatures using GnuPG, the GNU Privacy Guard
-
- * For RPM packages, the built-in RPM integrity verification
- mechanism
-
- The following sections describe how to use these methods.
-
- If you notice that the MD5 checksum or GPG signatures do not
- match, first try to download the respective package one more time,
- perhaps from another mirror site. If you repeatedly cannot
- successfully verify the integrity of the package, please notify us
- about such incidents, including the full package name and the
- download site you have been using, at webmaster@mysql.com or
- build@mysql.com. Do not report downloading problems using the
- bug-reporting system.
-
-2.1.4.1. Verifying the MD5 Checksum
-
- After you have downloaded a MySQL package, you should make sure
- that its MD5 checksum matches the one provided on the MySQL
- download pages. Each package has an individual checksum that you
- can verify with the following command, where package_name is the
- name of the package you downloaded:
-shell> md5sum package_name
-
- Example:
-shell> md5sum mysql-standard-5.1.46-linux-i686.tar.gz
-aaab65abbec64d5e907dcd41b8699945 mysql-standard-5.1.46-linux-i686.ta
-r.gz
-
- You should verify that the resulting checksum (the string of
- hexadecimal digits) matches the one displayed on the download page
- immediately below the respective package.
-
-Note
-
- Make sure to verify the checksum of the archive file (for example,
- the .zip or .tar.gz file) and not of the files that are contained
- inside of the archive.
-
- Note that not all operating systems support the md5sum command. On
- some, it is simply called md5, and others do not ship it at all.
- On Linux, it is part of the GNU Text Utilities package, which is
- available for a wide range of platforms. You can download the
- source code from http://www.gnu.org/software/textutils/ as well.
- If you have OpenSSL installed, you can use the command openssl md5
- package_name instead. A Windows implementation of the md5 command
- line utility is available from http://www.fourmilab.ch/md5/.
- winMd5Sum is a graphical MD5 checking tool that can be obtained
- from http://www.nullriver.com/index/products/winmd5sum.
-
-2.1.4.2. Signature Checking Using GnuPG
-
- Another method of verifying the integrity and authenticity of a
- package is to use cryptographic signatures. This is more reliable
- than using MD5 checksums, but requires more work.
-
- We sign MySQL downloadable packages with GnuPG (GNU Privacy
- Guard). GnuPG is an Open Source alternative to the well-known
- Pretty Good Privacy (PGP) by Phil Zimmermann. See
- http://www.gnupg.org/ for more information about GnuPG and how to
- obtain and install it on your system. Most Linux distributions
- ship with GnuPG installed by default. For more information about
- GnuPG, see http://www.openpgp.org/.
-
- To verify the signature for a specific package, you first need to
- obtain a copy of our public GPG build key, which you can download
- from http://keyserver.pgp.com/. The key that you want to obtain is
- named build@mysql.com. Alternatively, you can cut and paste the
- key directly from the following text:
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.5 (GNU/Linux)
-
-mQGiBD4+owwRBAC14GIfUfCyEDSIePvEW3SAFUdJBtoQHH/nJKZyQT7h9bPlUWC3
-RODjQReyCITRrdwyrKUGku2FmeVGwn2u2WmDMNABLnpprWPkBdCk96+OmSLN9brZ
-fw2vOUgCmYv2hW0hyDHuvYlQA/BThQoADgj8AW6/0Lo7V1W9/8VuHP0gQwCgvzV3
-BqOxRznNCRCRxAuAuVztHRcEAJooQK1+iSiunZMYD1WufeXfshc57S/+yeJkegNW
-hxwR9pRWVArNYJdDRT+rf2RUe3vpquKNQU/hnEIUHJRQqYHo8gTxvxXNQc7fJYLV
-K2HtkrPbP72vwsEKMYhhr0eKCbtLGfls9krjJ6sBgACyP/Vb7hiPwxh6rDZ7ITnE
-kYpXBACmWpP8NJTkamEnPCia2ZoOHODANwpUkP43I7jsDmgtobZX9qnrAXw+uNDI
-QJEXM6FSbi0LLtZciNlYsafwAPEOMDKpMqAK6IyisNtPvaLd8lH0bPAnWqcyefep
-rv0sxxqUEMcM3o7wwgfN83POkDasDbs3pjwPhxvhz6//62zQJ7Q7TXlTUUwgUGFj
-a2FnZSBzaWduaW5nIGtleSAod3d3Lm15c3FsLmNvbSkgPGJ1aWxkQG15c3FsLmNv
-bT6IXQQTEQIAHQULBwoDBAMVAwIDFgIBAheABQJLcC5lBQkQ8/JZAAoJEIxxjTtQ
-cuH1oD4AoIcOQ4EoGsZvy06D0Ei5vcsWEy8dAJ4g46i3WEcdSWxMhcBSsPz65sh5
-lohMBBMRAgAMBQI+PqPRBYMJZgC7AAoJEElQ4SqycpHyJOEAn1mxHijft00bKXvu
-cSo/pECUmppiAJ41M9MRVj5VcdH/KN/KjRtW6tHFPYhMBBMRAgAMBQI+QoIDBYMJ
-YiKJAAoJELb1zU3GuiQ/lpEAoIhpp6BozKI8p6eaabzF5MlJH58pAKCu/ROofK8J
-Eg2aLos+5zEYrB/LsrkCDQQ+PqMdEAgA7+GJfxbMdY4wslPnjH9rF4N2qfWsEN/l
-xaZoJYc3a6M02WCnHl6ahT2/tBK2w1QI4YFteR47gCvtgb6O1JHffOo2HfLmRDRi
-Rjd1DTCHqeyX7CHhcghj/dNRlW2Z0l5QFEcmV9U0Vhp3aFfWC4Ujfs3LU+hkAWzE
-7zaD5cH9J7yv/6xuZVw411x0h4UqsTcWMu0iM1BzELqX1DY7LwoPEb/O9Rkbf4fm
-Le11EzIaCa4PqARXQZc4dhSinMt6K3X4BrRsKTfozBu74F47D8Ilbf5vSYHbuE5p
-/1oIDznkg/p8kW+3FxuWrycciqFTcNz215yyX39LXFnlLzKUb/F5GwADBQf+Lwqq
-a8CGrRfsOAJxim63CHfty5mUc5rUSnTslGYEIOCR1BeQauyPZbPDsDD9MZ1ZaSaf
-anFvwFG6Llx9xkU7tzq+vKLoWkm4u5xf3vn55VjnSd1aQ9eQnUcXiL4cnBGoTbOW
-I39EcyzgslzBdC++MPjcQTcA7p6JUVsP6oAB3FQWg54tuUo0Ec8bsM8b3Ev42Lmu
-QT5NdKHGwHsXTPtl0klk4bQk4OajHsiy1BMahpT27jWjJlMiJc+IWJ0mghkKHt92
-6s/ymfdf5HkdQ1cyvsz5tryVI3Fx78XeSYfQvuuwqp2H139pXGEkg0n6KdUOetdZ
-Whe70YGNPw1yjWJT1IhMBBgRAgAMBQI+PqMdBQkJZgGAAAoJEIxxjTtQcuH17p4A
-n3r1QpVC9yhnW2cSAjq+kr72GX0eAJ4295kl6NxYEuFApmr1+0uUq/SlsQ==
-=Mski
-
------END PGP PUBLIC KEY BLOCK-----
-
- To import the build key into your personal public GPG keyring, use
- gpg --import. For example, if you have saved the key in a file
- named mysql_pubkey.asc, the import command looks like this:
-shell> gpg --import mysql_pubkey.asc
-gpg: key 5072E1F5: public key "MySQL Package signing key (www.mysql.c
-om) <build@mysql.com>" imported
-gpg: Total number processed: 1
-gpg: imported: 1
-gpg: no ultimately trusted keys found
-
- You can also download the key from the public keyserver using the
- public key id, 5072E1F5:
-shell> gpg --recv-keys 5072E1F5
-gpg: requesting key 5072E1F5 from hkp server subkeys.pgp.net
-gpg: key 5072E1F5: "MySQL Package signing key (www.mysql.com) <build@
-mysql.com>" 2 new signatures
-gpg: no ultimately trusted keys found
-gpg: Total number processed: 1
-gpg: new signatures: 2
-
- If you want to import the key into your RPM configuration to
- validate RPM install packages, you should be able to import the
- key directly:
-shell> rpm --import mysql_pubkey.asc
-
- If you experience problems, try exporting the key from gpg and
- importing:
-shell> gpg --export -a 5072e1f5 > 5072e1f5.asc
-shell> rpm --import 5072e1f5.asc
-
- Alternatively, rpm also supports loading the key directly from a
- URL, and you cas use this manual page:
-shell> rpm --import http://dev.mysql.com/doc/refman/5.1/en/checking-g
-pg-signature.html
-
- After you have downloaded and imported the public build key,
- download your desired MySQL package and the corresponding
- signature, which also is available from the download page. The
- signature file has the same name as the distribution file with an
- .asc extension, as shown by the examples in the following table.
- Distribution file mysql-standard-5.1.46-linux-i686.tar.gz
- Signature file mysql-standard-5.1.46-linux-i686.tar.gz.asc
-
- Make sure that both files are stored in the same directory and
- then run the following command to verify the signature for the
- distribution file:
-shell> gpg --verify package_name.asc
-
- Example:
-shell> gpg --verify mysql-standard-5.1.46-linux-i686.tar.gz.asc
-gpg: Signature made Tue 12 Jul 2005 23:35:41 EST using DSA key ID 507
-2E1F5
-gpg: Good signature from "MySQL Package signing key (www.mysql.com) <
-build@mysql.com>"
-
- The Good signature message indicates that everything is all right.
- You can ignore any insecure memory warning you might obtain.
-
- See the GPG documentation for more information on how to work with
- public keys.
-
-2.1.4.3. Signature Checking Using RPM
-
- For RPM packages, there is no separate signature. RPM packages
- have a built-in GPG signature and MD5 checksum. You can verify a
- package by running the following command:
-shell> rpm --checksig package_name.rpm
-
- Example:
-shell> rpm --checksig MySQL-server-5.1.46-0.glibc23.i386.rpm
-MySQL-server-5.1.46-0.glibc23.i386.rpm: md5 gpg OK
-
-Note
-
- If you are using RPM 4.1 and it complains about (GPG) NOT OK
- (MISSING KEYS: GPG#5072e1f5), even though you have imported the
- MySQL public build key into your own GPG keyring, you need to
- import the key into the RPM keyring first. RPM 4.1 no longer uses
- your personal GPG keyring (or GPG itself). Rather, it maintains
- its own keyring because it is a system-wide application and a
- user's GPG public keyring is a user-specific file. To import the
- MySQL public key into the RPM keyring, first obtain the key as
- described in Section 2.1.4.2, "Signature Checking Using GnuPG."
- Then use rpm --import to import the key. For example, if you have
- saved the public key in a file named mysql_pubkey.asc, import it
- using this command:
-shell> rpm --import mysql_pubkey.asc
-
- If you need to obtain the MySQL public key, see Section 2.1.4.2,
- "Signature Checking Using GnuPG."
-
-2.1.5. Installation Layouts
-
- This section describes the default layout of the directories
- created by installing binary or source distributions provided by
- Oracle Corporation. A distribution provided by another vendor
- might use a layout different from those shown here.
-
- Installations created from our Linux RPM distributions result in
- files under the following system directories.
- Directory Contents of Directory
- /usr/bin Client programs and scripts
- /usr/sbin The mysqld server
- /var/lib/mysql Log files, databases
- /usr/share/info Manual in Info format
- /usr/share/man Unix manual pages
- /usr/include/mysql Include (header) files
- /usr/lib/mysql Libraries
- /usr/share/mysql Error message and character set files
- /usr/share/sql-bench Benchmarks
-
- On Unix, a tar file binary distribution is installed by unpacking
- it at the installation location you choose (typically
- /usr/local/mysql) and creates the following directories in that
- location.
- Directory Contents of Directory
- bin Client programs and the mysqld server
- data Log files, databases
- docs Manual in Info format
- man Unix manual pages
- include Include (header) files
- lib Libraries
- scripts mysql_install_db
- share/mysql Error message files
- sql-bench Benchmarks
-
- A source distribution is installed after you configure and compile
- it. By default, the installation step installs files under
- /usr/local, in the following subdirectories.
- Directory Contents of Directory
- bin Client programs and scripts
- include/mysql Include (header) files
- Docs Manual in Info, CHM formats
- man Unix manual pages
- lib/mysql Libraries
- libexec The mysqld server
- share/mysql Error message files
- sql-bench Benchmarks and crash-me test
- var Databases and log files
-
- Within its installation directory, the layout of a source
- installation differs from that of a binary installation in the
- following ways:
-
- * The mysqld server is installed in the libexec directory rather
- than in the bin directory.
-
- * The data directory is var rather than data.
-
- * mysql_install_db is installed in the bin directory rather than
- in the scripts directory.
-
- * The header file and library directories are include/mysql and
- lib/mysql rather than include and lib.
-
- You can create your own binary installation from a compiled source
- distribution by executing the scripts/make_binary_distribution
- script from the top directory of the source distribution.
-
-2.2. Installing MySQL from Generic Binaries on Unix/Linux
-
- This section covers the installation of MySQL binary distributions
- that are provided for various platforms in the form of compressed
- tar files (files with a .tar.gz extension).
-
- To obtain MySQL, see Section 2.1.3, "How to Get MySQL."
-
- Sun Microsystems, Inc. provides a set of binary distributions of
- MySQL. In addition to binaries provided in platform-specific
- package formats, we offer binary distributions for a number of
- platforms in the form of compressed tar files (.tar.gz files). For
- Windows distributions, see Section 2.5, "Installing MySQL on
- Windows."
-
- If you want to compile a debug version of MySQL from a source
- distribution, you should add --with-debug or --with-debug=full to
- the configure command used to configure the distribution and
- remove any -fomit-frame-pointer options.
-
- MySQL tar file binary distributions have names of the form
- mysql-VERSION-OS.tar.gz, where VERSION is a number (for example,
- 5.1.46), and OS indicates the type of operating system for which
- the distribution is intended (for example, pc-linux-i686).
-
- In addition to these generic packages, we also offer binaries in
- platform-specific package formats for selected platforms. See the
- platform specific sections for more information, for more
- information on how to install these.
-
- You need the following tools to install a MySQL tar file binary
- distribution:
-
- * GNU gunzip to uncompress the distribution.
-
- * A reasonable tar to unpack the distribution. GNU tar is known
- to work. Some operating systems come with a preinstalled
- version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x,
- Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
- are known to have problems with long file names. On Mac OS X,
- you can use the preinstalled gnutar program. On Solaris 10 and
- OpenSolaris you can use the preinstalled gtar. On other
- systems with a deficient tar, you should install GNU tar
- first.
-
- If you run into problems and need to file a bug report, please use
- the instructions in Section 1.7, "How to Report Bugs or Problems."
-
- The basic commands that you must execute to install and use a
- MySQL binary distribution are:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
-shell> cd /usr/local
-shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
-shell> ln -s full-path-to-mysql-VERSION-OS mysql
-shell> cd mysql
-shell> chown -R mysql .
-shell> chgrp -R mysql .
-shell> scripts/mysql_install_db --user=mysql
-shell> chown -R root .
-shell> chown -R mysql data
-shell> bin/mysqld_safe --user=mysql &
-
-Note
-
- This procedure does not set up any passwords for MySQL accounts.
- After following the procedure, proceed to Section 2.13,
- "Post-Installation Setup and Testing."
-
- A more detailed version of the preceding description for
- installing a binary distribution follows:
-
- 1. Add a login user and group for mysqld to run as:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
- These commands add the mysql group and the mysql user. The
- syntax for useradd and groupadd may differ slightly on
- different versions of Unix, or they may have different names
- such as adduser and addgroup.
- You might want to call the user and group something else
- instead of mysql. If so, substitute the appropriate name in
- the following steps.
-
- 2. Pick the directory under which you want to unpack the
- distribution and change location into it. In the following
- example, we unpack the distribution under /usr/local. (The
- instructions, therefore, assume that you have permission to
- create files and directories in /usr/local. If that directory
- is protected, you must perform the installation as root.)
-shell> cd /usr/local
-
- 3. Obtain a distribution file using the instructions in Section
- 2.1.3, "How to Get MySQL." For a given release, binary
- distributions for all platforms are built from the same MySQL
- source distribution.
-
- 4. Unpack the distribution, which creates the installation
- directory. Then create a symbolic link to that directory:
-shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
-shell> ln -s full-path-to-mysql-VERSION-OS mysql
- The tar command creates a directory named mysql-VERSION-OS.
- The ln command makes a symbolic link to that directory. This
- lets you refer more easily to the installation directory as
- /usr/local/mysql.
- With GNU tar, no separate invocation of gunzip is necessary.
- You can replace the first line with the following alternative
- command to uncompress and extract the distribution:
-shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
-
- 5. Change location into the installation directory:
-shell> cd mysql
- You will find several files and subdirectories in the mysql
- directory. The most important for installation purposes are
- the bin and scripts subdirectories:
-
- + The bin directory contains client programs and the
- server. You should add the full path name of this
- directory to your PATH environment variable so that your
- shell finds the MySQL programs properly. See Section
- 2.14, "Environment Variables."
-
- + The scripts directory contains the mysql_install_db
- script used to initialize the mysql database containing
- the grant tables that store the server access
- permissions.
-
- 6. Ensure that the distribution contents are accessible to mysql.
- If you unpacked the distribution as mysql, no further action
- is required. If you unpacked the distribution as root, its
- contents will be owned by root. Change its ownership to mysql
- by executing the following commands as root in the
- installation directory:
-shell> chown -R mysql .
-shell> chgrp -R mysql .
- The first command changes the owner attribute of the files to
- the mysql user. The second changes the group attribute to the
- mysql group.
-
- 7. If you have not installed MySQL before, you must create the
- MySQL data directory and initialize the grant tables:
-shell> scripts/mysql_install_db --user=mysql
- If you run the command as root, include the --user option as
- shown. If you run the command while logged in as that user,
- you can omit the --user option.
- The command should create the data directory and its contents
- with mysql as the owner.
- After creating or updating the grant tables, you need to
- restart the server manually.
-
- 8. Most of the MySQL installation can be owned by root if you
- like. The exception is that the data directory must be owned
- by mysql. To accomplish this, run the following commands as
- root in the installation directory:
-shell> chown -R root .
-shell> chown -R mysql data
-
- 9. If you want MySQL to start automatically when you boot your
- machine, you can copy support-files/mysql.server to the
- location where your system has its startup files. More
- information can be found in the support-files/mysql.server
- script itself and in Section 2.13.1.2, "Starting and Stopping
- MySQL Automatically."
- 10. You can set up new accounts using the bin/mysql_setpermission
- script if you install the DBI and DBD::mysql Perl modules. See
- Section 4.6.14, "mysql_setpermission --- Interactively Set
- Permissions in Grant Tables." For Perl module installation
- instructions, see Section 2.15, "Perl Installation Notes."
- 11. If you would like to use mysqlaccess and have the MySQL
- distribution in some nonstandard location, you must change the
- location where mysqlaccess expects to find the mysql client.
- Edit the bin/mysqlaccess script at approximately line 18.
- Search for a line that looks like this:
-$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable
- Change the path to reflect the location where mysql actually
- is stored on your system. If you do not do this, a Broken pipe
- error will occur when you run mysqlaccess.
-
- After everything has been unpacked and installed, you should test
- your distribution. To start the MySQL server, use the following
- command:
-shell> bin/mysqld_safe --user=mysql &
-
- If you run the command as root, you must use the --user option as
- shown. The value of the option is the name of the login account
- that you created in the first step to use for running the server.
- If you run the command while logged in as mysql, you can omit the
- --user option.
-
- If the command fails immediately and prints mysqld ended, you can
- find some information in the host_name.err file in the data
- directory.
-
- More information about mysqld_safe is given in Section 4.3.2,
- "mysqld_safe --- MySQL Server Startup Script."
-
-Note
-
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.13,
- "Post-Installation Setup and Testing."
-
-2.3. MySQL Installation Using a Source Distribution
-
- Before you proceed with an installation from source, first check
- whether our binary is available for your platform and whether it
- works for you. We put a great deal of effort into ensuring that
- our binaries are built with the best possible options.
-
- To obtain a source distribution for MySQL, Section 2.1.3, "How to
- Get MySQL." If you want to build MySQL from source on Windows, see
- Section 2.5.10, "Installing MySQL from Source on Windows."
-
- MySQL source distributions are provided as compressed tar archives
- and have names of the form mysql-VERSION.tar.gz, where VERSION is
- a number like 5.1.46.
-
- You need the following tools to build and install MySQL from
- source:
-
- * GNU gunzip to uncompress the distribution.
-
- * A reasonable tar to unpack the distribution. GNU tar is known
- to work. Some operating systems come with a preinstalled
- version of tar that is known to have problems. For example,
- the tar provided with early versions of Mac OS X, SunOS 4.x,
- Solaris 8, Solaris 9, Solaris 10 and OpenSolaris, and HP-UX
- are known to have problems with long file names. On Mac OS X,
- you can use the preinstalled gnutar program. On Solaris 10 and
- OpenSolaris you can use the preinstalled gtar. On other
- systems with a deficient tar, you should install GNU tar
- first.
-
- * A working ANSI C++ compiler. GCC 3.2 or later, Sun Studio 10
- or later, Visual Studio 2005 or later, and many current
- vendor-supplied compilers are known to work.
-
- * A good make program. GNU make is always recommended and is
- sometimes required. (BSD make fails, and vendor-provided make
- implementations may fail as well.) If you have problems, use
- GNU make 3.75 or newer.
-
- * libtool 1.5.24 or later is also recommended.
-
- If you are using a version of gcc recent enough to understand the
- -fno-exceptions option, it is very important that you use this
- option. Otherwise, you may compile a binary that crashes randomly.
- Also use -felide-constructors and -fno-rtti along with
- -fno-exceptions. When in doubt, do the following:
-CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
- -fno-exceptions -fno-rtti" ./configure \
- --prefix=/usr/local/mysql --enable-assembler \
- --with-mysqld-ldflags=-all-static
-
- On most systems, this gives you a fast and stable binary.
-
- If you run into problems and need to file a bug report, please use
- the instructions in Section 1.7, "How to Report Bugs or Problems."
-
-2.3.1. Source Installation Overview
-
- The basic commands that you must execute to install a MySQL source
- distribution are:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
-shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
-shell> cd mysql-VERSION
-shell> ./configure --prefix=/usr/local/mysql
-shell> make
-shell> make install
-shell> cp support-files/my-medium.cnf /etc/my.cnf
-shell> cd /usr/local/mysql
-shell> chown -R mysql .
-shell> chgrp -R mysql .
-shell> bin/mysql_install_db --user=mysql
-shell> chown -R root .
-shell> chown -R mysql var
-shell> bin/mysqld_safe --user=mysql &
-
- If you start from a source RPM, do the following:
-shell> rpmbuild --rebuild --clean MySQL-VERSION.src.rpm
-
- This makes a binary RPM that you can install. For older versions
- of RPM, you may have to replace the command rpmbuild with rpm
- instead.
-
-Note
-
- This procedure does not set up any passwords for MySQL accounts.
- After following the procedure, proceed to Section 2.13,
- "Post-Installation Setup and Testing," for post-installation setup
- and testing.
-
- A more detailed version of the preceding description for
- installing MySQL from a source distribution follows:
-
- 1. Add a login user and group for mysqld to run as:
-shell> groupadd mysql
-shell> useradd -g mysql mysql
- These commands add the mysql group and the mysql user. The
- syntax for useradd and groupadd may differ slightly on
- different versions of Unix, or they may have different names
- such as adduser and addgroup.
- You might want to call the user and group something else
- instead of mysql. If so, substitute the appropriate name in
- the following steps.
-
- 2. Perform the following steps as the mysql user, except as
- noted.
-
- 3. Pick the directory under which you want to unpack the
- distribution and change location into it.
-
- 4. Obtain a distribution file using the instructions in Section
- 2.1.3, "How to Get MySQL."
-
- 5. Unpack the distribution into the current directory:
-shell> gunzip < /path/to/mysql-VERSION.tar.gz | tar xvf -
- This command creates a directory named mysql-VERSION.
- With GNU tar, no separate invocation of gunzip is necessary.
- You can use the following alternative command to uncompress
- and extract the distribution:
-shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
-
- 6. Change location into the top-level directory of the unpacked
- distribution:
-shell> cd mysql-VERSION
- Note that currently you must configure and build MySQL from
- this top-level directory. You cannot build it in a different
- directory.
-
- 7. Configure the release and compile everything:
-shell> ./configure --prefix=/usr/local/mysql
-shell> make
- When you run configure, you might want to specify other
- options. Run ./configure --help for a list of options. Section
- 2.3.2, "Typical configure Options," discusses some of the more
- useful options.
- If configure fails and you are going to send mail to a MySQL
- mailing list to ask for assistance, please include any lines
- from config.log that you think can help solve the problem.
- Also include the last couple of lines of output from
- configure. To file a bug report, please use the instructions
- in Section 1.7, "How to Report Bugs or Problems."
- If the compile fails, see Section 2.3.4, "Dealing with
- Problems Compiling MySQL," for help.
-
- 8. Install the distribution:
-shell> make install
- You might need to run this command as root.
- If you want to set up an option file, use one of those present
- in the support-files directory as a template. For example:
-shell> cp support-files/my-medium.cnf /etc/my.cnf
- You might need to run this command as root.
- If you want to configure support for InnoDB tables, you should
- edit the /etc/my.cnf file, remove the # character before the
- option lines that start with innodb_..., and modify the option
- values to be what you want. See Section 4.2.3.3, "Using Option
- Files," and Section 13.6.2, "InnoDB Configuration."
-
- 9. Change location into the installation directory:
-shell> cd /usr/local/mysql
- 10. If you ran the make install command as root, the installed
- files will be owned by root. Ensure that the installation is
- accessible to mysql by executing the following commands as
- root in the installation directory:
-shell> chown -R mysql .
-shell> chgrp -R mysql .
- The first command changes the owner attribute of the files to
- the mysql user. The second changes the group attribute to the
- mysql group.
- 11. If you have not installed MySQL before, you must create the
- MySQL data directory and initialize the grant tables:
-shell> bin/mysql_install_db --user=mysql
- If you run the command as root, include the --user option as
- shown. If you run the command while logged in as mysql, you
- can omit the --user option.
- The command should create the data directory and its contents
- with mysql as the owner.
- After using mysql_install_db to create the grant tables for
- MySQL, you must restart the server manually. The mysqld_safe
- command to do this is shown in a later step.
- 12. Most of the MySQL installation can be owned by root if you
- like. The exception is that the data directory must be owned
- by mysql. To accomplish this, run the following commands as
- root in the installation directory:
-shell> chown -R root .
-shell> chown -R mysql var
- 13. If you want MySQL to start automatically when you boot your
- machine, you can copy support-files/mysql.server to the
- location where your system has its startup files. More
- information can be found in the support-files/mysql.server
- script itself; see also Section 2.13.1.2, "Starting and
- Stopping MySQL Automatically."
- 14. You can set up new accounts using the bin/mysql_setpermission
- script if you install the DBI and DBD::mysql Perl modules. See
- Section 4.6.14, "mysql_setpermission --- Interactively Set
- Permissions in Grant Tables." For Perl module installation
- instructions, see Section 2.15, "Perl Installation Notes."
-
- After everything has been installed, you should test your
- distribution. To start the MySQL server, use the following
- command:
-shell> /usr/local/mysql/bin/mysqld_safe --user=mysql &
-
- If you run the command as root, you should use the --user option
- as shown. The value of the option is the name of the login account
- that you created in the first step to use for running the server.
- If you run the command while logged in as that user, you can omit
- the --user option.
-
- If the command fails immediately and prints mysqld ended, you can
- find some information in the host_name.err file in the data
- directory.
-
- More information about mysqld_safe is given in Section 4.3.2,
- "mysqld_safe --- MySQL Server Startup Script."
-
-Note
-
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.13,
- "Post-Installation Setup and Testing."
-
-2.3.2. Typical configure Options
-
- The configure script gives you a great deal of control over how
- you configure a MySQL source distribution. Typically you do this
- using options on the configure command line. You can also affect
- configure using certain environment variables. See Section 2.14,
- "Environment Variables." For a full list of options supported by
- configure, run this command:
-shell> ./configure --help
-
- A list of the available configure options is provided in the table
- below.
-
- Table 2.1. Build (configure) Reference
- Formats Description Default Introduced Removed
- --bindir=DIR User executables EPREFIX/bin
- --build=BUILD Configure for building on BUILD guessed
- --cache-file=FILE Cache test results in FILE disabled
- -C Alias for `--cache-file=config.cache'
- --config-cache
- --datadir=DIR Read-only architecture-independent data PREFIX/share
-
- --disable-FEATURE Do not include FEATURE
- --disable-dependency-tracking Disable dependency tracking
- --disable-grant-options Disable GRANT options
- --disable-largefile Omit support for large files
- --disable-libtool-lock Disable libtool lock
- --disable-thread-safe-client Compile the client without threads
- 5.1.7
- --enable-FEATURE Enable FEATURE
- --enable-assembler Use assembler versions of some string functions
- if available
- --enable-debug-sync Compile in Debug Sync facility 5.1.41
- --enable-dependency-tracking Do not reject slow dependency
- extractors
- --enable-fast-install Optimize for fast installation yes
- --enable-local-infile Enable LOAD DATA LOCAL INFILE disabled
- --enable-shared Build shared libraries yes
- --enable-static Build static libraries yes
- --enable-thread-safe-client Compile the client with threads
- --exec-prefix=EPREFIX Install architecture-dependent files in
- EPREFIX
- -h Display this help and exit
- --help
- --help=short Display options specific to this package
- --help=recursive Display the short help of all the included
- packages
- --host=HOST Cross-compile to build programs to run on HOST
- --includedir=DIR C header files PREFIX/include
- --infodir=DIR Info documentation PREFIX/info
- --libdir=DIR Object code libraries EPREFIX/lib
- --libexecdir=DIR Program executables EPREFIX/libexec
- --localstatedir=DIR Modifiable single-machine data PREFIX/var
- --mandir=DIR man documentation PREFIX/man
- -n Do not create output files
- --no-create
- --oldincludedir=DIR C header files for non-gcc /usr/include
- --prefix=PREFIX Install architecture-independent files in PREFIX
-
- --program-prefix=PREFIX Prepend PREFIX to installed program names
-
- --program-suffix=SUFFIX Append SUFFIX to installed program names
-
- --program-transform-name=PROGRAM run sed PROGRAM on installed
- program names
- -q Do not print `checking...' messages
- --quiet
- --sbindir=DIR System admin executables EPREFIX/sbin
- --sharedstatedir=DIR Modifiable architecture-independent data
- PREFIX/com
- --srcdir=DIR Find the sources in DIR configure directory or ..
- --sysconfdir=DIR Read-only single-machine data PREFIX/etc
- --target=TARGET Configure for building compilers for TARGET
- -V Display version information and exit
- --version
- --with-PACKAGE Use PACKAGE
- --with-archive-storage-engine Enable the Archive Storage Engine no
-
- --with-atomic-ops Implement atomic operations using pthread
- rwlocks or atomic CPU instructions for multi-processor 5.1.12
- --with-berkeley-db Use BerkeleyDB located in DIR no
- --with-berkeley-db-includes Find Berkeley DB headers in DIR
- --with-berkeley-db-libs Find Berkeley DB libraries in DIR
- --with-big-tables Support tables with more than 4 G rows even on
- 32 bit platforms
- --with-blackhole-storage-engine Enable the Blackhole Storage
- Engine no
- --with-charset Default character set
- --with-client-ldflags Extra linking arguments for clients
- --with-collation Default collation
- --with-comment Comment about compilation environment
- --with-csv-storage-engine Enable the CSV Storage Engine yes
- --with-darwin-mwcc Use Metrowerks CodeWarrior wrappers on OS
- X/Darwin
- --with-debug Add debug code 5.1.7
- --with-debug=full Add debug code (adds memory checker, very slow)
-
- --with-embedded-privilege-control Build parts to check user's
- privileges (only affects embedded library)
- --with-embedded-server Build the embedded server
- --with-error-inject Enable error injection in MySQL Server
- 5.1.11
- --with-example-storage-engine Enable the Example Storage Engine no
-
- --with-extra-charsets Use charsets in addition to default
- --with-fast-mutexes Compile with fast mutexes enabled 5.1.5
- --with-federated-storage-engine Enable federated storage engine no
- 5.1.3 5.1.9
- --with-gnu-ld Assume the C compiler uses GNU ld no
- --with-innodb Enable innobase storage engine no 5.1.3 5.1.9
- --with-lib-ccflags Extra CC options for libraries
- --with-libwrap=DIR Compile in libwrap (tcp_wrappers) support
- --with-low-memory Try to use less memory to compile to avoid
- memory limitations
- --with-machine-type Set the machine type, like "powerpc"
- --with-max-indexes=N Sets the maximum number of indexes per table
- 64
- --with-mysqld-ldflags Extra linking arguments for mysqld
- --with-mysqld-libs Extra libraries to link with for mysqld
- --with-mysqld-user What user the mysqld daemon shall be run as
-
- --with-mysqlmanager Build the mysqlmanager binary Build if server
- is built
- --with-named-curses-libs Use specified curses libraries
- --with-named-thread-libs Use specified thread libraries
- --with-ndb-ccflags Extra CC options for ndb compile
- --with-ndb-docs Include the NDB Cluster ndbapi and mgmapi
- documentation
- --with-ndb-port Port for NDB Cluster management server
- --with-ndb-port-base Port for NDB Cluster management server
- --with-ndb-sci=DIR Provide MySQL with a custom location of sci
- library
- --with-ndb-test Include the NDB Cluster ndbapi test programs
- --with-ndbcluster Include the NDB Cluster table handler no
- --with-openssl=DIR Include the OpenSSL support
- --with-openssl-includes Find OpenSSL headers in DIR
- --with-openssl-libs Find OpenSSL libraries in DIR
- --with-other-libc=DIR Link against libc and other standard
- libraries installed in the specified nonstandard location
- --with-pic Try to use only PIC/non-PIC objects Use both
- --with-plugin-PLUGIN Forces the named plugin to be linked into
- mysqld statically 5.1.11
- --with-plugins Plugins to include in mysqld none 5.1.11
- --with-pstack Use the pstack backtrace library
- --with-pthread Force use of pthread library
- --with-row-based-replication Include row-based replication 5.1.5
- 5.1.6
- --with-server-suffix Append value to the version string
- --with-ssl=DIR Include SSL support 5.1.11
- --with-system-type Set the system type, like "sun-solaris10"
- --with-tags Include additional configurations automatic
- --with-tcp-port Which port to use for MySQL services 3306
- --with-unix-socket-path Where to put the unix-domain socket
- --with-yassl Include the yaSSL support
- --with-zlib-dir=no|bundled|DIR Provide MySQL with a custom
- location of compression library
- --without-PACKAGE Do not use PACKAGE
- --without-bench Skip building of the benchmark suite
- --without-debug Build a production version without debugging code
-
- --without-docs Skip building of the documentation
- --without-extra-tools Skip building utilities in the tools
- directory
- --without-geometry Do not build geometry-related parts
- --without-libedit Use system libedit instead of bundled copy
- --without-man Skip building of the man pages
- --without-ndb-binlog Disable ndb binlog 5.1.6
- --without-ndb-debug Disable special ndb debug features
- --without-plugin-PLUGIN Exclude PLUGIN 5.1.11
- --without-query-cache Do not build query cache
- --without-readline Use system readline instead of bundled copy
-
- --without-row-based-replication Don't include row-based
- replication 5.1.7 5.1.14
- --without-server Only build the client
- --without-uca Skip building of the national Unicode collations
-
- Some of the configure options available are described here. For
- options that may be of use if you have difficulties building
- MySQL, see Section 2.3.4, "Dealing with Problems Compiling MySQL."
-
- * To compile just the MySQL client libraries and client programs
- and not the server, use the --without-server option:
-shell> ./configure --without-server
- If you have no C++ compiler, some client programs such as
- mysql cannot be compiled because they require C++.. In this
- case, you can remove the code in configure that tests for the
- C++ compiler and then run ./configure with the
- --without-server option. The compile step should still try to
- build all clients, but you can ignore any warnings about files
- such as mysql.cc. (If make stops, try make -k to tell it to
- continue with the rest of the build even if errors occur.)
-
- * If you want to build the embedded MySQL library (libmysqld.a),
- use the --with-embedded-server option.
-
- * If you don't want your log files and database directories
- located under /usr/local/var, use a configure command
- something like one of these:
-shell> ./configure --prefix=/usr/local/mysql
-shell> ./configure --prefix=/usr/local \
- --localstatedir=/usr/local/mysql/data
- The first command changes the installation prefix so that
- everything is installed under /usr/local/mysql rather than the
- default of /usr/local. The second command preserves the
- default installation prefix, but overrides the default
- location for database directories (normally /usr/local/var)
- and changes it to /usr/local/mysql/data.
- You can also specify the installation directory and data
- directory locations at server startup time by using the
- --basedir and --datadir options. These can be given on the
- command line or in an MySQL option file, although it is more
- common to use an option file. See Section 4.2.3.3, "Using
- Option Files."
-
- * This option specifies the port number on which the server
- listens for TCP/IP connections. The default is port 3306. To
- listen on a different port, use a configure command like this:
-shell> ./configure --with-tcp-port=3307
-
- * If you are using Unix and you want the MySQL socket file
- location to be somewhere other than the default location
- (normally in the directory /tmp or /var/run), use a configure
- command like this:
-shell> ./configure \
- --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
- The socket file name must be an absolute path name. You can
- also change the location of mysql.sock at server startup by
- using a MySQL option file. See Section B.5.4.5, "How to
- Protect or Change the MySQL Unix Socket File."
-
- * If you want to compile statically linked programs (for
- example, to make a binary distribution, to get better
- performance, or to work around problems with some Red Hat
- Linux distributions), run configure like this:
-shell> ./configure --with-client-ldflags=-all-static \
- --with-mysqld-ldflags=-all-static
-
- * If you are using gcc and don't have libg++ or libstdc++
- installed, you can tell configure to use gcc as your C++
- compiler:
-shell> CC=gcc CXX=gcc ./configure
- When you use gcc as your C++ compiler, it does not attempt to
- link in libg++ or libstdc++. This may be a good thing to do
- even if you have those libraries installed. Some versions of
- them have caused strange problems for MySQL users in the past.
- The following list indicates some compilers and environment
- variable settings that are commonly used with each one.
-
- + gcc 2.7.2:
-CC=gcc CXX=gcc CXXFLAGS="-O3 -felide-constructors"
-
- + gcc 2.95.2:
-CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
--felide-constructors -fno-exceptions -fno-rtti"
-
- + pgcc 2.90.29 or newer:
-CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
-CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
--felide-constructors -fno-exceptions -fno-rtti"
- In most cases, you can get a reasonably optimized MySQL binary
- by using the options from the preceding list and adding the
- following options to the configure line:
---prefix=/usr/local/mysql --enable-assembler \
---with-mysqld-ldflags=-all-static
- The full configure line would, in other words, be something
- like the following for all recent gcc versions:
-CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro \
--felide-constructors -fno-exceptions -fno-rtti" ./configure \
---prefix=/usr/local/mysql --enable-assembler \
---with-mysqld-ldflags=-all-static
- The binaries we provide on the MySQL Web site at
- http://dev.mysql.com/downloads/ are all compiled with full
- optimization and should be perfect for most users. See Section
- 2.2, "Installing MySQL from Generic Binaries on Unix/Linux."
- There are some configuration settings you can tweak to build
- an even faster binary, but these are only for advanced users.
- See Section 7.5.1, "How Compiling and Linking Affects the
- Speed of MySQL."
- If the build fails and produces errors about your compiler or
- linker not being able to create the shared library
- libmysqlclient.so.N (where N is a version number), you can
- work around this problem by giving the --disable-shared option
- to configure. In this case, configure does not build a shared
- libmysqlclient.so.N library.
-
- * By default, MySQL uses the latin1 (cp1252 West European)
- character set. To change the default set, use the
- --with-charset option:
-shell> ./configure --with-charset=CHARSET
- CHARSET may be one of binary, armscii8, ascii, big5, cp1250,
- cp1251, cp1256, cp1257, cp850, cp852, cp866, cp932, dec8,
- eucjpms, euckr, gb2312, gbk, geostd8, greek, hebrew, hp8,
- keybcs2, koi8r, koi8u, latin1, latin2, latin5, latin7, macce,
- macroman, sjis, swe7, tis620, ucs2, ujis, utf8. (Additional
- character sets might be available. Check the output from
- ./configure --help for the current list.)
- The default collation may also be specified. MySQL uses the
- latin1_swedish_ci collation by default. To change this, use
- the --with-collation option:
-shell> ./configure --with-collation=COLLATION
- To change both the character set and the collation, use both
- the --with-charset and --with-collation options. The collation
- must be a legal collation for the character set. (Use the SHOW
- COLLATION statement to determine which collations are
- available for each character set.)
- With the configure option --with-extra-charsets=LIST, you can
- define which additional character sets should be compiled into
- the server. LIST is one of the following:
-
- + A list of character set names separated by spaces
-
- + complex to include all character sets that can't be
- dynamically loaded
-
- + all to include all character sets into the binaries
- Clients that want to convert characters between the server and
- the client should use the SET NAMES statement. See Section
- 5.1.5, "Session System Variables," and Section 9.1.4,
- "Connection Character Sets and Collations."
-
- * To configure MySQL with debugging code, use the --with-debug
- option:
-shell> ./configure --with-debug
- This causes a safe memory allocator to be included that can
- find some errors and that provides output about what is
- happening. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
- As of MySQL 5.1.12, using --with-debug to configure MySQL with
- debugging support enables you to use the
- --debug-dbug="d,parser_debug" option when you start the server.
- This causes the Bison parser that is used to process SQL
- statements to dump a parser trace to the server's standard
- error output. Typically, this output is written to the error
- log.
-
- * To cause the Debug Sync facility to be compiled into the
- server, use the --enable-debug-sync option. This facility is
- used for testing and debugging. When compiled in, Debug Sync
- is disabled by default. To enable it, start mysqld with the
- --debug-sync-timeout=N option, where N is a timeout value
- greater than 0. (The default value is 0, which disables Debug
- Sync.) N becomes the default timeout for individual
- synchronization points.
- Debug Sync is also compiled in if you configure with the
- --with-debug option (which implies --enable-debug-sync),
- unless you also use the --disable-debug-sync option.
- For a description of the Debug Sync facility and how to use
- synchronization points, see MySQL Internals: Test
- Synchronization
- (http://forge.mysql.com/wiki/MySQL_Internals_Test_Synchronizat
- ion).
- The --enable-debug-sync and --disable-debug-sync options were
- added in MySQL 5.1.41.
-
- * If your client programs are using threads, you must compile a
- thread-safe version of the MySQL client library with the
- --enable-thread-safe-client configure option. This creates a
- libmysqlclient_r library with which you should link your
- threaded applications. See Section 21.9.16.2, "How to Make a
- Threaded Client."
-
- * Some features require that the server be built with
- compression library support, such as the COMPRESS() and
- UNCOMPRESS() functions, and compression of the client/server
- protocol. The --with-zlib-dir=no|bundled|DIR option provides
- control over compression library support. The value no
- explicitly disables compression support. bundled causes the
- zlib library bundled in the MySQL sources to be used. A DIR
- path name specifies the directory in which to find the
- compression library sources.
-
- * It is possible to build MySQL with large table support using
- the --with-big-tables option.
- This option causes the variables that store table row counts
- to be declared as unsigned long long rather than unsigned
- long. This enables tables to hold up to approximately
- 1.844E+19 ((2^32)^2) rows rather than 2^32 (~4.295E+09) rows.
- Previously it was necessary to pass -DBIG_TABLES to the
- compiler manually in order to enable this feature.
-
- * Run configure with the --disable-grant-options option to cause
- the --bootstrap, --skip-grant-tables, and --init-file options
- for mysqld to be disabled. For Windows, the configure.js
- script recognizes the DISABLE_GRANT_OPTIONS flag, which has
- the same effect. The capability is available as of MySQL
- 5.1.15.
-
- * This option allows MySQL Community Server features to be
- enabled. Additional options may be required for individual
- features, such as --enable-profiling to enable statement
- profiling. This option was added in MySQL 5.1.24. It is
- enabled by default as of MySQL 5.1.28; to disable it, use
- --disable-community-features.
-
- * When given with --enable-community-features, the
- --enable-profiling option enables the statement profiling
- capability exposed by the SHOW PROFILE and SHOW PROFILES
- statements. (See Section 12.4.5.33, "SHOW PROFILES Syntax.")
- This option was added in MySQL 5.1.24. It is enabled by
- default as of MySQL 5.1.28; to disable it, use
- --disable-profiling.
-
- * See Section 2.1, "General Installation Guidance," for options
- that pertain to particular operating systems.
-
- * See Section 5.5.6.2, "Using SSL Connections," for options that
- pertain to configuring MySQL to support secure (encrypted)
- connections.
-
- * Several configure options apply to plugin selection and
- building:
---with-plugins=PLUGIN[,PLUGIN]...
---with-plugins=GROUP
---with-plugin-PLUGIN
---without-plugin-PLUGIN
- PLUGIN is an individual plugin name such as csv or archive.
- As shorthand, GROUP is a configuration group name such as none
- (select no plugins) or all (select all plugins).
- You can build a plugin as static (compiled into the server) or
- dynamic (built as a dynamic library that must be installed
- using the INSTALL PLUGIN statement before it can be used).
- Some plugins might not support static or dynamic build.
- configure --help shows the following information pertaining to
- plugins:
-
- + The plugin-related options
-
- + The names of all available plugins
-
- + For each plugin, a description of its purpose, which
- build types it supports (static or dynamic), and which
- plugin groups it is a part of.
- --with-plugins can take a list of one or more plugin names
- separated by commas, or a plugin group name. The named plugins
- are configured to be built as static plugins.
- --with-plugin-PLUGIN configures the given plugin to be built
- as a static plugin.
- --without-plugin-PLUGIN disables the given plugin from being
- built.
- If a plugin is named both with a --with and --without option,
- the result is undefined.
- For any plugin that is not explicitly selected or disabled, it
- is selected to be built dynamically if it supports dynamic
- build, and not built if it does not support dynamic build.
- (Thus, in the case that no plugin options are given, all
- plugins that support dynamic build are selected to be built as
- dynamic plugins. Plugins that do not support dynamic build are
- not built.)
-
-2.3.3. Installing from the Development Source Tree
-
-Caution
-
- You should read this section only if you are interested in helping
- us test our new code. If you just want to get MySQL up and running
- on your system, you should use a standard release distribution
- (either a binary or source distribution).
-
- To obtain the most recent development source tree, you must have
- Bazaar installed. You can obtain Bazaar from the Bazaar VCS Web
- site (http://bazaar-vcs.org). Bazaar is supported by any platform
- that supports Python, and is therefore compatible with any Linux,
- Unix, Windows or Mac OS X host. Instructions for downloading and
- installing Bazaar on the different platforms are available on the
- Bazaar Web site.
-
- All MySQL projects are hosted on Launchpad
- (http://launchpad.net/). MySQL projects, including MySQL server,
- MySQL Workbench, and others are available from the Sun/MySQL
- Engineering (http://launchpad.net/~mysql) page. For the
- repositories related only to MySQL server, see the MySQL Server
- (http://launchpad.net/mysql-server) page.
-
- To build under Unix/Linux, you must have the following tools
- installed:
-
- * GNU make, available from http://www.gnu.org/software/make/.
- Although some platforms come with their own make
- implementations, it is highly recommended that you use GNU
- make. It may already be available on your system as gmake.
-
- * autoconf 2.58 (or newer), available from
- http://www.gnu.org/software/autoconf/.
-
- * automake 1.8.1, available from
- http://www.gnu.org/software/automake/.
-
- * libtool 1.5, available from
- http://www.gnu.org/software/libtool/.
-
- * m4, available from http://www.gnu.org/software/m4/.
-
- * bison, available from http://www.gnu.org/software/bison/. You
- should use the latest version of bison where possible. Version
- 1.75 and version 2.1 are known to work. There have been
- reported problems with bison 1.875. If you experience
- problems, upgrade to a later, rather than earlier, version.
- Versions of bison older than 1.75 may report this error:
-sql_yacc.yy:#####: fatal error: maximum table size (32767) exceeded
- The maximum table size is not actually exceeded; the error is
- caused by bugs in older versions of bison.
-
- To build under Windows you must have Microsoft Visual C++ 2005
- Express Edition, Visual Studio .Net 2003 (7.1), or Visual Studio
- 2005 (8.0) compiler system.
-
- Once the necessary tools are installed, you must create a local
- branch of the MySQL source code on your machine:
-
- 1. To obtain a copy of the MySQL source code, you must create a
- new Bazaar branch. If you do not already have a Bazaar
- repository directory set up, you need to initialize a new
- directory:
-shell> mkdir mysql-server
-shell> bzr init-repo --trees mysql-server
-
- 2. Once you have an initialized directory, you can branch from
- the public MySQL server repositories to create a local source
- tree. To create a branch of a specific version:
-shell> cd mysql-server
-shell> bzr branch lp:mysql-server/5.1 mysql-5.1
-
- 3. The initial download will take some time to complete,
- depending on the speed of your connection. Please be patient.
- Once you have downloaded the first tree, additional trees
- should take significantly less time to download.
-
- 4. When building from the Bazaar branch, you may want to create a
- copy of your active branch so that you can make configuration
- and other changes without affecting the original branch
- contents. You can achieve this by branching from the original
- branch:
-shell> bzr branch mysql-5.1 mysql-5.1-build
-
- 5. To obtain changes made after you have set up the branch
- initially, update it using the pull option periodically. Use
- this command in the top-level directory of the local copy:
-shell> bzr pull
- You can examine the changeset comments for the tree by using
- the log option to bzr:
-shell> bzr log
- You can also browse changesets, comments, and source code
- online. To browse this information for MySQL 5.1, go to the
- Launchpad MySQL Server (http://launchpad.net/mysql-server)
- page.
- If you see diffs (changes) or code that you have a question
- about, do not hesitate to send email to the MySQL internals
- mailing list. See Section 1.6.1, "MySQL Mailing Lists." Also,
- if you think you have a better idea on how to do something,
- send an email message to the list with a patch.
-
- After you have the local branch, you can build MySQL server from
- the source code. On Windows, the build process is different from
- Unix/Linux: see Section 2.5.10, "Installing MySQL from Source on
- Windows."
-
- On Unix/Linux, use the autoconf system to create the configure
- script so that you can configure the build environment before
- building. The following example shows the typical commands
- required to build MySQL from a source tree.
-
- 1. Change location to the top-level directory of the source tree;
- replace mysql-5.1 with the appropriate directory name.
-shell> cd mysql-5.1
-
- 2. Prepare the source tree for configuration.
- Prior to MySQL 5.1.12, you must separately configure the
- InnoDB storage engine. Run the following command from the main
- source directory:
-shell> (cd storage/innobase; autoreconf --force --install)
- You can omit the previous command for MySQL 5.1.12 and later,
- or if you do not require InnoDB support.
- Prepare the remainder of the source tree:
-shell> autoreconf --force --install
- As an alternative to the preceding autoreconf command, you can
- use BUILD/autorun.sh, which acts as a shortcut for the
- following sequence of commands:
-shell> aclocal; autoheader
-shell> libtoolize --automake --force
-shell> automake --force --add-missing; autoconf
- If you get some strange errors during this stage, verify that
- you have the correct version of libtool installed.
-
- 3. Configure the source tree and compile MySQL:
-shell> ./configure # Add your favorite options here
-shell> make
- For a description of some configure options, see Section
- 2.3.2, "Typical configure Options."
- A collection of our standard configuration scripts is located
- in the BUILD/ subdirectory. For example, you may find it more
- convenient to use the BUILD/compile-pentium-debug script than
- the preceding set of shell commands. To compile on a different
- architecture, modify the script by removing flags that are
- Pentium-specific, or use another script that may be more
- appropriate. These scripts are provided on an "as-is" basis.
- They are not officially maintained and their contents may
- change from release to release.
-
- 4. When the build is done, run make install. Be careful with this
- on a production machine; the command may overwrite your live
- release installation. If you already have MySQL installed and
- do not want to overwrite it, run ./configure with values for
- the --prefix, --with-tcp-port, and --with-unix-socket-path
- options different from those used for your production server.
-
- 5. Play hard with your new installation and try to make the new
- features crash. Start by running make test. See Section
- 22.1.2, "MySQL Test Suite."
-
- 6. If you have gotten to the make stage, but the distribution
- does not compile, please enter the problem into our bugs
- database using the instructions given in Section 1.7, "How to
- Report Bugs or Problems." If you have installed the latest
- versions of the required GNU tools, and they crash trying to
- process our configuration files, please report that also.
- However, if you get a command not found error or a similar
- problem for aclocal, configure, or other required tools, do
- not report it. Instead, make sure that all the required tools
- are installed and that your PATH variable is set correctly so
- that your shell can find them.
-
-2.3.4. Dealing with Problems Compiling MySQL
-
- All MySQL programs compile cleanly for us with no warnings on
- Solaris or Linux using gcc. On other systems, warnings may occur
- due to differences in system include files. See Section 2.3.5,
- "MIT-pthreads Notes," for warnings that may occur when using
- MIT-pthreads. For other problems, check the following list.
-
- The solution to many problems involves reconfiguring. If you do
- need to reconfigure, take note of the following:
-
- * If configure is run after it has previously been run, it may
- use information that was gathered during its previous
- invocation. This information is stored in config.cache. When
- configure starts up, it looks for that file and reads its
- contents if it exists, on the assumption that the information
- is still correct. That assumption is invalid when you
- reconfigure.
-
- * Each time you run configure, you must run make again to
- recompile. However, you may want to remove old object files
- from previous builds first because they were compiled using
- different configuration options.
-
- To prevent old configuration information or object files from
- being used, run these commands before re-running configure:
-shell> rm config.cache
-shell> make clean
-
- Alternatively, you can run make distclean.
-
- The following list describes some of the problems when compiling
- MySQL that have been found to occur most often:
-
- * If you get errors such as the ones shown here when compiling
- sql_yacc.cc, you probably have run out of memory or swap
- space:
-Internal compiler error: program cc1plus got fatal signal 11
-Out of virtual memory
-Virtual memory exhausted
- The problem is that gcc requires a huge amount of memory to
- compile sql_yacc.cc with inline functions. Try running
- configure with the --with-low-memory option:
-shell> ./configure --with-low-memory
- This option causes -fno-inline to be added to the compile line
- if you are using gcc and -O0 if you are using something else.
- You should try the --with-low-memory option even if you have
- so much memory and swap space that you think you can't
- possibly have run out. This problem has been observed to occur
- even on systems with generous hardware configurations, and the
- --with-low-memory option usually fixes it.
-
- * By default, configure picks c++ as the compiler name and GNU
- c++ links with -lg++. If you are using gcc, that behavior can
- cause problems during configuration such as this:
-configure: error: installation or configuration problem:
-C++ compiler cannot create executables.
- You might also observe problems during compilation related to
- g++, libg++, or libstdc++.
- One cause of these problems is that you may not have g++, or
- you may have g++ but not libg++, or libstdc++. Take a look at
- the config.log file. It should contain the exact reason why
- your C++ compiler didn't work. To work around these problems,
- you can use gcc as your C++ compiler. Try setting the
- environment variable CXX to "gcc -O3". For example:
-shell> CXX="gcc -O3" ./configure
- This works because gcc compiles C++ source files as well as
- g++ does, but does not link in libg++ or libstdc++ by default.
- Another way to fix these problems is to install g++, libg++,
- and libstdc++. However, do not use libg++ or libstdc++ with
- MySQL because this only increases the binary size of mysqld
- without providing any benefits. Some versions of these
- libraries have also caused strange problems for MySQL users in
- the past.
-
- * If your compile fails with errors such as any of the
- following, you must upgrade your version of make to GNU make:
-making all in mit-pthreads
-make: Fatal error in reader: Makefile, line 18:
-Badly formed macro assignment
- Or:
-make: file `Makefile' line 18: Must be a separator (:
- Or:
-pthread.h: No such file or directory
- Solaris and FreeBSD are known to have troublesome make
- programs.
- GNU make 3.75 is known to work.
-
- * If you want to define flags to be used by your C or C++
- compilers, do so by adding the flags to the CFLAGS and
- CXXFLAGS environment variables. You can also specify the
- compiler names this way using CC and CXX. For example:
-shell> CC=gcc
-shell> CFLAGS=-O3
-shell> CXX=gcc
-shell> CXXFLAGS=-O3
-shell> export CC CFLAGS CXX CXXFLAGS
- See Section 2.2, "Installing MySQL from Generic Binaries on
- Unix/Linux," for a list of flag definitions that have been
- found to be useful on various systems.
-
- * If you get errors such as those shown here when compiling
- mysqld, configure did not correctly detect the type of the
- last argument to accept(), getsockname(), or getpeername():
-cxx: Error: mysqld.cc, line 645: In this statement, the referenced
- type of the pointer value ''length'' is ''unsigned long'',
- which is not compatible with ''int''.
-new_sock = accept(sock, (struct sockaddr *)&cAddr, &length);
- To fix this, edit the config.h file (which is generated by
- configure). Look for these lines:
-/* Define as the base type of the last arg to accept */
-#define SOCKET_SIZE_TYPE XXX
- Change XXX to size_t or int, depending on your operating
- system. (You must do this each time you run configure because
- configure regenerates config.h.)
-
- * The sql_yacc.cc file is generated from sql_yacc.yy. Normally,
- the build process does not need to create sql_yacc.cc because
- MySQL comes with a pre-generated copy. However, if you do need
- to re-create it, you might encounter this error:
-"sql_yacc.yy", line xxx fatal: default action causes potential...
- This is a sign that your version of yacc is deficient. You
- probably need to install bison (the GNU version of yacc) and
- use that instead.
-
- * On Debian Linux 3.0, you need to install gawk instead of the
- default mawk.
-
- * If you need to debug mysqld or a MySQL client, run configure
- with the --with-debug option, and then recompile and link your
- clients with the new client library. See MySQL Internals:
- Porting (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
-
- * If you get a compilation error on Linux (for example, SuSE
- Linux 8.1 or Red Hat Linux 7.3) similar to the following one,
- you probably do not have g++ installed:
-libmysql.c:1329: warning: passing arg 5 of `gethostbyname_r' from
-incompatible pointer type
-libmysql.c:1329: too few arguments to function `gethostbyname_r'
-libmysql.c:1329: warning: assignment makes pointer from integer
-without a cast
-make[2]: *** [libmysql.lo] Error 1
- By default, the configure script attempts to determine the
- correct number of arguments by using g++ (the GNU C++
- compiler). This test yields incorrect results if g++ is not
- installed. There are two ways to work around this problem:
-
- + Make sure that the GNU C++ g++ is installed. On some
- Linux distributions, the required package is called gpp;
- on others, it is named gcc-c++.
-
- + Use gcc as your C++ compiler by setting the CXX
- environment variable to gcc:
-export CXX="gcc"
- You must run configure again after making either of those
- changes.
-
-2.3.5. MIT-pthreads Notes
-
- This section describes some of the issues involved in using
- MIT-pthreads.
-
- On Linux, you should not use MIT-pthreads. Use the installed
- LinuxThreads implementation instead. See Section 2.6, "Installing
- MySQL on Linux."
-
- If your system does not provide native thread support, you should
- build MySQL using the MIT-pthreads package. This includes older
- FreeBSD systems, SunOS 4.x, Solaris 2.4 and earlier, and some
- others. See Section 2.1, "General Installation Guidance."
-
- MIT-pthreads is not part of the MySQL 5.1 source distribution. If
- you require this package, you need to download it separately from
- http://dev.mysql.com/Downloads/Contrib/pthreads-1_60_beta6-mysql.t
- ar.gz
-
- After downloading, extract this source archive into the top level
- of the MySQL source directory. It creates a new subdirectory named
- mit-pthreads.
-
- * On most systems, you can force MIT-pthreads to be used by
- running configure with the --with-mit-threads option:
-shell> ./configure --with-mit-threads
- Building in a nonsource directory is not supported when using
- MIT-pthreads because we want to minimize our changes to this
- code.
-
- * The checks that determine whether to use MIT-pthreads occur
- only during the part of the configuration process that deals
- with the server code. If you have configured the distribution
- using --without-server to build only the client code, clients
- do not know whether MIT-pthreads is being used and use Unix
- socket file connections by default. Because Unix socket files
- do not work under MIT-pthreads on some platforms, this means
- you need to use -h or --host with a value other than localhost
- when you run client programs.
-
- * When MySQL is compiled using MIT-pthreads, system locking is
- disabled by default for performance reasons. You can tell the
- server to use system locking with the --external-locking
- option. This is needed only if you want to be able to run two
- MySQL servers against the same data files, but that is not
- recommended, anyway.
-
- * Sometimes the pthread bind() command fails to bind to a socket
- without any error message (at least on Solaris). The result is
- that all connections to the server fail. For example:
-shell> mysqladmin version
-mysqladmin: connect to server at '' failed;
-error: 'Can't connect to mysql server on localhost (146)'
- The solution to this problem is to kill the mysqld server and
- restart it. This has happened to us only when we have forcibly
- stopped the server and restarted it immediately.
-
- * With MIT-pthreads, the sleep() system call isn't interruptible
- with SIGINT (break). This is noticeable only when you run
- mysqladmin --sleep. You must wait for the sleep() call to
- terminate before the interrupt is served and the process
- stops.
-
- * When linking, you might receive warning messages like these
- (at least on Solaris); they can be ignored:
-ld: warning: symbol `_iob' has differing sizes:
- (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
-file /usr/lib/libc.so value=0x140);
- /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
-ld: warning: symbol `__iob' has differing sizes:
- (file /my/local/pthreads/lib/libpthread.a(findfp.o) value=0x4;
-file /usr/lib/libc.so value=0x140);
- /my/local/pthreads/lib/libpthread.a(findfp.o) definition taken
-
- * Some other warnings also can be ignored:
-implicit declaration of function `int strtoll(...)'
-implicit declaration of function `int strtoul(...)'
-
- * We have not been able to make readline work with MIT-pthreads.
- (This is not necessary, but may be of interest to some.)
-
-2.4. Upgrading or Downgrading MySQL
-
-2.4.1. Upgrading MySQL
-
- As a general rule, to upgrade from one release series to another,
- you should go to the next series rather than skipping a series. To
- upgrade from a release series previous to MySQL 5.0, upgrade to
- each successive release series in turn until you have reached
- MySQL 5.0, and then proceed with the upgrade to MySQL 5.1. For
- example, if you currently are running MySQL 4.0 and wish to
- upgrade to a newer series, upgrade to MySQL 4.1 first before
- upgrading to 5.0, and so forth. For information on upgrading to
- MySQL 5.0, see the MySQL 5.0 Reference Manual; for earlier
- releases, see the MySQL 3.23, 4.0, 4.1 Reference Manual.
-
- If you perform a binary (in-place) upgrade without dumping and
- reloading tables, you cannot upgrade directly from MySQL 4.1 to
- 5.1. This occurs due to an incompatible change in the MyISAM table
- index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
- repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
- Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
- and check and repair your tables.
-
- To upgrade from MySQL 5.0 to 5.1, use the items in the following
- checklist as a guide:
-
- * Before any upgrade, back up your databases, including the
- mysql database that contains the grant tables. See Section
- 6.2, "Database Backup Methods."
-
- * Read all the notes in Section 2.4.1.1, "Upgrading from MySQL
- 5.0 to 5.1." These notes enable you to identify upgrade issues
- that apply to your current MySQL installation. Some
- incompatibilities discussed in that section require your
- attention before upgrading. Others should be dealt with after
- upgrading.
-
- * Read Appendix C, "MySQL Change History" as well, which
- provides information about features that are new in MySQL 5.1
- or differ from those found in MySQL 5.0.
-
- * After you upgrade to a new version of MySQL, run mysql_upgrade
- (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
- Upgrade"). This program checks your tables, and attempts to
- repair them if necessary. It also updates your grant tables to
- make sure that they have the current structure so that you can
- take advantage of any new capabilities. (Some releases of
- MySQL introduce changes to the structure of the grant tables
- to add new privileges or features.)
-
- * If you are running MySQL Server on Windows, see Section 2.5.7,
- "Upgrading MySQL on Windows."
-
- * If you are using replication, see Section 16.4.3, "Upgrading a
- Replication Setup," for information on upgrading your
- replication setup.
-
- * If you are upgrading an installation originally produced by
- installing multiple RPM packages, it is best to upgrade all
- the packages, not just some. For example, if you previously
- installed the server and client RPMs, do not upgrade just the
- server RPM.
-
- * As of MySQL 5.1.9, the mysqld-max server is included in binary
- distributions. There is no separate MySQL-Max distribution. As
- of MySQL 5.1.12, there is no mysqld-max server at all in
- binary distributions. They contain a server that includes the
- features previously included in mysqld-max.
-
- * If you have created a user-defined function (UDF) with a given
- name and upgrade MySQL to a version that implements a new
- built-in function with the same name, the UDF becomes
- inaccessible. To correct this, use DROP FUNCTION to drop the
- UDF, and then use CREATE FUNCTION to re-create the UDF with a
- different nonconflicting name. The same is true if the new
- version of MySQL implements a built-in function with the same
- name as an existing stored function. See Section 8.2.4,
- "Function Name Parsing and Resolution," for the rules
- describing how the server interprets references to different
- kinds of functions.
-
- You can always move the MySQL format files and data files between
- different versions on systems with the same architecture as long
- as you stay within versions for the same release series of MySQL.
-
- If you are cautious about using new versions, you can always
- rename your old mysqld before installing a newer one. For example,
- if you are using MySQL 5.0.13 and want to upgrade to 5.1.10,
- rename your current server from mysqld to mysqld-5.0.13. If your
- new mysqld then does something unexpected, you can simply shut it
- down and restart with your old mysqld.
-
- If, after an upgrade, you experience problems with recompiled
- client programs, such as Commands out of sync or unexpected core
- dumps, you probably have used old header or library files when
- compiling your programs. In this case, you should check the date
- for your mysql.h file and libmysqlclient.a library to verify that
- they are from the new MySQL distribution. If not, recompile your
- programs with the new headers and libraries.
-
- If problems occur, such as that the new mysqld server does not
- start or that you cannot connect without a password, verify that
- you do not have an old my.cnf file from your previous
- installation. You can check this with the --print-defaults option
- (for example, mysqld --print-defaults). If this command displays
- anything other than the program name, you have an active my.cnf
- file that affects server or client operation.
-
- If your MySQL installation contains a large amount of data that
- might take a long time to convert after an in-place upgrade, you
- might find it useful to create a "dummy" database instance for
- assessing what conversions might be needed and the work involved
- to perform them. Make a copy of your MySQL instance that contains
- a full copy of the mysql database, plus all other databases
- without data. Run your upgrade procedure on this dummy instance to
- see what actions might be needed so that you can better evaluate
- the work involved when performing actual data conversion on your
- original database instance.
-
- It is a good idea to rebuild and reinstall the Perl DBD::mysql
- module whenever you install a new release of MySQL. The same
- applies to other MySQL interfaces as well, such as PHP mysql
- extensions and the Python MySQLdb module.
-
-2.4.1.1. Upgrading from MySQL 5.0 to 5.1
-
- After upgrading a 5.0 installation to 5.0.10 or above, it is
- necessary to upgrade your grant tables. Otherwise, creating stored
- procedures and functions might not work. To perform this upgrade,
- run mysql_upgrade.
-
-Note
-
- It is good practice to back up your data before installing any new
- version of software. Although MySQL works very hard to ensure a
- high level of quality, you should protect your data by making a
- backup.
-
- To upgrade to 5.1 from any previous version, MySQL recommends that
- you dump your tables with mysqldump before upgrading and reload
- the dump file after upgrading.
-
- If you perform a binary (in-place) upgrade without dumping and
- reloading tables, you cannot upgrade directly from MySQL 4.1 to
- 5.1. This occurs due to an incompatible change in the MyISAM table
- index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
- repair all MyISAM tables (see Section 2.4.4, "Rebuilding or
- Repairing Tables or Indexes"). Then upgrade from MySQL 5.0 to 5.1
- and check and repair your tables.
-
- In general, you should do the following when upgrading from MySQL
- 5.0 to 5.1:
-
- * Read all the items in the following sections to see whether
- any of them might affect your applications:
-
- + Section 2.4.1, "Upgrading MySQL," has general update
- information.
-
- + The items in the change lists found later in this section
- enable you to identify upgrade issues that apply to your
- current MySQL installation.
-
- + The MySQL 5.1 change history describes significant new
- features you can use in 5.1 or that differ from those
- found in MySQL 5.0. Some of these changes may result in
- incompatibilities. See Section C.1, "Changes in Release
- 5.1.x (Production)."
-
- * Note particularly any changes that are marked Known issue or
- Incompatible change. These incompatibilities with earlier
- versions of MySQL may require your attention before you
- upgrade.
- Our aim is to avoid these changes, but occasionally they are
- necessary to correct problems that would be worse than an
- incompatibility between releases. If any upgrade issue
- applicable to your installation involves an incompatibility
- that requires special handling, follow the instructions given
- in the incompatibility description. Often this will involve a
- dump and reload, or use of a statement such as CHECK TABLE or
- REPAIR TABLE.
- For dump and reload instructions, see Section 2.4.4,
- "Rebuilding or Repairing Tables or Indexes." Any procedure
- that involves REPAIR TABLE with the USE_FRM option must be
- done before upgrading. Use of this statement with a version of
- MySQL different from the one used to create the table (that
- is, using it after upgrading) may damage the table. See
- Section 12.4.2.6, "REPAIR TABLE Syntax."
-
- * After you upgrade to a new version of MySQL, run mysql_upgrade
- (see Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
- Upgrade"). This program checks your tables, and attempts to
- repair them if necessary. It also updates your grant tables to
- make sure that they have the current structure so that you can
- take advantage of any new capabilities. (Some releases of
- MySQL introduce changes to the structure of the grant tables
- to add new privileges or features.)
-
- * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
- Be Rebuilt," to see whether changes to table formats or to
- character sets or collations were made between your current
- version of MySQL and the version to which you are upgrading.
- If so and these changes result in an incompatibility between
- MySQL versions, you will need to upgrade the affected tables
- using the instructions in Section 2.4.4, "Rebuilding or
- Repairing Tables or Indexes."
-
- * If you are running MySQL Server on Windows, see Section 2.5.7,
- "Upgrading MySQL on Windows."
-
- * If you are using replication, see Section 16.4.3, "Upgrading a
- Replication Setup," for information on upgrading your
- replication setup.
-
- If your MySQL installation contains a large amount of data that
- might take a long time to convert after an in-place upgrade, you
- might find it useful to create a "dummy" database instance for
- assessing what conversions might be needed and the work involved
- to perform them. Make a copy of your MySQL instance that contains
- a full copy of the mysql database, plus all other databases
- without data. Run your upgrade procedure on this dummy instance to
- see what actions might be needed so that you can better evaluate
- the work involved when performing actual data conversion on your
- original database instance.
-
- MySQL Enterprise MySQL Enterprise subscribers will find more
- information about upgrading in the Knowledge Base articles found
- at Upgrading
- (https://kb.mysql.com/search.php?cat=search&category=41). Access
- to the MySQL Knowledge Base collection of articles is one of the
- advantages of subscribing to MySQL Enterprise. For more
- information, see
- http://www.mysql.com/products/enterprise/advisors.html.
-
- The following lists describe changes that may affect applications
- and that you should watch out for when upgrading to MySQL 5.1.
-
- Configuration Changes:
-
- * Before MySQL 5.1.11, to build MySQL from source with SSL
- support enabled, you would invoke configure with either the
- --with-openssl or --with-yassl option. In MySQL 5.1.11, those
- options both have been replaced by the --with-ssl option. By
- default, --with-ssl causes the bundled yaSSL library to be
- used. To select OpenSSL instead, give the option as
- --with-ssl=path, where path is the directory where the OpenSSL
- header files and libraries are located.
-
- Server Changes:
-
- * Known issue: After a binary upgrade to MySQL 5.1 from a MySQL
- 5.0 installation that contains ARCHIVE tables, accessing those
- tables will cause the server to crash, even if you have run
- mysql_upgrade or CHECK TABLE ... FOR UPGRADE. To work around
- this problem, use mysqldump to dump all ARCHIVE tables before
- upgrading, and reload them into MySQL 5.1 after upgrading.
-
- * Known issue: The fix for
- Bug#23491: http://bugs.mysql.com/bug.php?id=23491 introduced a
- problem with SHOW CREATE VIEW, which is used by mysqldump.
- This causes an incompatibility when upgrading from versions
- affected by that bug fix (MySQL 5.0.40 through 5.0.43, MySQL
- 5.1.18 through 5.1.19): If you use mysqldump before upgrading
- from an affected version and reload the data after upgrading
- to a higher version, you must drop and recreate your views.
-
- * Known issue: Dumps performed by using mysqldump to generate a
- dump file before the upgrade and reloading the file after
- upgrading are subject to the following problem:
- Before MySQL 5.0.40, mysqldump displays SPATIAL index
- definitions using prefix lengths for the indexed columns.
- These prefix lengths are accepted in MySQL 5.0, but not as of
- MySQL 5.1. If you use mysqldump from versions of MySQL older
- than 5.0.40, any table containing SPATIAL indexes will cause
- an error when the dump file is reloaded into MySQL 5.1 or
- higher.
- For example, a table definition might look like this when
- dumped in MySQL 5.0:
-CREATE TABLE `t` (
- `g` geometry NOT NULL,
- SPATIAL KEY `g` (`g`(32))
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- The SPATIAL index definition will not be accepted in MySQL
- 5.1. To work around this, edit the dump file to remove the
- prefix:
-CREATE TABLE `t` (
- `g` geometry NOT NULL,
- SPATIAL KEY `g` (`g`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
- Dump files can be large, so it may be preferable to dump table
- definitions and data separately to make it easier to edit the
- definitions:
-shell> mysqldump --no-data other_args > definitions.sql
-shell> mysqldump --no-create-info other_args > data.sql
- Then edit definitions.sql before reloading definitions.sql and
- data.sql, in that order.
- If you upgrade to a version of MySQL 5.0 higher than 5.0.40
- before upgrading to MySQL 5.1, this problem does not occur.
-
- * Known issue: Before MySQL 5.1.30, the CHECK TABLE ... FOR
- UPGRADE statement did not check for incompatible collation
- changes made in MySQL 5.1.24. (This also affects mysqlcheck
- and mysql_upgrade, which cause that statement to be executed.)
- Prior to the fix made in 5.1.30, a binary upgrade (performed
- without dumping tables with mysqldump before the upgrade and
- reloading the dump file after the upgrade) would corrupt
- tables. After the fix, CHECK TABLE ... FOR UPGRADE properly
- detects the problem and warns about tables that need repair.
- However, the fix is not backward compatible and can result in
- a downgrading problem under these circumstances:
-
- 1. Perform a binary upgrade to a version of MySQL that
- includes the fix.
-
- 2. Run CHECK TABLE ... FOR UPGRADE (or mysqlcheck or
- mysql_upgrade) to upgrade tables.
-
- 3. Perform a binary downgrade to a version of MySQL that
- does not include the fix.
- The solution is to dump tables with mysqldump before the
- downgrade and reload the dump file after the downgrade.
- Alternatively, drop and recreate affected indexes.
-
- * Known issue: MySQL introduces encoding for table names that
- have non-ASCII characters (see Section 8.2.3, "Mapping of
- Identifiers to File Names"). After a binary upgrade from MySQL
- 5.0 to 5.1 or higher, the server recognizes names that have
- non-ASCII characters and adds a #mysql50# prefix to them.
- As of MySQL 5.1.31, mysql_upgrade encodes these names by
- executing the following command:
-mysqlcheck --all-databases --check-upgrade --fix-db-names --fix-table
--names
- Prior to MySQL 5.1.31, mysql_upgrade does not execute this
- command, so you should execute it manually if you have
- database or table names that contain nonalphanumeric
- characters.
- Prior to MySQL 5.1.23, the mysqlcheck command does not perform
- the name encoding for views. To work around this problem, drop
- each affected view and recreate it.
- mysqlcheck cannot fix names that contain literal instances of
- the @ character that is used for encoding special characters.
- If you have databases or tables that contain this character,
- use mysqldump to dump them before upgrading to MySQL 5.1, and
- then reload the dump file after upgrading.
-
- * Known issue: When upgrading from MySQL 5.0 to versions of 5.1
- prior to 5.1.23, running mysqlcheck (or mysql_upgrade, which
- runs mysqlcheck) to upgrade tables fails for names that must
- be written as quoted identifiers. To work around this problem,
- rename each affected table to a name that does not require
- quoting:
-RENAME TABLE `tab``le_a` TO table_a;
-RENAME TABLE `table b` TO table_b;
- After renaming the tables, run the mysql_upgrade program. Then
- rename the tables back to their original names:
-RENAME TABLE table_a TO `tab``le_a`;
-RENAME TABLE table_b TO `table b`;
-
- * Known issue: In connection with view creation, the server
- created arc directories inside database directories and
- maintained useless copies of .frm files there. Creation and
- renaming procedures of those copies as well as creation of arc
- directories has been discontinued in MySQL 5.1.29.
- This change does cause a problem when downgrading to older
- server versions which manifests itself under these
- circumstances:
-
- 1. Create a view v_orig in MySQL 5.1.29 or higher.
-
- 2. Rename the view to v_new and then back to v_orig.
-
- 3. Downgrade to an older 5.1.x server and run mysql_upgrade.
-
- 4. Try to rename v_orig to v_new again. This operation
- fails.
- As a workaround to avoid this problem, use either of these
- approaches:
-
- + Dump your data using mysqldump before downgrading and
- reload the dump file after downgrading.
-
- + Instead of renaming a view after the downgrade, drop it
- and recreate it.
-
- * Incompatible change: Character set or collation changes were
- made in MySQL 5.1.21, 5.1.23, and 5.1.24 that may require
- table indexes to be rebuilt. For details, see Section 2.4.3,
- "Checking Whether Tables or Indexes Must Be Rebuilt."
-
- * Incompatible change: MySQL 5.1 implements support for a plugin
- API that allows the loading and unloading of components at
- runtime, without restarting the server. Section 22.2, "The
- MySQL Plugin API." The plugin API requires the mysql.plugin
- table. After upgrading from an older version of MySQL, you
- should run the mysql_upgrade command to create this table. See
- Section 4.4.8, "mysql_upgrade --- Check Tables for MySQL
- Upgrade."
- Plugins are installed in the directory named by the plugin_dir
- system variable. This variable also controls the location from
- which the server loads user-defined functions (UDFs), which is
- a change from earlier versions of MySQL. That is, all UDF
- library files now must be installed in the plugin directory.
- When upgrading from an older version of MySQL, you must
- migrate your UDF files to the plugin directory.
-
- * Incompatible change: The table_cache system variable has been
- renamed to table_open_cache. Any scripts that refer to
- table_cache must be updated to use the new name.
-
- * Incompatible change: In MySQL 5.1.36, options for loading
- plugins such as pluggable storage engines were changed from
- boolean to tristate format. The implementations overlap, but
- if you previously used options of the form --plugin_name=0 or
- --plugin_name=1, you should instead use --plugin_name=OFF or
- --plugin_name=ON, respectively. For details, see Section
- 5.1.3, "Server Options for Loading Plugins."
-
- * Incompatible change: From MySQL 5.1.24 to 5.1.31, the UPDATE
- statement was changed such that assigning NULL to a NOT NULL
- column caused an error even when strict SQL mode was not
- enabled. The original behavior before MySQL 5.1.24 was that
- such assignments caused an error only in strict SQL mode, and
- otherwise set the column to the implicit default value for the
- column data type and generated a warning. (For information
- about implicit default values, see Section 10.1.4, "Data Type
- Default Values.")
- The change caused compatibility problems for applications that
- relied on the original behavior. It also caused replication
- problems between servers that had the original behavior and
- those that did not, for applications that assigned NULL to NOT
- NULL columns in UPDATE statements without strict SQL mode
- enabled. The change was reverted in MySQL 5.1.32 so that
- UPDATE again had the original behavior. Problems can still
- occur if you replicate between servers that have the modified
- UPDATE behavior and those that do not.
-
- * Incompatible change: As of MySQL 5.1.29, the default binary
- logging mode has been changed from MIXED to STATEMENT for
- compatibility with MySQL 5.0.
-
- * Incompatible change: In MySQL 5.1.25, a change was made to the
- way that the server handles prepared statements. This affects
- prepared statements processed at the SQL level (using the
- PREPARE statement) and those processed using the binary
- client-server protocol (using the mysql_stmt_prepare() C API
- function).
- Previously, changes to metadata of tables or views referred to
- in a prepared statement could cause a server crash when the
- statement was next executed, or perhaps an error at execute
- time with a crash occurring later. For example, this could
- happen after dropping a table and recreating it with a
- different definition.
- Now metadata changes to tables or views referred to by
- prepared statements are detected and cause automatic
- repreparation of the statement when it is next executed.
- Metadata changes occur for DDL statements such as those that
- create, drop, alter, rename, or truncate tables, or that
- analyze, optimize, or repair tables. Repreparation also occurs
- after referenced tables or views are flushed from the table
- definition cache, either implicitly to make room for new
- entries in the cache, or explicitly due to FLUSH TABLES.
- Repreparation is automatic, but to the extent that it occurs,
- performance of prepared statements is diminished.
- Table content changes (for example, with INSERT or UPDATE) do
- not cause repreparation, nor do SELECT statements.
- An incompatibility with previous versions of MySQL is that a
- prepared statement may now return a different set of columns
- or different column types from one execution to the next. For
- example, if the prepared statement is SELECT * FROM t1,
- altering t1 to contain a different number of columns causes
- the next execution to return a number of columns different
- from the previous execution.
- Older versions of the client library cannot handle this change
- in behavior. For applications that use prepared statements
- with the new server, an upgrade to the new client library is
- strongly recommended.
- Along with this change to statement repreparation, the default
- value of the table_definition_cache system variable has been
- increased from 128 to 256. The purpose of this increase is to
- lessen the chance that prepared statements will need
- repreparation due to referred-to tables/views having been
- flushed from the cache to make room for new entries.
- A new status variable, Com_stmt_reprepare, has been introduced
- to track the number of repreparations.
-
- * Incompatible change: As of MySQL 5.1.23, within a stored
- routine, it is no longer allowable to declare a cursor for a
- SHOW or DESCRIBE statement. This happened to work in some
- instances, but is no longer supported. In many cases, a
- workaround for this change is to use the cursor with a SELECT
- query to read from an INFORMATION_SCHEMA table that produces
- the same information as the SHOW statement.
-
- * Incompatible change: SHOW CREATE VIEW displays view
- definitions using an AS alias_name clause for each column. If
- a column is created from an expression, the default alias is
- the expression text, which can be quite long. As of MySQL
- 5.1.23, aliases for column names in CREATE VIEW statements are
- checked against the maximum column length of 64 characters
- (not the maximum alias length of 256 characters). As a result,
- views created from the output of SHOW CREATE VIEW fail if any
- column alias exceeds 64 characters. This can cause problems
- for replication or loading dump files. For additional
- information and workarounds, see Section D.4, "Restrictions on
- Views."
-
- * Incompatible change: Several issues were identified for stored
- programs (stored procedures and functions, triggers, and
- events) and views containing non-ASCII symbols. These issues
- involved conversion errors due to incomplete character set
- information when translating these objects to and from stored
- format.
- To address these problems, the representation for these
- objects was changed in MySQL 5.1.21. However, the fixes affect
- all stored programs and views. (For example, you will see
- warnings about "no creation context.") To avoid warnings from
- the server about the use of old definitions from any release
- prior to 5.1.21, you should dump stored programs and views
- with mysqldump after upgrading to 5.1.21 or higher, and then
- reload them to recreate them with new definitions. Invoke
- mysqldump with a --default-character-set option that names the
- non-ASCII character set that was used for the definitions when
- the objects were originally defined.
-
- * Incompatible change: As of MySQL 5.1.20, mysqld_safe supports
- error logging to syslog on systems that support the logger
- command. The new --syslog and --skip-syslog options can be
- used instead of the --log-error option to control logging
- behavior, as described in Section 4.3.2, "mysqld_safe ---
- MySQL Server Startup Script."
- In 5.1.21 and up, the default is --skip-syslog, which is
- compatible with the default behavior of writing an error log
- file for releases prior to 5.1.20.
- In 5.1.20 only, the following conditions apply: 1) The default
- is to use syslog, which is not compatible with releases prior
- to 5.1.20. 2) Logging to syslog may fail to operate correctly
- in some cases. For these reasons, avoid using MySQL 5.1.20.
-
- * Incompatible change: As of MySQL 5.1.18, the plugin interface
- and its handling of system variables was changed. Command-line
- options such as --skip-innodb now cause an error if InnoDB is
- not built-in or plugin-loaded. You should use
- --loose-skip-innodb if you do not want any error even if
- InnoDB is not available. The --loose prefix modifier should be
- used for all command-line options where you are uncertain
- whether the plugin exists and when you want the operation to
- proceed even if the option is necessarily ignored due to the
- absence of the plugin. (For a desecription of how --loose
- works, see Section 4.2.3.1, "Using Options on the Command
- Line.")
-
- * Incompatible change: As of MySQL 5.1.15, InnoDB rolls back
- only the last statement on a transaction timeout. A new
- option, --innodb_rollback_on_timeout, causes InnoDB to abort
- and roll back the entire transaction if a transaction timeout
- occurs (the same behavior as in MySQL 4.1).
-
- * Incompatible change: As of MySQL 5.1.15, the following
- conditions apply to enabling the read_only system variable:
-
- + If you attempt to enable read_only while you have any
- explicit locks (acquired with LOCK TABLES or have a
- pending transaction, an error will occur.
-
- + If other clients hold explicit table locks or have
- pending transactions, the attempt to enable read_only
- blocks until the locks are released and the transactions
- end. While the attempt to enable read_only is pending,
- requests by other clients for table locks or to begin
- transactions also block until read_only has been set.
-
- + read_only can be enabled while you hold a global read
- lock (acquired with FLUSH TABLES WITH READ LOCK) because
- that does not involve table locks.
- Previously, the attempt to enable read_only would return
- immediately even if explicit locks or transactions were
- pending, so some data changes could occur for statements
- executing in the server at the same time.
-
- * Incompatible change: The number of function names affected by
- IGNORE_SPACE was reduced significantly in MySQL 5.1.13, from
- about 200 to about 30. (For details about IGNORE_SPACE, see
- Section 8.2.4, "Function Name Parsing and Resolution.") This
- change improves the consistency of parser operation. However,
- it also introduces the possibility of incompatibility for old
- SQL code that relies on the following conditions:
-
- + IGNORE_SPACE is disabled.
-
- + The presence or absence of whitespace following a
- function name is used to distinguish between a built-in
- function and stored function that have the same name (for
- example, PI() versus PI ()).
- For functions that are no longer affected by IGNORE_SPACE as
- of MySQL 5.1.13, that strategy no longer works. Either of the
- following approaches can be used if you have code that is
- subject to the preceding incompatibility:
-
- + If a stored function has a name that conflicts with a
- built-in function, refer to the stored function with a
- schema name qualifier, regardless of whether whitespace
- is present. For example, write schema_name.PI() or
- schema_name.PI ().
-
- + Alternatively, rename the stored function to use a
- nonconflicting name and change invocations of the
- function to use the new name.
-
- * Incompatible change: For utf8 columns, the full-text parser
- incorrectly considered several nonword punctuation and
- whitespace characters as word characters, causing some
- searches to return incorrect results. The fix involves a
- change to the full-text parser in MySQL 5.1.12, so as of
- 5.1.12, any tables that have FULLTEXT indexes on utf8 columns
- must be repaired with REPAIR TABLE:
-REPAIR TABLE tbl_name QUICK;
-
- * Incompatible change: Storage engines can be pluggable at
- runtime, so the distinction between disabled and invalid
- storage engines no longer applies. As of MySQL 5.1.12, this
- affects the NO_ENGINE_SUBSTITUTION SQL mode, as described in
- Section 5.1.8, "Server SQL Modes."
-
- * Incompatible change: The structure of FULLTEXT indexes has
- been changed in MySQL 5.1.6. After upgrading to MySQL 5.1.6 or
- greater, any tables that have FULLTEXT indexes must be
- repaired with REPAIR TABLE:
-REPAIR TABLE tbl_name QUICK;
-
- * Incompatible change: In MySQL 5.1.6, when log tables were
- implemented, the default log destination for the general query
- and slow query log was TABLE. As of MySQL 5.1.21, this default
- has been changed to FILE, which is compatible with MySQL 5.0,
- but incompatible with earlier releases of MySQL 5.1. If you
- are upgrading from MySQL 5.0 to 5.1.21 or higher, no logging
- option changes should be necessary. However, if you are
- upgrading from 5.1.6 through 5.1.20 to 5.1.21 or higher and
- were using TABLE logging, use the --log-output=TABLE option
- explicitly to preserve your server's table-logging behavior.
-
- * Incompatible change: For ENUM columns that had enumeration
- values containing commas, the commas were mapped to 0xff
- internally. However, this rendered the commas
- indistinguishable from true 0xff characters in the values.
- This no longer occurs. However, the fix requires that you dump
- and reload any tables that have ENUM columns containing true
- 0xff in their values: Dump the tables using mysqldump with the
- current server before upgrading from a version of MySQL 5.1
- older than 5.1.15 to version 5.1.15 or newer.
-
- * As of MySQL 5.1.12, the lc_time_names system variable
- specifies the locale that controls the language used to
- display day and month names and abbreviations. This variable
- affects the output from the DATE_FORMAT(), DAYNAME() and
- MONTHNAME() functions. See Section 9.7, "MySQL Server Locale
- Support."
-
- * As of MySQL 5.1.9, mysqld_safe no longer implicitly invokes
- mysqld-max if it exists. Instead, it invokes mysqld unless a
- --mysqld or --mysqld-version option is given to specify
- another server explicitly. If you previously relied on the
- implicit invocation of mysqld-max, you should use an
- appropriate option now. As of MySQL 5.1.12, there is no longer
- any separate mysqld-max server, so no change should be
- necessary.
-
- SQL Changes:
-
- * Known issue: Prior to MySQL 5.1.17, the parser accepted
- invalid code in SQL condition handlers, leading to server
- crashes or unexpected execution behavior in stored programs.
- Specifically, the parser allowed a condition handler to refer
- to labels for blocks that enclose the handler declaration.
- This was incorrect because block label scope does not include
- the code for handlers declared within the labeled block.
- As of 5.1.17, the parser rejects this invalid construct, but
- if you perform a binary upgrade (without dumping and reloading
- your databases), existing handlers that contain the construct
- still are invalid and should be rewritten even if they appear
- to function as you expect.
- To find affected handlers, use mysqldump to dump all stored
- procedures and functions, triggers, and events. Then attempt
- to reload them into an upgraded server. Handlers that contain
- illegal label references will be rejected.
- For more information about condition handlers and writing them
- to avoid invalid jumps, see Section 12.7.4.2, "DECLARE for
- Handlers."
-
- * Incompatible change: The parser accepted statements that
- contained /* ... */ that were not properly closed with */,
- such as SELECT 1 /* + 2. As of MySQL 5.1.23, statements that
- contain unclosed /*-comments now are rejected with a syntax
- error.
- This fix has the potential to cause incompatibilities. Because
- of Bug#26302: http://bugs.mysql.com/bug.php?id=26302, which
- caused the trailing */ to be truncated from comments in views,
- stored routines, triggers, and events, it is possible that
- objects of those types may have been stored with definitions
- that now will be rejected as syntactically invalid. Such
- objects should be dropped and re-created so that their
- definitions do not contain truncated comments.
-
- * Incompatible change: Multiple-table DELETE statements
- containing ambiguous aliases could have unintended side
- effects such as deleting rows from the wrong table. Example:
-DELETE FROM t1 AS a2 USING t1 AS a1 INNER JOIN t2 AS a2;
- As of MySQL 5.1.23, alias declarations can be declared only in
- the table_references part. Elsewhere in the statement, alias
- references are allowed but not alias declarations. Statements
- containing aliases that are no longer allowed must be
- rewritten.
-
- * Incompatible change: As of MySQL 5.1.8, TYPE = engine_name is
- still accepted as a synonym for the ENGINE = engine_name table
- option but generates a warning. You should note that this
- option is not available in MySQL 5.1.7, and is removed
- altogether as of MySQL 5.4 and produces a syntax error.
- TYPE has been deprecated since MySQL 4.0.
-
- * Incompatible change: The namespace for triggers changed in
- MySQL 5.0.10. Previously, trigger names had to be unique per
- table. Now they must be unique within the schema (database).
- An implication of this change is that DROP TRIGGER syntax now
- uses a schema name instead of a table name (schema name is
- optional and, if omitted, the current schema will be used).
- When upgrading from a version of MySQL 5 older than 5.0.10 to
- MySQL 5.0.10 or newer, you must drop all triggers and
- re-create them or DROP TRIGGER will not work after the
- upgrade. Here is a suggested procedure for doing this:
-
- 1. Upgrade to MySQL 5.0.10 or later to be able to access
- trigger information in the INFORMATION_SCHEMA.TRIGGERS
- table. (This should work even for pre-5.0.10 triggers.)
-
- 2. Dump all trigger definitions using the following SELECT
- statement:
-SELECT CONCAT('CREATE TRIGGER ', t.TRIGGER_SCHEMA, '.', t.TRIGGER_NAM
-E,
- ' ', t.ACTION_TIMING, ' ', t.EVENT_MANIPULATION, ' ON '
-,
- t.EVENT_OBJECT_SCHEMA, '.', t.EVENT_OBJECT_TABLE,
- ' FOR EACH ROW ', t.ACTION_STATEMENT, '//' )
-INTO OUTFILE '/tmp/triggers.sql'
-FROM INFORMATION_SCHEMA.TRIGGERS AS t;
- The statement uses INTO OUTFILE, so you must have the
- FILE privilege. The file will be created on the server
- host. Use a different file name if you like. To be 100%
- safe, inspect the trigger definitions in the triggers.sql
- file, and perhaps make a backup of the file.
-
- 3. Stop the server and drop all triggers by removing all
- .TRG files in your database directories. Change location
- to your data directory and issue this command:
-shell> rm */*.TRG
-
- 4. Start the server and re-create all triggers using the
- triggers.sql file:
-mysql> delimiter // ;
-mysql> source /tmp/triggers.sql //
-
- 5. Check that all triggers were successfully created using
- the SHOW TRIGGERS statement.
-
- * Incompatible change: MySQL 5.1.6 introduces the TRIGGER
- privilege. Previously, the SUPER privilege was needed to
- create or drop triggers. Now those operations require the
- TRIGGER privilege. This is a security improvement because you
- no longer need to grant users the SUPER privilege to enable
- them to create triggers. However, the requirement that the
- account named in a trigger's DEFINER clause must have the
- SUPER privilege has changed to a requirement for the TRIGGER
- privilege. When upgrading from a previous version of MySQL 5.0
- or 5.1 to MySQL 5.1.6 or newer, be sure to update your grant
- tables by running mysql_upgrade. This will assign the TRIGGER
- privilege to all accounts that had the SUPER privilege. If you
- fail to update the grant tables, triggers may fail when
- activated. After updating the grant tables, you can revoke the
- SUPER privilege from those accounts that no longer otherwise
- require it.
-
- * Some keywords may be reserved in MySQL 5.1 that were not
- reserved in MySQL 5.0. See Section 8.3, "Reserved Words."
-
- * The BACKUP TABLE, and RESTORE TABLE statements are deprecated.
- mysqldump or mysqlhotcopy can be used as alternatives.
-
- * The LOAD DATA FROM MASTER and LOAD TABLE FROM MASTER
- statements are deprecated. See Section 12.5.2.2, "LOAD DATA
- FROM MASTER Syntax," for recommended alternatives.
-
- * The INSTALL PLUGIN and UNINSTALL PLUGIN statements that are
- used for the plugin API are new. So is the WITH PARSER clause
- for FULLTEXT index creation that associates a parser plugin
- with a full-text index. Section 22.2, "The MySQL Plugin API."
-
- C API Changes:
-
- * Incompatible change: As of MySQL 5.1.7, the
- mysql_stmt_attr_get() C API function returns a boolean rather
- than an unsigned int for STMT_ATTR_UPDATE_MAX_LENGTH.
- (Bug#16144: http://bugs.mysql.com/bug.php?id=16144)
-
-2.4.2. Downgrading MySQL
-
- This section describes what you should do to downgrade to an older
- MySQL version in the unlikely case that the previous version
- worked better than the new one.
-
- If you are downgrading within the same release series (for
- example, from 5.0.13 to 5.0.12) the general rule is that you just
- have to install the new binaries on top of the old ones. There is
- no need to do anything with the databases. As always, however, it
- is always a good idea to make a backup.
-
- The following items form a checklist of things you should do
- whenever you perform a downgrade:
-
- * Read the upgrading section for the release series from which
- you are downgrading to be sure that it does not have any
- features you really need. See Section 2.4.1, "Upgrading
- MySQL."
-
- * If there is a downgrading section for that version, you should
- read that as well.
-
- * To see which new features were added between the version to
- which you are downgrading and your current version, see the
- change logs (Appendix C, "MySQL Change History").
-
- * Check Section 2.4.3, "Checking Whether Tables or Indexes Must
- Be Rebuilt," to see whether changes to table formats or to
- character sets or collations were made between your current
- version of MySQL and the version to which you are downgrading.
- If so and these changes result in an incompatibility between
- MySQL versions, you will need to downgrade the affected tables
- using the instructions in Section 2.4.4, "Rebuilding or
- Repairing Tables or Indexes."
-
- In most cases, you can move the MySQL format files and data files
- between different versions on the same architecture as long as you
- stay within versions for the same release series of MySQL.
-
- If you downgrade from one release series to another, there may be
- incompatibilities in table storage formats. In this case, use
- mysqldump to dump your tables before downgrading. After
- downgrading, reload the dump file using mysql or mysqlimport to
- re-create your tables. For examples, see Section 2.4.5, "Copying
- MySQL Databases to Another Machine."
-
- A typical symptom of a downward-incompatible table format change
- when you downgrade is that you cannot open tables. In that case,
- use the following procedure:
-
- 1. Stop the older MySQL server that you are downgrading to.
-
- 2. Restart the newer MySQL server you are downgrading from.
-
- 3. Dump any tables that were inaccessible to the older server by
- using mysqldump to create a dump file.
-
- 4. Stop the newer MySQL server and restart the older one.
-
- 5. Reload the dump file into the older server. Your tables should
- be accessible.
-
- It might also be the case that system tables in the mysql database
- have changed and that downgrading introduces some loss of
- functionality or requires some adjustments. Here are some
- examples:
-
- * Trigger creation requires the TRIGGER privilege as of MySQL
- 5.1. In MySQL 5.0, there is no TRIGGER privilege and SUPER is
- required instead. If you downgrade from MySQL 5.1 to 5.0, you
- will need to give the SUPER privilege to those accounts that
- had the TRIGGER privilege in 5.1.
-
- * Triggers were added in MySQL 5.0, so if you downgrade from 5.0
- to 4.1, you cannot use triggers at all.
-
- * The mysql.proc.comment column definition changed between MySQL
- 5.1 and 5.5. After a downgrade from 5.5 to 5.1, this table is
- seen as corrupt and in need of repair. To workaround this
- problem, execute mysql_upgrade from the version of MySQL to
- which you downgraded.
-
-2.4.2.1. Downgrading to MySQL 5.0
-
- When downgrading to MySQL 5.0 from MySQL 5.1, you should keep in
- mind the following issues relating to features found in MySQL 5.1,
- but not in MySQL 5.0:
-
- * Partitioning. MySQL 5.0 does not support user-defined
- partitioning. If a table was created as a partitioned table in
- 5.1 (or if an table created in a previous version of MySQL was
- altered to include partitions after an upgrade to 5.1), the
- table is accessible after downgrade only if you do one of the
- following:
-
- + Export the table using mysqldump and then drop it in
- MySQL 5.1; import the table again following the downgrade
- to MySQL 5.0.
-
- + Prior to the downgrade, remove the table's partitioning
- using ALTER TABLE table_name REMOVE PARTITIONING.
-
- * Event Scheduler. MySQL 5.0 does not support scheduled events.
- If your databases contain scheduled event definitions, you
- should prevent them from being dumped when you use mysqldump
- by using the --skip-events option. (See Section 4.5.4,
- "mysqldump --- A Database Backup Program.")
-
- * Stored routines. MySQL 5.1.21 added a number of new columns
- to the mysql.proc table in which stored routine definitions
- are stored. If you are downgrading from MySQL 5.1.21 or later
- to MySQL 5.0, you cannot import the MySQL 5.1 routine
- definitions into MySQL 5.0.46 or earlier using the dump of
- mysql.proc created by mysqldump (such as when using the
- --all-databases option). Instead, you should run mysqldump
- --routines prior to performing the downgrade and run the
- stored routines DDL statements following the downgrade.
- See Bug#11986: http://bugs.mysql.com/bug.php?id=11986,
- Bug#30029: http://bugs.mysql.com/bug.php?id=30029, and
- Bug#30660: http://bugs.mysql.com/bug.php?id=30660, for more
- information.
-
- * Triggers. Trigger creation requires the TRIGGER privilege as
- of MySQL 5.1. In MySQL 5.0, there is no TRIGGER privilege and
- SUPER is required instead. If you downgrade from MySQL 5.1 to
- 5.0, you will need to give the SUPER privilege to those
- accounts that had the TRIGGER privilege in 5.1.
-
-2.4.3. Checking Whether Tables or Indexes Must Be Rebuilt
-
- A binary upgrade or downgrade is one that installs one version of
- MySQL "in place" over an existing version, without dumping and
- reloading tables:
-
- 1. Stop the server for the existing version if it is running.
-
- 2. Install a different version of MySQL. This is an upgrade if
- the new version is higher than the original version, a
- downgrade if the version is lower.
-
- 3. Start the server for the new version.
-
- In many cases, the tables from the previous version of MySQL can
- be used without problem by the new version. However, sometimes
- changes occur that require tables or table indexes to be rebuilt,
- as described in this section. If you have tables that are affected
- by any of the issues described here, rebuild the tables or indexes
- as necessary using the instructions given in Section 2.4.4,
- "Rebuilding or Repairing Tables or Indexes."
-
- Table Incompatibilities
-
- After a binary upgrade to MySQL 5.1 from a MySQL 5.0 installation
- that contains ARCHIVE tables, accessing those tables causes the
- server to crash, even if you have run mysql_upgrade or CHECK TABLE
- ... FOR UPGRADE. To work around this problem, use mysqldump to
- dump all ARCHIVE tables before upgrading, and reload them into
- MySQL 5.1 after upgrading. The same problem occurs for binary
- downgrades from MySQL 5.1 to 5.0.
-
- Index Incompatibilities
-
- If you perform a binary upgrade without dumping and reloading
- tables, you cannot upgrade directly from MySQL 4.1 to 5.1 or
- higher. This occurs due to an incompatible change in the MyISAM
- table index format in MySQL 5.0. Upgrade from MySQL 4.1 to 5.0 and
- repair all MyISAM tables. Then upgrade from MySQL 5.0 to 5.1 and
- check and repair your tables.
-
- Modifications to the handling of character sets or collations
- might change the character sort order, which causes the ordering
- of entries in any index that uses an affected character set or
- collation to be incorrect. Such changes result in several possible
- problems:
-
- * Comparison results that differ from previous results
-
- * Inability to find some index values due to misordered index
- entries
-
- * Misordered ORDER BY results
-
- * Tables that CHECK TABLE reports as being in need of repair
-
- The solution to these problems is to rebuild any indexes that use
- an affected character set or collation, either by dropping and
- re-creating the indexes, or by dumping and reloading the entire
- table. For information about rebuilding indexes, see Section
- 2.4.4, "Rebuilding or Repairing Tables or Indexes."
-
- To check whether a table has indexes that must be rebuilt, consult
- the following list. It indicates which versions of MySQL
- introduced character set or collation changes that require indexes
- to be rebuilt. Each entry indicates the version in which the
- change occurred and the character sets or collations that the
- change affects. If the change is associated with a particular bug
- report, the bug number is given.
-
- The list applies both for binary upgrades and downgrades. For
- example, Bug#27877: http://bugs.mysql.com/bug.php?id=27877 was
- fixed in MySQL 5.1.24 and 5.4.0, so it applies to upgrades from
- versions older than 5.1.24 to 5.1.24 or newer, and to downgrades
- from 5.1.24 or newer to versions older than 5.1.24.
-
- In many cases, you can use CHECK TABLE ... FOR UPGRADE to identify
- tables for which index rebuilding is required. (It will report:
- Table upgrade required. Please do "REPAIR TABLE `tbl_name`" or
- dump/reload to fix it!) In these cases, you can also use
- mysqlcheck --check-upgrade or mysql_upgrade, which execute CHECK
- TABLE. However, the use of CHECK TABLE applies only after
- upgrades, not downgrades. Also, CHECK TABLE is not applicable to
- all storage engines. For details about which storage engines CHECK
- TABLE supports, see Section 12.4.2.3, "CHECK TABLE Syntax."
-
- Changes that cause index rebuilding to be necessary:
-
- * MySQL 5.0.48, 5.1.21
- (Bug#29461: http://bugs.mysql.com/bug.php?id=29461)
- Affects indexes for columns that use any of these character
- sets: eucjpms, euc_kr, gb2312, latin7, macce, ujis
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 5.4.0 (see
- Bug#39585: http://bugs.mysql.com/bug.php?id=39585).
-
- * MySQL 5.0.48, 5.1.23
- (Bug#27562: http://bugs.mysql.com/bug.php?id=27562)
- Affects indexes that use the ascii_general_ci collation for
- columns that contain any of these characters: '`' GRAVE
- ACCENT, '[' LEFT SQUARE BRACKET, '\' REVERSE SOLIDUS, ']'
- RIGHT SQUARE BRACKET, '~' TILDE
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.29, 5.4.0 (see
- Bug#39585: http://bugs.mysql.com/bug.php?id=39585).
-
- * MySQL 5.1.24, 5.4.0
- (Bug#27877: http://bugs.mysql.com/bug.php?id=27877)
- Affects indexes that use the utf8_general_ci or
- ucs2_general_ci collation for columns that contain 'ß' LATIN
- SMALL LETTER SHARP S (German).
- Affected tables can be detected by CHECK TABLE ... FOR UPGRADE
- as of MySQL 5.1.30, 5.4.0 (see
- Bug#40053: http://bugs.mysql.com/bug.php?id=40053).
-
-2.4.4. Rebuilding or Repairing Tables or Indexes
-
- This section describes how to rebuild a table. This can be
- necessitated by changes to MySQL such as how data types are
- handled or changes to character set handling. For example, an
- error in a collation might have been corrected, necessitating a
- table rebuild to update the indexes for character columns that use
- the collation. (For examples, see Section 2.4.3, "Checking Whether
- Tables or Indexes Must Be Rebuilt.") It might also be that a table
- repair or upgrade should be done as indicated by a table check
- operation such as that performed by CHECK TABLE, mysqlcheck, or
- mysql_upgrade.
-
- Methods for rebuilding a table include dumping and reloading it,
- or using ALTER TABLE or REPAIR TABLE.
-
-Note
-
- If you are rebuilding tables because a different version of MySQL
- will not handle them after a binary (in-place) upgrade or
- downgrade, you must use the dump-and-reload method. Dump the
- tables before upgrading or downgrading using your original version
- of MySQL. Then reload the tables after upgrading or downgrading.
-
- If you use the dump-and-reload method of rebuilding tables only
- for the purpose of rebuilding indexes, you can perform the dump
- either before or after upgrading or downgrading. Reloading still
- must be done afterward.
-
- To rebuild a table by dumping and reloading it, use mysqldump to
- create a dump file and mysql to reload the file:
-shell> mysqldump db_name t1 > dump.sql
-shell> mysql db_name < dump.sql
-
- To rebuild all the tables in a single database, specify the
- database name without any following table name:
-shell> mysqldump db_name > dump.sql
-shell> mysql db_name < dump.sql
-
- To rebuild all tables in all databases, use the --all-databases
- option:
-shell> mysqldump --all-databases > dump.sql
-shell> mysql < dump.sql
-
- To rebuild a table with ALTER TABLE, use a "null" alteration; that
- is, an ALTER TABLE statement that "changes" the table to use the
- storage engine that it already has. For example, if t1 is a MyISAM
- table, use this statement:
-mysql> ALTER TABLE t1 ENGINE = MyISAM;
-
- If you are not sure which storage engine to specify in the ALTER
- TABLE statement, use SHOW CREATE TABLE to display the table
- definition.
-
- If you must rebuild a table because a table checking operation
- indicates that the table is corrupt or needs an upgrade, you can
- use REPAIR TABLE if that statement supports the table's storage
- engine. For example, to repair a MyISAM table, use this statement:
-mysql> REPAIR TABLE t1;
-
- For storage engines such as InnoDB that REPAIR TABLE does not
- support, use mysqldump to create a dump file and mysql to reload
- the file, as described earlier.
-
- For specifics about which storage engines REPAIR TABLE supports,
- see Section 12.4.2.6, "REPAIR TABLE Syntax."
-
- mysqlcheck --repair provides command-line access to the REPAIR
- TABLE statement. This can be a more convenient means of repairing
- tables because you can use the --databases or --all-databases
- option to repair all tables in specific databases or all
- databases, respectively:
-shell> mysqlcheck --repair --databases db_name ...
-shell> mysqlcheck --repair --all-databases
-
-2.4.5. Copying MySQL Databases to Another Machine
-
- You can copy the .frm, .MYI, and .MYD files for MyISAM tables
- between different architectures that support the same
- floating-point format. (MySQL takes care of any byte-swapping
- issues.) See Section 13.5, "The MyISAM Storage Engine."
-
- In cases where you need to transfer databases between different
- architectures, you can use mysqldump to create a file containing
- SQL statements. You can then transfer the file to the other
- machine and feed it as input to the mysql client.
-
- Use mysqldump --help to see what options are available.
-
- The easiest (although not the fastest) way to move a database
- between two machines is to run the following commands on the
- machine on which the database is located:
-shell> mysqladmin -h 'other_hostname' create db_name
-shell> mysqldump db_name | mysql -h 'other_hostname' db_name
-
- If you want to copy a database from a remote machine over a slow
- network, you can use these commands:
-shell> mysqladmin create db_name
-shell> mysqldump -h 'other_hostname' --compress db_name | mysql db_na
-me
-
- You can also store the dump in a file, transfer the file to the
- target machine, and then load the file into the database there.
- For example, you can dump a database to a compressed file on the
- source machine like this:
-shell> mysqldump --quick db_name | gzip > db_name.gz
-
- Transfer the file containing the database contents to the target
- machine and run these commands there:
-shell> mysqladmin create db_name
-shell> gunzip < db_name.gz | mysql db_name
-
- You can also use mysqldump and mysqlimport to transfer the
- database. For large tables, this is much faster than simply using
- mysqldump. In the following commands, DUMPDIR represents the full
- path name of the directory you use to store the output from
- mysqldump.
-
- First, create the directory for the output files and dump the
- database:
-shell> mkdir DUMPDIR
-shell> mysqldump --tab=DUMPDIR db_name
-
- Then transfer the files in the DUMPDIR directory to some
- corresponding directory on the target machine and load the files
- into MySQL there:
-shell> mysqladmin create db_name # create database
-shell> cat DUMPDIR/*.sql | mysql db_name # create tables in databas
-e
-shell> mysqlimport db_name DUMPDIR/*.txt # load data into tables
-
- Do not forget to copy the mysql database because that is where the
- grant tables are stored. You might have to run commands as the
- MySQL root user on the new machine until you have the mysql
- database in place.
-
- After you import the mysql database on the new machine, execute
- mysqladmin flush-privileges so that the server reloads the grant
- table information.
-
-2.5. Installing MySQL on Windows
-
- This section describes the process for installing MySQL on
- Windows.
-
- To run MySQL on Windows, you need the following:
-
- * A Windows operating system such as Windows 2000, Windows XP,
- Windows Vista, Windows Server 2003, or Windows Server 2008.
- Both 32-bit and 64-bit versions are supported.
- In addition to running MySQL as a standard application, you
- can also run the MySQL server as a Windows service. By using a
- service you can monitor and control the operation of the
- server through the standard Windows service management tools.
- For more information, see Section 2.5.5.6, "Starting MySQL as
- a Windows Service."
- Generally, you should install MySQL on Windows using an
- account that has administrator rights. Otherwise, you may
- encounter problems with certain operations such as editing the
- PATH environment variable or accessing the Service Control
- Manager. Once installed, MySQL does not need to be executed
- using a user with Administrator privileges.
-
- * TCP/IP protocol support.
-
- * Enough space on the hard drive to unpack, install, and create
- the databases in accordance with your requirements (generally
- a minimum of 200 megabytes is recommended.)
-
- For a list of limitations within the Windows version of MySQL, see
- Section D.7.3, "Windows Platform Limitations."
-
- In addition to the MySQL Server package, you may need or want
- additional components to use MySQL with your application or
- development environment. These include, but are not limited to:
-
- * If you plan to connect to the MySQL server via ODBC, you need
- a Connector/ODBC driver. For more information, including
- installation and configuration instructions, see Section 21.1,
- "MySQL Connector/ODBC."
-
- * If you plan to use MySQL server with .NET applications, you
- need the Connector/NET driver. For more information, including
- installation and configuration instructions, see Section 21.2,
- "MySQL Connector/NET."
-
- MySQL distributions for Windows can be downloaded from
- http://dev.mysql.com/downloads/. See Section 2.1.3, "How to Get
- MySQL."
-
- MySQL for Windows is available in several distribution formats,
- detailed below. Generally speaking, you should use a binary
- distribution that includes an installer. It is simpler to use than
- the others, and you need no additional tools to get MySQL up and
- running. The installer for the Windows version of MySQL, combined
- with a GUI Config Wizard, automatically installs MySQL, creates an
- option file, starts the server, and secures the default user
- accounts.
-
- * Binary installer distribution. The installable distribution
- comes packaged as a Microsoft Windows Installer (MSI) package
- that you can install manually or automatically on your
- systems. Two formats are available, an essentials package that
- contains all the files you need to install and configure
- MySQL, but no additional components, and a complete package
- that includes MySQL, configuration tools, benchmarks and other
- components. For more information on the specific differences,
- see Section 2.5.2, "Choosing An Installation Package"
- For instructions on installing MySQL using one of the MSI
- installation packages, see Section 2.5.3, "Installing MySQL
- with the MSI Package."
-
- * Standard binary distribution format packaged as a Zip file
- containing all of the necessary files that you unpack into
- your chosen location. This package contains all of the files
- in the full Windows MSI Installer package, but does not
- including an installation program.
- For instructions on installing MySQL using the Zip file, see
- Section 2.5.5, "Installing MySQL from a noinstall Zip
- Archive."
-
- * The source distribution contains all the code and support
- files for building the executables using the Visual Studio
- compiler system.
- For instructions on building MySQL from source on Windows, see
- Section 2.5.10, "Installing MySQL from Source on Windows."
-
- MySQL on Windows considerations:
-
- * Large Table Support
- If you need tables with a size larger than 4GB, install MySQL
- on an NTFS or newer file system. Don't forget to use MAX_ROWS
- and AVG_ROW_LENGTH when you create tables. See Section
- 12.1.17, "CREATE TABLE Syntax."
-
- * MySQL and Virus Checking Software
- Using virus scanning software such as Norton/Symantec
- Anti-Virus on directories containing MySQL data and temporary
- tables can cause issues, both in terms of the performance of
- MySQL and the virus-scanning software mis-identifying the
- contents of the files as containing spam. This is because of
- the fingerprinting mechanism used by the virus scanning
- software, and the way in which MySQL rapidly updates different
- files, which may be identified as a potential security risk.
- After installing MySQL Server, it is recommended that you
- disable virus scanning on the main directory (datadir) being
- used to store your MySQL table data. There is usually a system
- built into the virus scanning software to allow certain
- directories to be specifically ignored during virus scanning.
- In addition, by default, MySQL creates temporary files in the
- standard Windows temporary directory. To prevent the temporary
- files also being scanned, you should configure a separate
- temporary directory for MySQL temporary files and add this to
- the virus scanning exclusion list. To do this, add a
- configuration option for the tmpdir parameter to your my.ini
- configuration file. For more information, see Section 2.5.5.2,
- "Creating an Option File."
-
-2.5.1. Windows Installation Layout
-
- For MySQL 5.1 on Windows, the default installation directory is
- C:\Program Files\MySQL\MySQL Server 5.1. Some Windows users prefer
- to install in C:\mysql, the directory that formerly was used as
- the default. However, the layout of the subdirectories remains the
- same.
-
- For MySQL 5.1.23 and earlier, all of the files are located within
- this parent directory, using the following structure:
-
- Table 2.2. Installation Layout for Windows using MySQL 5.1.23 and
- earlier
- Directory Contents of Directory
- bin Client programs and the mysqld server
- data Log files, databases
- Docs Manual in CHM format
- examples Example programs and scripts
- include Include (header) files
- lib Libraries
- scripts Utility scripts
- share Error message files
-
- For MySQL 5.1.24 and later, the default location of data directory
- was changed. The remainder of the directory structure remains the
- same:
-
- Table 2.3. Installation Layout for Windows using MySQL 5.1.24 and
- later
- Directory Contents of Directory
- bin Client programs and the mysqld server
- C:\Documents and Settings\All Users\Application Data\MySQL Log
- files, databases
- Docs Manual in CHM format
- examples Example programs and scripts
- include Include (header) files
- lib Libraries
- scripts Utility scripts
- share Error message files
-
-2.5.2. Choosing An Installation Package
-
- For MySQL 5.1, there are three installation packages to choose
- from when installing MySQL on Windows:
- Packaging
- Feature Essentials Complete Zip (No-install)
- Installer Yes Yes No
- Directory-only
- MySQL Server Instance Config Wizard Yes Yes No
- Test Suite No Yes Yes
- MySQL Server Yes Yes Yes
- MySQL Client Programs Yes Yes Yes
- C Headers/Libraries Yes Yes Yes
- Embedded Server No Optional Yes
- Scripts and Examples No Optional Yes
-
- In the above table:
-
- * Yes indiciates that the component is installed by default.
-
- * No indicates that the component is not installed or included.
-
- * Optional indicates that the component is included with the
- package, but not installed unless explicitly requested using
- the Custom installation mode.
-
- The workflow for installing using the MSI installer is shown
- below:
-
- Figure 2.1. Installation Workflow for Windows using MSI
- Installation Workflow for Windows using MSI
-
- The workflow for installing using the MSI installer is shown
- below:
-
- Figure 2.2. Installation Workflow for Windows using Zip
- Installation Workflow for Windows using Zip
-
-Note
-
- For the Essentials and Complete packages in the MSI installer, you
- can select individual components to be installed by using the
- Custom mode, including disable the components confiurated for
- installation by default.
-
- Full details on the components are suggested uses are provided
- below for reference:
-
- * Windows Essentials --- this package has a file name similar to
- mysql-essential-5.1.46-win32.msi and is supplied as a
- Microsoft Installer (MSI) package. The package includes the
- minimum set of files needed to install MySQL on Windows,
- including the MySQL Server Instance Config Wizard. This
- package does not include optional components such as the
- embedded server, developer headers and libraries or benchmark
- suite.
- To install using this package, see Section 2.5.3, "Installing
- MySQL with the MSI Package."
-
- * Windows MSI Installer (Complete) --- this package has a file
- name similar to mysql-5.1.46-win32.zip and contains all files
- needed for a complete Windows installation, including the
- MySQL Server Instance Config Wizard. This package includes
- optional components such as the embedded server and benchmark
- suite.
- To install using this package, see Section 2.5.3, "Installing
- MySQL with the MSI Package."
-
- * Without installer --- this package has a file name similar to
- mysql-noinstall-5.1.46-win32.zip and contains all the files
- found in the Complete install package, with the exception of
- the MySQL Server Instance Config Wizard. This package does not
- include an automated installer, and must be manually installed
- and configured.
-
- The Essentials package is recommended for most users. Both the
- Essentials and Complete distributions are available as an .msi
- file for use with the Windows Installer. The Noinstall
- distribution is packaged as Zip archives. To use Zip archives, you
- must have a tool that can unpack .zip files.
-
- When using the MSI installers you can automate the installation
- process. For more information, see Section 2.5.3.2, "Installing
- MySQL Automatically using MSI." To automate the creation of a
- MySQL instance, see Section 2.5.4.13, "Creating an Instance from
- the Command Line."
-
- Your choice of install package affects the installation process
- you must follow. If you choose to install either the Essentials or
- Complete install packages, see Section 2.5.3, "Installing MySQL
- with the MSI Package." If you choose to install MySQL from the
- Noinstall archive, see Section 2.5.5, "Installing MySQL from a
- noinstall Zip Archive."
-
-2.5.3. Installing MySQL with the MSI Package
-
- The MSI package are designed to install and configure MySQL in
- such a way that you can immediately get started using MySQL.
-
- The MySQL Installation Wizard and MySQL Config Wizard are
- available in the Essentials and Complete install packages. They
- are recommended for most standard MySQL installations. Exceptions
- include users who need to install multiple instances of MySQL on a
- single server host and advanced users who want complete control of
- server configuration.
-
- * For information on installing using the GUI MSI installer
- process, see Section 2.5.3, "Installing MySQL with the MSI
- Package."
-
- * For information on installing using the command line using the
- MSI package, see Section 2.5.3.2, "Installing MySQL
- Automatically using MSI."
-
- * If you have previously installed MySQL using the MSI package
- and want to remove MySQL, see Section 2.5.3.3, "Removing MySQL
- Installed from the MSI Package."
-
- The workflow sequence for using the installer is shown in the
- figure below:
-
- Figure 2.3. Installation Workflow for Windows using MSI Installer
- Installation Workflow for Windows using MSI Installer
-
-Note
-
- Microsoft Windows XP and later include a firewall which
- specifically blocks ports. If you plan on using MySQL through a
- network port then you should open and create an exception for this
- port before performing the installation. To check and if necessary
- add an exception to the firewall settings:
-
- 1. First ensure that you are logged in as an Administrator or a
- user with Administrator privileges.
-
- 2. Go to the Control Panel, and double click the Windows Firewall
- icon.
-
- 3. Choose the Allow a program through Windows Firewall option and
- click the Add port button.
-
- 4. Enter MySQL into the Name text box and 3306 (or the port of
- your choice) into the Port number text box.
-
- 5. Also ensure that the TCP protocol radio button is selected.
-
- 6. If you wish, you can also limit access to the MySQL server by
- choosing the Change scope button.
-
- 7. Confirm your choices by clicking the OK button.
-
- Additionally, when running the MySQL Installation Wizard on
- Windows Vista, ensure that you are logged in as a user with
- administrative rights.
-
-Note
-
- When using Windows Vista, you may want to disable User Account
- Control (UAC) before performing the installation. If you do not do
- so, then MySQL may be identified as a security risk, which will
- mean that you need to enable MySQL. You can disable the security
- checking by following these instructions:
-
- 1. Open Control Panel.
-
- 2. Under the User Accounts and Family Safety, select Add or
- remove user accounts.
-
- 3. Click on the Got to the main User Accounts page link.
-
- 4. Click on Turn User Account Control on or off. You may be
- prompted to provide permission to change this setting. Click
- Continue.
-
- 5. Deselect or unceck the checkbox next to Use User Account
- Control (UAC) to help protect your computer. Click OK to save
- the setting.
-
- You will need to restart to complete the process. Click Restart
- Now to reboot the machine and apply the changes. You can then
- follow the instructions below for installing Windows.
-
-2.5.3.1. Using the MySQL Installation Wizard
-
- MySQL Installation Wizard is an installer for the MySQL server
- that uses the latest installer technologies for Microsoft Windows.
- The MySQL Installation Wizard, in combination with the MySQL
- Config Wizard, allows a user to install and configure a MySQL
- server that is ready for use immediately after installation.
-
- The MySQL Installation Wizard uses the standard Microsoft
- Installer Engine (MSI) system is the standard installer for all
- MySQL server distributions, version 4.1.5 and higher. Users of
- previous versions of MySQL need to shut down and remove their
- existing MySQL installations manually before installing MySQL with
- the MySQL Installation Wizard. See Section 2.5.3.1.6, "Upgrading
- MySQL with the Installation Wizard," for more information on
- upgrading from a previous version.
-
- If you are upgrading an installation from MySQL 5.1.31 or earlier
- to MySQL 5.1.32 or later, read the notes provided in Section
- 2.5.3.1.6, "Upgrading MySQL with the Installation Wizard."
-
- The Microsoft Windows Installer Engine was updated with the
- release of Windows XP; those using a previous version of Windows
- can reference this Microsoft Knowledge Base article
- (http://support.microsoft.com/default.aspx?scid=kb;EN-US;292539)
- for information on upgrading to the latest version of the Windows
- Installer Engine.
-
- In addition, Microsoft has introduced the WiX (Windows Installer
- XML) toolkit. This is the first highly acknowledged Open Source
- project from Microsoft. We have switched to WiX because it is an
- Open Source project and it allows us to handle the complete
- Windows installation process in a flexible manner using scripts.
-
- Improving the MySQL Installation Wizard depends on the support and
- feedback of users like you. If you find that the MySQL
- Installation Wizard is lacking some feature important to you, or
- if you discover a bug, please report it in our bugs database using
- the instructions given in Section 1.7, "How to Report Bugs or
- Problems."
-
-2.5.3.1.1. Downloading and Starting the MySQL Installation Wizard
-
- The MySQL installation packages can be downloaded from
- http://dev.mysql.com/downloads/. If the package you download is
- contained within a Zip archive, you need to extract the archive
- first.
-
- The process for starting the wizard depends on the contents of the
- installation package you download. If there is a setup.exe file
- present, double-click it to start the installation process. If
- there is an .msi file present, double-click it to start the
- installation process.
-
-2.5.3.1.2. Choosing an Install Type
-
- There are three installation types available: Typical, Complete,
- and Custom.
-
- The Typical installation type installs the MySQL server, the mysql
- command-line client, and the command-line utilities. The
- command-line clients and utilities include mysqldump, myisamchk,
- and several other tools to help you manage the MySQL server.
-
- The Complete installation type installs all components included in
- the installation package. The full installation package includes
- components such as the embedded server library, the benchmark
- suite, support scripts, and documentation.
-
- The Custom installation type gives you complete control over which
- packages you wish to install and the installation path that is
- used. See Section 2.5.3.1.3, "The Custom Install Dialog," for more
- information on performing a custom install.
-
- If you choose the Typical or Complete installation types and click
- the Next button, you advance to the confirmation screen to verify
- your choices and begin the installation. If you choose the Custom
- installation type and click the Next button, you advance to the
- custom installation dialog, described in Section 2.5.3.1.3, "The
- Custom Install Dialog."
-
-2.5.3.1.3. The Custom Install Dialog
-
- If you wish to change the installation path or the specific
- components that are installed by the MySQL Installation Wizard,
- choose the Custom installation type.
-
- A tree view on the left side of the custom install dialog lists
- all available components. Components that are not installed have a
- red X icon; components that are installed have a gray icon. To
- change whether a component is installed, click on that component's
- icon and choose a new option from the drop-down list that appears.
-
- You can change the default installation path by clicking the
- Change... button to the right of the displayed installation path.
-
- After choosing your installation components and installation path,
- click the Next button to advance to the confirmation dialog.
-
-2.5.3.1.4. The Confirmation Dialog
-
- Once you choose an installation type and optionally choose your
- installation components, you advance to the confirmation dialog.
- Your installation type and installation path are displayed for you
- to review.
-
- To install MySQL if you are satisfied with your settings, click
- the Install button. To change your settings, click the Back
- button. To exit the MySQL Installation Wizard without installing
- MySQL, click the Cancel button.
-
- After installation is complete, you have the option of registering
- with the MySQL web site. Registration gives you access to post in
- the MySQL forums at forums.mysql.com (http://forums.mysql.com),
- along with the ability to report bugs at bugs.mysql.com
- (http://bugs.mysql.com) and to subscribe to our newsletter. The
- final screen of the installer provides a summary of the
- installation and gives you the option to launch the MySQL Config
- Wizard, which you can use to create a configuration file, install
- the MySQL service, and configure security settings.
-
-2.5.3.1.5. Changes Made by MySQL Installation Wizard
-
- Once you click the Install button, the MySQL Installation Wizard
- begins the installation process and makes certain changes to your
- system which are described in the sections that follow.
-
- Changes to the Registry
-
- The MySQL Installation Wizard creates one Windows registry key in
- a typical install situation, located in
- HKEY_LOCAL_MACHINE\SOFTWARE\MySQL AB.
-
- The MySQL Installation Wizard creates a key named after the major
- version of the server that is being installed, such as MySQL
- Server 5.1. It contains two string values, Location and Version.
- The Location string contains the path to the installation
- directory. In a default installation it contains C:\Program
- Files\MySQL\MySQL Server 5.1\. The Version string contains the
- release number. For example, for an installation of MySQL Server
- 5.1.46, the key contains a value of 5.1.46.
-
- These registry keys are used to help external tools identify the
- installed location of the MySQL server, preventing a complete scan
- of the hard-disk to determine the installation path of the MySQL
- server. The registry keys are not required to run the server, and
- if you install MySQL using the noinstall Zip archive, the registry
- keys are not created.
-
- Changes to the Start Menu
-
- The MySQL Installation Wizard creates a new entry in the Windows
- Start menu under a common MySQL menu heading named after the major
- version of MySQL that you have installed. For example, if you
- install MySQL 5.1, the MySQL Installation Wizard creates a MySQL
- Server 5.1 section in the Start menu.
-
- The following entries are created within the new Start menu
- section:
-
- * MySQL Command Line Client: This is a shortcut to the mysql
- command-line client and is configured to connect as the root
- user. The shortcut prompts for a root user password when you
- connect.
-
- * MySQL Server Instance Config Wizard: This is a shortcut to the
- MySQL Config Wizard. Use this shortcut to configure a newly
- installed server, or to reconfigure an existing server.
-
- * MySQL Documentation: This is a link to the MySQL server
- documentation that is stored locally in the MySQL server
- installation directory. This option is not available when the
- MySQL server is installed using the Essentials installation
- package.
-
- Changes to the File System
-
- The MySQL Installation Wizard by default installs the MySQL 5.1
- server to C:\Program Files\MySQL\MySQL Server 5.1, where Program
- Files is the default location for applications in your system, and
- 5.1 is the major version of your MySQL server. This is the
- recommended location for the MySQL server, replacing the former
- default location C:\mysql.
-
- By default, all MySQL applications are stored in a common
- directory at C:\Program Files\MySQL, where Program Files is the
- default location for applications in your Windows installation. A
- typical MySQL installation on a developer machine might look like
- this:
-C:\Program Files\MySQL\MySQL Server 5.1
-C:\Program Files\MySQL\MySQL Workbench 5.1 OSS
-
- This approach makes it easier to manage and maintain all MySQL
- applications installed on a particular system.
-
- In MySQL 5.1.23 and earlier, the default location for the data
- files used by MySQL is located within the corresponding MySQL
- Server installation directory. For MySQL 5.1.24 and later, the
- default location of the data directory is the AppData directory
- configured for the user that installed the MySQL application.
-
-2.5.3.1.6. Upgrading MySQL with the Installation Wizard
-
- The MySQL Installation Wizard can perform server upgrades
- automatically using the upgrade capabilities of MSI. That means
- you do not need to remove a previous installation manually before
- installing a new release. The installer automatically shuts down
- and removes the previous MySQL service before installing the new
- version.
-
- Automatic upgrades are available only when upgrading between
- installations that have the same major and minor version numbers.
- For example, you can upgrade automatically from MySQL 5.1.34 to
- MySQL 5.1.37, but not from MySQL 5.0 to MySQL 5.1.
-
- In MySQL 5.1.32 and later, the EXE version of the MSI installer
- packages were removed. When upgrading an existing MySQL
- installation from the old EXE based installer to the MSI based
- installer, please keep the following notes in mind:
-
- * The MSI installer will not identify an existing installation
- that was installed using the old EXE installer. This means
- that the installer will not stop the existing server, or
- detect that the existing password is required before
- installing the new version. To work around this:
-
- 1. Stop the current server manually using net stop or
- mysqladmin shutdown.
-
- 2. Remove the existing installation manually by using the
- Add/Remove Programs control panel. This will keep the
- existing configuration and data files, as these are not
- removed automatically.
-
- 3. Install the new version of MySQL using the MSI installer.
- When running the installation, skip updating the security
- by deselecting the checkbox on the security screen.
-
- 4. Complete the installation, and then start the server
- again. You should be able to login with your existing
- user and password credentials.
-
- * You can only upgrade the version and release using the MSI
- installer. For example, you can upgrade an open source
- installation with an open source installer. You cannot upgrade
- an open source installation using the enterprise installer.
-
- See Section 2.5.7, "Upgrading MySQL on Windows."
-
-2.5.3.2. Installing MySQL Automatically using MSI
-
- The Microsoft Installer (MSI) supports a both a quiet and a
- passive mode that can be used to install MySQL automatically
- without requireing intervention. You can use this either in
- scripts to automatically install MySQL or through a terminal
- connection such as Telnet where you do not have access to the
- standard Windows user interface. The MSI packages can also be used
- in combination with Microsoft's Group Policy system (part of
- Windows Server 2003 and Windows Server 2008) to install MySQL
- across multiple machines.
-
- To install MySQL from one of the MSI packages automatically from
- the command line (or within a script), you need to use the
- msiexec.exe tool. For example, to perform a quiet installation
- (which shows no dialog boxes or progress):
-shell> msiexec /i /quiet mysql-5.1.39.msi
-
- The /i indicates that you want to perform an installation. The
- /quiet option indicates that you want no interactive elements.
-
- To provide a dialog box showing the progress during installation,
- and the dialog boxes providing information on the installation and
- registration of MySQL, use /passive mode instead of /quiet:
-shell> msiexec /i /passive mysql-5.1.39.msi
-
- Regardless of the mode of the installation, installing the package
- in this manner performs a 'Typical' installation, and installs the
- default components into the standard location.
-
- You can also use this method to uninstall MySQL by using the
- /uninstall or /x options:
-shell> msiexec /x /quiet mysql-5.1.39.msi
-
- To install MySQL and configure a MySQL instance from the command
- line, see Section 2.5.4.13, "Creating an Instance from the Command
- Line."
-
- For information on using MSI packages to install software
- automatically using Group Policy, see How to use Group Policy to
- remotely install software in Windows Server 2003
- (http://support.microsoft.com/kb/816102).
-
-2.5.3.3. Removing MySQL Installed from the MSI Package
-
- To uninstall a MySQL where you have used the MSI packages, you
- must use the Add/Remove Programs tool within Control Panel. To do
- this:
-
- 1. Right click on the start menu and choose Control Panel.
-
- 2. If the Control Panel is set to category mode (you will see
- Pick a category at the top of the Control Panel window),
- double click on Add or Remove Programs. If the Control is set
- to classic mode, doubgle click on the Add or Remove Programs
- icon.
-
- 3. Find MySQL in the list of installed software. MySQL Server is
- installed against major version numbers (MySQL 5.0, MySQL 5.1,
- etc.). Select the version that you want to remove and click
- Remove.
-
- 4. You will be prompted to confirm the removal. Click Yes to
- remove MySQL.
-
- When MySQL is removed using this method, only the installed
- components are removed. Any database information (including the
- tables and data), import or export files, log files, and binary
- logs produced during execution are kept in their configured
- location.
-
-2.5.4. MySQL Server Instance Config Wizard
-
- The MySQL Server Instance Config Wizard helps automate the process
- of configuring your server. It creates a custom MySQL
- configuration file (my.ini or my.cnf) by asking you a series of
- questions and then applying your responses to a template to
- generate the configuration file that is tuned to your
- installation.
-
- The complete and essential MSI installation packages include the
- MySQL Server Instance Config Wizard in the MySQL 5.1 server. The
- MySQL Server Instance Config Wizard is only available for Windows.
-
- The workflow sequence for using the MySQL Server Instance Config
- Wizard is shown in the figure below:
-
- Figure 2.4. MySQL Server Instance Config Wizard Workflow
- MySQL Server Instance Config Wizard Workflow
-
-2.5.4.1. Starting the MySQL Server Instance Config Wizard
-
- The MySQL Server Instance Config Wizard is normally started as
- part of the installation process. You should only need to run the
- MySQL Server Instance Config Wizard again when you need to change
- the configuration parameters of your server.
-
- If you chose not to open a port prior to installing MySQL on
- Windows Vista, you can choose to use the MySQL Server Instance
- Config Wizard after installation. However, you must open a port in
- the Windows Firewall. To do this see the instructions given in
- Section 2.5.3.1.1, "Downloading and Starting the MySQL
- Installation Wizard." Rather than opening a port, you also have
- the option of adding MySQL as a program that bypasses the Windows
- Firewall. One or the other option is sufficient --- you need not
- do both. Additionally, when running the MySQL Server Config Wizard
- on Windows Vista ensure that you are logged in as a user with
- administrative rights.
- MySQL Server Instance Config Wizard
-
- You can launch the MySQL Config Wizard by clicking the MySQL
- Server Instance Config Wizard entry in the MySQL section of the
- Windows Start menu.
-
- Alternatively, you can navigate to the bin directory of your MySQL
- installation and launch the MySQLInstanceConfig.exe file directly.
-
- The MySQL Server Instance Config Wizard places the my.ini file in
- the installation directory for the MySQL server. This helps
- associate configuration files with particular server instances.
-
- To ensure that the MySQL server knows where to look for the my.ini
- file, an argument similar to this is passed to the MySQL server as
- part of the service installation:
---defaults-file="C:\Program Files\MySQL\MySQL Server 5.1\my.ini"
-
- Here, C:\Program Files\MySQL\MySQL Server 5.1 is replaced with the
- installation path to the MySQL Server. The --defaults-file option
- instructs the MySQL server to read the specified file for
- configuration options when it starts.
-
- Apart from making changes to the my.ini file by running the MySQL
- Server Instance Config Wizard again, you can modify it by opening
- it with a text editor and making any necessary changes. You can
- also modify the server configuration with the
- http://www.mysql.com/products/administrator/ utility. For more
- information about server configuration, see Section 5.1.2, "Server
- Command Options."
-
- MySQL clients and utilities such as the mysql and mysqldump
- command-line clients are not able to locate the my.ini file
- located in the server installation directory. To configure the
- client and utility applications, create a new my.ini file in the
- Windows installation directory (for example, C:\WINDOWS).
-
- Under Windows Server 2003, Windows Server 2000, Windows XP, and
- Windows Vista MySQL Server Instance Config Wizard will configure
- MySQL to work as a Windows service. To start and stop MySQL you
- use the Services application that is supplied as part of the
- Windows Administrator Tools.
-
-2.5.4.2. Choosing a Maintenance Option
-
- If the MySQL Server Instance Config Wizard detects an existing
- configuration file, you have the option of either reconfiguring
- your existing server, or removing the server instance by deleting
- the configuration file and stopping and removing the MySQL
- service.
-
- To reconfigure an existing server, choose the Re-configure
- Instance option and click the Next button. Any existing
- configuration file is not overwritten, but renamed (within the
- same directory) using a timestamp (Windows) or sequential number
- (Linux). To remove the existing server instance, choose the Remove
- Instance option and click the Next button.
-
- If you choose the Remove Instance option, you advance to a
- confirmation window. Click the Execute button. The MySQL Server
- Config Wizard stops and removes the MySQL service, and then
- deletes the configuration file. The server installation and its
- data folder are not removed.
-
- If you choose the Re-configure Instance option, you advance to the
- Configuration Type dialog where you can choose the type of
- installation that you wish to configure.
-
-2.5.4.3. Choosing a Configuration Type
-
- When you start the MySQL Server Instance Config Wizard for a new
- MySQL installation, or choose the Re-configure Instance option for
- an existing installation, you advance to the Configuration Type
- dialog.
- MySQL Server Instance Config Wizard: Configuration Type
-
- There are two configuration types available: Detailed
- Configuration and Standard Configuration. The Standard
- Configuration option is intended for new users who want to get
- started with MySQL quickly without having to make many decisions
- about server configuration. The Detailed Configuration option is
- intended for advanced users who want more fine-grained control
- over server configuration.
-
- If you are new to MySQL and need a server configured as a
- single-user developer machine, the Standard Configuration should
- suit your needs. Choosing the Standard Configuration option causes
- the MySQL Config Wizard to set all configuration options
- automatically with the exception of Service Options and Security
- Options.
-
- The Standard Configuration sets options that may be incompatible
- with systems where there are existing MySQL installations. If you
- have an existing MySQL installation on your system in addition to
- the installation you wish to configure, the Detailed Configuration
- option is recommended.
-
- To complete the Standard Configuration, please refer to the
- sections on Service Options and Security Options in Section
- 2.5.4.10, "The Service Options Dialog," and Section 2.5.4.11, "The
- Security Options Dialog," respectively.
-
-2.5.4.4. The Server Type Dialog
-
- There are three different server types available to choose from.
- The server type that you choose affects the decisions that the
- MySQL Server Instance Config Wizard makes with regard to memory,
- disk, and processor usage.
- MySQL Server Instance Config Wizard: Server Type
-
- * Developer Machine: Choose this option for a typical desktop
- workstation where MySQL is intended only for personal use. It
- is assumed that many other desktop applications are running.
- The MySQL server is configured to use minimal system
- resources.
-
- * Server Machine: Choose this option for a server machine where
- the MySQL server is running alongside other server
- applications such as FTP, email, and Web servers. The MySQL
- server is configured to use a moderate portion of the system
- resources.
-
- * Dedicated MySQL Server Machine: Choose this option for a
- server machine that is intended to run only the MySQL server.
- It is assumed that no other applications are running. The
- MySQL server is configured to use all available system
- resources.
-
-Note
-
- By selecting one of the preconfigured configurations, the values
- and settings of various options in your my.cnf or my.ini will be
- altered accordingly. The default values and options as described
- in the reference manual may therefore be different to the options
- and values that were created during the execution of the Config
- Wizard.
-
-2.5.4.5. The Database Usage Dialog
-
- The Database Usage dialog allows you to indicate the storage
- engines that you expect to use when creating MySQL tables. The
- option you choose determines whether the InnoDB storage engine is
- available and what percentage of the server resources are
- available to InnoDB.
- MySQL Server Instance Config Wizard: Usage Dialog
-
- * Multifunctional Database: This option enables both the InnoDB
- and MyISAM storage engines and divides resources evenly
- between the two. This option is recommended for users who use
- both storage engines on a regular basis.
-
- * Transactional Database Only: This option enables both the
- InnoDB and MyISAM storage engines, but dedicates most server
- resources to the InnoDB storage engine. This option is
- recommended for users who use InnoDB almost exclusively and
- make only minimal use of MyISAM.
-
- * Non-Transactional Database Only: This option disables the
- InnoDB storage engine completely and dedicates all server
- resources to the MyISAM storage engine. This option is
- recommended for users who do not use InnoDB.
-
- The Config Wizard uses a template to generate the server
- configuration file. The Database Usage dialog sets one of the
- following option strings:
-Multifunctional Database: MIXED
-Transactional Database Only: INNODB
-Non-Transactional Database Only: MYISAM
-
- When these options are processed through the default template
- (my-template.ini) the result is:
-Multifunctional Database:
-default-storage-engine=InnoDB
-_myisam_pct=50
-
-Transactional Database Only:
-default-storage-engine=InnoDB
-_myisam_pct=5
-
-Non-Transactional Database Only:
-default-storage-engine=MyISAM
-_myisam_pct=100
-skip-innodb
-
- The _myisam_pct value is used to calculate the percentage of
- resources dedicated to MyISAM. The remaining resources are
- allocated to InnoDB.
-
-2.5.4.6. The InnoDB Tablespace Dialog
-
- Some users may want to locate the InnoDB tablespace files in a
- different location than the MySQL server data directory. Placing
- the tablespace files in a separate location can be desirable if
- your system has a higher capacity or higher performance storage
- device available, such as a RAID storage system.
- MySQL Server Instance Config Wizard: InnoDB Data Tablespace
-
- To change the default location for the InnoDB tablespace files,
- choose a new drive from the drop-down list of drive letters and
- choose a new path from the drop-down list of paths. To create a
- custom path, click the ... button.
-
- If you are modifying the configuration of an existing server, you
- must click the Modify button before you change the path. In this
- situation you must move the existing tablespace files to the new
- location manually before starting the server.
-
-2.5.4.7. The Concurrent Connections Dialog
-
- To prevent the server from running out of resources, it is
- important to limit the number of concurrent connections to the
- MySQL server that can be established. The Concurrent Connections
- dialog allows you to choose the expected usage of your server, and
- sets the limit for concurrent connections accordingly. It is also
- possible to set the concurrent connection limit manually.
- MySQL Server Instance Config Wizard: Connections
-
- * Decision Support (DSS)/OLAP: Choose this option if your server
- does not require a large number of concurrent connections. The
- maximum number of connections is set at 100, with an average
- of 20 concurrent connections assumed.
-
- * Online Transaction Processing (OLTP): Choose this option if
- your server requires a large number of concurrent connections.
- The maximum number of connections is set at 500.
-
- * Manual Setting: Choose this option to set the maximum number
- of concurrent connections to the server manually. Choose the
- number of concurrent connections from the drop-down box
- provided, or enter the maximum number of connections into the
- drop-down box if the number you desire is not listed.
-
-2.5.4.8. The Networking and Strict Mode Options Dialog
-
- Use the Networking Options dialog to enable or disable TCP/IP
- networking and to configure the port number that is used to
- connect to the MySQL server.
- MySQL Server Instance Config Wizard: Network Configuration
-
- TCP/IP networking is enabled by default. To disable TCP/IP
- networking, uncheck the box next to the Enable TCP/IP Networking
- option.
-
- Port 3306 is used by default. To change the port used to access
- MySQL, choose a new port number from the drop-down box or type a
- new port number directly into the drop-down box. If the port
- number you choose is in use, you are prompted to confirm your
- choice of port number.
-
- Set the Server SQL Mode to either enable or disable strict mode.
- Enabling strict mode (default) makes MySQL behave more like other
- database management systems. If you run applications that rely on
- MySQL's old "forgiving" behavior, make sure to either adapt those
- applications or to disable strict mode. For more information about
- strict mode, see Section 5.1.8, "Server SQL Modes."
-
-2.5.4.9. The Character Set Dialog
-
- The MySQL server supports multiple character sets and it is
- possible to set a default server character set that is applied to
- all tables, columns, and databases unless overridden. Use the
- Character Set dialog to change the default character set of the
- MySQL server.
- MySQL Server Instance Config Wizard: Character Set
-
- * Standard Character Set: Choose this option if you want to use
- latin1 as the default server character set. latin1 is used for
- English and many Western European languages.
-
- * Best Support For Multilingualism: Choose this option if you
- want to use utf8 as the default server character set. This is
- a Unicode character set that can store characters from many
- different languages.
-
- * Manual Selected Default Character Set / Collation: Choose this
- option if you want to pick the server's default character set
- manually. Choose the desired character set from the provided
- drop-down list.
-
-2.5.4.10. The Service Options Dialog
-
- On Windows platforms, the MySQL server can be installed as a
- Windows service. When installed this way, the MySQL server can be
- started automatically during system startup, and even restarted
- automatically by Windows in the event of a service failure.
-
- The MySQL Server Instance Config Wizard installs the MySQL server
- as a service by default, using the service name MySQL. If you do
- not wish to install the service, uncheck the box next to the
- Install As Windows Service option. You can change the service name
- by picking a new service name from the drop-down box provided or
- by entering a new service name into the drop-down box.
-
-Note
-
- Service names can include any legal character except forward (/)
- or backward (\) slashes, and must be less than 256 characters
- long.
-
-Warning
-
- If you are installing multiple versions of MySQL onto the same
- machine, you must choose a different service name for each version
- that you install. If you do not choose a different service for
- each installed version then the service manager information will
- be inconsistent and this will cause problems when you try to
- uninstall a previous version.
-
- If you have already installed multiple versions using the same
- service name, you must manually edit the contents of the
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services parameters
- within the Windows registry to update the association of the
- service name with the correct server version.
-
- Typically, when installing multiple versions you create a service
- name based on the version information. For example, you might
- install MySQL 5.x as mysql5, or specific versions such as MySQL
- 5.1.30 as mysql50130.
-
- To install the MySQL server as a service but not have it started
- automatically at startup, uncheck the box next to the Launch the
- MySQL Server Automatically option.
-
-2.5.4.11. The Security Options Dialog
-
- The content of the security options portion of the MySQL Server
- Instance Configuration Wizard will depend on whether this is a new
- installation, or modifying an existing installation.
-
- * Setting the root password for a new installation
- It is strongly recommended that you set a root password for
- your MySQL server, and the MySQL Server Instance Config Wizard
- requires by default that you do so. If you do not wish to set
- a root password, uncheck the box next to the Modify Security
- Settings option.
- MySQL Server Instance Config Wizard: Security
-
- * To set the root password, enter the desired password into both
- the New root password and Confirm boxes.
- Setting the root password for an existing installation
- If you are modifying the configuration of an existing
- configuration, or you are installing an upgrade and the MySQL
- Server Instance Configuration Wizard has detected an existing
- MySQL system, then you must enter the existing password for
- root before changing the configuration information.
- MySQL Server Instance Config Wizard: Security (Existing
- Installation)
- If you want to change the current root password, enter the
- desired new password into both the New root password and
- Confirm boxes.
-
- To allow root logins from across the network, check the box next
- to the Enable root access from remote machines option. This
- decreases the security of your root account.
-
- To create an anonymous user account, check the box next to the
- Create An Anonymous Account option. Creating an anonymous account
- can decrease server security and cause login and permission
- difficulties. For this reason, it is not recommended.
-
-2.5.4.12. The Confirmation Dialog
-
- The final dialog in the MySQL Server Instance Config Wizard is the
- Confirmation Dialog. To start the configuration process, click the
- Execute button. To return to a previous dialog, click the Back
- button. To exit the MySQL Server Instance Config Wizard without
- configuring the server, click the Cancel button.
- MySQL Server Instance Config Wizard: Confirmation
-
- After you click the Execute button, the MySQL Server Instance
- Config Wizard performs a series of tasks and displays the progress
- onscreen as the tasks are performed.
-
- The MySQL Server Instance Config Wizard first determines
- configuration file options based on your choices using a template
- prepared by MySQL developers and engineers. This template is named
- my-template.ini and is located in your server installation
- directory.
-
- The MySQL Config Wizard then writes these options to the
- corresponding configuration file.
-
- If you chose to create a service for the MySQL server, the MySQL
- Server Instance Config Wizard creates and starts the service. If
- you are reconfiguring an existing service, the MySQL Server
- Instance Config Wizard restarts the service to apply your
- configuration changes.
-
- If you chose to set a root password, the MySQL Config Wizard
- connects to the server, sets your new root password, and applies
- any other security settings you may have selected.
-
- After the MySQL Server Instance Config Wizard has completed its
- tasks, it displays a summary. Click the Finish button to exit the
- MySQL Server Config Wizard.
-
-2.5.4.13. Creating an Instance from the Command Line
-
- In addition to using the GUI interface to the MySQL Server
- Instance Config Wizard, you can also create instances
- automatically from the command line.
-
- To use the MySQL Server Instance Config Wizard on the command
- line, you need to use the MySQLInstanceConfig.exe command that is
- installed with MySQL in the bin directory within the installation
- directory. MySQLInstanceConfig.exe takes a number of command-line
- arguments the set the properties that would normally be selected
- through the GUI interface, and then creates a new configuration
- file (my.ini) by combining these selections with a template
- configuration file to produce the working configuration file.
-
- The main command line options are provided in the table below.
- Some of the options are required, while some options are optional.
-
- Table 2.4. MySQL Server Instance Config Wizard Command Line
- Options
- Option Description
- Required Parameters
- -nPRODUCTNAME The name of the instance when installed
- -pPATH Path of the base directory for installation. This is
- equivalent to the directory when using the basedir configuration
- parameter
- -vVERSION The version tag to use for this installation
- Action to Perform
- -i Install an instance
- -r Remove an instance
- -s Stop an existing instance
- -q Perform the operation quietly
- -lFILENAME Sae the installation progress in a logfile
- Config File to Use
- -tFILENAME Path to the template config file that will be used to
- generate the installed configuration file
- -cFILENAME Path to a config file to be generated
-
- The -t and -c options work together to set the configuration
- parameters for a new instance. The -t option specifies the
- template configuration file to use as the basic configuration,
- which are then merged with the configuration parameters generated
- by the MySQL Server Instance Config Wizard into the configuration
- file specified by the -c option.
-
- A sample template file, my-template.ini is provided in the
- toplevel MySQL installation directory. The file contains elements
- are replaced automatically by the MySQL Server Instance Config
- Wizard during configuration.
-
- If you specify a configuration file that already exists, the
- existing configuration file will be saved in the file with the
- original, with the date and time added. For example, the mysql.ini
- will be copied to mysql 2009-10-27 1646.ini.bak.
-
- The parameters that you can specify on the command line are listed
- in the table below.
-
- Table 2.5. MySQL Server Instance Config Wizard Parameters
- Parameter Description
- ServiceName=$ Specify the name of the service to be created
- AddBinToPath={yes | no} Specifies whether to add the binary
- directory of MySQL to the standard PATH environment variable
- ServerType={DEVELOPMENT | SERVER | DEDICATED} Specify the server
- type. For more information, see Section 2.5.4.4, "The Server Type
- Dialog"
- DatabaseType={MIXED | INNODB | MYISAM} Specify the default
- database type. For more information, see Section 2.5.4.5, "The
- Database Usage Dialog"
- ConnectionUsage={DSS | OLTP} Specify the type of connection
- support, this automates the setting for the number of concurrent
- connections (see the ConnectionCount parameter). For more
- information, see Section 2.5.4.7, "The Concurrent Connections
- Dialog"
- ConnectionCount=# Specify the number of concurrent connections to
- support. For more information, see Section 2.5.4.4, "The Server
- Type Dialog"
- SkipNetworking={yes | no} Specify whether network support should
- be supported. Specifying yes disables network access altogether
- Port=# Specify the network port number to use for network
- connections. For more information, see Section 2.5.4.8, "The
- Networking and Strict Mode Options Dialog"
- StrictMode={yes | no} Specify whether to use the strict SQL mode.
- For more information, see Section 2.5.4.8, "The Networking and
- Strict Mode Options Dialog"
- Charset=$ Specify the default character set. For more information,
- see Section 2.5.4.9, "The Character Set Dialog"
- RootPassword=$ Specify the root password
- RootCurrentPassword=$ Specify the current root password then
- stopping and/or reconfiguring an existing service
-
-Note
-
- When specifying options on the command line, you can enclose the
- entire command-line option and the value you are specifying using
- double quotes. This enables you to use spaces in the options. For
- example, "-cC:\mysql.ini".
-
- The following command installs a MySQL Server 5.1 instance from
- the directory C:\Program Files\MySQL\MySQL Server 5.1 using the
- service name MySQL51 and setting the root password to 1234.
-shell> MySQLInstanceConfig.exe -i -q "-lC:\mysql_install_log.txt" »
- "-nMySQL Server 5.1" "-pC:\Program Files\MySQL\MySQL Server 5.1" -
-v5.1.39 »
- "-tmy-template.ini" "-cC:\mytest.ini" ServerType=DEVELOPMENT Datab
-aseType=MIXED »
- ConnectionUsage=DSS Port=3311 ServiceName=MySQL51 RootPassword=123
-4
-
- In the above example, a log file will be generated in
- mysql_install_log.txt containing the information about the
- instance creation process. The log file generated by the above
- example is shown below:
-Welcome to the MySQL Server Instance Configuration Wizard 1.0.16.0
-Date: 2009-10-27 17:07:21
-
-Installing service ...
-
-Product Name: MySQL Server 5.1
-Version: 5.1.39
-Installation Path: C:\Program Files\MySQL\MySQL Server 5.1\
-
-Creating configuration file C:\mytest.ini using template my-template.
-ini.
-Options:
-DEVELOPMENT
-MIXED
-DSS
-STRICTMODE
-
-Variables:
-port: 3311
-default-character-set: latin1
-basedir: "C:/Program Files/MySQL/MySQL Server 5.1/"
-datadir: "C:/Program Files/MySQL/MySQL Server 5.1/Data/"
-
-
-Creating Windows service entry.
-Service name: "MySQL51"
-Parameters: "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --
-defaults-file="C:\mytest.ini" MySQL51.
-Windows service MySQL51 installed.
-
- When using the command-line, the return values in the following
- table indicate an error performing the specified option.
-
- Table 2.6. Return Value from MySQL Server Instance Config Wizard
- Value Description
- 2 Configuration template file cannot be found
- 3 The Windows service entry cannot be created
- 4 Could not connect to the Service Control Manager
- 5 The MySQL service cannot be started
- 6 The MySQL service cannot be stopped
- 7 The security settings cannot be applied
- 8 The configuration file cannot be written
- 9 The Windows service entry cannot be removed
-
- You can perform an installation of MySQL automatically using the
- MSI packe. For more information, see Section 2.5.3.2, "Installing
- MySQL Automatically using MSI."
-
-2.5.5. Installing MySQL from a noinstall Zip Archive
-
- Users who are installing from the noinstall package can use the
- instructions in this section to manually install MySQL. The
- process for installing MySQL from a Zip archive is as follows:
-
- 1. Extract the archive to the desired install directory
-
- 2. Create an option file
-
- 3. Choose a MySQL server type
-
- 4. Start the MySQL server
-
- 5. Secure the default user accounts
-
- This process is described in the sections that follow.
-
-2.5.5.1. Extracting the Install Archive
-
- To install MySQL manually, do the following:
-
- 1. If you are upgrading from a previous version please refer to
- Section 2.5.7, "Upgrading MySQL on Windows," before beginning
- the upgrade process.
-
- 2. Make sure that you are logged in as a user with administrator
- privileges.
-
- 3. Choose an installation location. Traditionally, the MySQL
- server is installed in C:\mysql. The MySQL Installation Wizard
- installs MySQL under C:\Program Files\MySQL. If you do not
- install MySQL at C:\mysql, you must specify the path to the
- install directory during startup or in an option file. See
- Section 2.5.5.2, "Creating an Option File."
-
- 4. Extract the install archive to the chosen installation
- location using your preferred Zip archive tool. Some tools may
- extract the archive to a folder within your chosen
- installation location. If this occurs, you can move the
- contents of the subfolder into the chosen installation
- location.
-
-2.5.5.2. Creating an Option File
-
- If you need to specify startup options when you run the server,
- you can indicate them on the command line or place them in an
- option file. For options that are used every time the server
- starts, you may find it most convenient to use an option file to
- specify your MySQL configuration. This is particularly true under
- the following circumstances:
-
- * The installation or data directory locations are different
- from the default locations (C:\Program Files\MySQL\MySQL
- Server 5.1 and C:\Program Files\MySQL\MySQL Server 5.1\data).
-
- * You need to tune the server settings, such as memory, cache,
- or InnoDB configuration information.
-
- When the MySQL server starts on Windows, it looks for option files
- in several locations, such as the Windows directory, C:\, and the
- MySQL installation directory (for the full list of locations, see
- Section 4.2.3.3, "Using Option Files"). The Windows directory
- typically is named something like C:\WINDOWS. You can determine
- its exact location from the value of the WINDIR environment
- variable using the following command:
-C:\> echo %WINDIR%
-
- MySQL looks for options in each location first in the my.ini file,
- and then in the my.cnf file. However, to avoid confusion, it is
- best if you use only one file. If your PC uses a boot loader where
- C: is not the boot drive, your only option is to use the my.ini
- file. Whichever option file you use, it must be a plain text file.
-
- You can also make use of the example option files included with
- your MySQL distribution; see Section 4.2.3.3.2, "Preconfigured
- Option Files."
-
- An option file can be created and modified with any text editor,
- such as Notepad. For example, if MySQL is installed in E:\mysql
- and the data directory is in E:\mydata\data, you can create an
- option file containing a [mysqld] section to specify values for
- the basedir and datadir options:
-[mysqld]
-# set basedir to your installation path
-basedir=E:/mysql
-# set datadir to the location of your data directory
-datadir=E:/mydata/data
-
- Note that Windows path names are specified in option files using
- (forward) slashes rather than backslashes. If you do use
- backslashes, double them:
-[mysqld]
-# set basedir to your installation path
-basedir=E:\\mysql
-# set datadir to the location of your data directory
-datadir=E:\\mydata\\data
-
- The rules for use of backslash in option file values are given in
- Section 4.2.3.3, "Using Option Files."
-
- MySQL Enterprise For expert advice on the start-up options
- appropriate to your circumstances, subscribe to the MySQL
- Enterprise Monitor. For more information, see
- http://www.mysql.com/products/enterprise/advisors.html.
-
- In MySQL 5.1.23 and earlier, the MySQL installer places the data
- directory directly under the directory where you install MySQL. On
- MySQL 5.1.24 and later, the data directory is located within the
- AppData directory for the user running MySQL.
-
- If you would like to use a data directory in a different location,
- you should copy the entire contents of the data directory to the
- new location. For example, if you want to use E:\mydata as the
- data directory instead, you must do two things:
-
- 1. Move the entire data directory and all of its contents from
- the default location (for example C:\Program Files\MySQL\MySQL
- Server 5.1\data) to E:\mydata.
-
- 2. Use a --datadir option to specify the new data directory
- location each time you start the server.
-
-2.5.5.3. Selecting a MySQL Server Type
-
- The following table shows the available servers for Windows in
- MySQL 5.1.20 and earlier.
- Binary Description
- mysqld-nt Optimized binary with named-pipe support
- mysqld Optimized binary without named-pipe support
- mysqld-debug Like mysqld-nt, but compiled with full debugging and
- automatic memory allocation checking
-
- The following table shows the available servers for Windows in
- MySQL 5.1.21 and later.
- Binary Description
- mysqld Optimized binary with named-pipe support
- mysqld-debug Like mysqld, but compiled with full debugging and
- automatic memory allocation checking
-
- All of the preceding binaries are optimized for modern Intel
- processors, but should work on any Intel i386-class or higher
- processor.
-
- Each of the servers in a distribution support the same set of
- storage engines. The SHOW ENGINES statement displays which engines
- a given server supports.
-
- All Windows MySQL 5.1 servers have support for symbolic linking of
- database directories.
-
- MySQL supports TCP/IP on all Windows platforms. MySQL servers on
- Windows support named pipes as indicated in the following list.
- However, the default is to use TCP/IP regardless of platform.
- (Named pipes are slower than TCP/IP in many Windows
- configurations.)
-
- Use of named pipes is subject to these conditions:
-
- * Named pipes are enabled only if you start the server with the
- --enable-named-pipe option. It is necessary to use this option
- explicitly because some users have experienced problems with
- shutting down the MySQL server when named pipes were used.
-
- * For MySQL 5.1.20 and earlier, named-pipe connections are
- allowed only by the mysqld-nt and mysqld-debug servers. For
- MySQL 5.1.21 and later, the mysqld and mysqld-debug servers
- both contain support for named-pipe connections.
-
-Note
-
- Most of the examples in this manual use mysqld as the server name.
- If you choose to use a different server, such as mysqld-nt or
- mysqld-debug, make the appropriate substitutions in the commands
- that are shown in the examples.
-
-2.5.5.4. Starting the Server for the First Time
-
- This section gives a general overview of starting the MySQL
- server. The following sections provide more specific information
- for starting the MySQL server from the command line or as a
- Windows service.
-
- The information here applies primarily if you installed MySQL
- using the Noinstall version, or if you wish to configure and test
- MySQL manually rather than with the GUI tools.
-
- The examples in these sections assume that MySQL is installed
- under the default location of C:\Program Files\MySQL\MySQL Server
- 5.1. Adjust the path names shown in the examples if you have MySQL
- installed in a different location.
-
- Clients have two options. They can use TCP/IP, or they can use a
- named pipe if the server supports named-pipe connections.
-
- MySQL for Windows also supports shared-memory connections if the
- server is started with the --shared-memory option. Clients can
- connect through shared memory by using the --protocol=MEMORY
- option.
-
- For information about which server binary to run, see Section
- 2.5.5.3, "Selecting a MySQL Server Type."
-
- Testing is best done from a command prompt in a console window (or
- "DOS window"). In this way you can have the server display status
- messages in the window where they are easy to see. If something is
- wrong with your configuration, these messages make it easier for
- you to identify and fix any problems.
-
- To start the server, enter this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --console
-
- For a server that includes InnoDB support, you should see the
- messages similar to those following as it starts (the path names
- and sizes may differ):
-InnoDB: The first specified datafile c:\ibdata\ibdata1 did not exist:
-InnoDB: a new database to be created!
-InnoDB: Setting file c:\ibdata\ibdata1 size to 209715200
-InnoDB: Database physically writes the file full: wait...
-InnoDB: Log file c:\iblogs\ib_logfile0 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile0 size to 31457280
-InnoDB: Log file c:\iblogs\ib_logfile1 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile1 size to 31457280
-InnoDB: Log file c:\iblogs\ib_logfile2 did not exist: new to be creat
-ed
-InnoDB: Setting log file c:\iblogs\ib_logfile2 size to 31457280
-InnoDB: Doublewrite buffer not found: creating new
-InnoDB: Doublewrite buffer created
-InnoDB: creating foreign key constraint system tables
-InnoDB: foreign key constraint system tables created
-011024 10:58:25 InnoDB: Started
-
- When the server finishes its startup sequence, you should see
- something like this, which indicates that the server is ready to
- service client connections:
-mysqld: ready for connections
-Version: '5.1.46' socket: '' port: 3306
-
- The server continues to write to the console any further
- diagnostic output it produces. You can open a new console window
- in which to run client programs.
-
- If you omit the --console option, the server writes diagnostic
- output to the error log in the data directory (C:\Program
- Files\MySQL\MySQL Server 5.1\data by default). The error log is
- the file with the .err extension.
-
-Note
-
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.13,
- "Post-Installation Setup and Testing."
-
-2.5.5.5. Starting MySQL from the Windows Command Line
-
- The MySQL server can be started manually from the command line.
- This can be done on any version of Windows.
-
- To start the mysqld server from the command line, you should start
- a console window (or "DOS window") and enter this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
-
- The path to mysqld may vary depending on the install location of
- MySQL on your system.
-
- You can stop the MySQL server by executing this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
- shutdown
-
-Note
-
- If the MySQL root user account has a password, you need to invoke
- mysqladmin with the -p option and supply the password when
- prompted.
-
- This command invokes the MySQL administrative utility mysqladmin
- to connect to the server and tell it to shut down. The command
- connects as the MySQL root user, which is the default
- administrative account in the MySQL grant system. Note that users
- in the MySQL grant system are wholly independent from any login
- users under Windows.
-
- If mysqld doesn't start, check the error log to see whether the
- server wrote any messages there to indicate the cause of the
- problem. The error log is located in the C:\Program
- Files\MySQL\MySQL Server 5.1\data directory. It is the file with a
- suffix of .err. You can also try to start the server as mysqld
- --console; in this case, you may get some useful information on
- the screen that may help solve the problem.
-
- The last option is to start mysqld with the --standalone and
- --debug-dbug options. In this case, mysqld writes a log file
- C:\mysqld.trace that should contain the reason why mysqld doesn't
- start. See MySQL Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
-
- Use mysqld --verbose --help to display all the options that mysqld
- supports.
-
-2.5.5.6. Starting MySQL as a Windows Service
-
- On Windows, the recommended way to run MySQL is to install it as a
- Windows service, whereby MySQL starts and stops automatically when
- Windows starts and stops. A MySQL server installed as a service
- can also be controlled from the command line using NET commands,
- or with the graphical Services utility. Generally, to install
- MySQL as a Windows service you should be logged in using an
- account that has administrator rights.
-
- The Services utility (the Windows Service Control Manager) can be
- found in the Windows Control Panel (under Administrative Tools on
- Windows 2000, XP, Vista and Server 2003). To avoid conflicts, it
- is advisable to close the Services utility while performing server
- installation or removal operations from the command line.
-
- Before installing MySQL as a Windows service, you should first
- stop the current server if it is running by using the following
- command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin"
- -u root shutdown
-
-Note
-
- If the MySQL root user account has a password, you need to invoke
- mysqladmin with the -p option and supply the password when
- prompted.
-
- This command invokes the MySQL administrative utility mysqladmin
- to connect to the server and tell it to shut down. The command
- connects as the MySQL root user, which is the default
- administrative account in the MySQL grant system. Note that users
- in the MySQL grant system are wholly independent from any login
- users under Windows.
-
- Install the server as a service using this command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install
-
- The service-installation command does not start the server.
- Instructions for that are given later in this section.
-
- To make it easier to invoke MySQL programs, you can add the path
- name of the MySQL bin directory to your Windows system PATH
- environment variable:
-
- * On the Windows desktop, right-click on the My Computer icon,
- and select Properties.
-
- * Next select the Advanced tab from the System Properties menu
- that appears, and click the Environment Variables button.
-
- * Under System Variables, select Path, and then click the Edit
- button. The Edit System Variable dialogue should appear.
-
- * Place your cursor at the end of the text appearing in the
- space marked Variable Value. (Use the End key to ensure that
- your cursor is positioned at the very end of the text in this
- space.) Then enter the complete path name of your MySQL bin
- directory (for example, C:\Program Files\MySQL\MySQL Server
- 5.1\bin), Note that there should be a semicolon separating
- this path from any values present in this field. Dismiss this
- dialogue, and each dialogue in turn, by clicking OK until all
- of the dialogues that were opened have been dismissed. You
- should now be able to invoke any MySQL executable program by
- typing its name at the DOS prompt from any directory on the
- system, without having to supply the path. This includes the
- servers, the mysql client, and all MySQL command-line
- utilities such as mysqladmin and mysqldump.
- You should not add the MySQL bin directory to your Windows
- PATH if you are running multiple MySQL servers on the same
- machine.
-
-Warning
-
- You must exercise great care when editing your system PATH by
- hand; accidental deletion or modification of any portion of the
- existing PATH value can leave you with a malfunctioning or even
- unusable system.
-
- The following additional arguments can be used in MySQL 5.1 when
- installing the service:
-
- * You can specify a service name immediately following the
- --install option. The default service name is MySQL.
-
- * If a service name is given, it can be followed by a single
- option. By convention, this should be
- --defaults-file=file_name to specify the name of an option
- file from which the server should read options when it starts.
- The use of a single option other than --defaults-file is
- possible but discouraged. --defaults-file is more flexible
- because it enables you to specify multiple startup options for
- the server by placing them in the named option file.
-
- * You can also specify a --local-service option following the
- service name. This causes the server to run using the
- LocalService Windows account that has limited system
- privileges. This account is available only for Windows XP or
- newer. If both --defaults-file and --local-service are given
- following the service name, they can be in any order.
-
- For a MySQL server that is installed as a Windows service, the
- following rules determine the service name and option files that
- the server uses:
-
- * If the service-installation command specifies no service name
- or the default service name (MySQL) following the --install
- option, the server uses the a service name of MySQL and reads
- options from the [mysqld] group in the standard option files.
-
- * If the service-installation command specifies a service name
- other than MySQL following the --install option, the server
- uses that service name. It reads options from the [mysqld]
- group and the group that has the same name as the service in
- the standard option files. This allows you to use the [mysqld]
- group for options that should be used by all MySQL services,
- and an option group with the service name for use by the
- server installed with that service name.
-
- * If the service-installation command specifies a
- --defaults-file option after the service name, the server
- reads options only from the [mysqld] group of the named file
- and ignores the standard option files.
-
- As a more complex example, consider the following command:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld"
- --install MySQL --defaults-file=C:\my-opts.cnf
-
- Here, the default service name (MySQL) is given after the
- --install option. If no --defaults-file option had been given,
- this command would have the effect of causing the server to read
- the [mysqld] group from the standard option files. However,
- because the --defaults-file option is present, the server reads
- options from the [mysqld] option group, and only from the named
- file.
-
- You can also specify options as Start parameters in the Windows
- Services utility before you start the MySQL service.
-
- Once a MySQL server has been installed as a service, Windows
- starts the service automatically whenever Windows starts. The
- service also can be started immediately from the Services utility,
- or by using a NET START MySQL command. The NET command is not case
- sensitive.
-
- When run as a service, mysqld has no access to a console window,
- so no messages can be seen there. If mysqld does not start, check
- the error log to see whether the server wrote any messages there
- to indicate the cause of the problem. The error log is located in
- the MySQL data directory (for example, C:\Program
- Files\MySQL\MySQL Server 5.1\data). It is the file with a suffix
- of .err.
-
- When a MySQL server has been installed as a service, and the
- service is running, Windows stops the service automatically when
- Windows shuts down. The server also can be stopped manually by
- using the Services utility, the NET STOP MySQL command, or the
- mysqladmin shutdown command.
-
- You also have the choice of installing the server as a manual
- service if you do not wish for the service to be started
- automatically during the boot process. To do this, use the
- --install-manual option rather than the --install option:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --install-m
-anual
-
- To remove a server that is installed as a service, first stop it
- if it is running by executing NET STOP MySQL. Then use the
- --remove option to remove it:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld" --remove
-
- If mysqld is not running as a service, you can start it from the
- command line. For instructions, see Section 2.5.5.5, "Starting
- MySQL from the Windows Command Line."
-
- Please see Section 2.5.6, "Troubleshooting a MySQL Installation
- Under Windows," if you encounter difficulties during installation.
-
-2.5.5.7. Testing The MySQL Installation
-
- You can test whether the MySQL server is working by executing any
- of the following commands:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow"
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlshow" -u root
-mysql
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" version
- status proc
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql" test
-
-Note
-
- By default, mysqlshow will try to connect using the ODBC user.
- This user is not created by default. You should specify a valid
- user, or root with the right password to check the operation of
- the server.
-
- If mysqld is slow to respond to TCP/IP connections from client
- programs, there is probably a problem with your DNS. In this case,
- start mysqld with the --skip-name-resolve option and use only
- localhost and IP numbers in the Host column of the MySQL grant
- tables.
-
- You can force a MySQL client to use a named-pipe connection rather
- than TCP/IP by specifying the --pipe or --protocol=PIPE option, or
- by specifying . (period) as the host name. Use the --socket option
- to specify the name of the pipe if you do not want to use the
- default pipe name.
-
- Note that if you have set a password for the root account, deleted
- the anonymous account, or created a new user account, then you
- must use the appropriate -u and -p options with the commands shown
- above in order to connect with the MySQL Server. See Section
- 4.2.2, "Connecting to the MySQL Server."
-
- For more information about mysqlshow, see Section 4.5.6,
- "mysqlshow --- Display Database, Table, and Column Information."
-
-2.5.6. Troubleshooting a MySQL Installation Under Windows
-
- When installing and running MySQL for the first time, you may
- encounter certain errors that prevent the MySQL server from
- starting. The purpose of this section is to help you diagnose and
- correct some of these errors.
-
- Your first resource when troubleshooting server issues is the
- error log. The MySQL server uses the error log to record
- information relevant to the error that prevents the server from
- starting. The error log is located in the data directory specified
- in your my.ini file. The default data directory location is
- C:\Program Files\MySQL\MySQL Server 5.1\data. See Section 5.2.2,
- "The Error Log."
-
- Another source of information regarding possible errors is the
- console messages displayed when the MySQL service is starting. Use
- the NET START MySQL command from the command line after installing
- mysqld as a service to see any error messages regarding the
- starting of the MySQL server as a service. See Section 2.5.5.6,
- "Starting MySQL as a Windows Service."
-
- The following examples show other common error messages you may
- encounter when installing MySQL and starting the server for the
- first time:
-
- * If the MySQL server cannot find the mysql privileges database
- or other critical files, you may see these messages:
-System error 1067 has occurred.
-Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't
-exist
- These messages often occur when the MySQL base or data
- directories are installed in different locations than the
- default locations (C:\Program Files\MySQL\MySQL Server 5.1 and
- C:\Program Files\MySQL\MySQL Server 5.1\data, respectively).
- This situation may occur when MySQL is upgraded and installed
- to a new location, but the configuration file is not updated
- to reflect the new location. In addition, there may be old and
- new configuration files that conflict. Be sure to delete or
- rename any old configuration files when upgrading MySQL.
- If you have installed MySQL to a directory other than
- C:\Program Files\MySQL\MySQL Server 5.1, you need to ensure
- that the MySQL server is aware of this through the use of a
- configuration (my.ini) file. The my.ini file needs to be
- located in your Windows directory, typically C:\WINDOWS. You
- can determine its exact location from the value of the WINDIR
- environment variable by issuing the following command from the
- command prompt:
-C:\> echo %WINDIR%
- An option file can be created and modified with any text
- editor, such as Notepad. For example, if MySQL is installed in
- E:\mysql and the data directory is D:\MySQLdata, you can
- create the option file and set up a [mysqld] section to
- specify values for the basedir and datadir options:
-[mysqld]
-# set basedir to your installation path
-basedir=E:/mysql
-# set datadir to the location of your data directory
-datadir=D:/MySQLdata
- Note that Windows path names are specified in option files
- using (forward) slashes rather than backslashes. If you do use
- backslashes, double them:
-[mysqld]
-# set basedir to your installation path
-basedir=C:\\Program Files\\MySQL\\MySQL Server 5.1
-# set datadir to the location of your data directory
-datadir=D:\\MySQLdata
- The rules for use of backslash in option file values are given
- in Section 4.2.3.3, "Using Option Files."
- If you change the datadir value in your MySQL configuration
- file, you must move the contents of the existing MySQL data
- directory before restarting the MySQL server.
- See Section 2.5.5.2, "Creating an Option File."
-
- * If you reinstall or upgrade MySQL without first stopping and
- removing the existing MySQL service and install MySQL using
- the MySQL Config Wizard, you may see this error:
-Error: Cannot create Windows service for MySql. Error: 0
- This occurs when the Config Wizard tries to install the
- service and finds an existing service with the same name.
- One solution to this problem is to choose a service name other
- than mysql when using the configuration wizard. This allows
- the new service to be installed correctly, but leaves the
- outdated service in place. Although this is harmless, it is
- best to remove old services that are no longer in use.
- To permanently remove the old mysql service, execute the
- following command as a user with administrative privileges, on
- the command-line:
-C:\> sc delete mysql
-[SC] DeleteService SUCCESS
- If the sc utility is not available for your version of
- Windows, download the delsrv utility from
- http://www.microsoft.com/windows2000/techinfo/reskit/tools/exi
- sting/delsrv-o.asp and use the delsrv mysql syntax.
-
-2.5.7. Upgrading MySQL on Windows
-
- This section lists some of the steps you should take when
- upgrading MySQL on Windows.
-
- 1. Review Section 2.4.1, "Upgrading MySQL," for additional
- information on upgrading MySQL that is not specific to
- Windows.
-
- 2. You should always back up your current MySQL installation
- before performing an upgrade. See Section 6.2, "Database
- Backup Methods."
-
- 3. Download the latest Windows distribution of MySQL from
- http://dev.mysql.com/downloads/.
-
- 4. Before upgrading MySQL, you must stop the server. If the
- server is installed as a service, stop the service with the
- following command from the command prompt:
-C:\> NET STOP MySQL
- If you are not running the MySQL server as a service, use the
- following command to stop it:
-C:\> "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin" -u root
- shutdown
-
-Note
- If the MySQL root user account has a password, you need to
- invoke mysqladmin with the -p option and supply the password
- when prompted.
-
- 5. When upgrading to MySQL 5.1 from a version previous to 4.1.5,
- or when upgrading from a version of MySQL installed from a Zip
- archive to a version of MySQL installed with the MySQL
- Installation Wizard, you must manually remove the previous
- installation and MySQL service (if the server is installed as
- a service).
- To remove the MySQL service, use the following command:
-C:\> C:\mysql\bin\mysqld --remove
- If you do not remove the existing service, the MySQL
- Installation Wizard may fail to properly install the new MySQL
- service.
-
- 6. When upgrading from MySQL 5.1.23 to MySQL 5.1.24, the change
- in the default location of the data directory from a directory
- within the MySQL installation to the AppData folder means that
- you must manually copy the data files from your old
- installation to the new location.
-
- 7. If you are using the MySQL Installation Wizard, start the
- wizard as described in Section 2.5.3.1, "Using the MySQL
- Installation Wizard."
-
- 8. If you are installing MySQL from a Zip archive, extract the
- archive. You may either overwrite your existing MySQL
- installation (usually located at C:\mysql), or install it into
- a different directory, such as C:\mysql5. Overwriting the
- existing installation is recommended.
-
- 9. If you were running MySQL as a Windows service and you had to
- remove the service earlier in this procedure, reinstall the
- service. (See Section 2.5.5.6, "Starting MySQL as a Windows
- Service.")
- 10. Restart the server. For example, use NET START MySQL if you
- run MySQL as a service, or invoke mysqld directly otherwise.
- 11. If you encounter errors, see Section 2.5.6, "Troubleshooting a
- MySQL Installation Under Windows."
-
-2.5.8. Windows Post-Installation Procedures
-
- On Windows, the data directory and the grant tables do not have to
- be created. MySQL Windows distributions include the grant tables
- with a set of preinitialized accounts in the mysql database under
- the data directory. It is unnecessary to run the mysql_install_db
- script that is used on Unix. Regarding passwords, if you installed
- MySQL using the Windows Installation Wizard, you may have already
- assigned passwords to the accounts. (See Section 2.5.3.1, "Using
- the MySQL Installation Wizard.") Otherwise, use the
- password-assignment procedure given in Section 2.13.2, "Securing
- the Initial MySQL Accounts."
-
- Before setting up passwords, you might want to try running some
- client programs to make sure that you can connect to the server
- and that it is operating properly. Make sure that the server is
- running (see Section 2.5.5.4, "Starting the Server for the First
- Time"), and then issue the following commands to verify that you
- can retrieve information from the server. The output should be
- similar to what is shown here:
-C:\> C:\mysql\bin\mysqlshow
-+--------------------+
-| Databases |
-+--------------------+
-| information_schema |
-| mysql |
-| test |
-+--------------------+
-
-Note
-
- The above may not work if the correct user does not exist. If you
- installed using the MSI packages and used the MySQL Server
- Instance Config Wizard, then the root will haqve been created
- automatically with the password you supplied. In this case, you
- should use the -u and -p options where you will be prompted for
- the password.
-
-Note
-
- The list of installed databases may vary, but will always include
- the minimum of mysql and information_schema. In most cases, the
- test database will also be installed automatically.
-
- If you specify the name of the database, then a list of the tables
- within a given database will be displayed:
-C:\> C:\mysql\bin\mysqlshow mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| event |
-| func |
-| general_log |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| plugin |
-| proc |
-| procs_priv |
-| servers |
-| slow_log |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
-
-
-C:\> C:\mysql\bin\mysql -e "SELECT Host,Db,User FROM db" mysql
-+------+-------+------+
-| host | db | user |
-+------+-------+------+
-| % | test% | |
-+------+-------+------+
-
- You may need to specify a different directory from the one shown;
- if you used the Windows Installation Wizard, then the default
- directory is C:\Program Files\MySQL\MySQL Server 5.1, and the
- mysql and mysqlshow client programs are in C:\Program
- Files\MySQL\MySQL Server 5.1\bin. See Section 2.5.3.1, "Using the
- MySQL Installation Wizard," for more information.
-
- If you have already secured the initial MySQL accounts, you may
- need to use the -u and -p options to supply a user name and
- password to the mysqlshow and mysql client programs; otherwise the
- programs may fail with an error, or you may not be able to view
- all databases. For example, if you have assigned the password
- "secretpass" to the MySQL root account, then you can invoke
- mysqlshow and mysql as shown here:
-C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass
-+--------------------+
-| Databases |
-+--------------------+
-| information_schema |
-| mysql |
-| test |
-+--------------------+
-
-C:\> C:\mysql\bin\mysqlshow -uroot -psecretpass mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| event |
-| func |
-| general_log |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| plugin |
-| proc |
-| procs_priv |
-| servers |
-| slow_log |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
-
-
-C:\> C:\mysql\bin\mysql -uroot -psecretpass -e "SELECT Host,Db,User F
-ROM db" mysql
-+------+-------+------+
-| host | db | user |
-+------+-------+------+
-| % | test% | |
-+------+-------+------+
-
- For more information about these programs, see Section 4.5.6,
- "mysqlshow --- Display Database, Table, and Column Information,"
- and Section 4.5.1, "mysql --- The MySQL Command-Line Tool."
-
- If you are running a version of Windows that supports services and
- you want the MySQL server to run automatically when Windows
- starts, see Section 2.5.5.6, "Starting MySQL as a Windows
- Service."
-
-2.5.9. MySQL on Windows Compared to MySQL on Unix
-
- MySQL for Windows has proven itself to be very stable. The Windows
- version of MySQL has the same features as the corresponding Unix
- version, with the following exceptions:
-
- * Limited number of ports
- Windows systems have about 4,000 ports available for client
- connections, and after a connection on a port closes, it takes
- two to four minutes before the port can be reused. In
- situations where clients connect to and disconnect from the
- server at a high rate, it is possible for all available ports
- to be used up before closed ports become available again. If
- this happens, the MySQL server appears to be unresponsive even
- though it is running. Note that ports may be used by other
- applications running on the machine as well, in which case the
- number of ports available to MySQL is lower.
- For more information about this problem, see
- http://support.microsoft.com/default.aspx?scid=kb;en-us;196271
- .
-
- * Concurrent reads
- MySQL depends on the pread() and pwrite() system calls to be
- able to mix INSERT and SELECT. Currently, we use mutexes to
- emulate pread() and pwrite(). We intend to replace the file
- level interface with a virtual interface in the future so that
- we can use the readfile()/writefile() interface to get more
- speed. The current implementation limits the number of open
- files that MySQL 5.1 can use to 2,048, which means that you
- cannot run as many concurrent threads on Windows as on Unix.
-
- * Blocking read
- MySQL uses a blocking read for each connection. That has the
- following implications if named-pipe connections are enabled:
-
- + A connection is not disconnected automatically after
- eight hours, as happens with the Unix version of MySQL.
-
- + If a connection hangs, it is not possible to break it
- without killing MySQL.
-
- + mysqladmin kill does not work on a sleeping connection.
-
- + mysqladmin shutdown cannot abort as long as there are
- sleeping connections.
- We plan to fix this problem in the future.
-
- * ALTER TABLE
- While you are executing an ALTER TABLE statement, the table is
- locked from being used by other threads. This has to do with
- the fact that on Windows, you can't delete a file that is in
- use by another thread. In the future, we may find some way to
- work around this problem.
-
- * DATA DIRECTORY and INDEX DIRECTORY
- The DATA DIRECTORY and INDEX DIRECTORY options for CREATE
- TABLE are ignored on Windows, because Windows doesn't support
- symbolic links. These options also are ignored on systems that
- have a nonfunctional realpath() call.
-
- * DROP DATABASE
- You cannot drop a database that is in use by another thread.
-
- * Case-insensitive names
- File names are not case sensitive on Windows, so MySQL
- database and table names are also not case sensitive on
- Windows. The only restriction is that database and table names
- must be specified using the same case throughout a given
- statement. See Section 8.2.2, "Identifier Case Sensitivity."
-
- * Directory and file names
- On Windows, MySQL Server supports only directory and file
- names that are compatible with the current ANSI code pages.
- For example, the following Japanese directory name will not
- work in the Western locale (code page 1252):
-datadir="C:/ç§ãŸã¡ã®ãƒ—ロジェクトã®ãƒ‡ãƒ¼ã‚¿"
- The same limitation applies to directory and file names
- referred to in SQL statements, such as the data file path name
- in LOAD DATA INFILE.
-
- * The "\" path name separator character
- Path name components in Windows are separated by the "\"
- character, which is also the escape character in MySQL. If you
- are using LOAD DATA INFILE or SELECT ... INTO OUTFILE, use
- Unix-style file names with "/" characters:
-mysql> LOAD DATA INFILE 'C:/tmp/skr.txt' INTO TABLE skr;
-mysql> SELECT * INTO OUTFILE 'C:/tmp/skr.txt' FROM skr;
- Alternatively, you must double the "\" character:
-mysql> LOAD DATA INFILE 'C:\\tmp\\skr.txt' INTO TABLE skr;
-mysql> SELECT * INTO OUTFILE 'C:\\tmp\\skr.txt' FROM skr;
-
- * Problems with pipes
- Pipes do not work reliably from the Windows command-line
- prompt. If the pipe includes the character ^Z / CHAR(24),
- Windows thinks that it has encountered end-of-file and aborts
- the program.
- This is mainly a problem when you try to apply a binary log as
- follows:
-C:\> mysqlbinlog binary_log_file | mysql --user=root
- If you have a problem applying the log and suspect that it is
- because of a ^Z / CHAR(24) character, you can use the
- following workaround:
-C:\> mysqlbinlog binary_log_file --result-file=/tmp/bin.sql
-C:\> mysql --user=root --execute "source /tmp/bin.sql"
- The latter command also can be used to reliably read in any
- SQL file that may contain binary data.
-
- * Access denied for user error
- If MySQL cannot resolve your host name properly, you may get
- the following error when you attempt to run a MySQL client
- program to connect to a server running on the same machine:
-Access denied for user 'some_user'@'unknown'
-to database 'mysql'
- To fix this problem, you should create a file named
- \windows\hosts containing the following information:
-127.0.0.1 localhost
-
- Here are some open issues for anyone who might want to help us
- improve MySQL on Windows:
-
- * Add macros to use the faster thread-safe increment/decrement
- methods provided by Windows.
-
-2.5.10. Installing MySQL from Source on Windows
-
- These instructions describe how to build binaries from source for
- MySQL 5.1 on Windows. Instructions are provided for building
- binaries from a standard source distribution or from the Bazaar
- tree that contains the latest development source.
-
-Note
-
- The instructions here are strictly for users who want to test
- MySQL on Microsoft Windows from the latest source distribution or
- from the Bazaar tree. For production use, we do not advise using a
- MySQL server built by yourself from source. Normally, it is best
- to use precompiled binary distributions of MySQL that are built
- specifically for optimal performance on Windows by Oracle
- Corporation. Instructions for installing binary distributions are
- available in Section 2.5, "Installing MySQL on Windows."
-
- To build MySQL on Windows from source, you must satisfy the
- following system, compiler, and resource requirements:
-
- * Windows 2000, Windows XP, or newer version.
- Windows Vista is supported when using Visual Studio 2005
- provided you have installed the following updates:
-
- + Microsoft Visual Studio 2005 Professional Edition - ENU
- Service Pack 1 (KB926601)
- (http://support.microsoft.com/?kbid=926601)
-
- + Security Update for Microsoft Visual Studio 2005
- Professional Edition - ENU (KB937061)
- (http://support.microsoft.com/?kbid=937061)
-
- + Update for Microsoft Visual Studio 2005 Professional
- Edition - ENU (KB932232)
- (http://support.microsoft.com/?kbid=932232)
-
- * CMake, which can be downloaded from http://www.cmake.org.
- After installing, modify your path to include the cmake
- binary.
-
- * Microsoft Visual C++ 2005 Express Edition, Visual Studio .Net
- 2003 (7.1), or Visual Studio 2005 (8.0) compiler system.
-
- * If you are using Visual C++ 2005 Express Edition, you must
- also install an appropriate Platform SDK. More information and
- links to downloads for various Windows platforms is available
- from
- http://www.microsoft.com/downloads/details.aspx?familyid=0baf2
- b35-c656-4969-ace8-e4c0c0716adb.
-
- * If you are compiling from a Bazaar tree or making changes to
- the parser, you need bison for Windows, which can be
- downloaded from
- http://gnuwin32.sourceforge.net/packages/bison.htm. Download
- the package labeled "Complete package, excluding sources".
- After installing the package, modify your path to include the
- bison binary and ensure that this binary is accessible from
- Visual Studio.
-
- * Cygwin might be necessary if you want to run the test script
- or package the compiled binaries and support files into a Zip
- archive. (Cygwin is needed only to test or package the
- distribution, not to build it.) Cygwin is available from
- http://cygwin.com.
-
- * 3GB to 5GB of disk space.
-
- The exact system requirements for Visual Studio can be found here:
- http://msdn.microsoft.com/vstudio/Previous/2003/sysreqs/default.as
- px and
- http://msdn.microsoft.com/vstudio/products/sysreqs/default.aspx
-
- You also need a MySQL source distribution for Windows, which can
- be obtained two ways:
-
- * Obtain a source distribution packaged by Oracle Corporation.
- These are available from http://dev.mysql.com/downloads/.
-
- * Package a source distribution yourself from the latest Bazaar
- developer source tree. For instructions on pulling the latest
- source files, see Section 2.3.3, "Installing from the
- Development Source Tree."
-
- If you find something not working as expected, or you have
- suggestions about ways to improve the current build process on
- Windows, please send a message to the win32 mailing list. See
- Section 1.6.1, "MySQL Mailing Lists."
-
-2.5.10.1. Building MySQL from Source Using CMake and Visual Studio
-
- You can build MySQL on Windows by using a combination of cmake and
- Microsoft Visual Studio .NET 2003 (7.1), Microsoft Visual Studio
- 2005 (8.0), Microsoft Visual Studio 2008 (9.0) or Microsoft Visual
- C++ 2005 Express Edition. You must have the appropriate Microsoft
- Platform SDK installed.
-
-Note
-
- To compile from the source code on Windows you must use the
- standard source distribution (for example, mysql-5.1.46.tar.gz).
- You build from the same distribution as used to build MySQL on
- Unix, Linux and other platforms. Do not use the Windows Source
- distributions as they do not contain the necessary configuration
- script and other files.
-
- Follow this procedure to build MySQL:
-
- 1. If you are installing from a packaged source distribution,
- create a work directory (for example, C:\workdir), and unpack
- the source distribution there using WinZip or another Windows
- tool that can read .zip files. This directory is the work
- directory in the following instructions.
-
-Note
- You must run the commands in the win directory from the
- top-level source directory. Do not change into the win
- directory, as the commands will not be executed correctly.
-
- 2. Start a command shell. If you have not configured the PATH and
- other environment variables for all command shells, you may be
- able to start a command shell from the Start Menu within the
- Windows Visual Studio menu that contains the necessary
- environment changes.
-
- 3. Within the command shell, navigate to the work directory and
- run the following command:
-C:\workdir>win\configure.js options
- If you have associated the .js file extension with an
- application such as a text editor, then you may need to use
- the following command to force configure.js to be executed as
- a script:
-C:\workdir>cscript win\configure.js options
- These options are available for configure.js:
-
- + WITH_INNOBASE_STORAGE_ENGINE: Enable the InnoDB storage
- engine.
-
- + WITH_PARTITION_STORAGE_ENGINE: Enable user-defined
- partitioning.
-
- + WITH_ARCHIVE_STORAGE_ENGINE: Enable the ARCHIVE storage
- engine.
-
- + WITH_BLACKHOLE_STORAGE_ENGINE: Enable the BLACKHOLE
- storage engine.
-
- + WITH_EXAMPLE_STORAGE_ENGINE: Enable the EXAMPLE storage
- engine.
-
- + WITH_FEDERATED_STORAGE_ENGINE: Enable the FEDERATED
- storage engine.
-
- + WITH_NDBCLUSTER_STORAGE_ENGINE (experimental): Enable the
- NDBCLUSTER storage engine in the MySQL server; cause
- binaries for the MySQL Cluster management and data node,
- management client, and other programs to be built.
- This option is supported only in MySQL Cluster NDB 7.0
- (NDBCLUSTER storage engine versions 6.4.0 and later)
- using the MySQL Cluster sources. It cannot be used to
- enable clustering support in other MySQL source trees or
- distributions.
-
- + MYSQL_SERVER_SUFFIX=suffix: Server suffix, default none.
-
- + COMPILATION_COMMENT=comment: Server comment, default
- "Source distribution".
-
- + MYSQL_TCP_PORT=port: Server port, default 3306.
-
- + DISABLE_GRANT_OPTIONS: Disables the --bootstrap,
- --skip-grant-tables, and --init-file options for mysqld.
- This option is available as of MySQL 5.1.15.
- For example (type the command on one line):
-C:\workdir>win\configure.js WITH_INNOBASE_STORAGE_ENGINE
- WITH_PARTITION_STORAGE_ENGINE MYSQL_SERVER_SUFFIX=-pro
-
- 4. From the work directory, execute the win\build-vs9.bat
- (Windows Visual Studio 2008), win\build-vs8.bat (Windows
- Visual Studio 2005), or win\build-vs71.bat (Windows Visual
- Stidion 2003) script, depending on the version of Visual
- Studio you have installed. The script invokes CMake, which
- generates the mysql.sln solution file.
- You can also use the corresponding 64-bit file (for example
- win\build-vs8_x64.bat or win\build-vs9_x64.bat) to build the
- 64-bit version of MySQL. However, you cannot build the 64-bit
- version with Visual Studio Express Edition. You must use
- Visual Studio 2005 (8.0) or higher.
-
- 5. From the work directory, open the generated mysql.sln file
- with Visual Studio and select the proper configuration using
- the Configuration menu. The menu provides Debug, Release,
- RelwithDebInfo, MinRelInfo options. Then select Solution >
- Build to build the solution.
- Remember the configuration that you use in this step. It is
- important later when you run the test script because that
- script needs to know which configuration you used.
-
- 6. Test the server. The server built using the preceding
- instructions expects that the MySQL base directory and data
- directory are C:\mysql and C:\mysql\data by default. If you
- want to test your server using the source tree root directory
- and its data directory as the base directory and data
- directory, you need to tell the server their path names. You
- can either do this on the command line with the --basedir and
- --datadir options, or by placing appropriate options in an
- option file. (See Section 4.2.3.3, "Using Option Files.") If
- you have an existing data directory elsewhere that you want to
- use, you can specify its path name instead.
- When the server is running in standalone fashion or as a
- service based on your configuration, try to connect to it from
- the mysql interactive command-line utility.
- You can also run the standard test script, mysql-test-run.pl.
- This script is written in Perl, so you'll need either Cygwin
- or ActiveState Perl to run it. You may also need to install
- the modules required by the script. To run the test script,
- change location into the mysql-test directory under the work
- directory, set the MTR_VS_CONFIG environment variable to the
- configuration you selected earlier (or use the --vs-config
- option), and invoke mysql-test-run.pl. For example (using
- Cygwin and the bash shell):
-shell> cd mysql-test
-shell> export MTR_VS_CONFIG=debug
-shell> ./mysql-test-run.pl --force --timer
-shell> ./mysql-test-run.pl --force --timer --ps-protocol
-
- When you are satisfied that the programs you have built are
- working correctly, stop the server. Now you can install the
- distribution. One way to do this is to use the make_win_bin_dist
- script in the scripts directory of the MySQL source distribution
- (see Section 4.4.2, "make_win_bin_dist --- Package MySQL
- Distribution as ZIP Archive"). This is a shell script, so you must
- have Cygwin installed if you want to use it. It creates a Zip
- archive of the built executables and support files that you can
- unpack in the location at which you want to install MySQL.
-
- It is also possible to install MySQL by copying directories and
- files directly:
-
- 1. Create the directories where you want to install MySQL. For
- example, to install into C:\mysql, use these commands:
-C:\> mkdir C:\mysql
-C:\> mkdir C:\mysql\bin
-C:\> mkdir C:\mysql\data
-C:\> mkdir C:\mysql\share
-C:\> mkdir C:\mysql\scripts
- If you want to compile other clients and link them to MySQL,
- you should also create several additional directories:
-C:\> mkdir C:\mysql\include
-C:\> mkdir C:\mysql\lib
-C:\> mkdir C:\mysql\lib\debug
-C:\> mkdir C:\mysql\lib\opt
- If you want to benchmark MySQL, create this directory:
-C:\> mkdir C:\mysql\sql-bench
- Benchmarking requires Perl support. See Section 2.15, "Perl
- Installation Notes."
-
- 2. From the work directory, copy into the C:\mysql directory the
- following files and directories:
-C:\> cd \workdir
-C:\workdir> mkdir C:\mysql
-C:\workdir> mkdir C:\mysql\bin
-C:\workdir> copy client\Release\*.exe C:\mysql\bin
-C:\workdir> copy sql\Release\mysqld.exe C:\mysql\bin\mysqld.exe
-C:\workdir> xcopy scripts\*.* C:\mysql\scripts /E
-C:\workdir> xcopy share\*.* C:\mysql\share /E
- If you want to compile other clients and link them to MySQL,
- you should also copy several libraries and header files:
-C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\debug
-C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\debug
-C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\debug
-C:\workdir> copy lib\Release\mysqlclient.lib C:\mysql\lib\opt
-C:\workdir> copy lib\Release\libmysql.* C:\mysql\lib\opt
-C:\workdir> copy lib\Release\zlib.* C:\mysql\lib\opt
-C:\workdir> copy include\*.h C:\mysql\include
-C:\workdir> copy libmysql\libmysql.def C:\mysql\include
-
-Note
- If you have compiled a Debug, rather than Release solution,
- you can replace Release with Debug in the source file names
- shown above.
- If you want to benchmark MySQL, you should also do this:
-C:\workdir> xcopy sql-bench\*.* C:\mysql\bench /E
-
- After installation, set up and start the server in the same way as
- for binary Windows distributions. This includes creating the
- system tables by running mysql_install_db. For more information,
- see Section 2.5, "Installing MySQL on Windows."
-
-2.5.11. Compiling MySQL Clients on Windows
-
- In your source files, you should include my_global.h before
- mysql.h:
-#include <my_global.h>
-#include <mysql.h>
-
- my_global.h includes any other files needed for Windows
- compatibility (such as windows.h) if you compile your program on
- Windows.
-
- You can either link your code with the dynamic libmysql.lib
- library, which is just a wrapper to load in libmysql.dll on
- demand, or link with the static mysqlclient.lib library.
-
- The MySQL client libraries are compiled as threaded libraries, so
- you should also compile your code to be multi-threaded.
-
-2.6. Installing MySQL on Linux
-
- The following sections covers the installation of Linux using
- RPMs. For information on using a generic binary package using tar,
- see Section 2.2, "Installing MySQL from Generic Binaries on
- Unix/Linux." For information on installing from source, see
- Section 2.3, "MySQL Installation Using a Source Distribution."
-
- mysql.server can be found in the support-files directory under the
- MySQL installation directory or in a MySQL source tree. You can
- install it as /etc/init.d/mysql for automatic MySQL startup and
- shutdown. See Section 2.13.1.2, "Starting and Stopping MySQL
- Automatically."
-
-2.6.1. Installing MySQL from RPM Packages on Linux
-
- The recommended way to install MySQL on RPM-based Linux
- distributions is by using the RPM packages. The RPMs that we
- provide to the community should work on all versions of Linux that
- support RPM packages and use glibc 2.3. To obtain RPM packages,
- see Section 2.1.3, "How to Get MySQL."
-
- For non-RPM Linux distributions, you can install MySQL using a
- .tar.gz package. See Section 2.2, "Installing MySQL from Generic
- Binaries on Unix/Linux."
-
- We do provide some platform-specific RPMs; the difference between
- a platform-specific RPM and a generic RPM is that a
- platform-specific RPM is built on the targeted platform and is
- linked dynamically whereas a generic RPM is linked statically with
- LinuxThreads.
-
-Note
-
- RPM distributions of MySQL often are provided by other vendors. Be
- aware that they may differ in features and capabilities from those
- built by us, and that the instructions in this manual do not
- necessarily apply to installing them. The vendor's instructions
- should be consulted instead.
-
- In most cases, you need to install only the MySQL-server and
- MySQL-client packages to get a functional MySQL installation. The
- other packages are not required for a standard installation.
-
- RPMs for MySQL Cluster. Beginning with MySQL 5.1.24, standard
- MySQL server RPMs built by MySQL no longer provide support for the
- NDBCLUSTER storage engine. MySQL Cluster users wanting to upgrade
- MySQL 5.1.23 or earlier installations from RPMs built by MySQL
- should upgrade to MySQL Cluster NDB 6.2 or MySQL Cluster NDB 6.3;
- RPMs that should work with most Linux distributions are available
- for both of these release series.
-
-Important
-
- When upgrading a MySQL Cluster RPM installation, you must upgrade
- all installed RPMs, including the Server and Client RPMs.
-
- For more information about installing MySQL Cluster from RPMs, see
- Section 17.2.1, "MySQL Cluster Multi-Computer Installation."
-
- For upgrades, if your installation was originally produced by
- installing multiple RPM packages, it is best to upgrade all the
- packages, not just some. For example, if you previously installed
- the server and client RPMs, do not upgrade just the server RPM.
-
- The RPM packages shown in the following list are available. The
- names shown here use a suffix of .glibc23.i386.rpm, but particular
- packages can have different suffixes, described later.
-
- * MySQL-server-VERSION.glibc23.i386.rpm
- The MySQL server. You need this unless you only want to
- connect to a MySQL server running on another machine.
-
- * MySQL-client-VERSION.glibc23.i386.rpm
- The standard MySQL client programs. You probably always want
- to install this package.
-
- * MySQL-devel-VERSION.glibc23.i386.rpm
- The libraries and include files that are needed if you want to
- compile other MySQL clients, such as the Perl modules.
-
- * MySQL-debuginfo-VERSION.glibc23.i386.rpm
- This package contains debugging information. debuginfo RPMs
- are never needed to use MySQL software; this is true both for
- the server and for client programs. However, they contain
- additional information that might be needed by a debugger to
- analyze a crash.
-
- * MySQL-shared-VERSION.glibc23.i386.rpm
- This package contains the shared libraries
- (libmysqlclient.so*) that certain languages and applications
- need to dynamically load and use MySQL. It contains
- single-threaded and thread-safe libraries. If you install this
- package, do not install the MySQL-shared-compat package.
-
- * MySQL-shared-compat-VERSION.glibc23.i386.rpm
- This package includes the shared libraries for MySQL 3.23,
- 4.0, and so on, up to the current release. It contains
- single-threaded and thread-safe libraries. Install this
- package instead of MySQL-shared if you have applications
- installed that are dynamically linked against older versions
- of MySQL but you want to upgrade to the current version
- without breaking the library dependencies.
-
- * MySQL-shared-compat-advanced-gpl-VERSION.glibc23.i386.rpm,
- MySQL-shared-compat-advanced-VERSION.glibc23.i386.rpm
- These are like the MySQL-shared-compat package, but are for
- the "MySQL Enterprise Server - Advanced Edition" products.
- Install these packages rather than the normal
- MySQL-shared-compat package if you want to included shared
- client libraries for older MySQL versions.
-
- * MySQL-embedded-VERSION.glibc23.i386.rpm
- The embedded MySQL server library.
-
- * MySQL-ndb-management-VERSION.glibc23.i386.rpm,
- MySQL-ndb-storage-VERSION.glibc23.i386.rpm,
- MySQL-ndb-tools-VERSION.glibc23.i386.rpm,
- MySQL-ndb-extra-VERSION.glibc23.i386.rpm
- Packages that contain additional files for MySQL Cluster
- installations.
-
-Note
- The MySQL-ndb-tools RPM requires a working installation of
- perl. Prior to MySQL 5.1.18, the DBI and HTML::Template
- packages were also required. See Section 2.15, "Perl
- Installation Notes," and Section 17.4.21, "ndb_size.pl ---
- NDBCLUSTER Size Requirement Estimator," for more information.
-
- * MySQL-test-VERSION.glibc23.i386.rpm
- This package includes the MySQL test suite.
-
- * MySQL-VERSION.src.rpm
- This contains the source code for all of the previous
- packages. It can also be used to rebuild the RPMs on other
- architectures (for example, Alpha or SPARC).
-
- The suffix of RPM package names (following the VERSION value) has
- the following syntax:
-.PLATFORM.CPU.rpm
-
- The PLATFORM and CPU values indicate the type of system for which
- the package is built. PLATFORM indicates the platform and CPU
- indicates the processor type or family.
-
- All packages are dynamically linked against glibc 2.3. The
- PLATFORM value indicates whether the package is platform
- independent or intended for a specific platform, as shown in the
- following table.
- glibc23 Platform independent, should run on any Linux distribution
- that supports glibc 2.3
- rhel3, rhel4 Red Hat Enterprise Linux 3 or 4
- sles9, sles10 SuSE Linux Enterprise Server 9 or 10
-
- In MySQL 5.1, only glibc23 packages are available currently.
-
- The CPU value indicates the processor type or family for which the
- package is built.
- i386 x86 processor, 386 and up
- i586 x86 processor, Pentium and up
- x86_64 64-bit x86 processor
- ia64 Itanium (IA-64) processor
-
- To see all files in an RPM package (for example, a MySQL-server
- RPM), run a command like this:
-shell> rpm -qpl MySQL-server-VERSION.glibc23.i386.rpm
-
- To perform a standard minimal installation, install the server and
- client RPMs:
-shell> rpm -i MySQL-server-VERSION.glibc23.i386.rpm
-shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
-
- To install only the client programs, install just the client RPM:
-shell> rpm -i MySQL-client-VERSION.glibc23.i386.rpm
-
- RPM provides a feature to verify the integrity and authenticity of
- packages before installing them. If you would like to learn more
- about this feature, see Section 2.1.4, "Verifying Package
- Integrity Using MD5 Checksums or GnuPG."
-
- The server RPM places data under the /var/lib/mysql directory. The
- RPM also creates a login account for a user named mysql (if one
- does not exist) to use for running the MySQL server, and creates
- the appropriate entries in /etc/init.d/ to start the server
- automatically at boot time. (This means that if you have performed
- a previous installation and have made changes to its startup
- script, you may want to make a copy of the script so that you
- don't lose it when you install a newer RPM.) See Section 2.13.1.2,
- "Starting and Stopping MySQL Automatically," for more information
- on how MySQL can be started automatically on system startup.
-
- If you want to install the MySQL RPM on older Linux distributions
- that do not support initialization scripts in /etc/init.d
- (directly or via a symlink), you should create a symbolic link
- that points to the location where your initialization scripts
- actually are installed. For example, if that location is
- /etc/rc.d/init.d, use these commands before installing the RPM to
- create /etc/init.d as a symbolic link that points there:
-shell> cd /etc
-shell> ln -s rc.d/init.d .
-
- However, all current major Linux distributions should support the
- new directory layout that uses /etc/init.d, because it is required
- for LSB (Linux Standard Base) compliance.
-
- If the RPM files that you install include MySQL-server, the mysqld
- server should be up and running after installation. You should be
- able to start using MySQL.
-
- If something goes wrong, you can find more information in the
- binary installation section. See Section 2.2, "Installing MySQL
- from Generic Binaries on Unix/Linux."
-
-Note
-
- The accounts that are listed in the MySQL grant tables initially
- have no passwords. After starting the server, you should set up
- passwords for them using the instructions in Section 2.13,
- "Post-Installation Setup and Testing."
-
- During RPM installation, a user named mysql and a group named
- mysql are created on the system. This is done using the useradd,
- groupadd, and usermod commands. Those commands require appropriate
- administrative privileges, which is ensured for locally managed
- users and groups (as listed in the /etc/passwd and /etc/group
- files) by the RPM installation process being run by root.
-
- For nonlocal user management (LDAP, NIS, and so forth), the
- administrative tools may require additional authentication (such
- as a password), and will fail if the installing user does not
- provide this authentication. Even if they fail, the RPM
- installation will not abort but succeed, and this is intentional.
- If they failed, some of the intended transfer of ownership may be
- missing, and it is recommended that the system administrator then
- manually ensures some appropriate user andgroup exists and
- manually transfers ownership following the actions in the RPM spec
- file.
-
-2.7. Installing MySQL on Mac OS X
-
- MySQL for Mac OS X is available in a number of different forms:
-
- * Native Package Installer format, which uses the native Mac OS
- X installer to walk you through the installation of MySQL. For
- more information, see Section 2.7.1, "Installing MySQL Using
- the Installation Package." You can use the package installer
- with Mac OS X 10.3 and later, and available for both PowerPC
- and Intel architectures, and both 32-bit and 64-bit
- architectures. There is no Universal Binary available using
- the package installation method. The user you use to perform
- the installation must have administrator privileges.
-
- * Tar package format, which uses a file packaged using the Unix
- tar and gzip commands. To use this method, you will need to
- open a Terminal window. You do not need administrator
- privileges using this method, as you can install the MySQL
- server anywhere using this method. For more information on
- using this method, you can use the generic instructions for
- using a tarball, Section 2.2, "Installing MySQL from Generic
- Binaries on Unix/Linux."You can use the package installer with
- Mac OS X 10.3 and later, and available for both PowerPC and
- Intel architectures, and both 32-bit and 64-bit architectures.
- A Universal Binary, incorporating both Power PC and Intel
- architectures and 32-bit and 64-bit binaries is available.
- In addition to the core installation, the Package Installer
- also includes Section 2.7.2, "Installing the MySQL Startup
- Item" and Section 2.7.3, "Installing and Using the MySQL
- Preference Pane," both of which simplify the management of
- your installation.
-
- * Mac OS X server includes a version of MySQL as standard. If
- you want to use a more recent version than that supplied with
- the Mac OS X server release, you can make use of the package
- or tar formats. For more information on using the MySQL
- bundled with Mac OS X, see Section 2.7.4, "Using MySQL on Mac
- OS X Server."
-
- For additional information on using MySQL on Mac OS X, see Section
- 2.7.5, "MySQL Installation on Mac OS X Notes."
-
-2.7.1. Installing MySQL Using the Installation Package
-
- You can install MySQL on Mac OS X 10.3.x ("Panther") or newer
- using a Mac OS X binary package in PKG format instead of the
- binary tarball distribution. Please note that older versions of
- Mac OS X (for example, 10.1.x or 10.2.x) are not supported by this
- package.
-
- The package is located inside a disk image (.dmg) file that you
- first need to mount by double-clicking its icon in the Finder. It
- should then mount the image and display its contents.
-
-Note
-
- Before proceeding with the installation, be sure to shut down all
- running MySQL server instances by either using the MySQL Manager
- Application (on Mac OS X Server) or via mysqladmin shutdown on the
- command line.
-
- When installing from the package version, you should also install
- the MySQL Preference Pane, which will allow you to control the
- startup and execution of your MySQL server from System
- Preferences. For more information, see Section 2.7.3, "Installing
- and Using the MySQL Preference Pane."
-
- When installing using the package installer, the files are
- installed into a directory within /usr/local matching the name of
- the installation version and platform. For example, the installer
- file mysql-5.1.39-osx10.5-x86_64.pkg installs MySQL into
- /usr/local/mysql-5.1.39-osx10.5-x86_64 . The installation layout
- of the directory is as shown in the following table:
- Directory Contents of Directory
- bin Client programs and the mysqld server
- data Log files, databases
- docs Manual in Info format
- include Include (header) files
- lib Libraries
- man Unix manual pages
- mysql-test MySQL test suite
- scripts Contains the mysql_install_db script
- share/mysql Error message files
- sql-bench Benchmarks
- support-files Scripts and sample configuration files
- /tmp/mysql.sock The location of the MySQL Unix socket
-
- During the package installer process, a symbolic link from
- /usr/local/mysql to the version/platform specific directory
- created during installation will be created automatically.
-
- 1. Download and open the MySQL package installer, which is
- provided on a disk image (.dmg). Double-click to open the disk
- image, which includes the main MySQL installation package, the
- MySQLStartupItem.pkg installation package, and the
- MySQL.prefPane.
-
- 2. Double-click on the MySQL installer package. It will be named
- according to the version of MySQL you have downloaded. For
- example, if you have downloaded MySQL 5.1.39, double-click
- mysql-5.1.39-osx10.5-x86.pkg.
-
- 3. You will be presented with the openin installer dialog. Click
- Continue to begihn installation.
- MySQL Package Installer: Step 1
-
- 4. A copy of the installation instructions and other important
- information relevant to this installation are display. Click
- Continue .
-
- 5. If you have downloaded the community version of MySQL, you
- will be shown a copy of the relevent GNU General Public
- License. Click Continue .
-
- 6. Select the drive you want to use to install the MySQL Startup
- Item. The drive must have a valid, bootable, Mac OS X
- operating system installed. Click Continue.
- MySQL Package Installer: Step 4
-
- 7. You will be asked to confirm the details of the installation,
- including the space required for the installation. To change
- the drive on which the startup item is installed you can click
- either Go Back or Change Install Location.... To install the
- startup item, click Install.
-
- 8. Once the installation has been completed successfully, you
- will be given an Install Succeeded message.
-
- Once you have completed the basic installation, you must complete
- the post-installation steps as specifed in Section 2.13,
- "Post-Installation Setup and Testing."
-
- For convenience, you may also want to install the Section 2.7.2,
- "Installing the MySQL Startup Item" and Section 2.7.3, "Installing
- and Using the MySQL Preference Pane."
-
-2.7.2. Installing the MySQL Startup Item
-
- The MySQL Installation Package includes a startup item that can be
- used to automatically startup and shutdown MySQL during boot.
-
- To install the MySQL Startup Item:
-
- 1. Download and open the MySQL package installer, which is
- provided on a disk image (.dmg). Double-click to open the disk
- image, which includes the main MySQL installation package, the
- MySQLStartupItem.pkg installation package, and the
- MySQL.prefPane.
-
- 2. Double-click on the MySQLStartItem.pkg file to start the
- installation process.
-
- 3. You will be presented with the Install MySQL Startup Item
- dialog.
- MySQL Startup Item Installer: Step 1
- Click Continue to continue the installation process.
-
- 4. A copy of the installation instructions and other important
- information relevant to this installation are display. Click
- Continue .
-
- 5. Select the drive you want to use to install the MySQL Startup
- Item. The drive must have a valid, bootable, Mac OS X
- operating system installed. Click Continue.
- MySQL Startup Item Installer: Step 3
-
- 6. You will be asked to confirm the details of the installation.
- To change the drive on which the startup item is installed you
- can click either Go Back or Change Install Location.... To
- install the startup item, click Install.
-
- 7. Once the installation has been completed successfully, you
- will be given an Install Succeeded message.
- MySQL Startup Item Installer: Step 5
-
- The Startup Item for MySQL is installed into
- /Library/StartupItems/MySQLCOM. The Startup Item installation adds
- a variable MYSQLCOM=-YES- to the system configuration file
- /etc/hostconfig. If you want to disable the automatic startup of
- MySQL, simply change this variable to MYSQLCOM=-NO-.
-
- After the installation, you can start up MySQL by running the
- following commands in a terminal window. You must have
- administrator privileges to perform this task.
-
- If you have installed the Startup Item, use this command to start
- the server:
-shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
-
- You may be prompted for your password to complete the startup.
-
- If you have installed the Startup Item, use this command to stop
- the server:
-shell> sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
-
- You may be prompted for your password to complete the shutdown.
-
-2.7.3. Installing and Using the MySQL Preference Pane
-
- The MySQL Package installer disk image also includes a custom
- MySQL Preference Pane that enables you to start, stop and control
- automated startup during boot of your MySQL installation.
-
- To install the MySQL Preference Pane:
-
- 1. Download and open the MySQL package installer package, which
- is provided on a disk image (.dmg). Double-click to open the
- disk image, which includes the main MySQL installation
- package, the MySQLStartupItem.pkg installation package, and
- the MySQL.prefPane.
-
- 2. Double click on MySQL.prefPane. The MySQL System Preferences
- will open.
-
- 3. If this is the first time you have installed the preference
- pane, you will be asked to confirm installation and whether
- you want to install the preference pane for all users, or only
- the current user. To install the preference pane for all users
- you will need administrator privileges. If necessary, you will
- be prompted for the username and password for a user with
- administrator privileges.
-
- 4. If you already have the MySQL Preference Pane installed, you
- will be asked to confirm whether you want to overwrite the
- existing MySQL Preference Pane.
-
-Note
-
- The MySQL Preference Pane only starts and stops MySQL installation
- installed from the MySQL package installation that have been
- installed in the default location.
-
- Once the MySQL Preference Pane has been installed, you can control
- your MySQL server instance using the preference pane. To use the
- preference pane, open the System Preferences... from the Apple
- menu. Select the MySQL preference pane by clicking on the MySQL
- logo within the Other section of the preference panes list.
- MySQL Preference Pane
-
- The MySQL Preference Pane shows the current status of the MySQL
- server, showing stopped (in red) if the server is not running and
- running (in green) if the server has already been started. The
- preference pane will also show the current setting for whether the
- MySQL server has been set to start up automatically.
-
- * To start MySQL using the preference pane:
- Click Start MySQL Server. You may be prompted for the username
- and password of a user with administrator privileges to start
- the MySQL server.
-
- * To stop MySQL using the preference pane:
- Click Stop MySQL Server. You may be prompted for the username
- and password of a user with administrator privileges to
- shutdown the MySQL server.
-
- * To automatically start the MySQL server when the system boots:
- Check the checkbox next to Automatically Start MySQL Server on
- Startup.
-
- * To disable the automatic starting of the MySQL server when the
- system boots:
- Uncheck the checkbox next to Automatically Start MySQL Server
- on Startup.
-
- You can close the System Preferences... once you have completed
- your settings.
-
-2.7.4. Using MySQL on Mac OS X Server
-
- If you are running Mac OS X Server, a version of MySQL should
- already be installed. The following table shows the versions of
- MySQL that ship with Mac OS X Server versions.
- Mac OS X Server Version MySQL Version
- 10.2-10.2.2 3.23.51
- 10.2.3-10.2.6 3.23.53
- 10.3 4.0.14
- 10.3.2 4.0.16
- 10.4.0 4.1.10a
- 10.5.0 5.0.45
- 10.6.0 5.0.82
-
- The installation layout of MySQL on Mac OS X Server is as shown in
- the table below:
- Directory Contents of Directory
- /usr/bin Client programs
- /var/mysql Log files, databases
- /usr/libexec The mysqld server
- /usr/share/man Unix manual pages
- /usr/share/mysql/mysql-test MySQL test suite
- /usr/share/mysql Contains the mysql_install_db script
- /var/mysql/mysql.sock The location of the MySQL Unix socket
-
-Note
-
- The MySQL server bundled with Mac OS X Server does not include the
- MySQL client libraries and header files required if you want to
- access and use MySQL from a third-party driver, such as Perl DBI
- or PHP. For more information on obtaining and installing MySQL
- libraries, see Mac OS X Server version 10.5: MySQL libraries
- available for download (http://support.apple.com/kb/TA25017).
- Alternatively, you can ignore the bundled MySQL server and install
- MySQL from the package or tarball installation.
-
- For more information on managing the bundled MySQL instance in Mac
- OS X Server 10.5, see Mac OS X Server: Web Technologies
- Administration For Version 10.5 Leopard
- (http://images.apple.com/server/macosx/docs/Web_Technologies_Admin
- _v10.5.pdf). For more information on managing the bundled MySQL
- instance in Mac OS X Server 10.6, see Mac OS X Server: Web
- Technologies Administration Version 10.6 Snow Leopard
- (http://manuals.info.apple.com/en_US/WebTech_v10.6.pdf).
-
-2.7.5. MySQL Installation on Mac OS X Notes
-
- You should keep the following issues and notes in mind:
-
- * The default location for the MySQL Unix socket is different on
- Mac OS X and Mac OS X Server depending on the installation
- type you chose. The default locations by installation are as
- follows:
-
- Package Installer from MySQL /tmp/mysql.sock
- Tarball from MySQL /tmp/mysql.sock
- MySQL Bundled with Mac OS X Server /var/mysql/mysql.sock
- To prevent issues, you should either change the configuration
- of the socket used within your application (for example,
- changing php.ini), or you should configure the socket location
- using a MySQL configuration file and the socket option. For
- more information, see Section 5.1.2, "Server Command Options."
-
- * You may need (or want) to create a specific mysql user to own
- the MySQL directory and data. On Mac OS X 10.4 and lower you
- can do this by using the Netinfo Manager application, located
- within the Utilities folder within the Applications folder. On
- Mac OS X 10.5 and later you can do this through the Directory
- Utility. From Mac OS X 10.5 and later (including Mac OS X
- Server 10.5) the mysql should already exist. For use in single
- user mode, an entry for _mysql (note the underscore prefix)
- should already exist within the system /etc/passwd file.
-
- * Due to a bug in the Mac OS X package installer, you may see
- this error message in the destination disk selection dialog:
-You cannot install this software on this disk. (null)
- If this error occurs, simply click the Go Back button once to
- return to the previous screen. Then click Continue to advance
- to the destination disk selection again, and you should be
- able to choose the destination disk correctly. We have
- reported this bug to Apple and it is investigating this
- problem.
-
- * Because the MySQL package installer installs the MySQL
- contents into a version and platform specific directory, you
- can use this to upgrade and migrate your database between
- versions. You will need to either copy the data directory from
- the old version to the new version, or alternatively specify
- an alternative datadir value to set location of the data
- directory.
-
- * You might want to add aliases to your shell's resource file to
- make it easier to access commonly used programs such as mysql
- and mysqladmin from the command line. The syntax for bash is:
-alias mysql=/usr/local/mysql/bin/mysql
-alias mysqladmin=/usr/local/mysql/bin/mysqladmin
- For tcsh, use:
-alias mysql /usr/local/mysql/bin/mysql
-alias mysqladmin /usr/local/mysql/bin/mysqladmin
- Even better, add /usr/local/mysql/bin to your PATH environment
- variable. You can do this by modifying the appropriate startup
- file for your shell. For more information, see Section 4.2.1,
- "Invoking MySQL Programs."
-
- * After you have copied over the MySQL database files from the
- previous installation and have successfully started the new
- server, you should consider removing the old installation
- files to save disk space. Additionally, you should also remove
- older versions of the Package Receipt directories located in
- /Library/Receipts/mysql-VERSION.pkg.
-
-2.8. Installing MySQL on Solaris
-
- To obtain a binary MySQL distribution for Solaris in tarball or
- PKG format, http://dev.mysql.com/downloads/mysql/5.1.html.
-
- If you install MySQL using a binary tarball distribution on
- Solaris, you may run into trouble even before you get the MySQL
- distribution unpacked, as the Solaris tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
-
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
-
- You can install MySQL on Solaris using a binary package in PKG
- format instead of the binary tarball distribution. Before
- installing using the binary PKG format, you should create the
- mysql user and group, for example:
-groupadd mysql
-useradd -g mysql mysql
-
- Some basic PKG-handling commands follow:
-
- * To add a package:
-pkgadd -d package_name.pkg
-
- * To remove a package:
-pkgrm package_name
-
- * To get a full list of installed packages:
-pkginfo
-
- * To get detailed information for a package:
-pkginfo -l package_name
-
- * To list the files belonging to a package:
-pkgchk -v package_name
-
- * To get packaging information for an arbitrary file:
-pkgchk -l -p file_name
-
-2.8.1. Solaris Notes
-
- For information about installing MySQL on Solaris using PKG
- distributions, see Section 2.8, "Installing MySQL on Solaris."
-
- On Solaris, you may run into trouble even before you get the MySQL
- distribution unpacked, as the Solaris tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
-
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
-
- If you have an UltraSPARC system, you can get 4% better
- performance by adding -mcpu=v8 -Wa,-xarch=v8plusa to the CFLAGS
- and CXXFLAGS environment variables.
-
- If you have Sun's Forte 5.0 (or newer) compiler, you can run
- configure like this:
-CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt" \
-CXX=CC CXXFLAGS="-noex -mt" \
-./configure --prefix=/usr/local/mysql --enable-assembler
-
- To create a 64-bit binary with Sun's Forte compiler, use the
- following configuration options:
-CC=cc CFLAGS="-Xa -fast -native -xstrconst -mt -xarch=v9" \
-CXX=CC CXXFLAGS="-noex -mt -xarch=v9" ASFLAGS="-xarch=v9" \
-./configure --prefix=/usr/local/mysql --enable-assembler
-
- To create a 64-bit Solaris binary using gcc, add -m64 to CFLAGS
- and CXXFLAGS and remove --enable-assembler from the configure
- line.
-
- In the MySQL benchmarks, we obtained a 4% speed increase on
- UltraSPARC when using Forte 5.0 in 32-bit mode, as compared to
- using gcc 3.2 with the -mcpu flag.
-
- If you create a 64-bit mysqld binary, it is 4% slower than the
- 32-bit binary, but can handle more threads and memory.
-
- When using Solaris 10 for x86_64, you should mount any file
- systems on which you intend to store InnoDB files with the
- forcedirectio option. (By default mounting is done without this
- option.) Failing to do so will cause a significant drop in
- performance when using the InnoDB storage engine on this platform.
-
- If you get a problem with fdatasync or sched_yield, you can fix
- this by adding LIBS=-lrt to the configure line
-
- Solaris does not provide static versions of all system libraries
- (libpthreads and libdl), so you cannot compile MySQL with
- --static. If you try to do so, you get one of the following
- errors:
-ld: fatal: library -ldl: not found
-undefined reference to `dlopen'
-cannot find -lrt
-
- If you link your own MySQL client programs, you may see the
- following error at runtime:
-ld.so.1: fatal: libmysqlclient.so.#:
-open failed: No such file or directory
-
- This problem can be avoided by one of the following methods:
-
- * Link clients with the -Wl,r/full/path/to/libmysqlclient.so
- flag rather than with -Lpath).
-
- * Copy libmysqclient.so to /usr/lib.
-
- * Add the path name of the directory where libmysqlclient.so is
- located to the LD_RUN_PATH environment variable before running
- your client.
-
- If you have problems with configure trying to link with -lz when
- you don't have zlib installed, you have two options:
-
- * If you want to be able to use the compressed communication
- protocol, you need to get and install zlib from ftp.gnu.org.
-
- * Run configure with the --with-named-z-libs=no option when
- building MySQL.
-
- If you are using gcc and have problems with loading user-defined
- functions (UDFs) into MySQL, try adding -lgcc to the link line for
- the UDF.
-
- If you would like MySQL to start automatically, you can copy
- support-files/mysql.server to /etc/init.d and create a symbolic
- link to it named /etc/rc3.d/S99mysql.server.
-
- If too many processes try to connect very rapidly to mysqld, you
- should see this error in the MySQL log:
-Error in accept: Protocol error
-
- You might try starting the server with the --back_log=50 option as
- a workaround for this. (Use -O back_log=50 before MySQL 4.)
-
- To configure the generation of core files on Solaris you should
- use the coreadm command. Because of the security implications of
- generating a core on a setuid() application, by default, Solaris
- does not support core files on setuid() programs. However, you can
- modify this behavior using coreadm. If you enable setuid() core
- files for the current user, they will be generated using the mode
- 600 and owned by the superuser.
-
-2.9. Installing MySQL on i5/OS
-
- The i5/OS POWER MySQL package was created in cooperation with IBM.
- MySQL works within the Portable Application Solution Environment
- (PASE) on the System i series of hardware and will also provide
- database services for the Zend Core for i5/OS.
-
- MySQL for i5/OS is provided both as a tar file and as a save file
- (.savf) package that can be downloaded and installed directly
- without any additional installation steps required. To install
- MySQL using the tar file, see Section 2.2, "Installing MySQL from
- Generic Binaries on Unix/Linux."
-
- MySQL is only supported on i5/OS V5R4 or later releases. The i5/OS
- PASE must be installed for MySQL to operate. You must be able to
- login as a user in *SECOFR class.
-
- You should the installation notes and tips for i5/OS before
- starting installation. See i5/OS Installation Notes.
-
- Before Installation:
-
-Note
-
- The installation package will use an existing configuration if you
- have previously installed MySQL (which is identified by looking
- for the file /etc/my.cnf). The values for the data directory
- (DATADIR) and owner of the MySQL files (USRPRF) specified during
- the installation will be ignored, and the values determined from
- the /etc/my.cnf will be used instead.
-
- If you want to change these parameters during a new install, you
- should temporarily rename /etc/my.cnf, install MySQL using the new
- parameters you want to use, and then merge your previous
- /etc/my.cnf configuration settings with the new /etc/my.cnf file
- that is created during installation.
-
- * You must have a user profile with PASE with suitable
- privileges. The user should be within the *SECOFR class, such
- as the QSECOFR user ID. You can use the WRKUSRPRF command to
- check your user profile.
-
- * For network connections to MySQL, you must have TCP/IP
- enabled. You should also check the following:
-
- + Ensure that a name has defined for the system. Run the
- Configure TCP/IP (CFGTCP) command and select option 12
- (Change TCP/IP domain information) to display this
- setting. Make sure that a value is listed in the Host
- name field.
-
- + Make sure that the system has a loopback entry which
- represents the localhost or 127.0.0.1.
-
- + Ensure that the IP address of the IBM i machine is mapped
- correctly to the host name.
-
- To install MySQL on i5/OS, follow these steps:
-
- 1. On the System i machine, create a save file that will be used
- to receive the downloaded installation save file. The file
- should be located within the General Purpose Library (QGPL):
-CRTSAVF FILE(QGPL/MYSQLINST) TESXT('MySQL Save file')
-
- 2. Download the MySQL installation save file in 32-bit
- (mysql-5.1.39-i5os-power-32bit.savf) or 64-bit
- (mysql-5.1.39-i5os-power-64bit.savf) from MySQL Downloads
- (http://dev.mysql.com/downloads).
-
- 3. You need to FTP the downloaded .savf file directly into the
- QGPL/MYSQLINST file on the System i server. You can do this
- through FTP using the following steps after logging in to the
- System i machine:
-ftp> bin
-ftp> cd qgpl
-ftp> put mysql-5.1.39-i5os-power.savf mysqlinst
-
- 4. Log into the System i server using a user in the *SECOFR
- class, such as the QSECOFR user ID.
-
- 5. You need to restore the installation library stored in the
- .savf save file:
-RSTLIB MYSQLINST DEV(*SAVF) SAVF(QGPL/MYSQLINST) MBROPT(*ALL) ALWOBJD
-IF(*ALL)
-
-Note
- You can ignore the security changes-type message at the bottom
- of the installation panel.
-
- 6. Once you have finished restoring the MYSQLINST library, check
- that all the necessary objects for installation are on the
- system by using the Display Library (DSPLIB) command:
-DSPLIB LIB(MYSQLINST)
-
- 7. You need to execute the installation command,
- MYSQLINST/INSMYSQL. You can specify three parameter settings
- during installation:
-
- + DIR('/QOpenSys/usr/local/mysql') sets the installation
- location for the MySQL files. The directory will be
- created if it does not already exist.
-
- + DATADIR('/QOpenSys/usr/local/mysql/data') sets the
- location of the directory that will be used to store the
- database files and binary logs. The default setting is
- /QOpenSys/usr/local/mysql/data. Note that if the
- installer detects an existing installation (due to the
- existence of /etc/my.cnf), then the existing setting will
- be used instead of the default.
-
- + USRPRF(MYSQL) sets the user profile that will own the
- files that are installed. The profile will be created if
- it does not already exist.
-
-Note
- You should choose an appropriate user for using the MySQL
- server installation. The user will be used whenever you
- need to do any administration on the MySQL server.
- Once you have set the appropriate parameters, you can begin
- the installation.
- The installation copies all the necessary files into a
- directory matching the DIR configuration value; sets the
- ownership on those files, sets up the MySQL environment and
- creates the MySQL configuration file (in /etc/my.cnf)
- completing all the steps in a typical binary installation
- process automatically. If this is a new installation of MySQL,
- or if the installer detects that this is a new version
- (because the /etc/my.cnf file does not exist), then the
- initial core MySQL databases will also be created during
- installation.
- Once the installation has been completed, you will get a
- notice advising you to set the password for the root user. For
- more information, Section 2.13, "Post-Installation Setup and
- Testing."
-
- 8. Once the installation has completed, you can delete the
- installation file:
-DLTLIB LIB(MYSQLINST)
-
- Upgrading an existing MySQL instance
-
- You need to execute the upgrade command, MYSQLINST/UPGMYSQL.
-
-Note
-
- You cannot use MYSQLINST/UPGMYSQL to upgrade between major
- versions of MySQL (for example from 5.0 to 5.1). For information
- and advice on migrating between major versions you can use the
- advice provided in Section 2.4.1.1, "Upgrading from MySQL 5.0 to
- 5.1."
-
- You must specify 6 parameters to perform an upgrade:
-
- * DIR('/QOpenSys/usr/local/') --- sets the installation location
- for the MySQL files. The directory will be created if it does
- not already exist. This is the directory that the MySQL server
- will be installed into, inside a directory with a name
- matching the version and release. For example, if installing
- MySQL 5.1.39 with the DIR set to /QOpenSys/usr/local/ would
- result in /QOpenSys/usr/local/mysql-5.1.39-i5os-power64 and a
- symbolic link to this directory will be created in
- /QOpenSys/usr/local/mysql.
-
- * DATADIR('/QOpenSys/mysql/data') --- sets the location of the
- directory that will be upgraded.
-
- * USRPRF('MYSQL') --- sets the user profile that will own the
- files that are installed. The profile will be created if it
- does not already exist; if it is created as part of the
- upgrade process, it will be disabled initially. You may wish
- to enable this user profile so that it can be used to start
- the MySQL server later. It is best practice to use the one
- previously created during the first installation.
-
- * MYSQLUSR('root user') --- any user account in the current
- MySQL server with SUPER privileges.
-
- * PASSWORD('root user password') --- the password for the above
- account. This is necessary as the upgrade starts the MySQL
- server to upgrade the tables and the password is need to be
- able to shutdown the MySQL server.
-
- * CURINST('path to previous install') --- the full path to the
- installation that is being upgraded. For example an
- installation in /QOpenSys/usr/local/ will be
- /QOpenSys/usr/local/msyql-5.1.30-i5os-power64. Failure to
- specify this option may result in corruption of your existing
- data files.
-
- For example:
-MYSQLINST/UPGMYSQL DIR('/QOpenSys/usr/local/') DATADIR('/QOpenSys/mys
-ql/data') »
- USERPRF(MYSQL) MYSQLUSR('root') PASSWORD('root') CURINST('/QOpen
-Sys/usr/local/mysql-5.1.30-i5os-power64')
-
- You should receive a Program Message indicating UPGRADE
- SUCCESSFUL! upon completion or an error message if there is a
- problem.You can view the upgrade programs progression and the
- error in the text file upgrade.log in the installation directory.
-
- To start MySQL:
-
- 1. Log into the System i server using the user profile create or
- specified during installation. By default, this is MYSQL.
-
-Note
- You should start mysqld_safe using a user that in the PASE
- environment has the id=0 (the equivalent of the standard Unix
- root user). If you do not use a user with this ID then the
- system will be unable to change the user when executing mysqld
- as set using --user option. If this happens, mysqld may be
- unable to read the files located within the MySQL data
- directory and the execution will fail.
-
- 2. Enter the PASE environment using call qp2term.
-
- 3. Start the MySQL server by changing to the installation
- directory and running mysqld_safe, specifying the user name
- used to install the server. The installer conveniently
- installs a symbolic link to the installation directory
- (mysql-5.0.42-i5os-power-32bit) as /opt/mysql/mysql:
-> cd /opt/mysql/mysql
-> bin/mysqld_safe --user=mysql &
- You should see a message similar to the following:
-Starting mysqld daemon with databases »
- from /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data
-
- If you are having problems starting MySQL server, see Section
- 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
-
- To stop MySQL:
-
- 1. Log into the System i server using the user profile create or
- specified during installation. By default, this is MYSQL.
-
- 2. Enter the PASE environment using call qp2term.
-
- 3. Stop the MySQL server by changing into the installation
- directory and running mysqladmin, specifying the user name
- used to install the server:
-> cd /opt/mysql/mysql
-> bin/mysqladmin -u root shutdown
- If the session that you started and stopped MySQL are the
- same, you may get the log output from mysqld:
- STOPPING server from pid file »
- /opt/mysql/mysql-enterprise-5.0.42-i5os-power-32bit/data/I5DBX.R
-CHLAND.IBM.COM.pid
- 070718 10:34:20 mysqld ended
- If the sessions used to start and stop MySQL are different,
- you will not receive any confirmation of the shutdown.
-
- Note and tips
-
- * A problem has been identified with the installation process on
- DBCS systems. If you are having problems install MySQL on a
- DBCS system, you need to change your job's coded character set
- identifier (CSSID) to 37 (EBCDIC) before executing the install
- command, INSMYSQL. To do this, determine your existing CSSID
- (using DSPJOB and selecting option 2), execute CHGJOB
- CSSID(37), run INSMYSQL to install MySQL and then execute
- CHGJOB again with your original CSSID.
-
- * If you want to use the Perl scripts that are included with
- MySQL, you need to download the iSeries Tools for Developers
- (5799-PTL). See
- http://www-03.ibm.com/servers/enable/site/porting/tools/.
-
-2.10. Installing MySQL on FreeBSD
-
- This section provides information about using MySQL on variants of
- FreeBSD Unix.
-
- The easiest (and preferred) way to install MySQL is to use the
- mysql-server and mysql-client ports available at
- http://www.freebsd.org/. Using these ports gives you the following
- benefits:
-
- * A working MySQL with all optimizations enabled that are known
- to work on your version of FreeBSD.
-
- * Automatic configuration and build.
-
- * Startup scripts installed in /usr/local/etc/rc.d.
-
- * The ability to use pkg_info -L to see which files are
- installed.
-
- * The ability to use pkg_delete to remove MySQL if you no longer
- want it on your machine.
-
- The MySQL build process requires GNU make (gmake) to work. If GNU
- make is not available, you must install it first before compiling
- MySQL.
-
- The recommended way to compile and install MySQL on FreeBSD with
- gcc (2.95.2 and up) is:
-CC=gcc CFLAGS="-O2 -fno-strength-reduce" \
- CXX=gcc CXXFLAGS="-O2 -fno-rtti -fno-exceptions \
- -felide-constructors -fno-strength-reduce" \
- ./configure --prefix=/usr/local/mysql --enable-assembler
-gmake
-gmake install
-cd /usr/local/mysql
-bin/mysql_install_db --user=mysql
-bin/mysqld_safe &
-
- FreeBSD is known to have a very low default file handle limit. See
- Section B.5.2.18, "'File' Not Found and Similar Errors." Start the
- server by using the --open-files-limit option for mysqld_safe, or
- raise the limits for the mysqld user in /etc/login.conf and
- rebuild it with cap_mkdb /etc/login.conf. Also be sure that you
- set the appropriate class for this user in the password file if
- you are not using the default (use chpass mysqld-user-name). See
- Section 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
-
- In current versions of FreeBSD (at least 4.x and greater), you may
- increase the limit on the amount of memory available for a process
- by adding the following entries to the /boot/loader.conf file and
- rebooting the machine (these are not settings that can be changed
- at run time with the sysctl command):
-kern.maxdsiz="1073741824" # 1GB
-kern.dfldsiz="1073741824" # 1GB
-kern.maxssiz="134217728" # 128MB
-
- For older versions of FreeBSD, you must recompile your kernel to
- change the maximum data segment size for a process. In this case,
- you should look at the MAXDSIZ option in the LINT config file for
- more information.
-
- If you get problems with the current date in MySQL, setting the TZ
- variable should help. See Section 2.14, "Environment Variables."
-
-2.11. Installing MySQL on HP-UX
-
- If you install MySQL using a binary tarball distribution on HP-UX,
- you may run into trouble even before you get the MySQL
- distribution unpacked, as the HP-UX tar cannot handle long file
- names. This means that you may see errors when you try to unpack
- MySQL.
-
- If this occurs, you must use GNU tar (gtar) to unpack the
- distribution.
-
- Because of some critical bugs in the standard HP-UX libraries, you
- should install the following patches before trying to run MySQL on
- HP-UX 11.0:
-PHKL_22840 Streams cumulative
-PHNE_22397 ARPA cumulative
-
- This solves the problem of getting EWOULDBLOCK from recv() and
- EBADF from accept() in threaded applications.
-
- If you are using gcc 2.95.1 on an unpatched HP-UX 11.x system, you
- may get the following error:
-In file included from /usr/include/unistd.h:11,
- from ../include/global.h:125,
- from mysql_priv.h:15,
- from item.cc:19:
-/usr/include/sys/unistd.h:184: declaration of C function ...
-/usr/include/sys/pthread.h:440: previous declaration ...
-In file included from item.h:306,
- from mysql_priv.h:158,
- from item.cc:19:
-
- The problem is that HP-UX does not define pthreads_atfork()
- consistently. It has conflicting prototypes in
- /usr/include/sys/unistd.h:184 and /usr/include/sys/pthread.h:440.
-
- One solution is to copy /usr/include/sys/unistd.h into
- mysql/include and edit unistd.h and change it to match the
- definition in pthread.h. Look for this line:
-extern int pthread_atfork(void (*prepare)(), void (*parent)(),
- void (*child)());
-
- Change it to look like this:
-extern int pthread_atfork(void (*prepare)(void), void (*parent)(void)
-,
- void (*child)(void));
-
- After making the change, the following configure line should work:
-CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \
-./configure --prefix=/usr/local/mysql --disable-shared
-
- If you are using HP-UX compiler, you can use the following command
- (which has been tested with cc B.11.11.04):
-CC=cc CXX=aCC CFLAGS=+DD64 CXXFLAGS=+DD64 ./configure \
- --with-extra-character-set=complex
-
- You can ignore any errors of the following type:
-aCC: warning 901: unknown option: `-3': use +help for online
-documentation
-
- If you get the following error from configure, verify that you
- don't have the path to the K&R compiler before the path to the
- HP-UX C and C++ compiler:
-checking for cc option to accept ANSI C... no
-configure: error: MySQL requires an ANSI C compiler (and a C++ compil
-er).
-Try gcc. See the Installation chapter in the Reference Manual.
-
- Another reason for not being able to compile is that you didn't
- define the +DD64 flags as just described.
-
- Another possibility for HP-UX 11 is to use the MySQL binaries
- provided at http://dev.mysql.com/downloads/, which we have built
- and tested ourselves. We have also received reports that the HP-UX
- 10.20 binaries supplied by MySQL can be run successfully on HP-UX
- 11. If you encounter problems, you should be sure to check your
- HP-UX patch level.
-
-2.12. Installing MySQL on AIX
-
- Automatic detection of xlC is missing from Autoconf, so a number
- of variables need to be set before running configure. The
- following example uses the IBM compiler:
-export CC="xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 "
-export CXX="xlC_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192"
-export CFLAGS="-I /usr/local/include"
-export LDFLAGS="-L /usr/local/lib"
-export CPPFLAGS=$CFLAGS
-export CXXFLAGS=$CFLAGS
-
-./configure --prefix=/usr/local \
- --localstatedir=/var/mysql \
- --sbindir='/usr/local/bin' \
- --libexecdir='/usr/local/bin' \
- --enable-thread-safe-client \
- --enable-large-files
-
- The preceding options are used to compile the MySQL distribution
- that can be found at http://www-frec.bull.com/.
-
- If you change the -O3 to -O2 in the preceding configure line, you
- must also remove the -qstrict option. This is a limitation in the
- IBM C compiler.
-
- If you are using gcc to compile MySQL, you must use the
- -fno-exceptions flag, because the exception handling in gcc is not
- thread-safe! There are also some known problems with IBM's
- assembler that may cause it to generate bad code when used with
- gcc.
-
- Use the following configure line with gcc 2.95 on AIX:
-CC="gcc -pipe -mcpu=power -Wa,-many" \
-CXX="gcc -pipe -mcpu=power -Wa,-many" \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti" \
-./configure --prefix=/usr/local/mysql --with-low-memory
-
- The -Wa,-many option is necessary for the compile to be
- successful. IBM is aware of this problem but is in no hurry to fix
- it because of the workaround that is available. We don't know if
- the -fno-exceptions is required with gcc 2.95, but because MySQL
- doesn't use exceptions and the option generates faster code, you
- should always use it with gcc.
-
- If you get a problem with assembler code, try changing the
- -mcpu=xxx option to match your CPU. Typically power2, power, or
- powerpc may need to be used. Alternatively, you might need to use
- 604 or 604e. We are not positive but suspect that power would
- likely be safe most of the time, even on a power2 machine.
-
- If you don't know what your CPU is, execute a uname -m command. It
- produces a string that looks like 000514676700, with a format of
- xxyyyyyymmss where xx and ss are always 00, yyyyyy is a unique
- system ID and mm is the ID of the CPU Planar. A chart of these
- values can be found at
- http://www16.boulder.ibm.com/pseries/en_US/cmds/aixcmds5/uname.htm
- .
-
- This gives you a machine type and a machine model you can use to
- determine what type of CPU you have.
-
- If you have problems with threads on AIX 5.3, you should upgrade
- AIX 5.3 to technology level 7 (5300-07).
-
- If you have problems with signals (MySQL dies unexpectedly under
- high load), you may have found an OS bug with threads and signals.
- In this case, you can tell MySQL not to use signals by configuring
- as follows:
-CFLAGS=-DDONT_USE_THR_ALARM CXX=gcc \
-CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti \
--DDONT_USE_THR_ALARM" \
-./configure --prefix=/usr/local/mysql --with-debug \
- --with-low-memory
-
- This doesn't affect the performance of MySQL, but has the side
- effect that you can't kill clients that are "sleeping" on a
- connection with mysqladmin kill or mysqladmin shutdown. Instead,
- the client dies when it issues its next command.
-
- On some versions of AIX, linking with libbind.a makes
- getservbyname() dump core. This is an AIX bug and should be
- reported to IBM.
-
- For AIX 4.2.1 and gcc, you have to make the following changes.
-
- After configuring, edit config.h and include/my_config.h and
- change the line that says this:
-#define HAVE_SNPRINTF 1
-
- to this:
-#undef HAVE_SNPRINTF
-
- And finally, in mysqld.cc, you need to add a prototype for
- initgroups().
-#ifdef _AIX41
-extern "C" int initgroups(const char *,int);
-#endif
-
- For 32-bit binaries, if you need to allocate a lot of memory to
- the mysqld process, it is not enough to just use ulimit -d
- unlimited. You may also have to modify mysqld_safe to add a line
- something like this:
-export LDR_CNTRL='MAXDATA=0x80000000'
-
- You can find more information about using a lot of memory at
- http://publib16.boulder.ibm.com/pseries/en_US/aixprggd/genprogc/lr
- g_prg_support.htm.
-
- Users of AIX 4.3 should use gmake instead of the make utility
- included with AIX.
-
- As of AIX 4.1, the C compiler has been unbundled from AIX as a
- separate product. gcc 3.3.2 can be obtained here:
- ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gc
- c/
-
- The steps for compiling MySQL on AIX with gcc 3.3.2 are similar to
- those for using gcc 2.95 (in particular, the need to edit config.h
- and my_config.h after running configure). However, before running
- configure, you should also patch the curses.h file as follows:
-/opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/curses
-.h.ORIG
- Mon Dec 26 02:17:28 2005
---- /opt/freeware/lib/gcc-lib/powerpc-ibm-aix5.2.0.0/3.3.2/include/cu
-rses.h
-Mon Dec 26 02:40:13 2005
-***************
-*** 2023,2029 ****
-
-
- #endif /* _AIX32_CURSES */
-! #if defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus) || de
-fined
-(__STRICT_ANSI__)
- extern int delwin (WINDOW *);
- extern int endwin (void);
- extern int getcurx (WINDOW *);
---- 2023,2029 ----
-
-
- #endif /* _AIX32_CURSES */
-! #if 0 && (defined(__USE_FIXED_PROTOTYPES__) || defined(__cplusplus)
-|| defined
-(__STRICT_ANSI__))
- extern int delwin (WINDOW *);
- extern int endwin (void);
- extern int getcurx (WINDOW *);
-
-2.13. Post-Installation Setup and Testing
-
- After installing MySQL, there are some issues that you should
- address. For example, on Unix, you should initialize the data
- directory and create the MySQL grant tables. On all platforms, an
- important security concern is that the initial accounts in the
- grant tables have no passwords. You should assign passwords to
- prevent unauthorized access to the MySQL server. Optionally, you
- can create time zone tables to enable recognition of named time
- zones.
-
- The following sections include post-installation procedures that
- are specific to Windows systems and to Unix systems. Another
- section, Section 2.13.1.3, "Starting and Troubleshooting the MySQL
- Server," applies to all platforms; it describes what to do if you
- have trouble getting the server to start. Section 2.13.2,
- "Securing the Initial MySQL Accounts," also applies to all
- platforms. You should follow its instructions to make sure that
- you have properly protected your MySQL accounts by assigning
- passwords to them.
-
- When you are ready to create additional user accounts, you can
- find information on the MySQL access control system and account
- management in Section 5.4, "The MySQL Access Privilege System,"
- and Section 5.5, "MySQL User Account Management."
-
-2.13.1. Unix Post-Installation Procedures
-
- After installing MySQL on Unix, you need to initialize the grant
- tables, start the server, and make sure that the server works
- satisfactorily. You may also wish to arrange for the server to be
- started and stopped automatically when your system starts and
- stops. You should also assign passwords to the accounts in the
- grant tables.
-
- On Unix, the grant tables are set up by the mysql_install_db
- program. For some installation methods, this program is run for
- you automatically:
-
- * If you install MySQL on Linux using RPM distributions, the
- server RPM runs mysql_install_db.
-
- * If you install MySQL on Mac OS X using a PKG distribution, the
- installer runs mysql_install_db.
-
- Otherwise, you'll need to run mysql_install_db yourself.
-
- The following procedure describes how to initialize the grant
- tables (if that has not previously been done) and then start the
- server. It also suggests some commands that you can use to test
- whether the server is accessible and working properly. For
- information about starting and stopping the server automatically,
- see Section 2.13.1.2, "Starting and Stopping MySQL Automatically."
-
- After you complete the procedure and have the server running, you
- should assign passwords to the accounts created by
- mysql_install_db. Instructions for doing so are given in Section
- 2.13.2, "Securing the Initial MySQL Accounts."
-
- In the examples shown here, the server runs under the user ID of
- the mysql login account. This assumes that such an account exists.
- Either create the account if it does not exist, or substitute the
- name of a different existing login account that you plan to use
- for running the server.
-
- 1. Change location into the top-level directory of your MySQL
- installation, represented here by BASEDIR:
-shell> cd BASEDIR
- BASEDIR is likely to be something like /usr/local/mysql or
- /usr/local. The following steps assume that you are located in
- this directory.
-
- 2. If necessary, run the mysql_install_db program to set up the
- initial MySQL grant tables containing the privileges that
- determine how users are allowed to connect to the server.
- You'll need to do this if you used a distribution type for
- which the installation procedure doesn't run the program for
- you.
- Typically, mysql_install_db needs to be run only the first
- time you install MySQL, so you can skip this step if you are
- upgrading an existing installation, However, mysql_install_db
- does not overwrite any existing privilege tables, so it should
- be safe to run in any circumstances.
- To initialize the grant tables, use one of the following
- commands, depending on whether mysql_install_db is located in
- the bin or scripts directory:
-shell> bin/mysql_install_db --user=mysql
-shell> scripts/mysql_install_db --user=mysql
- It might be necessary to specify other options such as
- --basedir or --datadir if mysql_install_db does not use the
- correct locations for the installation directory or data
- directory. For example:
-shell> bin/mysql_install_db --user=mysql \
- --basedir=/opt/mysql/mysql \
- --datadir=/opt/mysql/mysql/data
- The mysql_install_db script creates the server's data
- directory. Under the data directory, it creates directories
- for the mysql database that holds all database privileges and
- the test database that you can use to test MySQL. The script
- also creates privilege table entries for root and
- anonymous-user accounts. The accounts have no passwords
- initially. A description of their initial privileges is given
- in Section 2.13.2, "Securing the Initial MySQL Accounts."
- Briefly, these privileges allow the MySQL root user to do
- anything, and allow anybody to create or use databases with a
- name of test or starting with test_.
- It is important to make sure that the database directories and
- files are owned by the mysql login account so that the server
- has read and write access to them when you run it later. To
- ensure this, the --user option should be used as shown if you
- run mysql_install_db as root. Otherwise, you should execute
- the script while logged in as mysql, in which case you can
- omit the --user option from the command.
- mysql_install_db creates several tables in the mysql database,
- including user, db, host, tables_priv, columns_priv, func, and
- others. See Section 5.4, "The MySQL Access Privilege System,"
- for a complete listing and description of these tables.
- If you don't want to have the test database, you can remove it
- with mysqladmin -u root drop test after starting the server.
- If you have trouble with mysql_install_db at this point, see
- Section 2.13.1.1, "Problems Running mysql_install_db."
-
- 3. Start the MySQL server:
-shell> bin/mysqld_safe --user=mysql &
- It is important that the MySQL server be run using an
- unprivileged (non-root) login account. To ensure this, the
- --user option should be used as shown if you run mysqld_safe
- as system root. Otherwise, you should execute the script while
- logged in to the system as mysql, in which case you can omit
- the --user option from the command.
- Further instructions for running MySQL as an unprivileged user
- are given in Section 5.3.6, "How to Run MySQL as a Normal
- User."
- If you neglected to create the grant tables before proceeding
- to this step, the following message appears in the error log
- file when you start the server:
-mysqld: Can't find file: 'host.frm'
- If you have other problems starting the server, see Section
- 2.13.1.3, "Starting and Troubleshooting the MySQL Server."
-
- 4. Use mysqladmin to verify that the server is running. The
- following commands provide simple tests to check whether the
- server is up and responding to connections:
-shell> bin/mysqladmin version
-shell> bin/mysqladmin variables
- The output from mysqladmin version varies slightly depending
- on your platform and version of MySQL, but should be similar
- to that shown here:
-shell> bin/mysqladmin version
-mysqladmin Ver 14.12 Distrib 5.1.46, for pc-linux-gnu on i686
-...
-
-Server version 5.1.46
-Protocol version 10
-Connection Localhost via UNIX socket
-UNIX socket /var/lib/mysql/mysql.sock
-Uptime: 14 days 5 hours 5 min 21 sec
-
-Threads: 1 Questions: 366 Slow queries: 0
-Opens: 0 Flush tables: 1 Open tables: 19
-Queries per second avg: 0.000
- To see what else you can do with mysqladmin, invoke it with
- the --help option.
-
- 5. Verify that you can shut down the server:
-shell> bin/mysqladmin -u root shutdown
-
- 6. Verify that you can start the server again. Do this by using
- mysqld_safe or by invoking mysqld directly. For example:
-shell> bin/mysqld_safe --user=mysql --log &
- If mysqld_safe fails, see Section 2.13.1.3, "Starting and
- Troubleshooting the MySQL Server."
-
- 7. Run some simple tests to verify that you can retrieve
- information from the server. The output should be similar to
- what is shown here:
-shell> bin/mysqlshow
-+-----------+
-| Databases |
-+-----------+
-| mysql |
-| test |
-+-----------+
-
-shell> bin/mysqlshow mysql
-Database: mysql
-+---------------------------+
-| Tables |
-+---------------------------+
-| columns_priv |
-| db |
-| func |
-| help_category |
-| help_keyword |
-| help_relation |
-| help_topic |
-| host |
-| proc |
-| procs_priv |
-| tables_priv |
-| time_zone |
-| time_zone_leap_second |
-| time_zone_name |
-| time_zone_transition |
-| time_zone_transition_type |
-| user |
-+---------------------------+
-
-shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
-+------+--------+------+
-| host | db | user |
-+------+--------+------+
-| % | test | |
-| % | test_% | |
-+------+--------+------+
-
- 8. There is a benchmark suite in the sql-bench directory (under
- the MySQL installation directory) that you can use to compare
- how MySQL performs on different platforms. The benchmark suite
- is written in Perl. It requires the Perl DBI module that
- provides a database-independent interface to the various
- databases, and some other additional Perl modules:
-DBI
-DBD::mysql
-Data::Dumper
-Data::ShowTable
- These modules can be obtained from CPAN
- (http://www.cpan.org/). See also Section 2.15.1, "Installing
- Perl on Unix."
- The sql-bench/Results directory contains the results from many
- runs against different databases and platforms. To run all
- tests, execute these commands:
-shell> cd sql-bench
-shell> perl run-all-tests
- If you don't have the sql-bench directory, you probably
- installed MySQL using RPM files other than the source RPM.
- (The source RPM includes the sql-bench benchmark directory.)
- In this case, you must first install the benchmark suite
- before you can use it. There are separate benchmark RPM files
- named mysql-bench-VERSION.i386.rpm that contain benchmark code
- and data.
- If you have a source distribution, there are also tests in its
- tests subdirectory that you can run. For example, to run
- auto_increment.tst, execute this command from the top-level
- directory of your source distribution:
-shell> mysql -vvf test < ./tests/auto_increment.tst
- The expected result of the test can be found in the
- ./tests/auto_increment.res file.
-
- 9. At this point, you should have the server running. However,
- none of the initial MySQL accounts have a password, so you
- should assign passwords using the instructions found in
- Section 2.13.2, "Securing the Initial MySQL Accounts."
-
- The MySQL 5.1 installation procedure creates time zone tables in
- the mysql database. However, you must populate the tables manually
- using the instructions in Section 9.6, "MySQL Server Time Zone
- Support."
-
-2.13.1.1. Problems Running mysql_install_db
-
- The purpose of the mysql_install_db script is to generate new
- MySQL privilege tables. It does not overwrite existing MySQL
- privilege tables, and it does not affect any other data.
-
- If you want to re-create your privilege tables, first stop the
- mysqld server if it is running. Then rename the mysql directory
- under the data directory to save it, and then run
- mysql_install_db. Suppose that your current directory is the MySQL
- installation directory and that mysql_install_db is located in the
- bin directory and the data directory is named data. To rename the
- mysql database and re-run mysql_install_db, use these commands.
-shell> mv data/mysql data/mysql.old
-shell> bin/mysql_install_db --user=mysql
-
- When you run mysql_install_db, you might encounter the following
- problems:
-
- * mysql_install_db fails to install the grant tables
- You may find that mysql_install_db fails to install the grant
- tables and terminates after displaying the following messages:
-Starting mysqld daemon with databases from XXXXXX
-mysqld ended
- In this case, you should examine the error log file very
- carefully. The log should be located in the directory XXXXXX
- named by the error message and should indicate why mysqld
- didn't start. If you do not understand what happened, include
- the log when you post a bug report. See Section 1.7, "How to
- Report Bugs or Problems."
-
- * There is a mysqld process running
- This indicates that the server is running, in which case the
- grant tables have probably been created already. If so, there
- is no need to run mysql_install_db at all because it needs to
- be run only once (when you install MySQL the first time).
-
- * Installing a second mysqld server does not work when one
- server is running
- This can happen when you have an existing MySQL installation,
- but want to put a new installation in a different location.
- For example, you might have a production installation, but you
- want to create a second installation for testing purposes.
- Generally the problem that occurs when you try to run a second
- server is that it tries to use a network interface that is in
- use by the first server. In this case, you should see one of
- the following error messages:
-Can't start server: Bind on TCP/IP port:
-Address already in use
-Can't start server: Bind on unix socket...
- For instructions on setting up multiple servers, see Section
- 5.6, "Running Multiple MySQL Servers on the Same Machine."
-
- * You do not have write access to the /tmp directory
- If you do not have write access to create temporary files or a
- Unix socket file in the default location (the /tmp directory),
- an error occurs when you run mysql_install_db or the mysqld
- server.
- You can specify different locations for the temporary
- directory and Unix socket file by executing these commands
- prior to starting mysql_install_db or mysqld, where
- some_tmp_dir is the full path name to some directory for which
- you have write permission:
-shell> TMPDIR=/some_tmp_dir/
-shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysql.sock
-shell> export TMPDIR MYSQL_UNIX_PORT
- Then you should be able to run mysql_install_db and start the
- server with these commands:
-shell> bin/mysql_install_db --user=mysql
-shell> bin/mysqld_safe --user=mysql &
- If mysql_install_db is located in the scripts directory,
- modify the first command to scripts/mysql_install_db.
- See Section B.5.4.5, "How to Protect or Change the MySQL Unix
- Socket File," and Section 2.14, "Environment Variables."
-
- There are some alternatives to running the mysql_install_db script
- provided in the MySQL distribution:
-
- * If you want the initial privileges to be different from the
- standard defaults, you can modify mysql_install_db before you
- run it. However, it is preferable to use GRANT and REVOKE to
- change the privileges after the grant tables have been set up.
- In other words, you can run mysql_install_db, and then use
- mysql -u root mysql to connect to the server as the MySQL root
- user so that you can issue the necessary GRANT and REVOKE
- statements.
- If you want to install MySQL on several machines with the same
- privileges, you can put the GRANT and REVOKE statements in a
- file and execute the file as a script using mysql after
- running mysql_install_db. For example:
-shell> bin/mysql_install_db --user=mysql
-shell> bin/mysql -u root < your_script_file
- By doing this, you can avoid having to issue the statements
- manually on each machine.
-
- * It is possible to re-create the grant tables completely after
- they have previously been created. You might want to do this
- if you're just learning how to use GRANT and REVOKE and have
- made so many modifications after running mysql_install_db that
- you want to wipe out the tables and start over.
- To re-create the grant tables, remove all the .frm, .MYI, and
- .MYD files in the mysql database directory. Then run the
- mysql_install_db script again.
-
- * You can start mysqld manually using the --skip-grant-tables
- option and add the privilege information yourself using mysql:
-shell> bin/mysqld_safe --user=mysql --skip-grant-tables &
-shell> bin/mysql mysql
- From mysql, manually execute the SQL commands contained in
- mysql_install_db. Make sure that you run mysqladmin
- flush-privileges or mysqladmin reload afterward to tell the
- server to reload the grant tables.
- Note that by not using mysql_install_db, you not only have to
- populate the grant tables manually, you also have to create
- them first.
-
-2.13.1.2. Starting and Stopping MySQL Automatically
-
- Generally, you start the mysqld server in one of these ways:
-
- * Invoke mysqld directly. This works on any platform.
-
- * Run the MySQL server as a Windows service. The service can be
- set to start the server automatically when Windows starts, or
- as a manual service that you start on request. For
- instructions, see Section 2.5.5.6, "Starting MySQL as a
- Windows Service."
-
- * Invoke mysqld_safe, which tries to determine the proper
- options for mysqld and then runs it with those options. This
- script is used on Unix and Unix-like systems. See Section
- 4.3.2, "mysqld_safe --- MySQL Server Startup Script."
-
- * Invoke mysql.server. This script is used primarily at system
- startup and shutdown on systems that use System V-style run
- directories, where it usually is installed under the name
- mysql. The mysql.server script starts the server by invoking
- mysqld_safe. See Section 4.3.3, "mysql.server --- MySQL Server
- Startup Script."
-
- * On Mac OS X, install a separate MySQL Startup Item package to
- enable the automatic startup of MySQL on system startup. The
- Startup Item starts the server by invoking mysql.server. See
- Section 2.7, "Installing MySQL on Mac OS X," for details.
-
- The mysqld_safe and mysql.server scripts and the Mac OS X Startup
- Item can be used to start the server manually, or automatically at
- system startup time. mysql.server and the Startup Item also can be
- used to stop the server.
-
- To start or stop the server manually using the mysql.server
- script, invoke it with start or stop arguments:
-shell> mysql.server start
-shell> mysql.server stop
-
- Before mysql.server starts the server, it changes location to the
- MySQL installation directory, and then invokes mysqld_safe. If you
- want the server to run as some specific user, add an appropriate
- user option to the [mysqld] group of the /etc/my.cnf option file,
- as shown later in this section. (It is possible that you will need
- to edit mysql.server if you've installed a binary distribution of
- MySQL in a nonstandard location. Modify it to change location into
- the proper directory before it runs mysqld_safe. If you do this,
- your modified version of mysql.server may be overwritten if you
- upgrade MySQL in the future, so you should make a copy of your
- edited version that you can reinstall.)
-
- mysql.server stop stops the server by sending a signal to it. You
- can also stop the server manually by executing mysqladmin
- shutdown.
-
- To start and stop MySQL automatically on your server, you need to
- add start and stop commands to the appropriate places in your
- /etc/rc* files.
-
- If you use the Linux server RPM package
- (MySQL-server-VERSION.rpm), the mysql.server script is installed
- in the /etc/init.d directory with the name mysql. You need not
- install it manually. See Section 2.6.1, "Installing MySQL from RPM
- Packages on Linux," for more information on the Linux RPM
- packages.
-
- Some vendors provide RPM packages that install a startup script
- under a different name such as mysqld.
-
- If you install MySQL from a source distribution or using a binary
- distribution format that does not install mysql.server
- automatically, you can install it manually. The script can be
- found in the support-files directory under the MySQL installation
- directory or in a MySQL source tree.
-
- To install mysql.server manually, copy it to the /etc/init.d
- directory with the name mysql, and then make it executable. Do
- this by changing location into the appropriate directory where
- mysql.server is located and executing these commands:
-shell> cp mysql.server /etc/init.d/mysql
-shell> chmod +x /etc/init.d/mysql
-
- Older Red Hat systems use the /etc/rc.d/init.d directory rather
- than /etc/init.d. Adjust the preceding commands accordingly.
- Alternatively, first create /etc/init.d as a symbolic link that
- points to /etc/rc.d/init.d:
-shell> cd /etc
-shell> ln -s rc.d/init.d .
-
- After installing the script, the commands needed to activate it to
- run at system startup depend on your operating system. On Linux,
- you can use chkconfig:
-shell> chkconfig --add mysql
-
- On some Linux systems, the following command also seems to be
- necessary to fully enable the mysql script:
-shell> chkconfig --level 345 mysql on
-
- On FreeBSD, startup scripts generally should go in
- /usr/local/etc/rc.d/. The rc(8) manual page states that scripts in
- this directory are executed only if their basename matches the
- *.sh shell file name pattern. Any other files or directories
- present within the directory are silently ignored. In other words,
- on FreeBSD, you should install the mysql.server script as
- /usr/local/etc/rc.d/mysql.server.sh to enable automatic startup.
-
- As an alternative to the preceding setup, some operating systems
- also use /etc/rc.local or /etc/init.d/boot.local to start
- additional services on startup. To start up MySQL using this
- method, you could append a command like the one following to the
- appropriate startup file:
-/bin/sh -c 'cd /usr/local/mysql; ./bin/mysqld_safe --user=mysql &'
-
- For other systems, consult your operating system documentation to
- see how to install startup scripts.
-
- You can add options for mysql.server in a global /etc/my.cnf file.
- A typical /etc/my.cnf file might look like this:
-[mysqld]
-datadir=/usr/local/mysql/var
-socket=/var/tmp/mysql.sock
-port=3306
-user=mysql
-
-[mysql.server]
-basedir=/usr/local/mysql
-
- The mysql.server script supports the following options: basedir,
- datadir, and pid-file. If specified, they must be placed in an
- option file, not on the command line. mysql.server supports only
- start and stop as command-line arguments.
-
- The following table shows which option groups the server and each
- startup script read from option files.
- Script Option Groups
- mysqld [mysqld], [server], [mysqld-major_version]
- mysqld_safe [mysqld], [server], [mysqld_safe]
- mysql.server [mysqld], [mysql.server], [server]
-
- [mysqld-major_version] means that groups with names like
- [mysqld-5.0] and [mysqld-5.1] are read by servers having versions
- 5.0.x, 5.1.x, and so forth. This feature can be used to specify
- options that can be read only by servers within a given release
- series.
-
- For backward compatibility, mysql.server also reads the
- [mysql_server] group and mysqld_safe also reads the [safe_mysqld]
- group. However, you should update your option files to use the
- [mysql.server] and [mysqld_safe] groups instead when using MySQL
- 5.1.
-
- See Section 4.2.3.3, "Using Option Files."
-
-2.13.1.3. Starting and Troubleshooting the MySQL Server
-
- This section provides troubleshooting suggestions for problems
- starting the server on Unix. If you are using Windows, see Section
- 2.5.6, "Troubleshooting a MySQL Installation Under Windows."
-
- If you have problems starting the server, here are some things to
- try:
-
- * Check the error log to see why the server does not start.
-
- * Specify any special options needed by the storage engines you
- are using.
-
- * Make sure that the server knows where to find the data
- directory.
-
- * Make sure that the server can access the data directory. The
- ownership and permissions of the data directory and its
- contents must be set such that the server can read and modify
- them.
-
- * Verify that the network interfaces the server wants to use are
- available.
-
- Some storage engines have options that control their behavior. You
- can create a my.cnf file and specify startup options for the
- engines that you plan to use. If you are going to use storage
- engines that support transactional tables (InnoDB, NDB), be sure
- that you have them configured the way you want before starting the
- server:
-
- * If you are using InnoDB tables, see Section 13.6.2, "InnoDB
- Configuration."
-
- * If you are using MySQL Cluster, see Section 17.3, "MySQL
- Cluster Configuration."
-
- MySQL Enterprise For expert advice on start-up options appropriate
- to your circumstances, subscribe to The MySQL Enterprise Monitor.
- For more information, see
- http://www.mysql.com/products/enterprise/advisors.html.
-
- Storage engines will use default option values if you specify
- none, but it is recommended that you review the available options
- and specify explicit values for those for which the defaults are
- not appropriate for your installation.
-
- When the mysqld server starts, it changes location to the data
- directory. This is where it expects to find databases and where it
- expects to write log files. The server also writes the pid
- (process ID) file in the data directory.
-
- The data directory location is hardwired in when the server is
- compiled. This is where the server looks for the data directory by
- default. If the data directory is located somewhere else on your
- system, the server will not work properly. You can determine what
- the default path settings are by invoking mysqld with the
- --verbose and --help options.
-
- If the default locations don't match the MySQL installation layout
- on your system, you can override them by specifying options to
- mysqld or mysqld_safe on the command line or in an option file.
-
- To specify the location of the data directory explicitly, use the
- --datadir option. However, normally you can tell mysqld the
- location of the base directory under which MySQL is installed and
- it looks for the data directory there. You can do this with the
- --basedir option.
-
- To check the effect of specifying path options, invoke mysqld with
- those options followed by the --verbose and --help options. For
- example, if you change location into the directory where mysqld is
- installed and then run the following command, it shows the effect
- of starting the server with a base directory of /usr/local:
-shell> ./mysqld --basedir=/usr/local --verbose --help
-
- You can specify other options such as --datadir as well, but
- --verbose and --help must be the last options.
-
- Once you determine the path settings you want, start the server
- without --verbose and --help.
-
- If mysqld is currently running, you can find out what path
- settings it is using by executing this command:
-shell> mysqladmin variables
-
- Or:
-shell> mysqladmin -h host_name variables
-
- host_name is the name of the MySQL server host.
-
- If you get Errcode 13 (which means Permission denied) when
- starting mysqld, this means that the privileges of the data
- directory or its contents do not allow the server access. In this
- case, you change the permissions for the involved files and
- directories so that the server has the right to use them. You can
- also start the server as root, but this raises security issues and
- should be avoided.
-
- On Unix, change location into the data directory and check the
- ownership of the data directory and its contents to make sure the
- server has access. For example, if the data directory is
- /usr/local/mysql/var, use this command:
-shell> ls -la /usr/local/mysql/var
-
- If the data directory or its files or subdirectories are not owned
- by the login account that you use for running the server, change
- their ownership to that account. If the account is named mysql,
- use these commands:
-shell> chown -R mysql /usr/local/mysql/var
-shell> chgrp -R mysql /usr/local/mysql/var
-
- If it possible that even with correct ownership, MySQL may fail to
- start up if there is other security software running on your
- system that manages application access to various parts of the
- file system. In this case, you may need to reconfigure that
- software to enable mysqld to access the directories it uses during
- normal operation.
-
- If the server fails to start up correctly, check the error log.
- Log files are located in the data directory (typically C:\Program
- Files\MySQL\MySQL Server 5.1\data on Windows,
- /usr/local/mysql/data for a Unix binary distribution, and
- /usr/local/var for a Unix source distribution). Look in the data
- directory for files with names of the form host_name.err and
- host_name.log, where host_name is the name of your server host.
- Then examine the last few lines of these files. On Unix, you can
- use tail to display them:
-shell> tail host_name.err
-shell> tail host_name.log
-
- The error log should contain information that indicates why the
- server couldn't start.
-
- If either of the following errors occur, it means that some other
- program (perhaps another mysqld server) is using the TCP/IP port
- or Unix socket file that mysqld is trying to use:
-Can't start server: Bind on TCP/IP port: Address already in use
-Can't start server: Bind on unix socket...
-
- Use ps to determine whether you have another mysqld server
- running. If so, shut down the server before starting mysqld again.
- (If another server is running, and you really want to run multiple
- servers, you can find information about how to do so in Section
- 5.6, "Running Multiple MySQL Servers on the Same Machine.")
-
- If no other server is running, try to execute the command telnet
- your_host_name tcp_ip_port_number. (The default MySQL port number
- is 3306.) Then press Enter a couple of times. If you don't get an
- error message like telnet: Unable to connect to remote host:
- Connection refused, some other program is using the TCP/IP port
- that mysqld is trying to use. You'll need to track down what
- program this is and disable it, or else tell mysqld to listen to a
- different port with the --port option. In this case, you'll also
- need to specify the port number for client programs when
- connecting to the server via TCP/IP.
-
- Another reason the port might be inaccessible is that you have a
- firewall running that blocks connections to it. If so, modify the
- firewall settings to allow access to the port.
-
- If the server starts but you can't connect to it, you should make
- sure that you have an entry in /etc/hosts that looks like this:
-127.0.0.1 localhost
-
- This problem occurs only on systems that do not have a working
- thread library and for which MySQL must be configured to use
- MIT-pthreads.
-
- If you cannot get mysqld to start, you can try to make a trace
- file to find the problem by using the --debug-dbug option. See MySQL
- Internals: Porting
- (http://forge.mysql.com/wiki/MySQL_Internals_Porting).
-
-2.13.2. Securing the Initial MySQL Accounts
-
- Part of the MySQL installation process is to set up the mysql
- database that contains the grant tables:
-
- * Windows distributions contain preinitialized grant tables that
- are installed automatically.
-
- * On Unix, the grant tables are populated by the
- mysql_install_db program. Some installation methods run this
- program for you. Others require that you execute it manually.
- For details, see Section 2.13.1, "Unix Post-Installation
- Procedures."
-
- The grant tables define the initial MySQL user accounts and their
- access privileges. These accounts are set up as follows:
-
- * Accounts with the user name root are created. These are
- superuser accounts that can do anything. The initial root
- account passwords are empty, so anyone can connect to the
- MySQL server as root --- without a password --- and be granted
- all privileges.
-
- + On Windows, one root account is created; this account
- allows connecting from the local host only. The Windows
- installer will optionally create an account allowing for
- connections from any host only if the user selects the
- Enable root access from remote machines option during
- installation.
-
- + On Unix, both root accounts are for connections from the
- local host. Connections must be made from the local host
- by specifying a host name of localhost for one of the
- accounts, or the actual host name or IP number for the
- other.
-
- * Two anonymous-user accounts are created, each with an empty
- user name. The anonymous accounts have no password, so anyone
- can use them to connect to the MySQL server.
-
- + On Windows, one anonymous account is for connections from
- the local host. It has no global privileges. (Before
- MySQL 5.1.16, it has all global privileges, just like the
- root accounts.) The other is for connections from any
- host and has all privileges for the test database and for
- other databases with names that start with test.
-
- + On Unix, both anonymous accounts are for connections from
- the local host. Connections must be made from the local
- host by specifying a host name of localhost for one of
- the accounts, or the actual host name or IP number for
- the other. These accounts have all privileges for the
- test database and for other databases with names that
- start with test_.
-
- As noted, none of the initial accounts have passwords. This means
- that your MySQL installation is unprotected until you do something
- about it:
-
- * If you want to prevent clients from connecting as anonymous
- users without a password, you should either assign a password
- to each anonymous account or else remove the accounts.
-
- * You should assign a password to each MySQL root account.
-
- The following instructions describe how to set up passwords for
- the initial MySQL accounts, first for the anonymous accounts and
- then for the root accounts. Replace "newpwd" in the examples with
- the actual password that you want to use. The instructions also
- cover how to remove the anonymous accounts, should you prefer not
- to allow anonymous access at all.
-
- You might want to defer setting the passwords until later, so that
- you don't need to specify them while you perform additional setup
- or testing. However, be sure to set them before using your
- installation for production purposes.
-
- Anonymous Account Password Assignment
-
- To assign passwords to the anonymous accounts, connect to the
- server as root and then use either SET PASSWORD or UPDATE. In
- either case, be sure to encrypt the password using the PASSWORD()
- function.
-
- To use SET PASSWORD on Windows, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR ''@'%' = PASSWORD('newpwd');
-
- To use SET PASSWORD on Unix, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');
-
- In the second SET PASSWORD statement, replace host_name with the
- name of the server host. This is the name that is specified in the
- Host column of the non-localhost record for root in the user
- table. If you don't know what host name this is, issue the
- following statement before using SET PASSWORD:
-mysql> SELECT Host, User FROM mysql.user;
-
- Look for the record that has root in the User column and something
- other than localhost in the Host column. Then use that Host value
- in the second SET PASSWORD statement.
-
- Anonymous Account Removal
-
- If you prefer to remove the anonymous accounts instead, do so as
- follows:
-shell> mysql -u root
-mysql> DROP USER '';
-
- The DROP statement applies both to Windows and to Unix. On
- Windows, if you want to remove only the anonymous account that has
- the same privileges as root, do this instead:
-shell> mysql -u root
-mysql> DROP USER ''@'localhost';
-
- That account allows anonymous access but has full privileges, so
- removing it improves security.
-
- root Account Password Assignment
-
- You can assign passwords to the root accounts in several ways. The
- following discussion demonstrates three methods:
-
- * Use the SET PASSWORD statement
-
- * Use the mysqladmin command-line client program
-
- * Use the UPDATE statement
-
- To assign passwords using SET PASSWORD, connect to the server as
- root and issue SET PASSWORD statements. Be sure to encrypt the
- password using the PASSWORD() function.
-
- For Windows, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
-
- For Unix, do this:
-shell> mysql -u root
-mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
-mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
-
- In the second SET PASSWORD statement, replace host_name with the
- name of the server host. This is the same host name that you used
- when you assigned the anonymous account passwords.
-
- If the user table contains an account with User and Host values of
- 'root' and '127.0.0.1', use an additional SET PASSWORD statement
- to set that account's password:
-mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');
-
- To assign passwords to the root accounts using mysqladmin, execute
- the following commands:
-shell> mysqladmin -u root password "newpwd"
-shell> mysqladmin -u root -h host_name password "newpwd"
-
- These commands apply both to Windows and to Unix. In the second
- command, replace host_name with the name of the server host. The
- double quotes around the password are not always necessary, but
- you should use them if the password contains spaces or other
- characters that are special to your command interpreter.
-
- The mysqladmin method of setting the root account passwords does
- not set the password for the 'root'@'127.0.0.1' account. To do so,
- use SET PASSWORD as shown earlier.
-
- You can also use UPDATE to modify the user table directly. The
- following UPDATE statement assigns a password to all root
- accounts:
-shell> mysql -u root
-mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
- -> WHERE User = 'root';
-mysql> FLUSH PRIVILEGES;
-
- The UPDATE statement applies both to Windows and to Unix.
-
- After the passwords have been set, you must supply the appropriate
- password whenever you connect to the server. For example, if you
- want to use mysqladmin to shut down the server, you can do so
- using this command:
-shell> mysqladmin -u root -p shutdown
-Enter password: (enter root password here)
-
-Note
-
- If you forget your root password after setting it up, Section
- B.5.4.1, "How to Reset the Root Password," covers the procedure
- for resetting it.
-
- To set up additional accounts, you can use the GRANT statement.
- For instructions, see Section 5.5.2, "Adding User Accounts."
-
-2.14. Environment Variables
-
- This section lists all the environment variables that are used
- directly or indirectly by MySQL. Most of these can also be found
- in other places in this manual.
-
- Note that any options on the command line take precedence over
- values specified in option files and environment variables, and
- values in option files take precedence over values in environment
- variables.
-
- In many cases, it is preferable to use an option file instead of
- environment variables to modify the behavior of MySQL. See Section
- 4.2.3.3, "Using Option Files."
- Variable Description
- CXX The name of your C++ compiler (for running configure).
- CC The name of your C compiler (for running configure).
- CFLAGS Flags for your C compiler (for running configure).
- CXXFLAGS Flags for your C++ compiler (for running configure).
- DBI_USER The default user name for Perl DBI.
- DBI_TRACE Trace options for Perl DBI.
- HOME The default path for the mysql history file is
- $HOME/.mysql_history.
- LD_RUN_PATH Used to specify the location of libmysqlclient.so.
- MYSQL_DEBUG Debug trace options when debugging.
- MYSQL_GROUP_SUFFIX Option group suffix value (like specifying
- --defaults-group-suffix).
- MYSQL_HISTFILE The path to the mysql history file. If this
- variable is set, its value overrides the default for
- $HOME/.mysql_history.
- MYSQL_HOME The path to the directory in which the server-specific
- my.cnf file resides (as of MySQL 5.0.3).
- MYSQL_HOST The default host name used by the mysql command-line
- client.
- MYSQL_PS1 The command prompt to use in the mysql command-line
- client.
- MYSQL_PWD The default password when connecting to mysqld. Note
- that using this is insecure. See Section 5.3.2.2, "End-User
- Guidelines for Password Security."
- MYSQL_TCP_PORT The default TCP/IP port number.
- MYSQL_UNIX_PORT The default Unix socket file name; used for
- connections to localhost.
- PATH Used by the shell to find MySQL programs.
- TMPDIR The directory where temporary files are created.
- TZ This should be set to your local time zone. See Section
- B.5.4.6, "Time Zone Problems."
- UMASK The user-file creation mode when creating files. See note
- following table.
- UMASK_DIR The user-directory creation mode when creating
- directories. See note following table.
- USER The default user name on Windows and NetWare used when
- connecting to mysqld.
-
- The UMASK and UMASK_DIR variables, despite their names, are used
- as modes, not masks:
-
- * If UMASK is set, mysqld uses ($UMASK | 0600) as the mode for
- file creation, so that newly created files have a mode in the
- range from 0600 to 0666 (all values octal).
-
- * If UMASK_DIR is set, mysqld uses ($UMASK_DIR | 0700) as the
- base mode for directory creation, which then is AND-ed with
- ~(~$UMASK & 0666), so that newly created directories have a
- mode in the range from 0700 to 0777 (all values octal). The
- AND operation may remove read and write permissions from the
- directory mode, but not execute permissions.
-
- MySQL assumes that the value for UMASK or UMASK_DIR is in octal if
- it starts with a zero.
-
-2.15. Perl Installation Notes
-
- Perl support for MySQL is provided by means of the DBI/DBD client
- interface. The interface requires Perl 5.6.0, and 5.6.1 or later
- is preferred. DBI does not work if you have an older version of
- Perl.
-
- If you want to use transactions with Perl DBI, you need to have
- DBD::mysql 2.0900. If you are using the MySQL 4.1 or newer client
- library, you must use DBD::mysql 2.9003 or newer. Support for
- server-side prepared statements requires DBD::mysql 3.0009 or
- newer.
-
- Perl support is not included with MySQL distributions. You can
- obtain the necessary modules from http://search.cpan.org for Unix,
- or by using the ActiveState ppm program on Windows. The following
- sections describe how to do this.
-
- Perl support for MySQL must be installed if you want to run the
- MySQL benchmark scripts; see Section 7.1.3, "The MySQL Benchmark
- Suite." It is also required for the MySQL Cluster ndb_size.pl
- utility; see Section 17.4.21, "ndb_size.pl --- NDBCLUSTER Size
- Requirement Estimator."
-
-2.15.1. Installing Perl on Unix
-
- MySQL Perl support requires that you have installed MySQL client
- programming support (libraries and header files). Most
- installation methods install the necessary files. However, if you
- installed MySQL from RPM files on Linux, be sure that you've
- installed the developer RPM. The client programs are in the client
- RPM, but client programming support is in the developer RPM.
-
- If you want to install Perl support, the files you need can be
- obtained from the CPAN (Comprehensive Perl Archive Network) at
- http://search.cpan.org.
-
- The easiest way to install Perl modules on Unix is to use the CPAN
- module. For example:
-shell> perl -MCPAN -e shell
-cpan> install DBI
-cpan> install DBD::mysql
-
- The DBD::mysql installation runs a number of tests. These tests
- attempt to connect to the local MySQL server using the default
- user name and password. (The default user name is your login name
- on Unix, and ODBC on Windows. The default password is "no
- password.") If you cannot connect to the server with those values
- (for example, if your account has a password), the tests fail. You
- can use force install DBD::mysql to ignore the failed tests.
-
- DBI requires the Data::Dumper module. It may be installed; if not,
- you should install it before installing DBI.
-
- It is also possible to download the module distributions in the
- form of compressed tar archives and build the modules manually.
- For example, to unpack and build a DBI distribution, use a
- procedure such as this:
-
- 1. Unpack the distribution into the current directory:
-shell> gunzip < DBI-VERSION.tar.gz | tar xvf -
- This command creates a directory named DBI-VERSION.
-
- 2. Change location into the top-level directory of the unpacked
- distribution:
-shell> cd DBI-VERSION
-
- 3. Build the distribution and compile everything:
-shell> perl Makefile.PL
-shell> make
-shell> make test
-shell> make install
-
- The make test command is important because it verifies that the
- module is working. Note that when you run that command during the
- DBD::mysql installation to exercise the interface code, the MySQL
- server must be running or the test fails.
-
- It is a good idea to rebuild and reinstall the DBD::mysql
- distribution whenever you install a new release of MySQL,
- particularly if you notice symptoms such as that all your DBI
- scripts fail after you upgrade MySQL.
-
- If you do not have access rights to install Perl modules in the
- system directory or if you want to install local Perl modules, the
- following reference may be useful:
- http://servers.digitaldaze.com/extensions/perl/modules.html#module
- s
-
- Look under the heading "Installing New Modules that Require
- Locally Installed Modules."
-
-2.15.2. Installing ActiveState Perl on Windows
-
- On Windows, you should do the following to install the MySQL DBD
- module with ActiveState Perl:
-
- 1. Get ActiveState Perl from
- http://www.activestate.com/Products/ActivePerl/ and install
- it.
-
- 2. Open a console window (a "DOS window").
-
- 3. If necessary, set the HTTP_proxy variable. For example, you
- might try a setting like this:
-set HTTP_proxy=my.proxy.com:3128
-
- 4. Start the PPM program:
-C:\> C:\perl\bin\ppm.pl
-
- 5. If you have not previously done so, install DBI:
-ppm> install DBI
-
- 6. If this succeeds, run the following command:
-ppm> install DBD-mysql
-
- This procedure should work with ActiveState Perl 5.6 or newer.
-
- If you cannot get the procedure to work, you should install the
- MyODBC driver instead and connect to the MySQL server through
- ODBC:
-use DBI;
-$dbh= DBI->connect("DBI:ODBC:$dsn",$user,$password) ||
- die "Got error $DBI::errstr when connecting to $dsn\n";
-
-2.15.3. Problems Using the Perl DBI/DBD Interface
-
- If Perl reports that it cannot find the ../mysql/mysql.so module,
- the problem is probably that Perl cannot locate the
- libmysqlclient.so shared library. You should be able to fix this
- problem by one of the following methods:
-
- * Compile the DBD::mysql distribution with perl Makefile.PL
- -static -config rather than perl Makefile.PL.
-
- * Copy libmysqlclient.so to the directory where your other
- shared libraries are located (probably /usr/lib or /lib).
-
- * Modify the -L options used to compile DBD::mysql to reflect
- the actual location of libmysqlclient.so.
-
- * On Linux, you can add the path name of the directory where
- libmysqlclient.so is located to the /etc/ld.so.conf file.
-
- * Add the path name of the directory where libmysqlclient.so is
- located to the LD_RUN_PATH environment variable. Some systems
- use LD_LIBRARY_PATH instead.
-
- Note that you may also need to modify the -L options if there are
- other libraries that the linker fails to find. For example, if the
- linker cannot find libc because it is in /lib and the link command
- specifies -L/usr/lib, change the -L option to -L/lib or add -L/lib
- to the existing link command.
-
- If you get the following errors from DBD::mysql, you are probably
- using gcc (or using an old binary compiled with gcc):
-/usr/bin/perl: can't resolve symbol '__moddi3'
-/usr/bin/perl: can't resolve symbol '__divdi3'
-
- Add -L/usr/lib/gcc-lib/... -lgcc to the link command when the
- mysql.so library gets built (check the output from make for
- mysql.so when you compile the Perl client). The -L option should
- specify the path name of the directory where libgcc.a is located
- on your system.
-
- Another cause of this problem may be that Perl and MySQL are not
- both compiled with gcc. In this case, you can solve the mismatch
- by compiling both with gcc.
-
- You may see the following error from DBD::mysql when you run the
- tests:
-t/00base............install_driver(mysql) failed:
-Can't load '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mys
-ql:
-../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol:
-uncompress at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 16
-9.
-
- This means that you need to include the -lz compression library on
- the link line. That can be done by changing the following line in
- the file lib/DBD/mysql/Install.pm:
-$sysliblist .= " -lm";
-
- Change that line to:
-$sysliblist .= " -lm -lz";
-
- After this, you must run make realclean and then proceed with the
- installation from the beginning.
-
- If you want to install DBI on SCO, you have to edit the Makefile
- in DBI-xxx and each subdirectory. Note that the following assumes
- gcc 2.95.2 or newer:
-OLD: NEW:
-CC = cc CC = gcc
-CCCDLFLAGS = -KPIC -W1,-Bexport CCCDLFLAGS = -fpic
-CCDLFLAGS = -wl,-Bexport CCDLFLAGS =
-
-LD = ld LD = gcc -G -fpic
-LDDLFLAGS = -G -L/usr/local/lib LDDLFLAGS = -L/usr/local/lib
-LDFLAGS = -belf -L/usr/local/lib LDFLAGS = -L/usr/local/lib
-
-LD = ld LD = gcc -G -fpic
-OPTIMISE = -Od OPTIMISE = -O1
-
-OLD:
-CCCFLAGS = -belf -dy -w0 -U M_XENIX -DPERL_SCO5 -I/usr/local/include
-
-NEW:
-CCFLAGS = -U M_XENIX -DPERL_SCO5 -I/usr/local/include
-
- These changes are necessary because the Perl dynaloader does not
- load the DBI modules if they were compiled with icc or cc.
-
- If you want to use the Perl module on a system that does not
- support dynamic linking (such as SCO), you can generate a static
- version of Perl that includes DBI and DBD::mysql. The way this
- works is that you generate a version of Perl with the DBI code
- linked in and install it on top of your current Perl. Then you use
- that to build a version of Perl that additionally has the DBD code
- linked in, and install that.
-
- On SCO, you must have the following environment variables set:
-LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/progressive/lib
-
- Or:
-LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
- /usr/progressive/lib:/usr/skunk/lib
-LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:\
- /usr/progressive/lib:/usr/skunk/lib
-MANPATH=scohelp:/usr/man:/usr/local1/man:/usr/local/man:\
- /usr/skunk/man:
-
- First, create a Perl that includes a statically linked DBI module
- by running these commands in the directory where your DBI
- distribution is located:
-shell> perl Makefile.PL -static -config
-shell> make
-shell> make install
-shell> make perl
-
- Then you must install the new Perl. The output of make perl
- indicates the exact make command you need to execute to perform
- the installation. On SCO, this is make -f Makefile.aperl inst_perl
- MAP_TARGET=perl.
-
- Next, use the just-created Perl to create another Perl that also
- includes a statically linked DBD::mysql by running these commands
- in the directory where your DBD::mysql distribution is located:
-shell> perl Makefile.PL -static -config
-shell> make
-shell> make install
-shell> make perl
-
- Finally, you should install this new Perl. Again, the output of
- make perl indicates the command to use.
diff --git a/client/mysql.cc b/client/mysql.cc
index 331302757a6..39fe52f4a1b 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2312,17 +2312,19 @@ static bool add_line(String &buffer,char *line,char *in_string,
{
uint length=(uint) (out-line);
- if (!truncated &&
- (length < 9 ||
- my_strnncoll (charset_info,
- (uchar *)line, 9, (const uchar *) "delimiter", 9)))
+ if (!truncated && (length < 9 ||
+ my_strnncoll (charset_info, (uchar *)line, 9,
+ (const uchar *) "delimiter", 9) ||
+ (*in_string || *ml_comment)))
{
/*
Don't add a new line in case there's a DELIMITER command to be
added to the glob buffer (e.g. on processing a line like
"<command>;DELIMITER <non-eof>") : similar to how a new line is
not added in the case when the DELIMITER is the first command
- entered with an empty glob buffer.
+ entered with an empty glob buffer. However, if the delimiter is
+ part of a string or a comment, the new line should be added. (e.g.
+ SELECT '\ndelimiter\n';\n)
*/
*out++='\n';
length++;
@@ -4727,7 +4729,13 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
if (info_type == INFO_ERROR)
{
if (!opt_nobeep)
+ {
+#ifdef _WIN32
+ MessageBeep(MB_ICONWARNING);
+#else
putchar('\a'); /* This should make a bell */
+#endif
+ }
vidattr(A_STANDOUT);
if (error)
{
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 87198347b10..c099459f61e 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -818,6 +818,88 @@ write_event_header_and_base64(Log_event *ev, FILE *result_file,
}
+static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
+{
+ /*
+ These events must be printed in base64 format, if printed.
+ base64 format requires a FD event to be safe, so if no FD
+ event has been printed, we give an error. Except if user
+ passed --short-form, because --short-form disables printing
+ row events.
+ */
+ if (!print_event_info->printed_fd_event && !short_form &&
+ opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
+ {
+ const char* type_str= ev->get_type_str();
+ if (opt_base64_output_mode == BASE64_OUTPUT_NEVER)
+ error("--base64-output=never specified, but binlog contains a "
+ "%s event which must be printed in base64.",
+ type_str);
+ else
+ error("malformed binlog: it does not contain any "
+ "Format_description_log_event. I now found a %s event, which "
+ "is not safe to process without a "
+ "Format_description_log_event.",
+ type_str);
+ return 1;
+ }
+ ev->print(result_file, print_event_info);
+ return print_event_info->head_cache.error == -1;
+}
+
+
+static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
+ ulong table_id, bool is_stmt_end)
+{
+ Table_map_log_event *ignored_map=
+ print_event_info->m_table_map_ignored.get_table(table_id);
+ bool skip_event= (ignored_map != NULL);
+
+ /*
+ end of statement check:
+ i) destroy/free ignored maps
+ ii) if skip event, flush cache now
+ */
+ if (is_stmt_end)
+ {
+ /*
+ Now is safe to clear ignored map (clear_tables will also
+ delete original table map events stored in the map).
+ */
+ if (print_event_info->m_table_map_ignored.count() > 0)
+ print_event_info->m_table_map_ignored.clear_tables();
+
+ /*
+ If there is a kept Annotate event and all corresponding
+ rbr-events were filtered away, the Annotate event was not
+ freed and it is just the time to do it.
+ */
+ free_annotate_event();
+
+ /*
+ One needs to take into account an event that gets
+ filtered but was last event in the statement. If this is
+ the case, previous rows events that were written into
+ IO_CACHEs still need to be copied from cache to
+ result_file (as it would happen in ev->print(...) if
+ event was not skipped).
+ */
+ if (skip_event)
+ {
+ if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
+ copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
+ return 1;
+ }
+ }
+
+ /* skip the event check */
+ if (skip_event)
+ return 0;
+
+ return print_base64(print_event_info, ev);
+}
+
+
/**
Print the given event, and either delete it or delegate the deletion
to someone else.
@@ -1130,86 +1212,29 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
error("Could not rewrite database name");
goto err;
}
+ if (print_base64(print_event_info, ev))
+ goto err;
+ break;
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
+ {
+ Rows_log_event *e= (Rows_log_event*) ev;
+ if (print_row_event(print_event_info, ev, e->get_table_id(),
+ e->get_flags(Rows_log_event::STMT_END_F)))
+ goto err;
+ break;
+ }
case PRE_GA_WRITE_ROWS_EVENT:
case PRE_GA_DELETE_ROWS_EVENT:
case PRE_GA_UPDATE_ROWS_EVENT:
{
- if (ev_type != TABLE_MAP_EVENT)
- {
- Rows_log_event *e= (Rows_log_event*) ev;
- Table_map_log_event *ignored_map=
- print_event_info->m_table_map_ignored.get_table(e->get_table_id());
- bool skip_event= (ignored_map != NULL);
-
- /*
- end of statement check:
- i) destroy/free ignored maps
- ii) if skip event, flush cache now
- */
- if (e->get_flags(Rows_log_event::STMT_END_F))
- {
- /*
- Now is safe to clear ignored map (clear_tables will also
- delete original table map events stored in the map).
- */
- if (print_event_info->m_table_map_ignored.count() > 0)
- print_event_info->m_table_map_ignored.clear_tables();
-
- /*
- If there is a kept Annotate event and all corresponding
- rbr-events were filtered away, the Annotate event was not
- freed and it is just the time to do it.
- */
- free_annotate_event();
-
- /*
- One needs to take into account an event that gets
- filtered but was last event in the statement. If this is
- the case, previous rows events that were written into
- IO_CACHEs still need to be copied from cache to
- result_file (as it would happen in ev->print(...) if
- event was not skipped).
- */
- if (skip_event)
- {
- if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
- copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
- goto err;
- }
- }
-
- /* skip the event check */
- if (skip_event)
- goto end;
- }
- /*
- These events must be printed in base64 format, if printed.
- base64 format requires a FD event to be safe, so if no FD
- event has been printed, we give an error. Except if user
- passed --short-form, because --short-form disables printing
- row events.
- */
- if (!print_event_info->printed_fd_event && !short_form &&
- opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
- {
- const char* type_str= ev->get_type_str();
- if (opt_base64_output_mode == BASE64_OUTPUT_NEVER)
- error("--base64-output=never specified, but binlog contains a "
- "%s event which must be printed in base64.",
- type_str);
- else
- error("malformed binlog: it does not contain any "
- "Format_description_log_event. I now found a %s event, which "
- "is not safe to process without a "
- "Format_description_log_event.",
- type_str);
+ Old_rows_log_event *e= (Old_rows_log_event*) ev;
+ if (print_row_event(print_event_info, ev, e->get_table_id(),
+ e->get_flags(Old_rows_log_event::STMT_END_F)))
goto err;
- }
- /* FALL THROUGH */
+ break;
}
default:
print_skip_replication_statement(print_event_info, ev);
@@ -2444,6 +2469,8 @@ int main(int argc, char** argv)
else
load_processor.init_by_cur_dir();
+ fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;\n");
+
fprintf(result_file,
"/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
@@ -2494,6 +2521,8 @@ int main(int argc, char** argv)
"/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n"
"/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n");
+ fprintf(result_file, "/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;\n");
+
if (tmpdir.list)
free_tmpdir(&tmpdir);
if (result_file != stdout)
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 1cf66fe3dd1..c1e848b1752 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2300,7 +2300,6 @@ static uint dump_routines_for_db(char *db)
const char *routine_type[]= {"FUNCTION", "PROCEDURE"};
char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3];
char *routine_name;
- char *query_str;
int i;
FILE *sql_file= md_result_file;
MYSQL_RES *routine_res, *routine_list_res;
@@ -2394,17 +2393,6 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n",
routine_type[i], routine_name);
- query_str= cover_definer_clause(row[2], strlen(row[2]),
- C_STRING_WITH_LEN("50020"),
- C_STRING_WITH_LEN("50003"),
- C_STRING_WITH_LEN(" FUNCTION"));
-
- if (!query_str)
- query_str= cover_definer_clause(row[2], strlen(row[2]),
- C_STRING_WITH_LEN("50020"),
- C_STRING_WITH_LEN("50003"),
- C_STRING_WITH_LEN(" PROCEDURE"));
-
if (mysql_num_fields(routine_res) >= 6)
{
if (switch_db_collation(sql_file, db_name_buff, ";",
@@ -2442,9 +2430,9 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file,
"DELIMITER ;;\n"
- "/*!50003 %s */;;\n"
+ "%s ;;\n"
"DELIMITER ;\n",
- (const char *) (query_str != NULL ? query_str : row[2]));
+ (const char *) row[2]);
restore_sql_mode(sql_file, ";");
@@ -2459,7 +2447,6 @@ static uint dump_routines_for_db(char *db)
}
}
- my_free(query_str);
}
} /* end of routine printing */
mysql_free_result(routine_res);
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index e2a939dbd73..708f9077cb2 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -3633,7 +3633,6 @@ void do_remove_files_wildcard(struct st_command *command)
fn_format(dirname, ds_directory.str, "", "", MY_UNPACK_FILENAME);
DBUG_PRINT("info", ("listing directory: %s", dirname));
- /* Note that my_dir sorts the list if not given any flags */
if (!(dir_info= my_dir(dirname, MYF(MY_DONT_SORT | MY_WANT_STAT | MY_WME))))
{
error= 1;
@@ -3648,7 +3647,7 @@ void do_remove_files_wildcard(struct st_command *command)
/* Set default wild chars for wild_compare, is changed in embedded mode */
set_wild_chars(1);
- for (i= 0; i < (uint) dir_info->number_off_files; i++)
+ for (i= 0; i < (uint) dir_info->number_of_files; i++)
{
file= dir_info->dir_entry + i;
/* Remove only regular files, i.e. no directories etc. */
@@ -3911,17 +3910,12 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
DBUG_ENTER("get_list_files");
DBUG_PRINT("info", ("listing directory: %s", ds_dirname->str));
- /* Note that my_dir sorts the list if not given any flags */
- if (!(dir_info= my_dir(ds_dirname->str, MYF(0))))
+ if (!(dir_info= my_dir(ds_dirname->str, MYF(MY_WANT_SORT))))
DBUG_RETURN(1);
set_wild_chars(1);
- for (i= 0; i < (uint) dir_info->number_off_files; i++)
+ for (i= 0; i < (uint) dir_info->number_of_files; i++)
{
file= dir_info->dir_entry + i;
- if (file->name[0] == '.' &&
- (file->name[1] == '\0' ||
- (file->name[1] == '.' && file->name[2] == '\0')))
- continue; /* . or .. */
if (ds_wild && ds_wild->length &&
wild_compare(file->name, ds_wild->str, 0))
continue;
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 056366e6ee6..ee7c4af7155 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -2,7 +2,7 @@ IF(RPM)
SET(CPACK_GENERATOR "RPM")
SET(CPACK_RPM_PACKAGE_DEBUG 1)
-SET(INSTALL_LAYOUT "RPM")
+SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
SET(CPACK_RPM_COMPONENT_INSTALL ON)
@@ -49,9 +49,13 @@ MariaDB bug reports should be submitted through https://mariadb.atlassian.net/
SET(CPACK_RPM_SPEC_MORE_DEFINE "
%define mysql_vendor ${CPACK_PACKAGE_VENDOR}
%define mysqlversion ${MYSQL_NO_DASH_VERSION}
-%define mysqldatadir /var/lib/mysql
+%define mysqlbasedir ${CMAKE_INSTALL_PREFIX}
+%define mysqldatadir ${INSTALL_MYSQLDATADIR}
%define mysqld_user mysql
%define mysqld_group mysql
+%define _bindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}
+%define _sbindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR}
+%define _sysconfdir ${INSTALL_SYSCONFDIR}
")
# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html
@@ -68,18 +72,18 @@ SET(ignored
"%ignore /etc"
"%ignore /etc/init.d"
"%ignore /etc/logrotate.d"
- "%ignore /usr"
- "%ignore /usr/bin"
- "%ignore /usr/include"
- "%ignore /usr/lib"
- "%ignore /usr/lib64"
- "%ignore /usr/sbin"
- "%ignore /usr/share"
- "%ignore /usr/share/aclocal"
- "%ignore /usr/share/doc"
- "%ignore /usr/share/man"
- "%ignore /usr/share/man/man1*"
- "%ignore /usr/share/man/man8*"
+ "%ignore ${CMAKE_INSTALL_PREFIX}"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/bin"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/include"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/lib"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/lib64"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/sbin"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/share"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/share/aclocal"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/share/doc"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/share/man"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*"
+ "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*"
)
SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
@@ -103,7 +107,7 @@ SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-de
SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel")
SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MySQL-server MySQL-OurDelta-server")
-SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql-server")
+SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql(x86-32) mysql(x86-64) mysql-server")
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 0542b8d2e21..22b0255a22a 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -67,7 +67,13 @@
# http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths
IF(NOT INSTALL_LAYOUT)
- SET(INSTALL_LAYOUT "STANDALONE")
+ IF(DEB)
+ SET(INSTALL_LAYOUT "DEB")
+ ELSEIF(RPM)
+ SET(INSTALL_LAYOUT "RPM")
+ ELSE()
+ SET(INSTALL_LAYOUT "STANDALONE")
+ ENDIF()
ENDIF()
SET(INSTALL_LAYOUT "${INSTALL_LAYOUT}"
@@ -187,7 +193,7 @@ SET(INSTALL_SHAREDIR_DEB "share")
SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql")
SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test")
SET(INSTALL_SQLBENCHDIR_DEB ".")
-SET(INSTALL_SUPPORTFILESDIR_DEB "support-files")
+SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql")
#
SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests})
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index d52405e8bcc..874e05b8a43 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -18,7 +18,7 @@ INCLUDE(CheckCCompilerFlag)
# Setup GCC (GNU C compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS)
SET(MY_MAINTAINER_WARNINGS
- "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wno-invalid-offsetof -DFORCE_INIT_OF_VARS")
+ "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -DFORCE_INIT_OF_VARS")
CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers"
HAVE_NO_MISSING_FIELD_INITIALIZERS)
@@ -44,7 +44,7 @@ ENDMACRO()
# Setup G++ (GNU C++ compiler) warning options.
MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS)
SET(MY_MAINTAINER_CXX_WARNINGS
- "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter -Woverloaded-virtual"
+ "${MY_MAINTAINER_WARNINGS} -Wno-invalid-offsetof -Wno-unused-parameter -Woverloaded-virtual"
CACHE INTERNAL "C++ warning options used in maintainer builds.")
ENDMACRO()
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index b93a1c12a2e..83ea3b0f3b3 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -267,6 +267,7 @@ SET(HAVE_SYNCH_H CACHE INTERNAL "")
SET(HAVE_SYSENT_H CACHE INTERNAL "")
SET(HAVE_SYS_CDEFS_H CACHE INTERNAL "")
SET(HAVE_SYS_DIR_H CACHE INTERNAL "")
+SET(HAVE_SYS_EVENT_H CACHE INTERNAL "")
SET(HAVE_SYS_ERRLIST CACHE INTERNAL "")
SET(HAVE_SYS_FILE_H CACHE INTERNAL "")
SET(HAVE_SYS_FPU_H CACHE INTERNAL "")
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 2978fb1a13c..f016d8eab4f 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -171,12 +171,12 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(ARG_MANDATORY)
SET (mysql_mandatory_plugins
- "${mysql_mandatory_plugins} builtin_maria_${target}_plugin,"
- PARENT_SCOPE)
+ "${mysql_mandatory_plugins} builtin_maria_${target}_plugin,")
+ SET (mysql_mandatory_plugins ${mysql_mandatory_plugins} PARENT_SCOPE)
ELSE()
SET (mysql_optional_plugins
- "${mysql_optional_plugins} builtin_maria_${target}_plugin,"
- PARENT_SCOPE)
+ "${mysql_optional_plugins} builtin_maria_${target}_plugin,")
+ SET (mysql_optional_plugins ${mysql_optional_plugins} PARENT_SCOPE)
ENDIF()
ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS)
diff --git a/config.h.cmake b/config.h.cmake
index 31475fa43ad..60c9d9d5242 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -44,6 +44,7 @@
#cmakedefine HAVE_IA64INTRIN_H 1
#cmakedefine HAVE_IEEEFP_H 1
#cmakedefine HAVE_INTTYPES_H 1
+#cmakedefine HAVE_KQUEUE 1
#cmakedefine HAVE_LIMITS_H 1
#cmakedefine HAVE_LINUX_UNISTD_H 1
#cmakedefine HAVE_LOCALE_H 1
diff --git a/configure.cmake b/configure.cmake
index ad8c814a387..66a7e78f3ff 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -153,6 +153,7 @@ IF(UNIX)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} wrap)
CHECK_C_SOURCE_COMPILES(
"
+ #include <sys/types.h>
#include <tcpd.h>
int allow_severity = 0;
int deny_severity = 0;
@@ -210,6 +211,7 @@ CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
CHECK_INCLUDE_FILES (semaphore.h HAVE_SEMAPHORE_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H)
+CHECK_INCLUDE_FILES ("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
CHECK_INCLUDE_FILES (sys/ndir.h HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILES (sys/pte.h HAVE_SYS_PTE_H)
CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H)
@@ -223,13 +225,13 @@ CHECK_INCLUDE_FILES (sys/cdefs.h HAVE_SYS_CDEFS_H)
CHECK_INCLUDE_FILES (sys/file.h HAVE_SYS_FILE_H)
CHECK_INCLUDE_FILES (sys/fpu.h HAVE_SYS_FPU_H)
CHECK_INCLUDE_FILES (sys/ioctl.h HAVE_SYS_IOCTL_H)
-CHECK_INCLUDE_FILES (sys/ipc.h HAVE_SYS_IPC_H)
-CHECK_INCLUDE_FILES (sys/malloc.h HAVE_SYS_MALLOC_H)
+CHECK_INCLUDE_FILES ("sys/types.h;sys/ipc.h" HAVE_SYS_IPC_H)
+CHECK_INCLUDE_FILES ("sys/types.h;sys/malloc.h" HAVE_SYS_MALLOC_H)
CHECK_INCLUDE_FILES (sys/mman.h HAVE_SYS_MMAN_H)
CHECK_INCLUDE_FILES (sys/prctl.h HAVE_SYS_PRCTL_H)
CHECK_INCLUDE_FILES (sys/resource.h HAVE_SYS_RESOURCE_H)
CHECK_INCLUDE_FILES (sys/select.h HAVE_SYS_SELECT_H)
-CHECK_INCLUDE_FILES (sys/shm.h HAVE_SYS_SHM_H)
+CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H)
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
@@ -459,6 +461,10 @@ CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN)
CHECK_FUNCTION_EXISTS (chown HAVE_CHOWN)
CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO)
+IF(HAVE_SYS_EVENT_H)
+CHECK_FUNCTION_EXISTS (kqueue HAVE_KQUEUE)
+ENDIF()
+
#--------------------------------------------------------------------
# Support for WL#2373 (Use cycle counter for timing)
#--------------------------------------------------------------------
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 8a16e677cb9..7558d6d00ae 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -26,8 +26,13 @@
#include <my_sys.h>
#include <m_string.h>
#include <my_getopt.h>
+#include <mysql_version.h>
+#define load_default_groups mysqld_groups
+#include <mysqld_default_groups.h>
+#undef load_default_groups
+my_bool opt_mysqld;
const char *config_file="my"; /* Default config file */
uint verbose= 0, opt_defaults_file_used= 0;
const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace";
@@ -78,6 +83,8 @@ static struct my_option my_long_options[] =
(void *)&my_defaults_extra_file,
(void *)&my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"mysqld", 0, "Read the same set of groups that the mysqld binary does.",
+ &opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.",
@@ -98,11 +105,12 @@ static void usage(my_bool version)
return;
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
puts("Prints all arguments that is give to some program using the default files");
- printf("Usage: %s [OPTIONS] groups\n", my_progname);
+ printf("Usage: %s [OPTIONS] [groups]\n", my_progname);
my_print_help(my_long_options);
my_print_default_files(config_file);
my_print_variables(my_long_options);
printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname);
+ exit(0);
}
@@ -115,17 +123,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_defaults_file_used= 1;
break;
case 'n':
- exit(0);
+ exit(0);
case 'I':
case '?':
- usage(0);
- exit(0);
+ usage(0);
case 'v':
verbose++;
break;
case 'V':
- usage(1);
- exit(0);
+ usage(1);
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);
break;
@@ -141,11 +147,6 @@ static int get_options(int *argc,char ***argv)
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
- if (*argc < 1)
- {
- usage(0);
- return 1;
- }
return 0;
}
@@ -153,9 +154,10 @@ static int get_options(int *argc,char ***argv)
int main(int argc, char **argv)
{
int count, error, args_used;
- char **load_default_groups, *tmp_arguments[6];
+ char **load_default_groups= 0, *tmp_arguments[6];
char **argument, **arguments, **org_argv;
char *defaults, *extra_defaults, *group_suffix;
+ int nargs, i= 0;
MY_INIT(argv[0]);
org_argv= argv;
@@ -169,13 +171,25 @@ int main(int argc, char **argv)
arguments[count]= 0;
/* Check out the args */
- if (!(load_default_groups=(char**) my_malloc((argc+1)*sizeof(char*),
- MYF(MY_WME))))
- exit(1);
if (get_options(&argc,&argv))
exit(1);
- memcpy((char*) load_default_groups, (char*) argv, (argc + 1) * sizeof(*argv));
+ nargs= argc + 1;
+ if (opt_mysqld)
+ nargs+= array_elements(mysqld_groups);
+
+ if (nargs < 2)
+ usage(0);
+
+ load_default_groups=(char**) my_malloc(nargs*sizeof(char*), MYF(MY_WME));
+ if (!load_default_groups)
+ exit(1);
+ if (opt_mysqld)
+ {
+ for (; mysqld_groups[i]; i++)
+ load_default_groups[i]= (char*) mysqld_groups[i];
+ }
+ memcpy(load_default_groups + i, argv, (argc + 1) * sizeof(*argv));
if ((error= load_defaults(config_file, (const char **) load_default_groups,
&count, &arguments)))
{
@@ -198,6 +212,6 @@ int main(int argc, char **argv)
puts(*argument);
my_free(load_default_groups);
free_defaults(arguments);
-
+ my_end(0);
exit(0);
}
diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp
index 3a1ade9816c..97db6264dbb 100644
--- a/extra/yassl/src/handshake.cpp
+++ b/extra/yassl/src/handshake.cpp
@@ -767,8 +767,14 @@ int DoProcessReply(SSL& ssl)
while (buffer.get_current() < hdr.length_ + RECORD_HEADER + offset) {
// each message in record, can be more than 1 if not encrypted
- if (ssl.getSecurity().get_parms().pending_ == false) // cipher on
+ if (ssl.getSecurity().get_parms().pending_ == false) { // cipher on
+ // sanity check for malicious/corrupted/illegal input
+ if (buffer.get_remaining() < hdr.length_) {
+ ssl.SetError(bad_input);
+ return 0;
+ }
decrypt_message(ssl, buffer, hdr.length_);
+ }
mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_));
if (!msg.get()) {
diff --git a/include/hash.h b/include/hash.h
index 2ecfe0891d7..f014c44c7ec 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2013, Monty Program Ab.
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
@@ -60,11 +61,8 @@ typedef struct st_hash {
/* A search iterator state */
typedef uint HASH_SEARCH_STATE;
-#define my_hash_init(A,B,C,D,E,F,G,H) \
- _my_hash_init(A,0,B,C,D,E,F,G,H)
-#define my_hash_init2(A,B,C,D,E,F,G,H,I) \
- _my_hash_init(A,B,C,D,E,F,G,H,I)
-my_bool _my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
+#define my_hash_init(A,B,C,D,E,F,G,H) my_hash_init2(A,0,B,C,D,E,F,G,H)
+my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
ulong default_array_elements, size_t key_offset,
size_t key_length, my_hash_get_key get_key,
void (*free_element)(void*),
@@ -98,7 +96,7 @@ my_bool my_hash_iterate(HASH *hash, my_hash_walk_action action, void *argument);
#define my_hash_clear(H) bzero((char*) (H), sizeof(*(H)))
#define my_hash_inited(H) ((H)->blength != 0)
#define my_hash_init_opt(A,B,C,D,E,F,G,H) \
- (!my_hash_inited(A) && _my_hash_init(A,0,B,C,D,E,F,G,H))
+ (!my_hash_inited(A) && my_hash_init(A,B,C,D,E,F,G,H))
#ifdef __cplusplus
}
diff --git a/include/maria.h b/include/maria.h
index cab296246b6..4dd007df74e 100644
--- a/include/maria.h
+++ b/include/maria.h
@@ -1,4 +1,5 @@
/* Copyright (C) 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -60,31 +61,31 @@ extern "C" {
sets all high keys.
*/
#define MARIA_KEYMAP_BITS (8 * SIZEOF_LONG_LONG)
-#define MARIA_KEYMAP_HIGH_MASK (ULL(1) << (MARIA_KEYMAP_BITS - 1))
+#define MARIA_KEYMAP_HIGH_MASK (1ULL << (MARIA_KEYMAP_BITS - 1))
#define maria_get_mask_all_keys_active(_keys_) \
(((_keys_) < MARIA_KEYMAP_BITS) ? \
- ((ULL(1) << (_keys_)) - ULL(1)) : \
- (~ ULL(0)))
+ ((1ULL << (_keys_)) - 1ULL) : \
+ (~ 0ULL))
#if MARIA_MAX_KEY > MARIA_KEYMAP_BITS
#define maria_is_key_active(_keymap_,_keyno_) \
(((_keyno_) < MARIA_KEYMAP_BITS) ? \
- test((_keymap_) & (ULL(1) << (_keyno_))) : \
+ test((_keymap_) & (1ULL << (_keyno_))) : \
test((_keymap_) & MARIA_KEYMAP_HIGH_MASK))
#define maria_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
- (ULL(1) << (_keyno_)) : \
+ (1ULL << (_keyno_)) : \
MARIA_KEYMAP_HIGH_MASK)
#define maria_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (((_keyno_) < MARIA_KEYMAP_BITS) ? \
- (~ (ULL(1) << (_keyno_))) : \
- (~ (ULL(0))) /*ignore*/ )
+ (~ (1ULL << (_keyno_))) : \
+ (~ (0ULL)) /*ignore*/ )
#else
#define maria_is_key_active(_keymap_,_keyno_) \
- test((_keymap_) & (ULL(1) << (_keyno_)))
+ test((_keymap_) & (1ULL << (_keyno_)))
#define maria_set_key_active(_keymap_,_keyno_) \
- (_keymap_)|= (ULL(1) << (_keyno_))
+ (_keymap_)|= (1ULL << (_keyno_))
#define maria_clear_key_active(_keymap_,_keyno_) \
- (_keymap_)&= (~ (ULL(1) << (_keyno_)))
+ (_keymap_)&= (~ (1ULL << (_keyno_)))
#endif
#define maria_is_any_key_active(_keymap_) \
test((_keymap_))
diff --git a/include/my_base.h b/include/my_base.h
index 4cbcb00425b..0984ff8dfa9 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -313,12 +313,12 @@ enum ha_base_keytype {
#define HA_OPTION_CHECKSUM 32
#define HA_OPTION_DELAY_KEY_WRITE 64
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
-#define HA_OPTION_CREATE_FROM_ENGINE 256
+/* unused 256 */
#define HA_OPTION_RELIES_ON_SQL_LAYER 512
#define HA_OPTION_NULL_FIELDS 1024
#define HA_OPTION_PAGE_CHECKSUM 2048
/* .frm has extra create options in linked-list format */
-#define HA_OPTION_TEXT_CREATE_OPTIONS (1L << 14)
+#define HA_OPTION_TEXT_CREATE_OPTIONS_legacy (1L << 14) /* 5.2 to 5.5, unused since 10.0 */
#define HA_OPTION_TEMP_COMPRESS_RECORD (1L << 15) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA (1L << 16) /* Set by isamchk */
#define HA_OPTION_NO_CHECKSUM (1L << 17)
@@ -405,7 +405,7 @@ enum ha_base_keytype {
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
-#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */
+#define HA_ERR_OUT_OF_MEM 128 /* Out of memory */
#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
#define HA_ERR_OLD_FILE 132 /* old databasfile */
diff --git a/include/my_dir.h b/include/my_dir.h
index 6a941b37d79..be988ae790c 100644
--- a/include/my_dir.h
+++ b/include/my_dir.h
@@ -46,8 +46,9 @@ extern "C" {
#define MY_S_ISFIFO(m) (((m) & MY_S_IFMT) == MY_S_IFIFO)
/* Ensure these dosn't clash with anything in my_sys.h */
-#define MY_DONT_SORT 8192 /* my_lib; Don't sort files */
+#define MY_WANT_SORT 8192 /* my_lib; sort files */
#define MY_WANT_STAT 16384 /* my_lib; stat files */
+#define MY_DONT_SORT 0
/* typedefs for my_dir & my_stat */
@@ -94,7 +95,7 @@ typedef struct st_my_dir /* Struct returned from my_dir */
we don't want to change code that uses my_dir.
*/
struct fileinfo *dir_entry;
- uint number_off_files;
+ uint number_of_files;
} MY_DIR;
extern MY_DIR *my_dir(const char *path,myf MyFlags);
diff --git a/include/my_global.h b/include/my_global.h
index 7c133268f59..b3c7819c9a5 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,5 +1,6 @@
/*
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2013, Monty Program Ab.
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
@@ -89,6 +90,12 @@
#define IF_WIN(A,B) B
#endif
+#ifdef EMBEDDED_LIBRARY
+#define IF_EMBEDDED(A,B) A
+#else
+#define IF_EMBEDDED(A,B) B
+#endif
+
#if defined (_WIN32)
/*
off_t is 32 bit long. We do not use C runtime functions
@@ -379,7 +386,8 @@ C_MODE_END
#define compile_time_assert(X) \
do \
{ \
- typedef char compile_time_assert[(X) ? 1 : -1]; \
+ typedef char compile_time_assert[(X) ? 1 : -1] \
+ __attribute__((unused)); \
} while(0)
#endif
@@ -464,7 +472,7 @@ typedef unsigned int uint;
typedef unsigned short ushort;
#endif
-#define swap_variables(t, a, b) { t dummy; dummy= a; a= b; b= dummy; }
+#define swap_variables(t, a, b) do { t dummy; dummy= a; a= b; b= dummy; } while(0)
#define test(a) ((a) ? 1 : 0)
#define set_if_bigger(a,b) do { if ((a) < (b)) (a)=(b); } while(0)
#define set_if_smaller(a,b) do { if ((a) > (b)) (a)=(b); } while(0)
@@ -997,25 +1005,8 @@ typedef struct st_mysql_lex_string LEX_STRING;
typedef ulong myf; /* Type of MyFlags in my_funcs */
typedef char my_bool; /* Small bool */
-/* Macros for converting *constants* to the right type */
#define MYF(v) (myf) (v)
-#ifndef LL
-#ifdef HAVE_LONG_LONG
-#define LL(A) A ## LL
-#else
-#define LL(A) A ## L
-#endif
-#endif
-
-#ifndef ULL
-#ifdef HAVE_LONG_LONG
-#define ULL(A) A ## ULL
-#else
-#define ULL(A) A ## UL
-#endif
-#endif
-
/*
Defines to make it possible to prioritize register assignments. No
longer that important with modern compilers.
diff --git a/include/my_sys.h b/include/my_sys.h
index 42ee9c915da..e2132815cdd 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -713,7 +713,6 @@ extern size_t cleanup_dirname(char * to,const char *from);
extern size_t system_filename(char * to,const char *from);
extern size_t unpack_filename(char * to,const char *from);
extern char * intern_filename(char * to,const char *from);
-extern char * directory_file_name(char * dst, const char *src);
extern int pack_filename(char * to, const char *name, size_t max_length);
extern char * my_path(char * to,const char *progname,
const char *own_pathname_part);
@@ -884,7 +883,7 @@ extern void *my_az_allocator(void *dummy, unsigned int items, unsigned int size)
extern void my_az_free(void *dummy, void *address);
extern int my_compress_buffer(uchar *dest, size_t *destLen,
const uchar *source, size_t sourceLen);
-extern int packfrm(uchar *, size_t, uchar **, size_t *);
+extern int packfrm(const uchar *, size_t, uchar **, size_t *);
extern int unpackfrm(uchar **, size_t *, const uchar *);
extern ha_checksum my_checksum(ha_checksum crc, const uchar *mem,
diff --git a/include/myisam.h b/include/myisam.h
index eaa6b2dbd1f..d5484b1eac6 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -57,35 +58,35 @@ extern "C" {
sets all high keys.
*/
#define MI_KEYMAP_BITS (8 * SIZEOF_LONG_LONG)
-#define MI_KEYMAP_HIGH_MASK (ULL(1) << (MI_KEYMAP_BITS - 1))
+#define MI_KEYMAP_HIGH_MASK (1ULL << (MI_KEYMAP_BITS - 1))
#define mi_get_mask_all_keys_active(_keys_) \
(((_keys_) < MI_KEYMAP_BITS) ? \
- ((ULL(1) << (_keys_)) - ULL(1)) : \
- (~ ULL(0)))
+ ((1ULL << (_keys_)) - 1ULL) : \
+ (~ 0ULL))
#if MI_MAX_KEY > MI_KEYMAP_BITS
#define mi_is_key_active(_keymap_,_keyno_) \
(((_keyno_) < MI_KEYMAP_BITS) ? \
- test((_keymap_) & (ULL(1) << (_keyno_))) : \
+ test((_keymap_) & (1ULL << (_keyno_))) : \
test((_keymap_) & MI_KEYMAP_HIGH_MASK))
#define mi_set_key_active(_keymap_,_keyno_) \
(_keymap_)|= (((_keyno_) < MI_KEYMAP_BITS) ? \
- (ULL(1) << (_keyno_)) : \
+ (1ULL << (_keyno_)) : \
MI_KEYMAP_HIGH_MASK)
#define mi_clear_key_active(_keymap_,_keyno_) \
(_keymap_)&= (((_keyno_) < MI_KEYMAP_BITS) ? \
- (~ (ULL(1) << (_keyno_))) : \
- (~ (ULL(0))) /*ignore*/ )
+ (~ (1ULL << (_keyno_))) : \
+ (~ (0ULL)) /*ignore*/ )
#else
#define mi_is_key_active(_keymap_,_keyno_) \
- test((_keymap_) & (ULL(1) << (_keyno_)))
+ test((_keymap_) & (1ULL << (_keyno_)))
#define mi_set_key_active(_keymap_,_keyno_) \
- (_keymap_)|= (ULL(1) << (_keyno_))
+ (_keymap_)|= (1ULL << (_keyno_))
#define mi_clear_key_active(_keymap_,_keyno_) \
- (_keymap_)&= (~ (ULL(1) << (_keyno_)))
+ (_keymap_)&= (~ (1ULL << (_keyno_)))
#endif
diff --git a/include/myisamchk.h b/include/myisamchk.h
index 7e7b685a88a..c079b7d290b 100644
--- a/include/myisamchk.h
+++ b/include/myisamchk.h
@@ -140,9 +140,9 @@ typedef struct st_handler_check_param
/* Following is used to check if rows are visible */
ulonglong max_trid, max_found_trid;
ulonglong not_visible_rows_found;
+ ulonglong sort_buffer_length;
ulonglong use_buffers; /* Used as param to getopt() */
- size_t read_buffer_length, write_buffer_length;
- size_t sort_buffer_length, sort_key_blocks;
+ size_t read_buffer_length, write_buffer_length, sort_key_blocks;
time_t backup_time; /* To sign backup files */
ulong rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];
double new_rec_per_key_part[HA_MAX_KEY_SEG * HA_MAX_POSSIBLE_KEY];
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 987ed3d578f..1c4b46c2a01 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -52,14 +52,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_thread_scheduler.h>
-struct scheduler_functions;
-extern struct my_thread_scheduler_service {
- int (*set)(struct scheduler_functions *scheduler);
- int (*reset)();
-} *my_thread_scheduler_service;
-int my_thread_scheduler_set(struct scheduler_functions *scheduler);
-int my_thread_scheduler_reset();
#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h
index 75e7fba5266..156fb386aae 100644
--- a/include/mysql/plugin_auth.h
+++ b/include/mysql/plugin_auth.h
@@ -27,7 +27,7 @@
#include <mysql/plugin.h>
-#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100
+#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0200
#include <mysql/plugin_auth_common.h>
@@ -78,7 +78,7 @@ typedef struct st_mysql_server_auth_info
Not used by the server.
Available through the @@EXTERNAL_USER variable.
*/
- char external_user[512];
+ char external_user[MYSQL_USERNAME_LENGTH+1];
/**
This only affects the "Authentication failed. Password used: %s"
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 9371cb90b95..ac6e5e3b13d 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -52,14 +52,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_thread_scheduler.h>
-struct scheduler_functions;
-extern struct my_thread_scheduler_service {
- int (*set)(struct scheduler_functions *scheduler);
- int (*reset)();
-} *my_thread_scheduler_service;
-int my_thread_scheduler_set(struct scheduler_functions *scheduler);
-int my_thread_scheduler_reset();
#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
@@ -267,8 +259,8 @@ typedef struct st_mysql_server_auth_info
unsigned int user_name_length;
const char *auth_string;
unsigned long auth_string_length;
- char authenticated_as[48 +1];
- char external_user[512];
+ char authenticated_as[512 +1];
+ char external_user[512 +1];
int password_used;
const char *host_or_ip;
unsigned int host_or_ip_length;
diff --git a/include/mysql/plugin_auth_common.h b/include/mysql/plugin_auth_common.h
index 820d299bf88..c0b61730d0d 100644
--- a/include/mysql/plugin_auth_common.h
+++ b/include/mysql/plugin_auth_common.h
@@ -28,7 +28,7 @@
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/** the max allowed length for a user name */
-#define MYSQL_USERNAME_LENGTH 48
+#define MYSQL_USERNAME_LENGTH 512
/**
return values of the plugin authenticate_user() method.
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 16aa496588b..f5d6ac3b849 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -52,14 +52,6 @@ extern struct thd_wait_service_st {
} *thd_wait_service;
void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
-#include <mysql/service_thread_scheduler.h>
-struct scheduler_functions;
-extern struct my_thread_scheduler_service {
- int (*set)(struct scheduler_functions *scheduler);
- int (*reset)();
-} *my_thread_scheduler_service;
-int my_thread_scheduler_set(struct scheduler_functions *scheduler);
-int my_thread_scheduler_reset();
#include <mysql/service_progress_report.h>
extern struct progress_report_service_st {
void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h
index 57b67f1416d..a7fd3e8a2c6 100644
--- a/include/mysql/service_my_snprintf.h
+++ b/include/mysql/service_my_snprintf.h
@@ -49,6 +49,7 @@
string will be quoted according to MySQL identifier quoting rules.
Both <width> and <precision> can be specified as numbers or '*'.
+ If an asterisk is used, an argument of type int is consumed.
<length modifier> can be 'l', 'll', or 'z'.
diff --git a/include/mysql/service_thread_scheduler.h b/include/mysql/service_thread_scheduler.h
deleted file mode 100644
index 5a5e0e2f520..00000000000
--- a/include/mysql/service_thread_scheduler.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef SERVICE_THREAD_SCHEDULER_INCLUDED
-#define SERVICE_THREAD_SCHEDULER_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct scheduler_functions;
-
-extern struct my_thread_scheduler_service {
- int (*set)(struct scheduler_functions *scheduler);
- int (*reset)();
-} *my_thread_scheduler_service;
-
-#ifdef MYSQL_DYNAMIC_PLUGIN
-
-#define my_thread_scheduler_set(F) my_thread_scheduler_service->set((F))
-#define my_thread_scheduler_reset() my_thread_scheduler_service->reset()
-
-#else
-
-/**
- Set the thread scheduler to use for the server.
-
- @param scheduler Pointer to scheduler callbacks to use.
- @retval 0 Scheduler installed correctly.
- @retval 1 Invalid value (NULL) used for scheduler.
-*/
-int my_thread_scheduler_set(struct scheduler_functions *scheduler);
-
-/**
- Restore the previous thread scheduler.
-
- @note If no thread scheduler was installed previously with
- thd_set_thread_scheduler, this function will report an error.
-
- @retval 0 Scheduler installed correctly.
- @retval 1 No scheduler installed.
-*/
-int my_thread_scheduler_reset();
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */
diff --git a/include/mysql/services.h b/include/mysql/services.h
index b5b331d4923..e14523f4fa1 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -1,5 +1,6 @@
#ifndef MYSQL_SERVICES_INCLUDED
-/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2013, Monty Program Ab
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
@@ -21,7 +22,6 @@ extern "C" {
#include <mysql/service_my_snprintf.h>
#include <mysql/service_thd_alloc.h>
#include <mysql/service_thd_wait.h>
-#include <mysql/service_thread_scheduler.h>
#include <mysql/service_progress_report.h>
#include <mysql/service_debug_sync.h>
#include <mysql/service_kill_statement.h>
diff --git a/include/mysql_com.h b/include/mysql_com.h
index 63b95bb5295..229f54f68e1 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -34,6 +34,31 @@
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1)
#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH)
+/*
+ MDEV-4088
+
+ MySQL (and MariaDB 5.x before the fix) was using the first character of the
+ server version string (as sent in the first handshake protocol packet) to
+ decide on the replication event formats. And for 10.x the first character
+ is "1", which the slave thought comes from some ancient 1.x version
+ (ignoring the fact that the first ever MySQL version was 3.x).
+
+ To support replication to these old clients, we fake the version in the
+ first handshake protocol packet to start from "5.5.5-" (for example,
+ it might be "5.5.5-10.0.1-MariaDB-debug-log".
+
+ On the client side we remove this fake version prefix to restore the
+ correct server version. The version "5.5.5" did not support
+ pluggable authentication, so any version starting from "5.5.5-" and
+ claiming to support pluggable auth, must be using this fake prefix.
+*/
+#ifdef EMBEDDED_LIBRARY
+#define RPL_VERSION_HACK ""
+#else
+/* this version must be the one that *does not* support pluggable auth */
+#define RPL_VERSION_HACK "5.5.5-"
+#endif
+
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
#define LIST_PROCESS_HOST_LEN 64
@@ -41,7 +66,7 @@
/*
Maximum length of comments
*/
-#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 6.0: 60 characters */
+#define TABLE_COMMENT_INLINE_MAXLEN 180 /* pre 5.5: 60 characters */
#define TABLE_COMMENT_MAXLEN 2048
#define COLUMN_COMMENT_MAXLEN 1024
#define INDEX_COMMENT_MAXLEN 1024
diff --git a/include/mysqld_default_groups.h b/include/mysqld_default_groups.h
new file mode 100644
index 00000000000..a2e94ddd854
--- /dev/null
+++ b/include/mysqld_default_groups.h
@@ -0,0 +1,8 @@
+const char *load_default_groups[]= {
+#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
+"mysql_cluster",
+#endif
+"mysqld", "server", MYSQL_BASE_VERSION,
+"mariadb", MARIADB_BASE_VERSION,
+"client-server",
+0, 0};
diff --git a/include/probes_mysql_nodtrace.h b/include/probes_mysql_nodtrace.h
index bc3b65a00e5..a84bf7726c3 100644
--- a/include/probes_mysql_nodtrace.h
+++ b/include/probes_mysql_nodtrace.h
@@ -6,121 +6,124 @@
#define _PROBES_MYSQL_D
#ifdef __cplusplus
+#define MYSQL_PROBES_FALSE false
extern "C" {
+#else
+#define MYSQL_PROBES_FALSE 0
#endif
#define MYSQL_CONNECTION_START(arg0, arg1, arg2)
-#define MYSQL_CONNECTION_START_ENABLED() (0)
+#define MYSQL_CONNECTION_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_CONNECTION_DONE(arg0, arg1)
-#define MYSQL_CONNECTION_DONE_ENABLED() (0)
+#define MYSQL_CONNECTION_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3)
-#define MYSQL_COMMAND_START_ENABLED() (0)
+#define MYSQL_COMMAND_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_COMMAND_DONE(arg0)
-#define MYSQL_COMMAND_DONE_ENABLED() (0)
+#define MYSQL_COMMAND_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4)
-#define MYSQL_QUERY_START_ENABLED() (0)
+#define MYSQL_QUERY_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_DONE(arg0)
-#define MYSQL_QUERY_DONE_ENABLED() (0)
+#define MYSQL_QUERY_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_PARSE_START(arg0)
-#define MYSQL_QUERY_PARSE_START_ENABLED() (0)
+#define MYSQL_QUERY_PARSE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_PARSE_DONE(arg0)
-#define MYSQL_QUERY_PARSE_DONE_ENABLED() (0)
+#define MYSQL_QUERY_PARSE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_CACHE_HIT(arg0, arg1)
-#define MYSQL_QUERY_CACHE_HIT_ENABLED() (0)
+#define MYSQL_QUERY_CACHE_HIT_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_CACHE_MISS(arg0)
-#define MYSQL_QUERY_CACHE_MISS_ENABLED() (0)
+#define MYSQL_QUERY_CACHE_MISS_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5)
-#define MYSQL_QUERY_EXEC_START_ENABLED() (0)
+#define MYSQL_QUERY_EXEC_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_EXEC_DONE(arg0)
-#define MYSQL_QUERY_EXEC_DONE_ENABLED() (0)
+#define MYSQL_QUERY_EXEC_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_ROW_START(arg0, arg1)
-#define MYSQL_INSERT_ROW_START_ENABLED() (0)
+#define MYSQL_INSERT_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_ROW_DONE(arg0)
-#define MYSQL_INSERT_ROW_DONE_ENABLED() (0)
+#define MYSQL_INSERT_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_ROW_START(arg0, arg1)
-#define MYSQL_UPDATE_ROW_START_ENABLED() (0)
+#define MYSQL_UPDATE_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_ROW_DONE(arg0)
-#define MYSQL_UPDATE_ROW_DONE_ENABLED() (0)
+#define MYSQL_UPDATE_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_ROW_START(arg0, arg1)
-#define MYSQL_DELETE_ROW_START_ENABLED() (0)
+#define MYSQL_DELETE_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_ROW_DONE(arg0)
-#define MYSQL_DELETE_ROW_DONE_ENABLED() (0)
+#define MYSQL_DELETE_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_READ_ROW_START(arg0, arg1, arg2)
-#define MYSQL_READ_ROW_START_ENABLED() (0)
+#define MYSQL_READ_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_READ_ROW_DONE(arg0)
-#define MYSQL_READ_ROW_DONE_ENABLED() (0)
+#define MYSQL_READ_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INDEX_READ_ROW_START(arg0, arg1)
-#define MYSQL_INDEX_READ_ROW_START_ENABLED() (0)
+#define MYSQL_INDEX_READ_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INDEX_READ_ROW_DONE(arg0)
-#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (0)
+#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1)
-#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (0)
+#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1)
-#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (0)
+#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1)
-#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (0)
+#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_RDLOCK_DONE(arg0)
-#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (0)
+#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_WRLOCK_DONE(arg0)
-#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (0)
+#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_UNLOCK_DONE(arg0)
-#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (0)
+#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_FILESORT_START(arg0, arg1)
-#define MYSQL_FILESORT_START_ENABLED() (0)
+#define MYSQL_FILESORT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_FILESORT_DONE(arg0, arg1)
-#define MYSQL_FILESORT_DONE_ENABLED() (0)
+#define MYSQL_FILESORT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_SELECT_START(arg0)
-#define MYSQL_SELECT_START_ENABLED() (0)
+#define MYSQL_SELECT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_SELECT_DONE(arg0, arg1)
-#define MYSQL_SELECT_DONE_ENABLED() (0)
+#define MYSQL_SELECT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_START(arg0)
-#define MYSQL_INSERT_START_ENABLED() (0)
+#define MYSQL_INSERT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_DONE(arg0, arg1)
-#define MYSQL_INSERT_DONE_ENABLED() (0)
+#define MYSQL_INSERT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_SELECT_START(arg0)
-#define MYSQL_INSERT_SELECT_START_ENABLED() (0)
+#define MYSQL_INSERT_SELECT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_SELECT_DONE(arg0, arg1)
-#define MYSQL_INSERT_SELECT_DONE_ENABLED() (0)
+#define MYSQL_INSERT_SELECT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_START(arg0)
-#define MYSQL_UPDATE_START_ENABLED() (0)
+#define MYSQL_UPDATE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_DONE(arg0, arg1, arg2)
-#define MYSQL_UPDATE_DONE_ENABLED() (0)
+#define MYSQL_UPDATE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_UPDATE_START(arg0)
-#define MYSQL_MULTI_UPDATE_START_ENABLED() (0)
+#define MYSQL_MULTI_UPDATE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2)
-#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (0)
+#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_START(arg0)
-#define MYSQL_DELETE_START_ENABLED() (0)
+#define MYSQL_DELETE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_DONE(arg0, arg1)
-#define MYSQL_DELETE_DONE_ENABLED() (0)
+#define MYSQL_DELETE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_DELETE_START(arg0)
-#define MYSQL_MULTI_DELETE_START_ENABLED() (0)
+#define MYSQL_MULTI_DELETE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_DELETE_DONE(arg0, arg1)
-#define MYSQL_MULTI_DELETE_DONE_ENABLED() (0)
+#define MYSQL_MULTI_DELETE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_READ_START()
-#define MYSQL_NET_READ_START_ENABLED() (0)
+#define MYSQL_NET_READ_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_READ_DONE(arg0, arg1)
-#define MYSQL_NET_READ_DONE_ENABLED() (0)
+#define MYSQL_NET_READ_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_WRITE_START(arg0)
-#define MYSQL_NET_WRITE_START_ENABLED() (0)
+#define MYSQL_NET_WRITE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_WRITE_DONE(arg0)
-#define MYSQL_NET_WRITE_DONE_ENABLED() (0)
+#define MYSQL_NET_WRITE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_START(arg0, arg1, arg2, arg3)
-#define MYSQL_KEYCACHE_READ_START_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_BLOCK(arg0)
-#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_HIT()
-#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_MISS()
-#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_DONE(arg0, arg1)
-#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_START(arg0, arg1, arg2, arg3)
-#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (0)
+#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_BLOCK(arg0)
-#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (0)
+#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_DONE(arg0, arg1)
-#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (0)
+#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#ifdef __cplusplus
}
diff --git a/include/service_versions.h b/include/service_versions.h
index 9b41da7440e..e0a717fea9e 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2013, Monty Program Ab
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
@@ -22,7 +23,6 @@
#define VERSION_my_snprintf 0x0100
#define VERSION_thd_alloc 0x0100
#define VERSION_thd_wait 0x0100
-#define VERSION_my_thread_scheduler 0x0100
#define VERSION_progress_report 0x0100
#define VERSION_debug_sync 0x1000
#define VERSION_kill_statement 0x1000
diff --git a/include/thread_pool_priv.h b/include/thread_pool_priv.h
index 78526894e21..84c7faa2e2b 100644
--- a/include/thread_pool_priv.h
+++ b/include/thread_pool_priv.h
@@ -61,6 +61,7 @@ uint thd_get_net_read_write(THD *thd);
void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
ulong thd_get_net_wait_timeout(THD *thd);
my_socket thd_get_fd(THD *thd);
+int thd_store_globals(THD* thd);
THD *first_global_thread();
THD *next_global_thread(THD *thd);
diff --git a/include/violite.h b/include/violite.h
index eb01f5e446f..68b2b6c5e52 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -239,11 +239,7 @@ struct st_vio
struct sockaddr_storage remote; /* Remote internet address */
int addrLen; /* Length of remote address */
enum enum_vio_type type; /* Type of connection */
- /*
- Description string. This member MUST NOT be used directly, but only
- via function "vio_description"
- */
- char desc[VIO_DESCRIPTION_SIZE];
+ const char *desc; /* String description */
char *read_buffer; /* buffer for vio_read_buff */
char *read_pos; /* start of unfetched data in the
read buffer */
diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h
index 01139677b7d..9878ab1c07d 100644
--- a/include/welcome_copyright_notice.h
+++ b/include/welcome_copyright_notice.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates.
+/* Copyright (c) 2011, 2013, Oracle and/or its affiliates.
Copyright (c) 2011, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_
-#define COPYRIGHT_NOTICE_CURRENT_YEAR "2012"
+#define COPYRIGHT_NOTICE_CURRENT_YEAR "2013"
/*
This define specifies copyright notice which is displayed by every MySQL
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 9996b167323..1ddb0f7db98 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -141,13 +141,14 @@ mysql_load_plugin
mysql_load_plugin_v
mysql_plugin_options
# Async API
+mysql_get_timeout_value
+mysql_get_timeout_value_ms
+mysql_get_socket
mysql_autocommit_cont
mysql_autocommit_start
mysql_change_user_cont
mysql_change_user_start
mysql_close_cont
-mysql_close_slow_part_cont
-mysql_close_slow_part_start
mysql_close_start
mysql_commit_cont
mysql_commit_start
@@ -262,17 +263,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(RPM)
# Fedora & Co declared following functions as part of API
- # These functions are alias of another function (given mysql_ prefix=. The
- # renaming is handled in rpm_support.cc below
SET(CLIENT_API_EXTRA
mysql_default_charset_info
mysql_get_charset
mysql_get_charset_by_csname
mysql_net_realloc
mysql_client_errors
- )
+
+ # Also export the non-renamed variants
+ # (in case someone wants to rebuild mysqli-php or something similar)
+ # See MDEV-4127
+ default_charset_info
+ get_charset
+ get_charset_by_csname
+ net_realloc
+ client_errors
+ THR_KEY_mysys
+ )
+
# Add special script to fix symbols renames by Fedora
- SET(CLIENT_SOURCES_EXTRA ${CLIENT_SOURCES} rpm_support.cc)
+ SET(CLIENT_SOURCES_EXTRA rpm_support.cc)
SET(VERSION_SCRIPT_TEMPLATE
${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in)
ELSEIF(DEB)
@@ -361,7 +371,7 @@ IF(UNIX)
ENDIF()
IF(NOT DISABLE_SHARED)
- MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} COMPONENT SharedLibraries)
+ MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_EXTRA} COMPONENT SharedLibraries)
IF(UNIX)
# libtool compatability
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index 16f6b25822d..e704aec8337 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -62,13 +62,35 @@
/* were just going to fake it here and get input from the keyboard */
void get_tty_password_buff(const char *opt_message, char *to, size_t length)
{
+ HANDLE consoleinput;
+ DWORD oldstate;
char *pos=to,*end=to+length-1;
int i=0;
+
+ consoleinput= CreateFile("CONIN$", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ ,
+ NULL, OPEN_EXISTING, 0, NULL);
+ if (consoleinput == NULL || consoleinput == INVALID_HANDLE_VALUE)
+ {
+ /* This is a GUI application or service without console input, bail out. */
+ *to= 0;
+ return;
+ }
_cputs(opt_message ? opt_message : "Enter password: ");
+
+ /*
+ Switch to raw mode (no line input, no echo input).
+ Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT.
+ */
+ GetConsoleMode(consoleinput, &oldstate);
+ SetConsoleMode(consoleinput, ENABLE_PROCESSED_INPUT);
for (;;)
{
- int tmp;
- tmp=_getch();
+ char tmp;
+ DWORD chars_read;
+ if (!ReadConsole(consoleinput, &tmp, 1, &chars_read, NULL))
+ break;
+ if (chars_read == 0)
+ break;
if (tmp == '\b' || tmp == 127)
{
if (pos != to)
@@ -78,13 +100,16 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length)
continue;
}
}
- if (tmp == -1 || tmp == '\n' || tmp == '\r' || tmp == 3)
+ if (tmp == '\n' || tmp == '\r')
break;
if (iscntrl(tmp) || pos == end)
continue;
_cputs("*");
- *(pos++) = (char)tmp;
+ *(pos++) = tmp;
}
+ /* Reset console mode after password input. */
+ SetConsoleMode(consoleinput, oldstate);
+ CloseHandle(consoleinput);
*pos=0;
_cputs("\n");
}
diff --git a/libmysql/libmysql_rpm_version.in b/libmysql/libmysql_rpm_version.in
index ad15c8aa2c8..ff0707cdb75 100644
--- a/libmysql/libmysql_rpm_version.in
+++ b/libmysql/libmysql_rpm_version.in
@@ -21,6 +21,8 @@ libmysqlclient_16 {
my_print_help;
# pure-ftpd requires this
my_make_scrambled_password;
+# fedora18 export
+ THR_KEY_mysys;
# hydra requires this
scramble;
# DBD::mysql requires this
@@ -34,15 +36,27 @@ libmysqlclient_18 {
@CLIENT_API_5_5_LIST@
#
# Ideally the following symbols wouldn't be exported, but various applications
-# require them. We limit the namespace damage by prefixing mysql_
+# require them. Fedora limits the namespace damage by prefixing mysql_
# (see mysql-dubious-exports.patch), which means the symbols are not present
# in libmysqlclient_16.
#
+# MariaDB does not do the Fedora-style function renaming via #define in headers,
+# however it exports mysql_ prefixed symbols in addition to the "normal" ones.
+#
+# To ensure successful recompilation of affected projects, as well as drop-in replacement
+# for MySQL libraries, provided by distribution, both original symbols and their mysql_
+# prefixed counterparts have to be exported.
+
# mysql-connector-odbc requires these
mysql_default_charset_info;
mysql_get_charset;
mysql_get_charset_by_csname;
mysql_net_realloc;
+ default_charset_info;
+ get_charset;
+ get_charset_by_csname;
+ net_realloc;
# PHP's mysqli.so requires this (via the ER() macro)
mysql_client_errors;
+ client_errors;
};
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 6d718a6baa6..12f93f22d31 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -440,7 +440,7 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql)
int emb_read_change_user_result(MYSQL *mysql)
{
mysql->net.read_pos= (uchar*)""; // fake an OK packet
- return mysql_errno(mysql) ? packet_error : 1 /* length of the OK packet */;
+ return mysql_errno(mysql) ? (int)packet_error : 1 /* length of the OK packet */;
}
MYSQL_METHODS embedded_methods=
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index 1583d1ff792..86ed3493993 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 MySQL AB, 2010 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006 MySQL AB, 2010 Oracle and/or its affiliates.
#
# 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
@@ -19,7 +19,6 @@ SET(MYSQLSERVICES_SOURCES
my_snprintf_service.c
thd_alloc_service.c
thd_wait_service.c
- my_thread_scheduler_service.c
progress_report_service.c
debug_sync_service.c
kill_statement_service.c)
diff --git a/libservices/HOWTO b/libservices/HOWTO
index 7dcfb6d9583..512cdb43c99 100644
--- a/libservices/HOWTO
+++ b/libservices/HOWTO
@@ -76,7 +76,7 @@ it should also declare all the accompanying data structures, as necessary
==================================================================
/* GPL header */
#include <service_versions.h>
- SERVICE_VERSION *foo_service= (void*)VERSION_foo;
+ SERVICE_VERSION foo_service= (void*)VERSION_foo;
==================================================================
7. add the new file to libservices/CMakeLists.txt (MYSQLSERVICES_SOURCES)
diff --git a/libservices/debug_sync_service.c b/libservices/debug_sync_service.c
index 8c7f109e95a..3afa088dee7 100644
--- a/libservices/debug_sync_service.c
+++ b/libservices/debug_sync_service.c
@@ -15,4 +15,4 @@
*/
#include <service_versions.h>
-SERVICE_VERSION *debug_sync_service= (void*)VERSION_debug_sync;
+SERVICE_VERSION debug_sync_service= (void*)VERSION_debug_sync;
diff --git a/libservices/my_thread_scheduler_service.c b/libservices/my_thread_scheduler_service.c
deleted file mode 100644
index 0bbad39dd0a..00000000000
--- a/libservices/my_thread_scheduler_service.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#include <service_versions.h>
-SERVICE_VERSION my_thread_scheduler_service=
- (void*)VERSION_my_thread_scheduler;
diff --git a/libservices/progress_report_service.c b/libservices/progress_report_service.c
index cd8db3eeacb..e55daf31e7d 100644
--- a/libservices/progress_report_service.c
+++ b/libservices/progress_report_service.c
@@ -14,4 +14,4 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <service_versions.h>
-SERVICE_VERSION *progress_report_service= (void*)VERSION_progress_report;
+SERVICE_VERSION progress_report_service= (void*)VERSION_progress_report;
diff --git a/libservices/thd_alloc_service.c b/libservices/thd_alloc_service.c
index 65e3fc490c8..54e498c6cd1 100644
--- a/libservices/thd_alloc_service.c
+++ b/libservices/thd_alloc_service.c
@@ -15,4 +15,4 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <service_versions.h>
-SERVICE_VERSION *thd_alloc_service= (void*)VERSION_thd_alloc;
+SERVICE_VERSION thd_alloc_service= (void*)VERSION_thd_alloc;
diff --git a/libservices/thd_wait_service.c b/libservices/thd_wait_service.c
index 8cec4eecf77..1f8c19ac555 100644
--- a/libservices/thd_wait_service.c
+++ b/libservices/thd_wait_service.c
@@ -16,4 +16,4 @@
*/
#include <service_versions.h>
-SERVICE_VERSION *thd_wait_service= (void*)VERSION_thd_wait;
+SERVICE_VERSION thd_wait_service= (void*)VERSION_thd_wait;
diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt
index d065e8935c2..c0ee12fbd23 100644
--- a/mysql-test/CMakeLists.txt
+++ b/mysql-test/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 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
@@ -154,8 +154,10 @@ ENDMACRO()
FILE(GLOB infiles "collections/*.in")
FOREACH(collin ${infiles})
STRING(REPLACE ".in" "" collection ${collin})
+ STRING(REPLACE ".in" ".done" colldone ${collin})
# Only generate file once
- IF(NOT EXISTS ${collection})
+ IF(NOT EXISTS ${colldone})
PROCESS_COLLECTION_INCLUDE(${collin} ${collection})
+ FILE(APPEND ${colldone} "${collin}\n")
ENDIF()
ENDFOREACH()
diff --git a/mysql-test/collections/default.daily b/mysql-test/collections/default.daily
index e8b15acb34d..665da0d152c 100644
--- a/mysql-test/collections/default.daily
+++ b/mysql-test/collections/default.daily
@@ -1,5 +1,5 @@
-perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --skip-test-list=collections/disabled-daily.list --unit-tests
+perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --skip-test-list=collections/disabled-daily.list
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-daily.list
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=row --vardir=var-row --mysqld=--binlog-format=row --skip-test-list=collections/disabled-daily.list
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --mysqld=--binlog-format=row --ps-protocol --skip-test-list=collections/disabled-daily.list
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 1f4d29968a5..56b8feb6739 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -18,9 +18,4 @@ rpl.rpl_row_sp011 @solaris # Bug#11753919 2011-07-25 sven Several
sys_vars.max_sp_recursion_depth_func @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails
-# BUG #59055 : All ndb tests should be removed from the repository
-# Leaving the sys_vars tests for now. sys_vars.all_vars.test fails on removing ndb tests
-sys_vars.ndb_log_update_as_write_basic
-sys_vars.have_ndbcluster_basic
-sys_vars.ndb_log_updated_only_basic
sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5
diff --git a/mysql-test/collections/default.push b/mysql-test/collections/default.push
index c8402aecd75..e1781d5082c 100644
--- a/mysql-test/collections/default.push
+++ b/mysql-test/collections/default.push
@@ -1,5 +1,6 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list --unit-tests
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental --skip-ndb
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
-perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=embedded --vardir=var-emebbed --embedded --experimental=collections/default.experimental
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --suite=rpl,binlog --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental
+
diff --git a/mysql-test/collections/default.release.in b/mysql-test/collections/default.release.in
index 0e3ad30671b..8833086fad9 100644
--- a/mysql-test/collections/default.release.in
+++ b/mysql-test/collections/default.release.in
@@ -4,14 +4,14 @@
# include default.daily
# include default.weekly
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-ndbcluster --skip-rpl --report-features --debug-server
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --skip-ndbcluster --report-features
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --skip-ndbcluster --ps-protocol
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=debug --vardir=var-debug --skip-rpl --report-features --debug-server
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --ps-protocol
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs1+ps --vardir=var-funcs_1_ps --suite=funcs_1 --ps-protocol
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs2 --vardir=var-funcs2 --suite=funcs_2
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=stress --vardir=var-stress --suite=stress
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=jp --vardir=var-jp --suite=jp
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server --skip-rpl --skip-ndbcluster
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server --skip-rpl
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist --vardir=var-nist --suite=nist
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist+ps --vardir=var-nist_ps --suite=nist --ps-protocol
diff --git a/mysql-test/disabled.def b/mysql-test/disabled.def
index 46e20f86ec3..6d84b8ce0f4 100644
--- a/mysql-test/disabled.def
+++ b/mysql-test/disabled.def
@@ -13,10 +13,10 @@ tablespace : disabled in MariaDB (no TABLESPACE table attribute)
events_time_zone : Test is not predictable as it depends on precise timing.
lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
-sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
ssl_crl_clients_valid : broken upstream
ssl_crl : broken upstream
ssl_crl_clrpath : broken upstream
+show_explain : Psergey: random timeout in range-checked-for-each record query.
diff --git a/mysql-test/include/get_binlog_dump_thread_id.inc b/mysql-test/include/get_binlog_dump_thread_id.inc
deleted file mode 100644
index bfc8506b39e..00000000000
--- a/mysql-test/include/get_binlog_dump_thread_id.inc
+++ /dev/null
@@ -1,22 +0,0 @@
---exec $MYSQL test -e "show processlist" > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id
---disable_warnings
-drop table if exists t999;
---enable_warnings
-# Create a table to hold the process list
-create temporary table t999(
- id int,
- user char(255),
- host char(255),
- db char(255),
- Command char(255),
- time int,
- State char(255),
- info char(255)
-);
-# Load processlist into table, headers will create seom warnings
---disable_warnings
---replace_result $MYSQLTEST_VARDIR "."
-eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999;
---enable_warnings
-let $id = `select Id from t999 where Command="Binlog Dump"`;
-drop table t999;
diff --git a/mysql-test/include/have_debug_sync.inc b/mysql-test/include/have_debug_sync.inc
index 8efec7dad95..dbe6dfddd26 100644
--- a/mysql-test/include/have_debug_sync.inc
+++ b/mysql-test/include/have_debug_sync.inc
@@ -1,4 +1,4 @@
-if (`SELECT COUNT(*) = 0 FROM information_schema.session_variables WHERE
- variable_name = 'debug_sync' AND variable_value LIKE 'ON %'`) {
- --skip Needs debug_sync enabled
+if (`select count(*) = 0 from information_schema.session_variables where variable_name = 'debug_sync' and variable_value like 'on %'`)
+{
+ skip debug_sync is not available;
}
diff --git a/mysql-test/include/have_semisync.inc b/mysql-test/include/have_semisync.inc
new file mode 100644
index 00000000000..243fad83717
--- /dev/null
+++ b/mysql-test/include/have_semisync.inc
@@ -0,0 +1,4 @@
+if (`select count(*) < 2 from information_schema.plugins where plugin_name like 'rpl_semi_sync_%'`)
+{
+ --skip Test requires semisync plugins
+}
diff --git a/mysql-test/include/have_semisync.opt b/mysql-test/include/have_semisync.opt
new file mode 100644
index 00000000000..2888844cdcd
--- /dev/null
+++ b/mysql-test/include/have_semisync.opt
@@ -0,0 +1,4 @@
+--plugin-load=$SEMISYNC_MASTER_SO
+--plugin-load=$SEMISYNC_SLAVE_SO
+--loose-rpl-semi-sync-master
+--loose-rpl-semi-sync-slave
diff --git a/mysql-test/include/have_semisync_plugin.inc b/mysql-test/include/have_semisync_plugin.inc
deleted file mode 100644
index 8a1679de636..00000000000
--- a/mysql-test/include/have_semisync_plugin.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Check if server has support for loading plugins
-#
-if (`SELECT @@have_dynamic_loading != 'YES'`) {
- --skip Requires dynamic loading
-}
-
-#
-# Check if the variable SEMISYNC_MASTER_SO is set
-#
-if (!$SEMISYNC_MASTER_SO)
-{
- skip Need semisync plugins;
-}
-
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index 87d6698865a..75ba0e43221 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -627,17 +627,12 @@ DROP TABLE t1,t2,t3;
create table t1 (a int) engine=innodb;
let $MYSQLD_DATADIR= `select @@datadir`;
copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/bug29807.frm;
---error 1146
+--error ER_NO_SUCH_TABLE_IN_ENGINE
select * from bug29807;
drop table t1;
---error 1051
drop table bug29807;
-create table bug29807 (a int);
-drop table bug29807;
---disable_query_log
call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal");
call mtr.add_suppression("Cannot find or open table test\/bug29807 from");
---enable_query_log
#
diff --git a/mysql-test/include/support_long_file_names.inc b/mysql-test/include/support_long_file_names.inc
new file mode 100644
index 00000000000..1f5b3d7be08
--- /dev/null
+++ b/mysql-test/include/support_long_file_names.inc
@@ -0,0 +1,37 @@
+--error 0,3
+--perl
+my $n = 254 - length($ENV{MYSQLTEST_VARDIR});
+my $name = $ENV{MYSQLTEST_VARDIR} . '/' . sprintf("%0${n}d", $$);
+if (!open(LONG_NAME,">$name"))
+{
+ # We cannot rely either on a particular error code, or error string
+ # to check that we indeed hit "File name too long".
+ # Instead, we will try to create a file with a short name
+ # the same way, in the same location. If it goes all right,
+ # we will assume the problem was with the file name length
+
+ open(SHORT_NAME,">$ENV{MYSQLTEST_VARDIR}/$$") ||
+ # Even a shorter name could not be created, something else is wrong
+ die "Could not create file $ENV{MYSQLTEST_VARDIR}/$$: $!";
+ close(SHORT_NAME);
+ unlink("$ENV{MYSQLTEST_VARDIR}/$$");
+ exit(3);
+} else {
+ close(LONG_NAME);
+ unlink($name);
+ exit(0);
+}
+EOF
+
+# If perl exited with error code 0, the check has passed,
+# so the calling test will be executed.
+# If perl exited with error code 3, it will be caught by
+# --error above, and processed by the check below.
+# If perl exited with some other error code, something went wrong,
+# so the test will fail.
+
+if ($errno)
+{
+ --skip Long file names are not supported
+}
+
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index 810096805c8..95e23756c30 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -29,4 +29,4 @@ INSTALL(TARGETS my_safe_process DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/Safe
IF(WIN32)
INSTALL(TARGETS my_safe_kill DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
ENDIF()
-INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
+INSTALL(FILES Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess" COMPONENT Test)
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index ffe11417e7d..f41a77ff6ac 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -153,12 +153,19 @@ int main(int argc, char* const argv[] )
pid_t own_pid= getpid();
pid_t parent_pid= getppid();
bool nocore = false;
+ struct sigaction sa,sa_abort;
+ sa.sa_handler= handle_signal;
+ sa.sa_flags= SA_NOCLDSTOP;
+ sigemptyset(&sa.sa_mask);
+
+ sa_abort.sa_handler= handle_abort;
+ sigemptyset(&sa_abort.sa_mask);
/* Install signal handlers */
- signal(SIGTERM, handle_signal);
- signal(SIGINT, handle_signal);
- signal(SIGCHLD, handle_signal);
- signal(SIGABRT, handle_abort);
+ sigaction(SIGTERM, &sa,NULL);
+ sigaction(SIGINT, &sa,NULL);
+ sigaction(SIGCHLD, &sa,NULL);
+ sigaction(SIGABRT, &sa_abort,NULL);
sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.pl b/mysql-test/lib/My/SafeProcess/safe_process.pl
deleted file mode 100644
index de844e010a1..00000000000
--- a/mysql-test/lib/My/SafeProcess/safe_process.pl
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/perl
-# -*- cperl -*-
-
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-use strict;
-use warnings;
-
-use lib 'lib';
-use My::SafeProcess::Base;
-use POSIX qw(WNOHANG);
-
-###########################################################################
-# Util functions
-###########################################################################
-
-#
-#Print message to stderr
-#
-my $verbose= 0;
-sub message {
- if ($verbose > 0){
- use Time::localtime;
- my $tm= localtime();
- my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d",
- $tm->year % 100, $tm->mon+1, $tm->mday,
- $tm->hour, $tm->min, $tm->sec);
- print STDERR $timestamp, " monitor[$$]: ", @_, "\n";
- }
-}
-
-
-###########################################################################
-# Main program
-###########################################################################
-
-my $terminated= 0;
-
-# Protect against being killed in the middle
-# of child creation, just set the terminated flag
-# to make sure the child will be killed off
-# when program is ready to do that
-$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; };
-$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; };
-
-my $parent_pid= getppid();
-
-my $found_double_dash= 0;
-while (my $arg= shift(@ARGV)){
-
- if ($arg =~ /^--$/){
- $found_double_dash= 1;
- last;
- }
- elsif ($arg =~ /^--verbose$/){
- $verbose= 1;
- }
- else {
- die "Unknown option: $arg";
- }
-}
-
-my $path= shift(@ARGV); # Executable
-
-die "usage:\n" .
- " safe_process.pl [opts] -- <path> [<args> [...<args_n>]]"
- unless defined $path || $found_double_dash;
-
-
-message("started");
-#message("path: '$path'");
-message("parent: $parent_pid");
-
-# Start process to monitor
-my $child_pid=
- create_process(
- path => $path,
- args => \@ARGV,
- setpgrp => 1,
- );
-message("Started child $child_pid");
-
-eval {
- sub handle_signal {
- $terminated= 1;
- message("Got signal @_");
-
- # Ignore all signals
- foreach my $name (keys %SIG){
- $SIG{$name}= 'IGNORE';
- }
-
- die "signaled\n";
- };
- local $SIG{TERM}= \&handle_signal;
- local $SIG{INT}= \&handle_signal;
- local $SIG{CHLD}= sub {
- message("Got signal @_");
- kill('KILL', -$child_pid);
- my $ret= waitpid($child_pid, 0);
- if ($? & 127){
- exit(65); # Killed by signal
- }
- exit($? >> 8);
- };
-
- # Monitoring loop
- while(!$terminated) {
-
- # Check if parent is still alive
- if (kill(0, $parent_pid) < 1){
- message("Parent is not alive anymore");
- last;
- }
-
- # Wait for child to terminate but wakeup every
- # second to also check that parent is still alive
- my $ret_pid;
- $ret_pid= waitpid($child_pid, &WNOHANG);
- if ($ret_pid == $child_pid) {
- # Process has exited, collect return status
- my $ret_code= $? >> 8;
- message("Child exit: $ret_code");
- # Exit with exit status of the child
- exit ($ret_code);
- }
- sleep(1);
- }
-};
-if ( $@ ) {
- # The monitoring loop should have been
- # broken by handle_signal
- warn "Unexpected: $@" unless ( $@ =~ /signaled/ );
-}
-
-# Use negative pid in order to kill the whole
-# process group
-#
-my $ret= kill('KILL', -$child_pid);
-message("Killed child: $child_pid, ret: $ret");
-if ($ret > 0) {
- message("Killed child: $child_pid");
- # Wait blocking for the child to return
- my $ret_pid= waitpid($child_pid, 0);
- if ($ret_pid != $child_pid){
- message("unexpected pid $ret_pid returned from waitpid($child_pid)");
- }
-}
-
-message("DONE!");
-exit (1);
-
-
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index a8db67f1e67..a82e3ee10b7 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -769,18 +769,11 @@ sub collect_one_test_case {
if ( $tinfo->{'ndb_test'} )
{
# This is a NDB test
- if ( $::opt_skip_ndbcluster == 2 )
+ if ( $::ndbcluster_enabled == 0)
{
- # Ndb is not supported, skip it
+ # ndbcluster is disabled
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No ndbcluster support or ndb tests not enabled";
- return $tinfo;
- }
- elsif ( $::opt_skip_ndbcluster )
- {
- # All ndb test's should be skipped
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No ndbcluster";
+ $tinfo->{'comment'}= "ndbcluster disabled";
return $tinfo;
}
}
@@ -975,6 +968,8 @@ sub get_tags_from_file($$) {
} elsif ($over and $file =~ m@^$pdir/(.*)$@) {
$suffix = $1;
@prefix = map { "$_/" } $sdir, $pdir;
+ } else {
+ $over = 0; # file neither in $sdir nor in $pdir
}
while (my $line= <$F>)
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index e68ac783369..9ab82c454ed 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -28,7 +28,7 @@ our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
mtr_warning mtr_error mtr_debug mtr_verbose
mtr_verbose_restart mtr_report_test_passed
mtr_report_test_skipped mtr_print
- mtr_report_test);
+ mtr_report_test isotime);
use mtr_match;
use My::Platform;
@@ -106,6 +106,8 @@ sub mtr_report_test_passed ($) {
$tinfo->{'result'}= 'MTR_RES_PASSED';
mtr_report_test($tinfo);
+
+ resfile_global("endtime ", isotime (time));
}
@@ -550,4 +552,12 @@ sub mtr_verbose_restart (@) {
}
+# Used by --result-file for for formatting times
+
+sub isotime($) {
+ my ($sec,$min,$hr,$day,$mon,$yr)= gmtime($_[0]);
+ return sprintf "%d-%02d-%02dT%02d:%02d:%02dZ",
+ $yr+1900, $mon+1, $day, $hr, $min, $sec;
+}
+
1;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 46f2215ffb8..fdf06bfd327 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -208,6 +208,8 @@ our @opt_mysqld_envs;
my $opt_stress;
+my $opt_dry_run;
+
my $opt_compress;
my $opt_ssl;
my $opt_skip_ssl;
@@ -334,8 +336,9 @@ sub check_timeout ($) { return testcase_timeout($_[0]) / 10; }
our $opt_warnings= 1;
-our $opt_include_ndbcluster= 0;
-our $opt_skip_ndbcluster= 1;
+our $ndbcluster_enabled= 0;
+my $opt_include_ndbcluster= 0;
+my $opt_skip_ndbcluster= 0;
my $exe_ndbd;
my $exe_ndbmtd;
@@ -346,7 +349,7 @@ my $exe_ndb_mgm;
our %mysqld_variables;
our @optional_plugins;
-my $source_dist= 0;
+my $source_dist= -d "../sql";
my $opt_max_save_core= env_or_val(MTR_MAX_SAVE_CORE => 5);
my $opt_max_save_datadir= env_or_val(MTR_MAX_SAVE_DATADIR => 20);
@@ -362,14 +365,6 @@ my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE};
select(STDOUT);
$| = 1; # Automatically flush STDOUT
-# Used by --result-file for for formatting times
-
-sub isotime($) {
- my ($sec,$min,$hr,$day,$mon,$yr)= gmtime($_[0]);
- return sprintf "%d-%02d-%02dT%02d:%02d:%02dZ",
- $yr+1900, $mon+1, $day, $hr, $min, $sec;
-}
-
main();
@@ -382,6 +377,8 @@ sub main {
# directly before it executes them, like "make test-force-pl" in RPM builds.
mtr_report("Logging: $0 ", join(" ", @ARGV));
+ $DEFAULT_SUITES.=",sequence,sql_discovery" if $source_dist;
+
command_line_setup();
# --help will not reach here, so now it's safe to assume we have binaries
@@ -394,26 +391,6 @@ sub main {
if (!$opt_suites) {
$opt_suites= $DEFAULT_SUITES;
-
- # Check for any extra suites to enable based on the path name
- my %extra_suites=
- (
- "mysql-5.1-new-ndb" => "ndb_team",
- "mysql-5.1-new-ndb-merge" => "ndb_team",
- "mysql-5.1-telco-6.2" => "ndb_team",
- "mysql-5.1-telco-6.2-merge" => "ndb_team",
- "mysql-5.1-telco-6.3" => "ndb_team",
- "mysql-6.0-ndb" => "ndb_team",
- );
-
- foreach my $dir ( reverse splitdir($basedir) ) {
- my $extra_suite= $extra_suites{$dir};
- if (defined $extra_suite) {
- mtr_report("Found extra suite: $extra_suite");
- $opt_suites= "$extra_suite,$opt_suites";
- last;
- }
- }
}
mtr_report("Using suites: $opt_suites") unless @opt_cases;
@@ -447,6 +424,14 @@ sub main {
my $tests= collect_test_cases($opt_reorder, $opt_suites, \@opt_cases, \@opt_skip_test_list);
mark_time_used('collect');
+ if ($opt_dry_run)
+ {
+ for (@$tests) {
+ print $_->fullname(), "\n";
+ }
+ exit 0;
+ }
+
if ( $opt_report_features ) {
# Put "report features" as the first test to run
my $tinfo = My::Test->new
@@ -763,6 +748,10 @@ sub run_test_server ($$$) {
else {
mtr_report("\nRetrying test $tname, ".
"attempt($retries/$opt_retry)...\n");
+ #saving the log file as filename.failed in case of retry
+ my $worker_logdir= $result->{savedir};
+ my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
+ rename $log_file_name,$log_file_name.".failed";
delete($result->{result});
$result->{retries}= $retries+1;
$result->write_test($sock, 'TESTCASE');
@@ -1139,7 +1128,7 @@ sub command_line_setup {
# Control what test suites or cases to run
'force+' => \$opt_force,
'with-ndbcluster-only' => \&collect_option,
- 'include-ndbcluster' => \$opt_include_ndbcluster,
+ 'ndb|include-ndbcluster' => \$opt_include_ndbcluster,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
'suite|suites=s' => \$opt_suites,
'skip-rpl' => \&collect_option,
@@ -1260,6 +1249,7 @@ sub command_line_setup {
'report-times' => \$opt_report_times,
'result-file' => \$opt_resfile,
'stress=s' => \$opt_stress,
+ 'dry-run' => \$opt_dry_run,
'help|h' => \$opt_usage,
# list-options is internal, not listed in help
@@ -1278,11 +1268,6 @@ sub command_line_setup {
report_option('verbose', $opt_verbose);
}
- if ( -d "../sql" )
- {
- $source_dist= 1;
- }
-
# Find the absolute path to the test directory
$glob_mysql_test_dir= cwd();
if ($glob_mysql_test_dir =~ / /)
@@ -1581,7 +1566,6 @@ sub command_line_setup {
# --------------------------------------------------------------------------
if ( $opt_embedded_server )
{
- $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
$opt_skip_ssl= 1; # Turn off use of SSL
# Turn off use of bin log
@@ -2037,7 +2021,7 @@ sub executable_setup () {
$exe_mysql_embedded= mtr_exe_maybe_exists("$basedir/libmysqld/examples/mysql_embedded");
- if ( ! $opt_skip_ndbcluster )
+ if ( $ndbcluster_enabled )
{
# Look for single threaded NDB
$exe_ndbd=
@@ -2299,7 +2283,7 @@ sub environment_setup {
# --------------------------------------------------------------------------
# Add the path where libndbclient can be found
# --------------------------------------------------------------------------
- if ( !$opt_skip_ndbcluster )
+ if ( $ndbcluster_enabled )
{
push(@ld_library_paths, "$basedir/storage/ndb/src/.libs");
}
@@ -2392,7 +2376,7 @@ sub environment_setup {
# ----------------------------------------------------
# Setup env for NDB
# ----------------------------------------------------
- if ( ! $opt_skip_ndbcluster )
+ if ( $ndbcluster_enabled )
{
$ENV{'NDB_MGM'}=
my_find_bin($bindir,
@@ -2823,7 +2807,7 @@ sub fix_vs_config_dir () {
$opt_vs_config="";
- for (<$bindir/sql/*/mysqld.exe>) {
+ for (<$bindir/sql/*/mysqld.exe>) { #/
if (-M $_ < $modified)
{
$modified = -M _;
@@ -2865,37 +2849,87 @@ sub vs_config_dirs ($$) {
sub check_ndbcluster_support {
- # Check if this is MySQL Cluster, ie. mysql version string ends
- # with -ndb-Y.Y.Y[-status]
- if ( defined $mysql_version_extra &&
- $mysql_version_extra =~ /^-ndb-/ )
+ my $ndbcluster_supported = 0;
+ if ($mysqld_variables{'ndb-connectstring'})
{
- mtr_report(" - MySQL Cluster");
- # Enable ndb engine and add more test suites
- $opt_include_ndbcluster = 1;
- $DEFAULT_SUITES.=",ndb";
+ $ndbcluster_supported = 1;
}
- if ($opt_include_ndbcluster)
+ if ($opt_skip_ndbcluster && $opt_include_ndbcluster)
{
- $opt_skip_ndbcluster= 0;
+ # User is ambivalent. Theoretically the arg which was
+ # given last on command line should win, but that order is
+ # unknown at this time.
+ mtr_error("Ambigous command, both --include-ndbcluster " .
+ " and --skip-ndbcluster was specified");
}
- if ($opt_skip_ndbcluster)
+ # Check if this is MySQL Cluster, ie. mysql version string ends
+ # with -ndb-Y.Y.Y[-status]
+ if ( defined $mysql_version_extra &&
+ $mysql_version_extra =~ /-ndb-([0-9]*)\.([0-9]*)\.([0-9]*)/ )
{
- mtr_report(" - skipping ndbcluster");
- return;
- }
+ # MySQL Cluster tree
+ mtr_report(" - MySQL Cluster detected");
- if ( ! $mysqld_variables{'ndb-connectstring'} )
- {
- #mtr_report(" - skipping ndbcluster, mysqld not compiled with ndbcluster");
- $opt_skip_ndbcluster= 2;
- return;
+ if ($opt_skip_ndbcluster)
+ {
+ mtr_report(" - skipping ndbcluster(--skip-ndbcluster)");
+ return;
+ }
+
+ if (!$ndbcluster_supported)
+ {
+ # MySQL Cluster tree, but mysqld was not compiled with
+ # ndbcluster -> fail unless --skip-ndbcluster was used
+ mtr_error("This is MySQL Cluster but mysqld does not " .
+ "support ndbcluster. Use --skip-ndbcluster to " .
+ "force mtr to run without it.");
+ }
+
+ # mysqld was compiled with ndbcluster -> auto enable
}
+ else
+ {
+ # Not a MySQL Cluster tree
+ if (!$ndbcluster_supported)
+ {
+ if ($opt_include_ndbcluster)
+ {
+ mtr_error("Could not detect ndbcluster support ".
+ "requested with --include-ndbcluster");
+ }
- mtr_report(" - using ndbcluster when necessary, mysqld supports it");
+ # Silently skip, mysqld was compiled without ndbcluster
+ # which is the default case
+ return;
+ }
+
+ if ($opt_skip_ndbcluster)
+ {
+ # Compiled with ndbcluster but ndbcluster skipped
+ mtr_report(" - skipping ndbcluster(--skip-ndbcluster)");
+ return;
+ }
+
+
+ # Not a MySQL Cluster tree, enable ndbcluster
+ # if --include-ndbcluster was used
+ if ($opt_include_ndbcluster)
+ {
+ # enable ndbcluster
+ }
+ else
+ {
+ mtr_report(" - skipping ndbcluster(disabled by default)");
+ return;
+ }
+ }
+ mtr_report(" - enabling ndbcluster");
+ $ndbcluster_enabled= 1;
+ # Add MySQL Cluster test suites
+ $DEFAULT_SUITES.=",ndb,ndb_binlog,rpl_ndb,ndb_rpl,ndb_memcache";
return;
}
@@ -4751,6 +4785,7 @@ sub extract_warning_lines ($$) {
qr|Error: io_setup\(\) failed|,
qr|Warning: io_setup\(\) failed|,
qr|Warning: io_setup\(\) attempt|,
+ qr|setrlimit could not change the size of core files to 'infinity';|,
);
my $matched_lines= [];
@@ -6257,6 +6292,8 @@ Options to control what engine/variation to run
all generated configs
combination=<opt> Use at least twice to run tests with specified
options to mysqld
+ dry-run Don't run any tests, print the list of tests
+ that were selected for execution
Options to control directories to use
tmpdir=DIR The directory where temporary files are stored
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index b2cfd079ff5..b6e99952c23 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -415,7 +415,7 @@ alter table t1 drop key a;
drop table t1;
CREATE TABLE T12207(a int) ENGINE=MYISAM;
ALTER TABLE T12207 DISCARD TABLESPACE;
-ERROR HY000: Table storage engine for 'T12207' doesn't have this option
+ERROR HY000: Storage engine MyISAM of the table `test`.`T12207` doesn't have this option
DROP TABLE T12207;
create table t1 (a text) character set koi8r;
insert into t1 values (_koi8r'ÔÅÓÔ');
@@ -978,7 +978,7 @@ SHOW CREATE TABLE `tt+2`;
Table Create Table
tt+2 CREATE TEMPORARY TABLE `tt+2` (
`c1` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
DROP TABLE `tt+1`, `tt+2`;
CREATE TABLE `#sql1` (c1 INT);
CREATE TABLE `@0023sql2` (c1 INT);
@@ -1015,12 +1015,12 @@ SHOW CREATE TABLE `#sql2`;
Table Create Table
#sql2 CREATE TEMPORARY TABLE `#sql2` (
`c1` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
SHOW CREATE TABLE `@0023sql1`;
Table Create Table
@0023sql1 CREATE TEMPORARY TABLE `@0023sql1` (
`c1` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
DROP TABLE `#sql2`, `@0023sql1`;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
@@ -1340,3 +1340,43 @@ rename table t2 to t1;
execute stmt1;
deallocate prepare stmt1;
drop table t2;
+CREATE TABLE t1 (
+id INT(11) NOT NULL,
+x_param INT(11) DEFAULT NULL,
+PRIMARY KEY (id)
+);
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT,
+ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+Warnings:
+Note 1060 Duplicate column name 'id'
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+Warnings:
+Note 1060 Duplicate column name 'lol'
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
+Warnings:
+Note 1091 Can't DROP 'lol'; check that column/key exists
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+Warnings:
+Note 1061 Duplicate key name 'x_param'
+ALTER TABLE t1 MODIFY IF EXISTS lol INT;
+Warnings:
+Note 1054 Unknown column 'lol' in 't1'
+DROP INDEX IF EXISTS x_param ON t1;
+DROP INDEX IF EXISTS x_param ON t1;
+Warnings:
+Note 1091 Can't DROP 'x_param'; check that column/key exists
+CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
+CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
+Warnings:
+Note 1061 Duplicate key name 'x_param1'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `x_param` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ KEY `x_param1` (`x_param`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/alter_table_trans.result b/mysql-test/r/alter_table_trans.result
index 3dd5c00d3d8..6e034e47e76 100644
--- a/mysql-test/r/alter_table_trans.result
+++ b/mysql-test/r/alter_table_trans.result
@@ -2,5 +2,5 @@ drop table if exists t1,t2;
CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
Warnings:
-Note 1031 Table storage engine for 't1' doesn't have this option
+Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option
DROP TABLE t2;
diff --git a/mysql-test/r/bug13633383.result b/mysql-test/r/bug13633383.result
index 89b522724f9..3b533f89df2 100644
--- a/mysql-test/r/bug13633383.result
+++ b/mysql-test/r/bug13633383.result
@@ -4,18 +4,18 @@
CREATE TABLE t1 (
`a` int(11) DEFAULT NULL,
`col432` bit(8) DEFAULT NULL,
-`col433` multipoint DEFAULT NULL,
-`col434` polygon DEFAULT NULL,
+`col433` geometry DEFAULT NULL,
+`col434` geometry DEFAULT NULL,
`col435` decimal(50,17) unsigned DEFAULT NULL,
`col436` geometry NOT NULL,
`col437` tinyblob NOT NULL,
-`col438` multipolygon DEFAULT NULL,
+`col438` geometry DEFAULT NULL,
`col439` mediumblob NOT NULL,
`col440` tinyblob NOT NULL,
`col441` double unsigned DEFAULT NULL
);
CREATE TABLE t2 (
-`a` multipoint DEFAULT NULL,
+`a` geometry DEFAULT NULL,
`col460` date DEFAULT NULL,
`col461` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`col462` date NOT NULL,
@@ -31,7 +31,7 @@ CREATE TABLE t3 (
`col579` bit(38) NOT NULL,
`col580` varchar(93) NOT NULL,
`col581` datetime DEFAULT NULL,
-`col583` multipolygon DEFAULT NULL,
+`col583` geometry DEFAULT NULL,
`col584` bit(47) NOT NULL
);
set session sort_buffer_size= 32768;
diff --git a/mysql-test/r/cache_temporal_4265.result b/mysql-test/r/cache_temporal_4265.result
new file mode 100644
index 00000000000..1b4b3c2c4aa
--- /dev/null
+++ b/mysql-test/r/cache_temporal_4265.result
@@ -0,0 +1,10 @@
+create table t1 (a date);
+insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
+set debug_dbug='d,str_to_datetime_warn';
+select * from t1 where a > date_add('2000-01-01', interval 5 day);
+a
+2001-02-03
+2002-03-04
+Warnings:
+Note 1003 2000-01-01
+drop table t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 23417b16698..31f1d57f916 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -268,37 +268,37 @@ cast(010203101112.121314 as datetime)
0001-02-03 10:11:12
select cast(120010203101112.121314 as datetime);
cast(120010203101112.121314 as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '120010203101112.121314'
select cast(cast(1.1 as decimal) as datetime);
cast(cast(1.1 as decimal) as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '1'
select cast(cast(-1.1 as decimal) as datetime);
cast(cast(-1.1 as decimal) as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '-1'
select cast('0' as date);
cast('0' as date)
-NULL
+0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '0'
select cast('' as date);
cast('' as date)
-NULL
+0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: ''
select cast('0' as datetime);
cast('0' as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '0'
select cast('' as datetime);
cast('' as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: ''
select cast('0' as time);
@@ -306,7 +306,7 @@ cast('0' as time)
00:00:00
select cast('' as time);
cast('' as time)
-NULL
+00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: ''
select cast(NULL as DATE);
@@ -323,13 +323,13 @@ cast(NULL as BINARY)
NULL
select cast(cast(120010203101112.121314 as double) as datetime);
cast(cast(120010203101112.121314 as double) as datetime)
-NULL
+0000-00-00 00:00:00
select cast(cast(1.1 as double) as datetime);
cast(cast(1.1 as double) as datetime)
0000-00-00 00:00:01
select cast(cast(-1.1 as double) as datetime);
cast(cast(-1.1 as double) as datetime)
-NULL
+0000-00-00 00:00:00
explain extended select cast(10 as double(5,2));
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
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 7c556354d2e..7e814283d32 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -31,9 +31,9 @@ Warnings:
Note 1051 Unknown table 't1'
Note 1051 Unknown table 't2'
create table t1 (b char(0) not null, index(b));
-ERROR 42000: The used storage engine can't index column 'b'
+ERROR 42000: The storage engine MyISAM can't index column `b`
create table t1 (a int not null,b text) engine=heap;
-ERROR 42000: The used table type doesn't support BLOB/TEXT columns
+ERROR 42000: Storage engine MEMORY doesn't support BLOB/TEXT columns
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
@@ -1899,25 +1899,36 @@ create table t3 (a int) row_format=page;
drop table t1,t2,t3;
# -- End of Bug#45829
-# new table creation/renaming blocked if old encoded table present
-create table `t-1` (a int) engine=myisam;
-insert into `t-1` values (1);
+create table `#mysql50#t-1` (a int) engine=myisam;
+insert into `#mysql50#t-1` values (1);
show tables;
Tables_in_test
-t-1
-flush tables;
-convert table files in mysql 5.0 file name encoding
+#mysql50#t-1
+create table `t-1` (a int);
show tables;
Tables_in_test
#mysql50#t-1
-create table `t-1` (a int);
-ERROR 42S01: Table '#mysql50#t-1' already exists
+t-1
+select * from `t-1`;
+a
+select * from `#mysql50#t-1`;
+a
+1
+drop table `t-1`;
create table t1 (a int);
alter table t1 rename `t-1`;
-ERROR 42S01: Table '#mysql50#t-1' already exists
+show tables;
+Tables_in_test
+#mysql50#t-1
+t-1
+drop table `t-1`;
+create table t1 (a int);
rename table t1 to `t-1`;
-ERROR 42S01: Table '#mysql50#t-1' already exists
-drop table `#mysql50#t-1`, t1;
+show tables;
+Tables_in_test
+#mysql50#t-1
+t-1
+drop table `#mysql50#t-1`, `t-1`;
End of 5.1 tests
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 7f69fd1a5a4..3bbd25cbbcc 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -521,7 +521,7 @@ TIME_FORMAT("25:00:00", '%l %p')
1 AM
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
-NULL
+1151414896
Warnings:
Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s'
select str_to_date('04 /30/2004', '%m /%d/%Y');
diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result
index 0d858424715..fbed2ac1565 100644
--- a/mysql-test/r/ddl_i18n_koi8r.result
+++ b/mysql-test/r/ddl_i18n_koi8r.result
@@ -734,7 +734,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT ÐÁÒÁÍ1 CHAR(10),
OUT ÐÁÒÁÍ2 CHAR(10))
BEGIN
@@ -751,7 +751,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -768,7 +768,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8,
OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8)
BEGIN
@@ -785,7 +785,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -810,7 +810,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT ÐÁÒÁÍ1 CHAR(10),
OUT ÐÁÒÁÍ2 CHAR(10))
BEGIN
@@ -827,7 +827,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -844,7 +844,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8,
OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8)
BEGIN
@@ -861,7 +861,7 @@ COLLATION(_utf8 'текÑÑ‚') AS c6,
@@character_set_client AS c8;
SET ÐÁÒÁÍ1 = 'a';
SET ÐÁÒÁÍ2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result
index fb32d229040..98da459dafc 100644
--- a/mysql-test/r/ddl_i18n_utf8.result
+++ b/mysql-test/r/ddl_i18n_utf8.result
@@ -734,7 +734,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
@@ -751,7 +751,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -768,7 +768,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
@@ -785,7 +785,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -810,7 +810,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`(
INOUT парам1 CHAR(10),
OUT парам2 CHAR(10))
BEGIN
@@ -827,7 +827,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -844,7 +844,7 @@ ALTER DATABASE `mysqltest2` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`(
+CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`(
INOUT парам1 CHAR(10) CHARACTER SET utf8,
OUT парам2 CHAR(10) CHARACTER SET utf8)
BEGIN
@@ -861,7 +861,7 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c6,
@@character_set_client AS c8;
SET парам1 = 'a';
SET парам2 = 'b';
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index c6b8bf73a6f..363a4700ee6 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -441,3 +441,16 @@ ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1, t2;
DROP VIEW v1, v2;
set optimizer_switch=@save_derived_optimizer_switch;
+create table t1 (n bigint(20) unsigned, d1 datetime, d2 datetime, key (d1));
+insert t1 values (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
+insert t1 values (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
+insert t1 values (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
+select * from (
+select n, d1, d2, @result := 0 as result
+from t1
+where d1 < '2012-12-12 12:12:12' and n in (2085, 2084) order by d2 asc
+) as calculated_result;
+n d1 d2 result
+2085 2012-01-01 00:00:00 2013-01-01 00:00:00 0
+2084 2012-02-01 00:00:00 2013-01-01 00:00:00 0
+drop table t1;
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index bce1da10e35..40420a15c25 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2164,6 +2164,57 @@ a
set optimizer_switch=@save3912_optimizer_switch;
drop table t1, t2, t3;
#
+# MDEV-4209: equi-join on BLOB column from materialized view
+# or derived table
+#
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='derived_with_keys=on';
+CREATE TABLE t1 (c1 text, c2 int);
+INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3);
+CREATE TABLE t2 (c1 text, c2 int);
+INSERT INTO t2 VALUES ('b',2), ('c',3);
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+EXPLAIN EXTENDED
+SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
+Warnings:
+Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where ((`v1`.`c1` = `test`.`t2`.`c1`) and (`v1`.`c2` = `test`.`t2`.`c2`))
+SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
+c1 c2
+c 3
+c 3
+EXPLAIN EXTENDED
+SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
+WHERE t.g=t2.c1 AND t.m=t2.c2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY <derived2> ref key0 key0 5 test.t2.c2 2 100.00 Using where
+2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort
+Warnings:
+Note 1003 select `test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from (select `test`.`t1`.`c1` AS `g`,max(`test`.`t1`.`c2`) AS `m` from `test`.`t1` group by `test`.`t1`.`c1`) `t` join `test`.`t2` where ((`t`.`g` = `test`.`t2`.`c1`) and (`t`.`m` = `test`.`t2`.`c2`))
+SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
+WHERE t.g=t2.c1 AND t.m=t2.c2;
+c1 c2
+c 3
+EXPLAIN EXTENDED
+SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
+2 DERIVED t1 ALL NULL NULL NULL NULL 5 100.00
+Warnings:
+Note 1003 select `v1`.`c1` AS `c1`,`v1`.`c2` AS `c2`,`test`.`t2`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`v1` join `test`.`t2` where (`v1`.`c1` = `test`.`t2`.`c1`)
+SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
+c1 c2 c1 c2
+c 3 c 3
+c 3 c 3
+DROP VIEW v1;
+DROP TABLE t1,t2;
+set optimizer_switch=@save_optimizer_switch;
+#
# end of 5.3 tests
#
set optimizer_switch=@exit_optimizer_switch;
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index db3aa770499..55309e54fb3 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -142,9 +142,9 @@ create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ERROR 42000: Incorrect table name '#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345'
show tables;
Tables_in_mysqltestbug26703
+#mysql50#abc`def
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-#mysql50#abc`def
use test;
drop database mysqltestbug26703;
End of 5.1 tests
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index 925fb38a0f8..172179bd7f4 100644
--- a/mysql-test/r/dyncol.result
+++ b/mysql-test/r/dyncol.result
@@ -182,13 +182,13 @@ select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
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 cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)`
+Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)`
explain extended
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned);
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 cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)`
+Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)`
select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int);
column_get(column_create(1, 1212 AS decimal), 1 as unsigned int)
1212
@@ -261,13 +261,13 @@ select column_get(column_create(1, 1212 AS int), 1 as int);
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 cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)`
+Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)`
explain extended
select column_get(column_create(1, 1212 AS int), 1 as signed int);
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 cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)`
+Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)`
select column_get(column_create(1, -1212 AS int), 1 as int);
column_get(column_create(1, -1212 AS int), 1 as int)
-1212
@@ -368,7 +368,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
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 cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)`
+Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)`
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8);
column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8)
1212
@@ -428,7 +428,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
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 cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)`
+Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)`
#
# column get real
#
@@ -440,13 +440,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as double);
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 cast(column_get(column_create(1,1212.12 AS double),1) as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)`
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2));
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 cast(column_get(column_create(1,1212.12 AS double),1) as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))`
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double);
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double)
1.8446744073709552e19
@@ -521,13 +521,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
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 cast(column_get(column_create(1,1212.12 AS double),1) as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)`
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
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 cast(column_get(column_create(1,1212.12 AS double),1) as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))`
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0));
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0))
18446744073709551615
@@ -1336,6 +1336,77 @@ select hex(COLUMN_CREATE(0, 0.0 as decimal));
hex(COLUMN_CREATE(0, 0.0 as decimal))
000100000004
#
+# MDEV-4292: parse error when selecting on views using dynamic column
+#
+create table t1 (i int, d blob);
+create view v1 as select i, column_get(d, 1 as binary) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset binary) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as int) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as signed) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as unsigned) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as date) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as date) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as time) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as time) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as datetime) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as datetime) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as decimal) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as decimal(10,0)) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as double) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as double) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as char) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset latin1) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+drop table t1;
+#
+# end of 5.3 tests
+#
+#
# test of symbolic names
#
# creation test (names)
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index c067ff02574..e6abd44c267 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -699,3 +699,14 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.1 tests
+CREATE TABLE t1 (
+id int(11) auto_increment,
+title varchar(100) default '',
+PRIMARY KEY (id),
+KEY ind5 (title)
+) ENGINE=MyISAM;
+CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
+CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
+Warnings:
+Note 1061 Duplicate key name 'ft1'
+DROP TABLE t1;
diff --git a/mysql-test/r/fulltext_derived_4316.result b/mysql-test/r/fulltext_derived_4316.result
new file mode 100644
index 00000000000..141202c9842
--- /dev/null
+++ b/mysql-test/r/fulltext_derived_4316.result
@@ -0,0 +1,8 @@
+create table t1 (ft text) engine=myisam;
+insert into t1 values ('test1'),('test2');
+select distinct match(ft) against("test1" in boolean mode) from
+(select distinct ft from t1) as t;
+match(ft) against("test1" in boolean mode)
+1
+0
+drop table t1;
diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result
index a7f2383848d..e8fbba786a4 100644
--- a/mysql-test/r/func_date_add.result
+++ b/mysql-test/r/func_date_add.result
@@ -96,3 +96,9 @@ b + interval a day
2002-02-04
drop table t1;
End of 5.0 tests
+create table t1 (a varchar(10));
+insert t1 values ('2000-12-03'),('2008-05-03');
+select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end;
+a
+drop table t1;
+End of 5.5 tests
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 65323257300..c6fa040246a 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1837,10 +1837,10 @@ INSERT INTO t2 VALUES
EXPLAIN EXTENDED
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (<cache>(<in_optimizer>((1,2),<exists>(select 3,4 having (((1 = 3) or isnull(3)) and ((2 = 4) or isnull(4)) and <is_not_null_test>(3) and <is_not_null_test>(4))))) and (`test`.`t1`.`a` < 10))
+Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where 0
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
MAX(a)
NULL
@@ -1851,7 +1851,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = 1) and (`test`.`t1`.`a` < 10))
+Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`a` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t1`.`a` < 10))
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT a,b FROM t2 WHERE b<5) and a<10;
MAX(a)
NULL
@@ -2090,6 +2090,13 @@ set @@optimizer_switch=@save_optimizer_switch;
# Cleanup for BUG#46680
#
DROP TABLE IF EXISTS t1,t2,t3,empty1;
+create table t1 (i int, d date);
+insert into t1 values (1, '2008-10-02'), (2, '2010-12-12');
+select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i;
+avg(export_set( 3, 'y', sha(i))) group_concat(d)
+0 2008-10-02
+0 2010-12-12
+drop table t1;
#
# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
# file .\item_sum.cc, line 587
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
index 67ea44f187a..9489960d28c 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -217,7 +217,20 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
member_id_to COUNT(*)
518491 2
DROP TABLE t1;
-# End of test BUG#12713907
+#
+# MDEV-4269: crash when grouping by values()
+#
+SELECT @@storage_engine INTO @old_engine;
+set storage_engine=innodb;
+create table y select 1 b;
+select 1 from y group by b;
+1
+1
+select 1 from y group by values(b);
+1
+1
+drop table y;
+SET storage_engine=@old_engine;
#
# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
#
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 55b0f9d3c57..a033c91bc05 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -338,6 +338,227 @@ set optimizer_switch=@optimizer_switch_save;
drop view v_merge, vm;
drop table t1,tv;
#
+# GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
+#
+# IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired
+# Note: IS_USED_LOCK returns NULL if the lock is unused
+select is_used_lock('test');
+is_used_lock('test')
+NULL
+select is_free_lock('test');
+is_free_lock('test')
+1
+# GET_LOCK returns 1 if it manages to acquire a lock
+select get_lock('test', 0);
+get_lock('test', 0)
+1
+# IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired
+select is_free_lock('test');
+is_free_lock('test')
+0
+select is_used_lock('test') = connection_id();
+is_used_lock('test') = connection_id()
+1
+# -> Switching to connection 'con1'
+# IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired in another
+# connection
+select is_used_lock('test') = connection_id();
+is_used_lock('test') = connection_id()
+0
+select is_free_lock('test');
+is_free_lock('test')
+0
+# GET_LOCK returns 0 if it can't acquire a lock (wait timeout)
+select get_lock('test', 0);
+get_lock('test', 0)
+0
+# RELEASE_LOCK returns 0 if the lock belongs to another connection
+select release_lock('test');
+release_lock('test')
+0
+# -> Switching to connection 'default'
+# RELEASE_LOCK returns 1 if it successfully releases a lock
+select release_lock('test');
+release_lock('test')
+1
+# RELEASE_LOCK returns NULL if it doesn't release a lock and there is no such lock
+select release_lock('test');
+release_lock('test')
+NULL
+# Test that get_lock() returns NULL if error.
+select get_lock('test', 0);
+get_lock('test', 0)
+1
+# -> Switching to connection 'con1'
+create table t1 select connection_id() as id;
+select get_lock('test', 7200);
+# -> Switching to connection 'default'
+select (@id := id) - id from t1;
+(@id := id) - id
+0
+kill query @id;
+# -> Switching to connection 'con1'
+get_lock('test', 7200)
+NULL
+# -> Switching to connection 'default'
+# GET_LOCK() works recursively
+select get_lock('test', 0);
+get_lock('test', 0)
+1
+select get_lock('test', 0);
+get_lock('test', 0)
+1
+select get_lock('test', 0);
+get_lock('test', 0)
+1
+# RELEASE_LOCK() needs to be called recursively then, too
+select release_lock('test');
+release_lock('test')
+1
+select release_lock('test');
+release_lock('test')
+1
+select release_lock('test');
+release_lock('test')
+1
+# Once the last instance of the lock is released,
+# the next call returns NULL
+select release_lock('test');
+release_lock('test')
+1
+# Multiple locks in the same session are OK
+select get_lock('test1', 0);
+get_lock('test1', 0)
+1
+select get_lock('test2', 0);
+get_lock('test2', 0)
+1
+select get_lock('test3', 0);
+get_lock('test3', 0)
+1
+select release_lock('test1');
+release_lock('test1')
+1
+select release_lock('test2');
+release_lock('test2')
+1
+select release_lock('test3');
+release_lock('test3')
+1
+# Deadlocks are detected e.g. in case of a mutual wait
+select get_lock('test1', 0);
+get_lock('test1', 0)
+1
+# -> Switching to connection 'con1'
+select get_lock('test2', 0);
+get_lock('test2', 0)
+1
+select get_lock('test1', 7200);
+# -> Switching to connection 'default'
+select get_lock('test2', 7200);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select release_lock('test1');
+release_lock('test1')
+1
+# -> Switching to connection 'con1'
+get_lock('test1', 7200)
+1
+select release_lock('test2');
+release_lock('test2')
+1
+select release_lock('test1');
+release_lock('test1')
+1
+# -> Switching to connection 'default'
+# LOCK/UNLOCK TABLES works fine with a user lock.
+lock table t1 write;
+select get_lock('test', 0);
+get_lock('test', 0)
+1
+unlock tables;
+commit;
+select release_lock('test');
+release_lock('test')
+1
+# GLOBAL READ LOCK works with fine with user locks
+select get_lock('test1', 0);
+get_lock('test1', 0)
+1
+flush tables with read lock;
+select get_lock('test2', 0);
+get_lock('test2', 0)
+1
+unlock tables;
+commit;
+select release_lock('test1');
+release_lock('test1')
+1
+select release_lock('test2');
+release_lock('test2')
+1
+# BEGIN/COMMIT/ROLLBACK don't unlock user locks.
+begin;
+select get_lock('test1', 0);
+get_lock('test1', 0)
+1
+select get_lock('test2', 0);
+get_lock('test2', 0)
+1
+select count(*) from t1;
+count(*)
+1
+rollback;
+select release_lock('test1');
+release_lock('test1')
+1
+select release_lock('test2');
+release_lock('test2')
+1
+# Deadlocks between user locks and LOCK TABLES locks
+# are detected OK.
+select get_lock('test', 0);
+get_lock('test', 0)
+1
+# -> Switching to connection 'con1'
+lock table t1 write;
+select get_lock('test', 7200);
+# -> Switching to connection 'default'
+lock table t1 read;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+select release_lock('test');
+release_lock('test')
+1
+# -> Switching to connection 'con1'
+get_lock('test', 7200)
+1
+select release_lock('test');
+release_lock('test')
+1
+unlock tables;
+# cleanup
+drop table t1;
+# check too long identifier names
+select get_lock(repeat('a', 192), 0);
+get_lock(repeat('a', 192), 0)
+1
+select is_used_lock(repeat('a', 192)) = connection_id();
+is_used_lock(repeat('a', 192)) = connection_id()
+1
+select is_free_lock(repeat('a', 192));
+is_free_lock(repeat('a', 192))
+0
+select release_lock(repeat('a', 192));
+release_lock(repeat('a', 192))
+1
+select get_lock(repeat('a', 193), 0);
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+select is_used_lock(repeat('a', 193));
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+select is_free_lock(repeat('a', 193));
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+select release_lock(repeat('a', 193));
+ERROR 42000: Identifier name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index fa3d37c08c2..1f20ddc6cbb 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -168,7 +168,7 @@ date("1997-12-31 23:59:59.000001")
1997-12-31
select date("1997-13-31 23:59:59.000001");
date("1997-13-31 23:59:59.000001")
-NULL
+0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '1997-13-31 23:59:59.000001'
select time("1997-12-31 23:59:59.000001");
@@ -176,7 +176,7 @@ time("1997-12-31 23:59:59.000001")
23:59:59.000001
select time("1997-12-31 25:59:59.000001");
time("1997-12-31 25:59:59.000001")
-NULL
+00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '1997-12-31 25:59:59.000001'
select microsecond("1997-12-31 23:59:59.000001");
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 80729545902..16c0854241f 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2634,6 +2634,31 @@ SELECT * FROM t1;
a
aaaaaaaaaaaaaa
DROP TABLE t1;
+SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
+SUBSTRING('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT LEFT('1', DAY(FROM_UNIXTIME(-1)));
+LEFT('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1)));
+RIGHT('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1)));
+REPEAT('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
+NULL
+SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
+NULL
+create table t1 (i int);
+insert into t1 values (null),(8);
+select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field;
+group_concat( i ) field
+NULL NULL
+8
+drop table t1;
End of 5.1 tests
Start of 5.4 tests
SELECT format(12345678901234567890.123, 3);
@@ -2864,9 +2889,6 @@ sha1('P'),
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
SET @@global.max_allowed_packet:= @tmp_max;
-#
-# End of 5.5 tests
-#
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
@@ -2880,3 +2902,15 @@ NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
SET @@global.max_allowed_packet:= @tmp_max;
+#
+# MDEV-4272: DIV operator crashes in Item_func_int_div::val_int
+# (incorrect NULL value handling by convert)
+#
+create table t1(a int) select null;
+select 1 div convert(a using utf8) from t1;
+1 div convert(a using utf8)
+NULL
+drop table t1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index dd4b73b0b05..e8526ae8f1f 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1781,7 +1781,7 @@ Warnings:
Warning 1441 Datetime function: time field overflow
select cast('131415.123e0' as time);
cast('131415.123e0' as time)
-NULL
+00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '131415.123e0'
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
@@ -1801,12 +1801,12 @@ unix_timestamp(null)
NULL
select truncate(date('2010-40-10'), 6);
truncate(date('2010-40-10'), 6)
-NULL
+0.000000
Warnings:
Warning 1292 Incorrect datetime value: '2010-40-10'
select extract(month from '2010-40-50');
extract(month from '2010-40-50')
-NULL
+0
Warnings:
Warning 1292 Incorrect datetime value: '2010-40-50'
select subtime('0000-00-10 10:10:10', '30 10:00:00');
@@ -1924,3 +1924,15 @@ microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
select now(258);
ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.
+SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
+1
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 26787366358..c394aec8851 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -758,7 +758,7 @@ SPATIAL KEY(g)
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
drop table t1;
CREATE TABLE t1 (
-line LINESTRING NOT NULL,
+line GEOMETRY NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
SPATIAL KEY (line)
@@ -1553,7 +1553,7 @@ End of 5.0 tests.
# Bug #57323/11764487: myisam corruption with insert ignore
# and invalid spatial data
#
-CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
+CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL,
SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
INSERT IGNORE INTO t1 SET a=GEOMFROMTEXT("point (-6 0)"), b=GEOMFROMTEXT("error");
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 30385323502..eb9f1a57c32 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -406,20 +406,20 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second
first second w c o e d t i r
120 120 1 1 0 1 0 1 1 0
120 121 0 0 1 0 0 0 1 0
-120 122 0 1 NULL 0 NULL 0 NULL 0
-120 123 0 1 NULL 0 NULL 0 NULL 0
+120 122 NULL NULL NULL NULL NULL NULL NULL NULL
+120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 1 1 0
-121 122 0 1 NULL 0 NULL 0 NULL 0
-121 123 0 1 NULL 0 NULL 0 NULL 0
-122 120 1 0 NULL 0 NULL 0 NULL 0
-122 121 1 0 NULL 0 NULL 0 NULL 0
-122 122 1 1 NULL 1 NULL 0 NULL 0
-122 123 1 1 NULL 1 NULL 0 NULL 0
-123 120 1 0 NULL 0 NULL 0 NULL 0
-123 121 1 0 NULL 0 NULL 0 NULL 0
-123 122 1 1 NULL 1 NULL 0 NULL 0
-123 123 1 1 NULL 1 NULL 0 NULL 0
+121 122 NULL NULL NULL NULL NULL NULL NULL NULL
+121 123 NULL NULL NULL NULL NULL NULL NULL NULL
+122 120 NULL NULL NULL NULL NULL NULL NULL NULL
+122 121 NULL NULL NULL NULL NULL NULL NULL NULL
+122 122 NULL NULL NULL NULL NULL NULL NULL NULL
+122 123 NULL NULL NULL NULL NULL NULL NULL NULL
+123 120 NULL NULL NULL NULL NULL NULL NULL NULL
+123 121 NULL NULL NULL NULL NULL NULL NULL NULL
+123 122 NULL NULL NULL NULL NULL NULL NULL NULL
+123 123 NULL NULL NULL NULL NULL NULL NULL NULL
explain extended SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
@@ -1047,7 +1047,7 @@ SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000
SET @a=POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
-create table t1(a polygon NOT NULL)engine=myisam;
+create table t1(a geometry NOT NULL)engine=myisam;
insert into t1 values (geomfromtext("point(0 1)"));
insert into t1 values (geomfromtext("point(1 0)"));
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
@@ -1063,6 +1063,84 @@ create table t1(a char(32) not null) engine=myisam;
create spatial index i on t1 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
drop table t1;
+CREATE TABLE t0 (a BINARY(32) NOT NULL);
+CREATE SPATIAL INDEX i on t0 (a);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+INSERT INTO t0 VALUES (1);
+CREATE TABLE t1(
+col0 BINARY NOT NULL,
+col2 TIMESTAMP,
+SPATIAL INDEX i1 (col0)
+) ENGINE=MyISAM;
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+CREATE TABLE t1 (
+col0 BINARY NOT NULL,
+col2 TIMESTAMP
+) ENGINE=MyISAM;
+CREATE SPATIAL INDEX idx0 ON t1(col0);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+CREATE TABLE t2 (
+col0 INTEGER NOT NULL,
+col1 POINT,
+col2 POINT
+);
+CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+CREATE TABLE t3 (
+col0 INTEGER NOT NULL,
+col1 POINT,
+col2 LINESTRING,
+SPATIAL INDEX i1 (col1, col2)
+);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+DROP TABLE t0, t1, t2;
+#
+# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
+#
+SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
+ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
+NULL
+#
+# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
+# GEOMETRY FUNCTION ARGUMENTS
+#
+SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
+ERROR 22007: Illegal non geometric '' value found during parsing
+#
+# MDEV-4252 geometry query crashes server
+#
+select astext(0x0100000000030000000100000000000010);
+astext(0x0100000000030000000100000000000010)
+NULL
+select astext(st_centroid(0x0100000000030000000100000000000010));
+astext(st_centroid(0x0100000000030000000100000000000010))
+NULL
+select astext(st_exteriorring(0x0100000000030000000100000000000010));
+astext(st_exteriorring(0x0100000000030000000100000000000010))
+NULL
+select envelope(0x0100000000030000000100000000000010);
+envelope(0x0100000000030000000100000000000010)
+NULL
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
+geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
+NULL
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
+geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
+NULL
+#
+# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
+#
+SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
+Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )))
+NULL
+#
+# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
+#
+SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
+Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))))
+NULL
End of 5.1 tests
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
@@ -1428,6 +1506,7 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
count(*)
1
DROP DATABASE gis_ogs;
+USE test;
#
# BUG #1043845 st_distance() results are incorrect depending on variable order
#
@@ -1451,20 +1530,23 @@ geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.
0.008148695928146028
-USE test;
#
-# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
+# MDEV-4310 geometry function equals hangs forever.
#
-SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
-ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
+create table t1(a geometry not null)engine=myisam;
+insert into t1 values(geomfromtext("POINT(0 0)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+select equals(`a`,convert(`a` using utf8)) from `t1`;
+equals(`a`,convert(`a` using utf8))
+1
NULL
-#
-# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
-# GEOMETRY FUNCTION ARGUMENTS
-#
-SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
-ERROR 22007: Illegal non geometric '' value found during parsing
-End of 5.1 tests
+NULL
+Warnings:
+Warning 1300 Invalid utf8 character string: 'E043'
+Warning 1300 Invalid utf8 character string: 'E043'
+drop table t1;
+End of 5.3 tests
#
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
#
@@ -1491,4 +1573,11 @@ SELECT 1 FROM g1 WHERE a >= ANY
(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ;
1
DROP TABLE g1;
+#
+# MDEV-3819 missing constraints for spatial column types
+#
+create table t1 (pt point);
+insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
+ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
+drop table t1;
End of 5.5 tests
diff --git a/mysql-test/r/grant4.result b/mysql-test/r/grant4.result
index d0b6627cd0b..65ab92c1afd 100644
--- a/mysql-test/r/grant4.result
+++ b/mysql-test/r/grant4.result
@@ -86,9 +86,9 @@ GRANT SHOW VIEW, SELECT ON v3 to mysqltest_u1@localhost;
use mysqltest_db1;
** Connect as restricted user mysqltest_u1.
** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough).
+** but will return no rows
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLUMN_NAME COLLATION CARDINALITY SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT INDEX_COMMENT
-def mysqltest_db1 t5 1 mysqltest_db1 i 1 s1 A NULL NULL NULL YES BTREE
** SHOW INDEX FROM t5 will fail because we don't have any privileges on any column combination.
SHOW INDEX FROM t5;
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't5'
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 085003c7790..a1f19204274 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1946,6 +1946,250 @@ Warning 1292 Truncated incorrect INTEGER value: 'K'
Warning 1292 Truncated incorrect INTEGER value: 'jxW<'
DROP TABLE t1;
SET BIG_TABLES=0;
+#
+# MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause
+# Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...'
+# WITH GROUP BY ON DUPLICATED FIELDS
+#
+CREATE TABLE t1(
+col1 int,
+UNIQUE INDEX idx (col1));
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
+(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+EXPLAIN SELECT col1 AS field1, col1 AS field2
+FROM t1 GROUP BY field1, field2;;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort
+FLUSH STATUS;
+SELECT col1 AS field1, col1 AS field2
+FROM t1 GROUP BY field1, field2;;
+field1 field2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+SHOW SESSION STATUS LIKE 'Sort_scan%';
+Variable_name Value
+Sort_scan 1
+EXPLAIN SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
+FROM t1 GROUP BY field1, field2;;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort
+FLUSH STATUS;
+SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
+FROM t1 GROUP BY field1, field2;;
+field1 field2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+SHOW SESSION STATUS LIKE 'Sort_scan%';
+Variable_name Value
+Sort_scan 1
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
+FROM v1
+GROUP BY field1, field2;
+field1 field2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+SELECT SQL_BIG_RESULT tbl1.col1 AS field1, tbl2.col1 AS field2
+FROM t1 as tbl1, t1 as tbl2
+GROUP BY field1, field2
+LIMIT 3;
+field1 field2
+1 1
+1 2
+1 3
+explain
+select col1 f1, col1 f2 from t1 order by f2, f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using filesort
+select col1 f1, col1 f2 from t1 order by f2, f1;
+f1 f2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+explain
+select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL idx 5 NULL 7 Using index for group-by; Using temporary; Using filesort
+select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
+f1 f2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+explain
+select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL idx 5 NULL 20 Using index; Using temporary; Using filesort
+select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
+f1 f2
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+CREATE TABLE t2(
+col1 int,
+col2 int,
+UNIQUE INDEX idx (col1, col2));
+INSERT INTO t2(col1, col2) VALUES
+(1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
+(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
+explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using temporary; Using filesort
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
+f1 f2 f3
+1 20 1
+2 19 2
+3 18 3
+4 17 4
+5 16 5
+6 15 6
+7 14 7
+8 13 8
+9 12 9
+10 11 10
+11 10 11
+12 9 12
+13 8 13
+14 7 14
+15 6 15
+16 5 16
+17 4 17
+18 3 18
+19 2 19
+20 1 20
+explain
+select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL idx 10 NULL 20 Using index; Using filesort
+select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
+f1 f2 f3
+1 20 1
+2 19 2
+3 18 3
+4 17 4
+5 16 5
+6 15 6
+7 14 7
+8 13 8
+9 12 9
+10 11 10
+11 10 11
+12 9 12
+13 8 13
+14 7 14
+15 6 15
+16 5 16
+17 4 17
+18 3 18
+19 2 19
+20 1 20
+DROP VIEW v1;
+DROP TABLE t1, t2;
# End of 5.1 tests
#
# LP bug#694450 Wrong result with non-standard GROUP BY + ORDER BY
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index d1faec7f758..cc7c9c4d364 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -1714,7 +1714,7 @@ explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`a2` >= 'b'))
+Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 'a') and (`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`a2` >= 'b'))
explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by
@@ -1731,7 +1731,7 @@ explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index
Warnings:
-Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`a2` >= 'b'))
+Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`b` = 'a') and (`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`a2` >= 'b'))
explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by
@@ -3187,6 +3187,106 @@ a b
drop table t1;
End of 5.1 tests
#
+# MDEV-765 lp:825075 - Wrong result with GROUP BY + multipart key + MIN/MAX loose scan
+#
+CREATE TABLE t1 (a varchar(1), b varchar(1), KEY (b,a));
+INSERT INTO t1 VALUES
+('0',NULL),('9',NULL),('8','c'),('4','d'),('7','d'),(NULL,'f'),
+('7','f'),('8','g'),(NULL,'j');
+explain
+SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
+SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
+max(a) b
+NULL f
+NULL j
+explain
+SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
+SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
+b min(a)
+d 7
+f 7
+explain
+SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
+SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
+b min(a)
+NULL 0
+d 4
+explain
+SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 4 const 1 Using where; Using index
+SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
+b min(a)
+explain
+SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 8 NULL 9 Using where; Using index
+SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
+b min(a)
+d 7
+f 7
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'c'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'd'
+Warning 1292 Truncated incorrect DOUBLE value: 'f'
+Warning 1292 Truncated incorrect DOUBLE value: 'g'
+explain
+SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index b b 8 NULL 9 Using where; Using index
+SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
+b min(a)
+NULL 9
+c 8
+d 4
+f 7
+g 8
+drop table t1;
+#
+# MDEV-4140 Wrong result with GROUP BY + multipart key + MIN/MAX loose scan and a subquery
+#
+CREATE TABLE t1 (a int, b int, KEY (b, a)) ;
+INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0);
+CREATE TABLE t2 (c int) ;
+INSERT INTO t2 VALUES (0),(1);
+EXPLAIN
+SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL b 10 NULL 10 Using where; Using index for group-by
+SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
+MIN(a) b
+1 0
+9 99
+EXPLAIN
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range NULL b 10 NULL 10 Using where; Using index for group-by
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
+MIN(a) b
+1 0
+9 99
+EXPLAIN
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL b 10 NULL 9 Using where; Using index
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY t1a index NULL b 10 NULL 9 Using index; Using join buffer (flat, BNL join)
+2 SUBQUERY t1b index NULL b 10 NULL 9 Using index; Using join buffer (incremental, BNL join)
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
+MIN(a) b
+1 0
+9 99
+drop table t1, t2;
+End of 5.3 tests
+#
# WL#3220 (Loose index scan for COUNT DISTINCT)
#
CREATE TABLE t1 (a INT, b INT, c INT, KEY (a,b));
diff --git a/mysql-test/r/group_min_max_innodb.result b/mysql-test/r/group_min_max_innodb.result
index 0e7841e979d..320c4b2b750 100644
--- a/mysql-test/r/group_min_max_innodb.result
+++ b/mysql-test/r/group_min_max_innodb.result
@@ -70,7 +70,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
explain select distinct f1, f2 from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
+1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index
drop table t1;
create table t1(pk int primary key) engine=innodb;
create view v1 as select pk from t1 where pk < 20;
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index 5961a84cddc..a0a4fc42e2d 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -473,7 +473,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having ((7 = 8) and (`test`.`table1`.`f1` >= 6))
+Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having ((7 = 8) and (`test`.`table1`.`f1` >= 6))
EXPLAIN EXTENDED
SELECT table1.f1, table2.f2
FROM t1 AS table1
@@ -485,7 +485,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE table2 const PRIMARY PRIMARY 4 const 1 100.00 Using filesort
1 SIMPLE table1 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = 9)) group by `test`.`table1`.`f1`,7 having (7 = 8)
+Note 1003 select `test`.`table1`.`f1` AS `f1`,7 AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where (`test`.`table1`.`f3` = 9) group by `test`.`table1`.`f1`,7 having (7 = 8)
DROP TABLE t1;
#
# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result
index 3d4fa27859d..c0016a8e5c3 100644
--- a/mysql-test/r/information_schema-big.result
+++ b/mysql-test/r/information_schema-big.result
@@ -36,6 +36,7 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
+ALL_PLUGINS PLUGIN_NAME
PROCESSLIST ID
PROFILING QUERY_ID
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
@@ -88,6 +89,7 @@ KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
+ALL_PLUGINS PLUGIN_NAME
PROCESSLIST ID
PROFILING QUERY_ID
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index a30fe668490..a7051f275d7 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -46,6 +46,7 @@ table_name not like 'ndb_%' AND table_name not like 'innodb_%' AND
table_name not like 'pbxt_%' AND table_name not like 'xtradb_%';
select * from v1;
c
+ALL_PLUGINS
CHARACTER_SETS
CLIENT_STATISTICS
COLLATIONS
@@ -802,6 +803,7 @@ information_schema PARTITIONS PARTITION_EXPRESSION
information_schema PARTITIONS SUBPARTITION_EXPRESSION
information_schema PARTITIONS PARTITION_DESCRIPTION
information_schema PLUGINS PLUGIN_DESCRIPTION
+information_schema ALL_PLUGINS PLUGIN_DESCRIPTION
information_schema PROCESSLIST INFO
information_schema ROUTINES DTD_IDENTIFIER
information_schema ROUTINES ROUTINE_DEFINITION
@@ -1180,7 +1182,7 @@ group by column_type order by num;
column_type group_concat(table_schema, '.', table_name) num
varchar(27) information_schema.COLUMNS 1
varchar(7) information_schema.ROUTINES,information_schema.VIEWS 2
-varchar(20) information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PROFILING 6
+varchar(20) information_schema.FILES,information_schema.FILES,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.ALL_PLUGINS,information_schema.PROFILING 9
create table t1(f1 char(1) not null, f2 char(9) not null)
default character set utf8;
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
diff --git a/mysql-test/r/information_schema_all_engines.result b/mysql-test/r/information_schema_all_engines.result
index 455f2e36ffc..8b1aff8a209 100644
--- a/mysql-test/r/information_schema_all_engines.result
+++ b/mysql-test/r/information_schema_all_engines.result
@@ -1,6 +1,7 @@
use INFORMATION_SCHEMA;
show tables;
Tables_in_information_schema
+ALL_PLUGINS
CHARACTER_SETS
CLIENT_STATISTICS
COLLATIONS
@@ -74,6 +75,7 @@ c2.table_name = t.table_name AND
c2.column_name LIKE '%SCHEMA%'
) order by t.table_name;
table_name column_name
+ALL_PLUGINS PLUGIN_NAME
CHARACTER_SETS CHARACTER_SET_NAME
CLIENT_STATISTICS CLIENT
COLLATIONS COLLATION_NAME
@@ -147,6 +149,7 @@ c2.table_name = t.table_name AND
c2.column_name LIKE '%SCHEMA%'
) order by t.table_name;
table_name column_name
+ALL_PLUGINS PLUGIN_NAME
CHARACTER_SETS CHARACTER_SET_NAME
CLIENT_STATISTICS CLIENT
COLLATIONS COLLATION_NAME
@@ -205,7 +208,7 @@ USER_PRIVILEGES GRANTEE
USER_STATISTICS USER
VIEWS TABLE_SCHEMA
XTRADB_ADMIN_COMMAND result_message
-select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
+select 1 as f1 from information_schema.tables where "ALL_PLUGINS"=
(select cast(table_name as char) from information_schema.tables
order by table_name limit 1) limit 1;
f1
@@ -226,6 +229,7 @@ c2.table_schema='information_schema' and
group by c2.column_type order by num limit 1)
group by t.table_name order by num1, t.table_name;
table_name group_concat(t.table_schema, '.', t.table_name) num1
+ALL_PLUGINS information_schema.ALL_PLUGINS 1
CHARACTER_SETS information_schema.CHARACTER_SETS 1
CLIENT_STATISTICS information_schema.CLIENT_STATISTICS 1
COLLATIONS information_schema.COLLATIONS 1
@@ -288,6 +292,7 @@ VIEWS information_schema.VIEWS 1
+---------------------------------------+
Database: information_schema
| Tables |
+| ALL_PLUGINS |
| CHARACTER_SETS |
| CLIENT_STATISTICS |
| COLLATIONS |
@@ -351,6 +356,7 @@ Database: information_schema
+---------------------------------------+
Database: INFORMATION_SCHEMA
| Tables |
+| ALL_PLUGINS |
| CHARACTER_SETS |
| CLIENT_STATISTICS |
| COLLATIONS |
@@ -417,5 +423,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
-information_schema 58
+information_schema 59
mysql 26
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index 4e441245a39..0da4feaf26f 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -731,6 +731,7 @@ CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t1 (a) VALUES (4), (6);
INSERT INTO t2 (b) VALUES (0), (8);
set @save_optimizer_switch=@@optimizer_switch;
+set @save_join_cache_level=@@join_cache_level;
SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on';
SET optimizer_switch='join_cache_bka=on';
@@ -742,6 +743,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 hash_ALL NULL #hash#$hj 5 test.t1.a 2 Using where; Using join buffer (flat, BNLH join)
SELECT * FROM t1, t2 WHERE b=a;
a b
+set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
#
@@ -772,5 +774,97 @@ INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1;
+#
+# Bug mdev-4220: using ref instead of eq_ref
+# with extended_keys=on
+# (performance regression introduced in the patch for mdev-3851)
+#
+set @save_optimizer_switch=@@optimizer_switch;
+create table t1 (a int not null) engine=innodb;
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (
+pk int primary key, a int not null, b int, unique(a)
+)engine=innodb;
+insert into t2
+select
+A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a
+from t1 A, t1 B;
+set optimizer_switch='extended_keys=off';
+explain
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10
+1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where
+flush status;
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+a pk a b
+0 0 0 0
+1 1 1 1
+show status like 'handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 10
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 11
+set optimizer_switch='extended_keys=on';
+explain
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 10
+1 SIMPLE t2 eq_ref a a 4 test.t1.a 1 Using where
+flush status;
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+a pk a b
+0 0 0 0
+1 1 1 1
+show status like 'handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 10
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 11
+drop table t1,t2;
+create table t1(a int) engine=myisam;
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2(a int) engine=myisam;
+insert into t2 select A.a + 10*B.a + 100*C.a from t1 A, t1 B, t1 C;
+create table t3 (
+pk1 int not null, pk2 int not null, col1 int not null, col2 int not null)
+engine=innodb;
+insert into t3 select a,a,a,a from t2;
+alter table t3 add primary key (pk1, pk2);
+alter table t3 add key (col1, col2);
+set optimizer_switch='extended_keys=off';
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
+1 SIMPLE t3 ref col1 col1 8 test.t1.a,test.t1.a # Using index
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
+1 SIMPLE t3 ref PRIMARY,col1 PRIMARY 4 test.t1.a # Using where
+set optimizer_switch='extended_keys=on';
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
+1 SIMPLE t3 ref col1 col1 8 test.t1.a,test.t1.a # Using index
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
+1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index
+drop table t1,t2,t3;
+set optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_ext_key_optimizer_switch;
SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result
index 044e582ceb6..7c41ffec344 100644
--- a/mysql-test/r/innodb_mysql_sync.result
+++ b/mysql-test/r/innodb_mysql_sync.result
@@ -18,10 +18,10 @@ SET DEBUG_SYNC='now SIGNAL table_altered';
# Complete optimization
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
-test.t1 optimize error Got error -1 "Internal error < 0 (Not system error)" from storage engine
+test.t1 optimize error Got error -1 "Internal error < 0 (Not system error)" from storage engine MEMORY
test.t1 optimize status Operation failed
Warnings:
-Error 1030 Got error -1 "Internal error < 0 (Not system error)" from storage engine
+Error 1030 Got error -1 "Internal error < 0 (Not system error)" from storage engine MEMORY
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
#
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index ba16d7dd9de..1d045d0a58d 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -1473,3 +1473,44 @@ dog_id dog_id birthday dog_id t_id birthday dog_id t_id birthday a_id dog_id
SET optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2,t3,t4,t5;
SET optimizer_switch=@save_optimizer_switch;
+#
+# Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
+#
+CREATE TABLE t1 (a int);
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+CREATE TABLE t2 (a int);
+INSERT INTO t2 (a) VALUES (1),(2),(3),(4);
+EXPLAIN
+SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;
+a
+1
+2
+3
+4
+EXPLAIN
+SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
+SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;
+a
+1
+2
+3
+4
+EXPLAIN
+SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort
+1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
+SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
+a
+1
+2
+3
+4
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/join_cache.result b/mysql-test/r/join_cache.result
index bb455f2b39a..618ce7e540b 100644
--- a/mysql-test/r/join_cache.result
+++ b/mysql-test/r/join_cache.result
@@ -5595,7 +5595,7 @@ DROP TABLE t1,t2,t3;
#
CREATE TABLE t1 (
col269 decimal(31,10) unsigned DEFAULT NULL,
-col280 multipoint DEFAULT NULL,
+col280 geometry DEFAULT NULL,
col281 tinyint(1) DEFAULT NULL,
col282 time NOT NULL,
col284 datetime DEFAULT NULL,
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index dfb1a8c72d3..255714a7236 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -235,7 +235,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`b` = `test`.`t7`.`b`))) where 1
+Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10))) where 1
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM (t6, t7)
LEFT JOIN
@@ -556,7 +556,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM t0,t1
@@ -652,7 +652,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
SELECT t9.a,t9.b
FROM t9;
a b
@@ -858,7 +858,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t3`.`b` is not null))) where 1
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM (t3,t4)
LEFT JOIN
@@ -920,7 +920,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0);
INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0);
CREATE INDEX idx_b ON t4(b);
@@ -972,7 +972,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and ((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`))))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0);
CREATE INDEX idx_b ON t8(b);
EXPLAIN EXTENDED
@@ -1022,7 +1022,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0);
CREATE INDEX idx_b ON t1(b);
CREATE INDEX idx_a ON t0(a);
@@ -1073,7 +1073,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
@@ -1215,7 +1215,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index
-1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index
+1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
a b c
NULL 0 0
@@ -1286,7 +1286,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1 SIMPLE t3 index c c 5 NULL 0 Using where; Using index
-1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index
+1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
a b c
NULL NULL NULL
@@ -1843,7 +1843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 100.00 Using where; Not exists
1 SIMPLE t4 ALL NULL NULL NULL NULL 0 0.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`a`))) left join `test`.`t4` on((`test`.`t4`.`b` = `test`.`t3`.`a`))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on((`test`.`t4`.`b` = `test`.`t3`.`a`))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`)
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result
index 69eb4532c73..c744df9e2fe 100644
--- a/mysql-test/r/join_nested_jcl6.result
+++ b/mysql-test/r/join_nested_jcl6.result
@@ -246,7 +246,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t7`.`b` is not null))) where 1
+Note 1003 select `test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t7`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` is not null))) where 1
SELECT t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM (t6, t7)
LEFT JOIN
@@ -567,7 +567,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)))
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b
FROM t0,t1
@@ -663,7 +663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
SELECT t9.a,t9.b
FROM t9;
a b
@@ -869,7 +869,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ref idx_b idx_b 5 test.t3.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t3`.`b` is not null))) where 1
+Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`b` = `test`.`t3`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t3`.`b` is not null))) where 1
SELECT t2.a,t2.b,t3.a,t3.b,t4.a,t4.b
FROM (t3,t4)
LEFT JOIN
@@ -931,7 +931,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
INSERT INTO t4 VALUES (-3,12,0), (-4,13,0), (-1,11,0), (-3,11,0), (-5,15,0);
INSERT INTO t5 VALUES (-3,11,0), (-2,12,0), (-3,13,0), (-4,12,0);
CREATE INDEX idx_b ON t4(b);
@@ -983,7 +983,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t8 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
INSERT INTO t8 VALUES (-3,12,0), (-1,14,0), (-5,15,0), (-1,11,0), (-4,13,0);
CREATE INDEX idx_b ON t8(b);
EXPLAIN EXTENDED
@@ -1033,7 +1033,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` > 0) and (`test`.`t4`.`a` > 0) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t8`.`a` >= 0) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`a` > 0) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
INSERT INTO t1 VALUES (-1,133,0), (-2,12,0), (-3,11,0), (-5,15,0);
CREATE INDEX idx_b ON t1(b);
CREATE INDEX idx_a ON t0(a);
@@ -1082,9 +1082,9 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t5 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t7 hash_ALL NULL #hash#$hj 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BNLH join)
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t8 ref idx_b idx_b 5 test.t7.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
+1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
-Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t6`.`b` < 10) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t7`.`b` is not null)))) on(((`test`.`t6`.`b` >= 2) and (`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and (((`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t5`.`b` = `test`.`t0`.`b`)) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
+Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t3`.`a` = 1) and (`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` is not null))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10) and (`test`.`t5`.`b` is not null)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2) and (`test`.`t5`.`b` is not null)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2) and (`test`.`t1`.`a` > 0))) join `test`.`t9` where ((`test`.`t0`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t9`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t8`.`b` = `test`.`t9`.`b`) or isnull(`test`.`t8`.`c`)))
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
@@ -1226,7 +1226,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1 SIMPLE t3 index c c 5 NULL 6 Using where; Using index
-1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index
+1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
a b c
NULL 0 0
@@ -1297,7 +1297,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL a 5 NULL 21 Using index
1 SIMPLE t3 index c c 5 NULL 0 Using where; Using index
-1 SIMPLE t2 ref b b 5 test.t3.c 2 Using where; Using index
+1 SIMPLE t2 ref b b 5 test.t3.c 2 Using index
SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
a b c
NULL NULL NULL
@@ -1854,7 +1854,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1 100.00 Using where; Not exists; Using join buffer (incremental, BNLH join)
1 SIMPLE t4 hash_ALL NULL #hash#$hj 5 test.t3.a 0 0.00 Using where; Using join buffer (incremental, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on(((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t3`.`b` = `test`.`t1`.`a`))) left join `test`.`t4` on(((`test`.`t4`.`b` = `test`.`t3`.`a`) and (`test`.`t3`.`a` is not null)))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`)
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`b` AS `b` from `test`.`t1` left join (`test`.`t2` left join `test`.`t3` on((`test`.`t3`.`b` = `test`.`t1`.`a`)) left join `test`.`t4` on(((`test`.`t4`.`b` = `test`.`t3`.`a`) and (`test`.`t3`.`a` is not null)))) on((`test`.`t2`.`a` = `test`.`t1`.`a`)) where isnull(`test`.`t3`.`a`)
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index fd2a948847c..c28887d4ff2 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -2008,7 +2008,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index
Warnings:
-Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5
+Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5
SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a
WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5
ORDER BY t1.pk;
diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result
index 650946d8b06..0184e236d14 100644
--- a/mysql-test/r/join_outer_innodb.result
+++ b/mysql-test/r/join_outer_innodb.result
@@ -183,6 +183,296 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t6b ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
drop table t1,t2,t3,t4,t5,t6;
+#
+Bug mdev-4318: view over a complex query with outer joins
+#
+CREATE TABLE t1 (
+a1 int NOT NULL, a2 int NOT NULL, a3 int DEFAULT NULL, a4 tinyint NOT NULL,
+a5 int NOT NULL, a6 tinyint NOT NULL, a7 tinyint(4) DEFAULT NULL,
+a8 smallint(6) DEFAULT NULL, a9 smallint(6) DEFAULT NULL, a10 tinyint NOT NULL,
+PRIMARY KEY (a1), KEY a2 (a2), KEY a3 (a3), KEY a4 (a4), KEY a6 (a6),
+KEY a5 (a5), KEY a7 (a7), KEY a8 (a8), KEY a9 (a9)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(3360,5684,2219,1,316832,1,0,NULL,NULL,NULL),
+(3362,2754,597,2,316844,1,0,NULL,NULL,NULL),
+(3363,369,NULL,1,317295,1,0,NULL,NULL,NULL);
+Warnings:
+Warning 1048 Column 'a10' cannot be null
+Warning 1048 Column 'a10' cannot be null
+Warning 1048 Column 'a10' cannot be null
+CREATE TABLE t2 (
+b1 int NOT NULL, b2 int NOT NULL, PRIMARY KEY (b1,b2), KEY b2 (b2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+c1 int NOT NULL, PRIMARY KEY (c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES
+(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),
+(1000),(1001),(1002),(1003),(9999);
+CREATE TABLE t4 (
+d1 int NOT NULL, PRIMARY KEY (d1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t4 VALUES (5674),(5676),(5680),(5684),(5685);
+CREATE TABLE t5 (
+e1 int NOT NULL, e2 varchar(64) NOT NULL, PRIMARY KEY (e1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t5 VALUES
+(5684,'51a5de7a9f56314e082094d78f58be082c3cf0c1'),
+(5685,'754dc8292cb9f5eb9ade126fe7e961c62412a349'),
+(5686,'75eeb33f1c819bac21f6d023b4c5b24185eeda5c');
+CREATE TABLE t6 (
+f1 int NOT NULL, PRIMARY KEY (f1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t6 VALUES (5542),(5620),(5686);
+CREATE TABLE t7 (
+g1 tinyint NOT NULL DEFAULT '0', g2 varchar(20) NOT NULL, PRIMARY KEY (g1)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t7 VALUES
+(1,'60feec2b20ed19f55ad0'),(3,'9ddb18bff7fcbd1e3133'),
+(5,'a05599df9222bb160d11'),(7,'e31bae372f7d01df0589'),
+(9,'8f8372dd7fc8eb46c8a3'),(11,'f8d0e28529e990a09309');
+CREATE TABLE t8 (
+h1 tinyint NOT NULL, h2 varchar(128) DEFAULT NULL, PRIMARY KEY (h1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t8 VALUES (1,'b'),(2,'c'),(3,'d'),(4,'e');
+CREATE TABLE t9 (
+i1 tinyint NOT NULL, i2 varchar(7) NOT NULL, i3 varchar(128) NOT NULL,
+PRIMARY KEY (i1,i2), KEY i2 (i2), KEY i3 (i3)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t9 VALUES
+(2,'a','07630d223c7e5f7b1feb19b3caafb0833fd028eb'),
+(3,'b','1ca53dcc50b68af86f4b1b4676dbed917b543c30'),
+(1,'b','2c01ac36c1ce9a7de66be89f85d8aa5f0052e2e8'),
+(4,'a','496c486b3a9edc439477fef7d34cbefdebba86df'),
+(3,'a','98bf72d8d467201058a5f69bd7709bfc74a8637e'),
+(2,'b','9a45425f6160fb59d7f8a02c721498d4ce945302'),
+(4,'b','9c9a7300f3e708f8e430f9f3376d966f5951f583'),
+(1,'a','c0af3f076b905f31cbb51af304b9c7ad539e0861');
+CREATE TABLE t10 (
+j1 tinyint NOT NULL, j2 varchar(20) NOT NULL, PRIMARY KEY (j1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t10 VALUES (1,'b'),(2,'c'),(3,'d');
+CREATE TABLE t11 (
+k1 int NOT NULL, k2 datetime DEFAULT NULL, k3 int DEFAULT NULL,
+k4 int DEFAULT NULL, PRIMARY KEY (k1), KEY k3 (k3), KEY k4 (k4)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t11 VALUES
+(317422,'2013-03-18 11:43:03',1,NULL),(317423,'2013-03-18 11:43:11',1,NULL),
+(317424,'2013-03-18 11:52:01',1,1),(317425,'2013-03-18 11:52:01',1,1),
+(317426,'2013-03-18 11:56:38',1,1),(317427,'2013-03-18 12:18:25',1,NULL),
+(317428,'2013-03-18 12:46:28',1,NULL),(317429,'2013-03-18 12:46:28',1,NULL),
+(317430,'2013-03-18 12:46:28',1,NULL),(317431,'2013-03-18 12:46:28',1,NULL),
+(317432,'2013-03-18 12:46:28',1,NULL),(317433,'2013-03-18 12:46:28',1,NULL),
+(317434,'2013-03-18 12:46:28',1,NULL),(317435,'2013-03-18 12:46:28',1,NULL),
+(317436,'2013-03-18 12:46:28',1,NULL),(317437,'2013-03-18 12:46:28',1,NULL),
+(317438,'2013-03-18 12:46:28',1,NULL),(317439,'2013-03-18 12:46:28',1,NULL),
+(317440,'2013-03-18 12:55:20',1,NULL),(317441,'2013-03-18 12:58:29',1,NULL),
+(317442,'2013-03-18 13:06:02',1,NULL),(317443,'2013-03-18 15:23:18',21,NULL);
+CREATE TABLE t12 (
+l1 int NOT NULL, l2 varchar(64) NOT NULL, PRIMARY KEY (l1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t12 VALUES
+(552,'59a498252ef59f96fbdc13a414abe244d8e8bc30'),
+(554,'c6025c7cb2d9dfb1be7ce4a61f35b45bb9e61ba3'),
+(555,'b245bcc672082bb6d10794b2b4ac972dd14b1cf5');
+CREATE TABLE t13 (
+m1 int NOT NULL, m2 int NOT NULL, m3 int NOT NULL,
+PRIMARY KEY (m1,m2,m3), KEY m3 (m3), KEY m2 (m2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t13 VALUES (3324,43,4),(3332,263,1),(3348,27,3);
+CREATE TABLE t14 (
+n1 smallint NOT NULL, n2 varchar(64) NOT NULL, PRIMARY KEY (n1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t14 VALUES
+(21,'685bf7ca576af964c7cff564d5e4473b81499b8b'),
+(23,'b8e42dab1ab952406b3accfb47089c61478138a8'),
+(25,'3fea441e411db8c70bf039b50c8f18f59515be53'),
+(27,'998aecc30fd0e0b8a1cac6590e5eccc2d7822223');
+CREATE TABLE t15 (
+o1 smallint NOT NULL, PRIMARY KEY (o1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t15 VALUES (1),(3);
+CREATE TABLE t16 (
+p1 smallint NOT NULL, p2 varchar(7) NOT NULL, p3 varchar(64) NOT NULL,
+PRIMARY KEY (p1,p2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t16 VALUES
+(1,'a','66bdbb389456f3ae97206da115a7b397c31400e8'),
+(1,'b','66bdbb389456f3ae97206da115a7b397c31400e8'),
+(3,'a','386c10e454278c6e27feb16258089166422f79b4'),
+(3,'b','386c10e454278c6e27feb16258089166422f79b4');
+create view v1 as select t3.c1,t5.e2,t1.a1,t14.n2,t16.p3,t10.j2,t7.g2,t11.k2,l3.l2,
+t9.i3,t12.l2 AS l_l2,l2.l2 AS l2_l2,l4.l1 AS l4_l1,t6.f1
+from
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+t1
+left join t2 on t1.a1 = t2.b1
+)
+left join t3 on t2.b2 = t3.c1
+)
+left join t4 on t1.a2 = t4.d1
+)
+left join t5 on t4.d1 = t5.e1
+)
+left join t6 on t1.a3 = t6.f1
+)
+left join t5 e2 on t6.f1 = e2.e1
+)
+join t7 on t1.a7 = t7.g1
+)
+join t8 on t1.a4 = t8.h1
+)
+join t9 on t8.h1 = t9.i1
+)
+join t10 on t1.a6 = t10.j1
+)
+join t11 on t1.a5 = t11.k1
+)
+left join t12 on t11.k3 = t12.l1
+)
+left join t12 l2 on t11.k4 = l2.l1
+)
+left join t13 on t1.a1 = t13.m1 and t13.m3 = 4
+)
+left join t12 l4 on l4.l1 = t13.m2
+)
+left join t13 m2 on t1.a1 = m2.m1 and m2.m3 = 3
+)
+left join t12 l3 on l3.l1 = m2.m2
+)
+left join t14 on t1.a8 = t14.n1
+)
+left join t15 on t1.a9 = t15.o1
+)
+left join t16 on t15.o1 = t16.p1
+where t1.a10 = 1;
+explain select t3.c1,t5.e2,t1.a1,t14.n2,t16.p3,t10.j2,t7.g2,t11.k2,l3.l2,
+t9.i3,t12.l2 AS l_l2,l2.l2 AS l2_l2,l4.l1 AS l4_l1,t6.f1
+from
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+t1
+left join t2 on t1.a1 = t2.b1
+)
+left join t3 on t2.b2 = t3.c1
+)
+left join t4 on t1.a2 = t4.d1
+)
+left join t5 on t4.d1 = t5.e1
+)
+left join t6 on t1.a3 = t6.f1
+)
+left join t5 e2 on t6.f1 = e2.e1
+)
+join t7 on t1.a7 = t7.g1
+)
+join t8 on t1.a4 = t8.h1
+)
+join t9 on t8.h1 = t9.i1
+)
+join t10 on t1.a6 = t10.j1
+)
+join t11 on t1.a5 = t11.k1
+)
+left join t12 on t11.k3 = t12.l1
+)
+left join t12 l2 on t11.k4 = l2.l1
+)
+left join t13 on t1.a1 = t13.m1 and t13.m3 = 4
+)
+left join t12 l4 on l4.l1 = t13.m2
+)
+left join t13 m2 on t1.a1 = m2.m1 and m2.m3 = 3
+)
+left join t12 l3 on l3.l1 = m2.m2
+)
+left join t14 on t1.a8 = t14.n1
+)
+left join t15 on t1.a9 = t15.o1
+)
+left join t16 on t15.o1 = t16.p1
+where t1.a10 = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index
+1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where
+1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
+1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
+1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
+1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
+1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
+1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
+1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
+1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
+1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
+1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
+1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
+1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
+1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+explain select * from v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index
+1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where
+1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
+1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
+1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
+1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
+1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
+1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
+1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
+1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
+1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
+1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
+1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
+1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
+1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+drop view v1;
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result
index d891f5c49b2..4efb6126cba 100644
--- a/mysql-test/r/join_outer_jcl6.result
+++ b/mysql-test/r/join_outer_jcl6.result
@@ -2019,7 +2019,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 100.00 Using index
Warnings:
-Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where (1) order by 5
+Note 1003 select 5 AS `pk` from `test`.`t2` join `test`.`t1` where 1 order by 5
SELECT t1.pk FROM t2 JOIN t1 ON t2.pk = t1.a
WHERE t1.b BETWEEN 5 AND 6 AND t1.pk IS NULL OR t1.pk = 5
ORDER BY t1.pk;
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index 58cb7430563..a3588017e97 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -269,3 +269,9 @@ call p2();
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE t1;
+create table option (option int not null);
+drop table option;
+set option=1;
+ERROR HY000: Unknown system variable 'option'
+set option option=1;
+ERROR HY000: Unknown system variable 'option'
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index 76784be1e16..18da8765d4b 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -251,7 +251,7 @@ alter table mysql.slow_log engine=NonExistentEngine;
Warnings:
Warning 1286 Unknown storage engine 'NonExistentEngine'
alter table mysql.slow_log engine=memory;
-ERROR HY000: This storage engine cannot be used for log tables
+ERROR HY000: Storage engine MEMORY cannot be used for log tables
set storage_engine= @save_storage_engine;
drop table mysql.slow_log;
drop table mysql.general_log;
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index c478d792e52..ac368a06bc9 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -272,7 +272,7 @@ Database Table In_use Name_locked
test t_bug44738_uppercase 0 0
# So attempt to create table with the same name should fail.
create table t_bug44738_UPPERCASE (i int);
-ERROR HY000: Can't find file: 't_bug44738_uppercase' (errno: 2 "No such file or directory")
+ERROR HY000: Can't find file: './test/t_bug44738_uppercase.MYI' (errno: 2 "No such file or directory")
# And should succeed after FLUSH TABLES.
flush tables;
create table t_bug44738_UPPERCASE (i int);
diff --git a/mysql-test/r/mdev316.result b/mysql-test/r/mdev316.result
index 43082769872..78272549e81 100644
--- a/mysql-test/r/mdev316.result
+++ b/mysql-test/r/mdev316.result
@@ -16,7 +16,7 @@ cast(convert(0x0030 using ucs2) as decimal(5.2)) cast(concat(convert(0x0030 usin
0 0
select cast(convert(_ucs2 0x0030 using latin1) as date), cast(concat(convert(_ucs2 0x0030 using latin1)) as date);
cast(convert(_ucs2 0x0030 using latin1) as date) cast(concat(convert(_ucs2 0x0030 using latin1)) as date)
-NULL NULL
+0000-00-00 0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index b2e71faf741..1c94f867a54 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -2850,7 +2850,7 @@ SET DEBUG_SYNC= 'now SIGNAL blocked';
# Reaping: DROP DATABASE db1
# Connection con2
# Reaping: RENAME TABLE db1.t1 TO test.t1
-Got one of the listed errors
+ERROR 42S02: Table 'db1.t1' doesn't exist
# Connection default
CREATE DATABASE db1;
CREATE TABLE test.t2 (a INT);
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index b5c85555ed8..5c4261e7d6d 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -580,25 +580,25 @@ select max(b) from t1 where a = 2;
max(b)
1
drop table t3,t1,t2;
-CREATE TABLE t1 (c1 INT NOT NULL);
-CREATE TABLE t2 (c1 INT NOT NULL);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2);
-SELECT * FROM t3;
-c1
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t2 values (2);
+create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
+select * from t3;
+a
1
2
-CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL);
-CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL);
-INSERT INTO t4 VALUES (4);
-INSERT INTO t5 VALUES (5);
-CREATE TEMPORARY TABLE t6 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t4,t5);
-SELECT * FROM t6;
-c1
-4
-5
-DROP TABLE t6, t3, t1, t2, t4, t5;
+create temporary table t4 (a int not null);
+create temporary table t5 (a int not null);
+insert into t4 values (1);
+insert into t5 values (2);
+create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5);
+select * from t6;
+a
+1
+2
+drop table t6, t3, t1, t2, t4, t5;
create temporary table t1 (a int not null);
create temporary table t2 (a int not null);
insert into t1 values (1);
@@ -996,11 +996,6 @@ m1 CREATE TABLE `m1` (
`a` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, m1;
-CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
-SELECT MAX(a) FROM t1;
-MAX(a)
-NULL
-DROP TABLE t1;
CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
@@ -1935,9 +1930,9 @@ ALTER TABLE t2 UNION=(t3,t1);
SELECT * FROM t2;
ERROR HY000: Table 't3' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, t2, t3;
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
+CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t3;
@@ -2262,7 +2257,7 @@ CREATE TABLE m1(a int)engine=merge union=(t1,t2,t3,t4,t5,t6,t7);
SELECT 1 FROM m1;
1
HANDLER m1 OPEN;
-ERROR HY000: Table storage engine for 'm1' doesn't have this option
+ERROR HY000: Storage engine MRG_MyISAM of the table `test`.`m1` doesn't have this option
DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
SELECT 1 FROM m1;
ERROR 42S02: Table 'test.m1' doesn't exist
@@ -2400,6 +2395,142 @@ Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
DROP TABLE m1, t1;
End of 5.1 tests
+#
+# MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
+#
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 ( i int ) engine=myisam;
+insert into t2 values (1),(2);
+create table t3 (a int, b int, filler char(100), key(a), key(b)) engine=myisam;
+create table t4 like t3;
+insert into t3
+select A.a+10*B.a+100*C.a,
+A.a+10*B.a+100*C.a,
+'filler-data-FILLER-DATA-qqq'
+from t1 A, t1 B, t1 C where C.a < 5;
+insert into t4
+select A.a+10*B.a+100*C.a,
+A.a+10*B.a+100*C.a,
+'filler-data-FILLER-DATA-qqq'
+from t1 A, t1 B, t1 C where C.a >= 5;
+create table t5 like t3;
+alter table t5 engine=merge;
+alter table t5 union(t3, t4);
+update t5 set b=999, a=999 where b>950;
+explain
+select * from t2, t5 where t5.a=999 and t5.b=999;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t5 index_merge a,b a,b 5,5 NULL 6 Using intersect(a,b); Using where; Using join buffer (flat, BNL join)
+select * from t2, t5 where t5.a=999 and t5.b=999;
+i a b filler
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+drop table t5;
+drop table t1,t2,t3,t4;
+End of 5.3 tests
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+MAX(a)
+NULL
+DROP TABLE t1;
#
# An additional test case for Bug#27430 Crash in subquery code
# when in PS and table DDL changed after PREPARE
@@ -2752,7 +2883,7 @@ Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
@@ -2769,7 +2900,7 @@ Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m1;
c1 c2
111 121
@@ -2858,7 +2989,7 @@ Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
INSERT INTO m1 VALUES (511, 521);
SELECT * FROM m1;
c1 c2
@@ -2909,7 +3040,7 @@ Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
#
CREATE TABLE m2 SELECT * FROM m1;
SHOW CREATE TABLE m2;
@@ -2961,7 +3092,7 @@ Table Create Table
m2 CREATE TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
@@ -2987,7 +3118,7 @@ Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
@@ -3157,7 +3288,7 @@ Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
@@ -3174,7 +3305,7 @@ Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m1;
c1 c2
111 121
@@ -3265,7 +3396,7 @@ Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
INSERT INTO m1 VALUES (511, 521);
SELECT * FROM m1;
c1 c2
@@ -3316,7 +3447,7 @@ Table Create Table
m1 CREATE TEMPORARY TABLE `m1` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
CREATE TABLE m2 SELECT * FROM m1;
ERROR HY000: Table 'm2' was not locked with LOCK TABLES
#
@@ -3361,14 +3492,14 @@ Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
LOCK TABLE m1 WRITE, m2 WRITE;
SHOW CREATE TABLE m2;
Table Create Table
m2 CREATE TEMPORARY TABLE `m2` (
`c1` int(11) DEFAULT NULL,
`c2` int(11) DEFAULT NULL
-) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
SELECT * FROM m2;
c1 c2
111 121
@@ -3421,7 +3552,7 @@ CREATE TABLE t2 (c1 int);
CREATE TABLE t3 (c1 int) ENGINE = MERGE UNION (t1,t2);
START TRANSACTION;
HANDLER t3 OPEN;
-ERROR HY000: Table storage engine for 't3' doesn't have this option
+ERROR HY000: Storage engine MRG_MyISAM of the table `test`.`t3` doesn't have this option
DROP TABLE t1, t2, t3;
# Connection default.
# Disconnecting con1, all mdl_tickets must have been released.
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 55e5db231a9..461673f5b21 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -689,6 +689,58 @@ DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
#
+# MDEV-4123: Incorrect results after multi-table update or
+# assertion `!table || (!table->read_set ||
+# bitmap_is_set(table->read_set, field_index))' failure
+#
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (
+id int(10) unsigned NOT NULL,
+level tinyint(3) unsigned NOT NULL,
+PRIMARY KEY (id)
+);
+INSERT INTO t1 VALUES (2519583,1);
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t2 (
+club_id int(11) NOT NULL DEFAULT '0',
+profile_id int(11) NOT NULL DEFAULT '0',
+member_level_id int(11) NOT NULL DEFAULT '0',
+PRIMARY KEY (profile_id,club_id)
+);
+INSERT INTO t2 VALUES (2,2519583,12);
+DROP TABLE IF EXISTS t3;
+Warnings:
+Note 1051 Unknown table 't3'
+CREATE TABLE t3 (
+member_level_id int(11) unsigned NOT NULL DEFAULT '0',
+map_level int(11) unsigned NOT NULL DEFAULT '0',
+map_status int(11) unsigned NOT NULL DEFAULT '0',
+PRIMARY KEY (member_level_id)
+);
+INSERT INTO t3 VALUES (12,12,1);
+CREATE
+VIEW v1 AS
+select club_id,profile_id,
+map_level AS member_level_id,map_status AS member_status
+from (t2 tc join t3 map
+on(((tc.member_level_id = map.member_level_id) and
+(club_id = 2))));
+select level, count(*) as cnt from t1 group by level;
+level cnt
+1 1
+UPDATE t1 c LEFT JOIN v1 t ON (c.id = t.profile_id AND t.club_id = 2)
+SET c.level = IF (t.member_status IS NULL, 1, IF (t.member_status = 1, 2,3));
+select level, count(*) as cnt from t1 group by level;
+level cnt
+2 1
+drop view v1;
+drop table t1,t2,t3;
+end of tests
+#
# BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
# table is updated twice
#
@@ -742,3 +794,4 @@ SELECT * FROM t2;
col_int_key pk_1 pk_2 col_int
1 7 11 4
DROP TABLE t1,t2;
+end of 5.5 tests
diff --git a/mysql-test/r/myisam-metadata.result b/mysql-test/r/myisam-metadata.result
new file mode 100644
index 00000000000..5192253d5d1
--- /dev/null
+++ b/mysql-test/r/myisam-metadata.result
@@ -0,0 +1,12 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+id INT PRIMARY KEY,
+a VARCHAR(100),
+INDEX(a)
+) ENGINE=MyISAM;
+ALTER TABLE t1 DISABLE KEYS;
+ALTER TABLE t1 ENABLE KEYS;
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 MyISAM 10 Dynamic 100000 27 # # # 0 NULL # # # latin1_swedish_ci NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/myisam-system.result b/mysql-test/r/myisam-system.result
index 924e7885814..9d5a59459ec 100644
--- a/mysql-test/r/myisam-system.result
+++ b/mysql-test/r/myisam-system.result
@@ -2,12 +2,18 @@ drop table if exists t1,t2;
create table t1 (a int) engine=myisam;
drop table if exists t1;
Warnings:
-Warning 2 Can't find file: 't1' (errno: 2 "No such file or directory")
+Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
create table t1 (a int) engine=myisam;
+select * from t1;
+ERROR HY000: Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
drop table t1;
-Got one of the listed errors
+Warnings:
+Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
create table t1 (a int) engine=myisam;
+select * from t1;
+ERROR HY000: File './test/t1.MYD' not found (Errcode: 2 "No such file or directory")
drop table t1;
-Got one of the listed errors
+Warnings:
+Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
drop table t1;
ERROR 42S02: Unknown table 't1'
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 6c0826775ad..2530182ea67 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -618,7 +618,7 @@ t1 1 a 1 a A 1000 NULL NULL YES BTREE
alter table t1 engine=heap;
alter table t1 disable keys;
Warnings:
-Note 1031 Table storage engine for 't1' doesn't have this option
+Note 1031 Storage engine MEMORY of the table `test`.`t1` doesn't have this option
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL 500 NULL NULL YES HASH
@@ -2291,19 +2291,19 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 TRANSACTIONAL=1
drop table t1;
CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t1;
Table Checksum
-test.t1 326284887
+test.t1 310616673
CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t2;
Table Checksum
-test.t2 326284887
+test.t2 310616673
CREATE TABLE t3 select * from t1;
checksum table t3;
Table Checksum
-test.t3 326284887
+test.t3 310616673
drop table t1,t2,t3;
create table t1 (a1 int,a2 int,a3 int,a4 int,a5 int,a6 int,a7 int,a8 int,a9 int,a10 int,a11 int,a12 int,a13 int,a14 int,a15 int,a16 int,a17 int,a18 int,a19 int,a20 int,a21 int,a22 int,a23 int,a24 int,a25 int,a26 int,a27 int,a28 int,a29 int,a30 int,a31 int,a32 int,
key(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32)) engine=myisam;
@@ -2337,25 +2337,6 @@ h+0 d + 0 e g + 0
1 1 3 0
1 1 4 0
DROP TABLE t1;
-#
-# Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field
-# (same content / differen checksum)
-#
-CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
-checksum table t1;
-Table Checksum
-test.t1 326284887
-CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
-checksum table t2;
-Table Checksum
-test.t2 326284887
-CREATE TABLE t3 select * from t1;
-checksum table t3;
-Table Checksum
-test.t3 326284887
-drop table t1,t2,t3;
CREATE TABLE t1(a INT, b CHAR(10), KEY(a), KEY(b));
INSERT INTO t1 VALUES(1,'0'),(2,'0'),(3,'0'),(4,'0'),(5,'0'),
(6,'0'),(7,'0');
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index e0670f7d643..4d2ac25a0eb 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -513,5 +513,7 @@ create database `aa``bb````cc`;
DATABASE()
aa`bb``cc
drop database `aa``bb````cc`;
+a
+>>\ndelimiter\n<<
End of tests
diff --git a/mysql-test/r/mysql_client_test.result b/mysql-test/r/mysql_client_test.result
index 7875464ebe2..4ad07b20ab5 100644
--- a/mysql-test/r/mysql_client_test.result
+++ b/mysql-test/r/mysql_client_test.result
@@ -1,5 +1,6 @@
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
+call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
ok
# cat MYSQL_TMP_DIR/test_wl4435.out.log
diff --git a/mysql-test/r/mysql_client_test_nonblock.result b/mysql-test/r/mysql_client_test_nonblock.result
index edda7980e97..e37e2132b0c 100644
--- a/mysql-test/r/mysql_client_test_nonblock.result
+++ b/mysql-test/r/mysql_client_test_nonblock.result
@@ -1,5 +1,6 @@
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
+call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
ok
SET @@global.general_log= @old_general_log;
SET @@global.slow_query_log= @old_slow_query_log;
diff --git a/mysql-test/r/mysqlbinlog-innodb.result b/mysql-test/r/mysqlbinlog-innodb.result
index 41d15bc32d3..a5865fe4fac 100644
--- a/mysql-test/r/mysqlbinlog-innodb.result
+++ b/mysql-test/r/mysqlbinlog-innodb.result
@@ -19,6 +19,7 @@ a
1
2
FLUSH LOGS;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -50,6 +51,8 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -81,5 +84,6 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
DROP DATABASE test2;
DROP TABLE t1;
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 63b0ea2a71a..27693b62f51 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -14,6 +14,7 @@ insert into t1 values ("Alas");
flush logs;
--- Local --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -95,8 +96,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Broken LOAD DATA --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -131,8 +134,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --database --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -186,8 +191,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --start-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -213,8 +220,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Remote --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -296,8 +305,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Broken LOAD DATA --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -332,8 +343,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --database --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -387,8 +400,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- --start-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -414,8 +429,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- reading stdin --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -435,6 +452,8 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -453,6 +472,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t1,t2;
flush logs;
flush logs;
@@ -495,6 +515,7 @@ call p1();
drop procedure p1;
call p1();
ERROR 42000: PROCEDURE test.p1 does not exist
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -517,6 +538,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
call p1();
1
1
@@ -545,6 +567,7 @@ C3BF
D0AA
drop table t1;
flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -634,6 +657,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
CREATE TABLE t1 (c1 CHAR(10));
FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
@@ -721,6 +745,7 @@ RESET MASTER;
FLUSH LOGS;
#
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -772,8 +797,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -806,8 +833,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -846,8 +875,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -873,6 +904,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
End of 5.0 tests
End of 5.1 tests
# Expect deprecation warning.
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 10f1691e80a..b28cfd8ef20 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -188,6 +188,7 @@ Table Op Msg_type Msg_text
test.v1 check status OK
information_schema.routines check note The storage engine for the table doesn't support check
drop view v1;
+call mtr.add_suppression("Error reading file './test/t1.frm'");
CREATE TABLE t1(a INT) engine=myisam;
CREATE TABLE t2(a INT) engine=myisam;
test.t1
@@ -204,15 +205,15 @@ t1
v1
show tables;
Tables_in_test
-t1
#mysql50#v-1
+t1
v1
test.t1 OK
show tables;
Tables_in_test
t1
-v1
v-1
+v1
drop view v1, `v-1`;
drop table t1;
SET NAMES utf8;
diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff
index 0fa6e41391f..24719fce917 100644
--- a/mysql-test/r/mysqld--help,win.rdiff
+++ b/mysql-test/r/mysqld--help,win.rdiff
@@ -1,6 +1,6 @@
---- r/mysqld--help.result 2012-10-25 14:02:57.000000000 +0200
-+++ mysqld--help,win.result~ 2012-10-30 11:37:08.000000000 +0100
-@@ -244,7 +244,6 @@
+--- mysql-test/r/mysqld--help.result 2012-09-08 22:22:06 +0000
++++ mysql-test/r/mysqld--help.result 2012-10-01 14:03:59 +0000
+@@ -248,7 +248,6 @@
The number of segments in a key cache
-L, --language=name Client error messages in given language. May be given as
a full path. Deprecated. Use --lc-messages-dir instead.
@@ -8,7 +8,7 @@
--lc-messages=name Set the language used for the error messages.
-L, --lc-messages-dir=name
Directory where error messages are
-@@ -437,6 +436,7 @@
+@@ -443,6 +442,7 @@
NULLS_UNEQUAL (default behavior for 4.1 and later),
NULLS_EQUAL (emulate 4.0 behavior), and NULLS_IGNORED
--myisam-use-mmap Use memory mapping for reading and writing MyISAM tables
@@ -16,7 +16,7 @@
--net-buffer-length=#
Buffer length for TCP/IP and socket communication
--net-read-timeout=#
-@@ -774,6 +774,9 @@
+@@ -710,6 +710,9 @@
files within specified directory
--server-id=# Uniquely identifies the server instance in the community
of replication partners
@@ -26,7 +26,7 @@
--show-slave-auth-info
Show user and password in SHOW SLAVE HOSTS on this
master.
-@@ -841,6 +844,10 @@
+@@ -777,6 +780,10 @@
Log slow queries to given log file. Defaults logging to
'hostname'-slow.log. Must be enabled to activate other
slow log options
@@ -37,7 +37,7 @@
--socket=name Socket file to use for connection
--sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of
-@@ -849,6 +856,7 @@
+@@ -785,6 +792,7 @@
for the complete list of valid sql modes
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
@@ -45,7 +45,35 @@
--stored-program-cache=#
The soft upper limit for number of cached stored routines
for one connection.
-@@ -889,8 +897,8 @@
+@@ -817,25 +825,11 @@
+ values are COMMIT or ROLLBACK.
+ --thread-cache-size=#
+ How many threads we should keep in a cache for reuse
+- --thread-pool-idle-timeout=#
+- Timeout in seconds for an idle thread in the thread
+- pool.Worker thread will be shut down after timeout
+ --thread-pool-max-threads=#
+ Maximum allowed number of worker threads in the thread
+ pool
+- --thread-pool-oversubscribe=#
+- How many additional active worker threads in a group are
+- allowed.
+- --thread-pool-size=#
+- Number of thread groups in the pool. This parameter is
+- roughly equivalent to maximum number of concurrently
+- executing threads (threads in a waiting state do not
+- count as executing).
+- --thread-pool-stall-limit=#
+- Maximum query execution time in milliseconds,before an
+- executing non-yielding thread is considered stalled.If a
+- worker thread is stalled, additional worker thread may be
+- created to handle remaining clients.
++ --thread-pool-min-threads=#
++ Minimum number of threads in the thread pool.
+ --thread-stack=# The stack size for each thread
+ --time-format=name The TIME format (ignored)
+ --timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
+@@ -844,8 +838,8 @@
size, MySQL will automatically convert it to an on-disk
MyISAM or Aria table
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
@@ -56,7 +84,7 @@
--transaction-alloc-block-size=#
Allocation block size for transactions to be stored in
binary log
-@@ -993,7 +1001,6 @@
+@@ -949,7 +943,6 @@
key-cache-block-size 1024
key-cache-division-limit 100
key-cache-segments 0
@@ -64,7 +92,7 @@
lc-messages en_US
lc-messages-dir MYSQL_SHAREDIR/
lc-time-names en_US
-@@ -1056,6 +1063,7 @@
+@@ -1012,6 +1005,7 @@
myisam-sort-buffer-size 8388608
myisam-stats-method nulls_unequal
myisam-use-mmap FALSE
@@ -72,7 +100,7 @@
net-buffer-length 16384
net-read-timeout 30
net-retry-count 10
-@@ -1148,6 +1156,8 @@
+@@ -1077,6 +1071,8 @@
secure-auth FALSE
secure-file-priv (No default value)
server-id 0
@@ -81,7 +109,7 @@
show-slave-auth-info FALSE
skip-grant-tables TRUE
skip-name-resolve FALSE
-@@ -1164,6 +1174,7 @@
+@@ -1093,6 +1089,7 @@
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
@@ -89,3 +117,15 @@
sort-buffer-size 2097152
sql-mode
stack-trace TRUE
+@@ -1109,10 +1106,8 @@
+ table-open-cache 400
+ tc-heuristic-recover COMMIT
+ thread-cache-size 0
+-thread-pool-idle-timeout 60
+ thread-pool-max-threads 500
+-thread-pool-oversubscribe 3
+-thread-pool-stall-limit 500
++thread-pool-min-threads 1
+ thread-stack 294912
+ time-format %H:%i:%s
+ timed-mutexes FALSE
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 197743d6c6f..699e6764fa9 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -496,8 +496,8 @@ The following options may be given as the first argument:
mrr_cost_based, mrr_sort_keys, optimize_join_buffer_size,
outer_join_with_cache, partial_match_rowid_merge,
partial_match_table_scan, semijoin, semijoin_with_cache,
- subquery_cache, table_elimination, extended_keys } and
- val is one of {on, off, default}
+ subquery_cache, table_elimination, extended_keys,
+ exists_to_in } and val is one of {on, off, default}
--performance-schema
Enable the performance schema.
--performance-schema-accounts-size=#
@@ -890,6 +890,25 @@ The following options may be given as the first argument:
values are COMMIT or ROLLBACK.
--thread-cache-size=#
How many threads we should keep in a cache for reuse
+ --thread-pool-idle-timeout=#
+ Timeout in seconds for an idle thread in the thread
+ pool.Worker thread will be shut down after timeout
+ --thread-pool-max-threads=#
+ Maximum allowed number of worker threads in the thread
+ pool
+ --thread-pool-oversubscribe=#
+ How many additional active worker threads in a group are
+ allowed.
+ --thread-pool-size=#
+ Number of thread groups in the pool. This parameter is
+ roughly equivalent to maximum number of concurrently
+ executing threads (threads in a waiting state do not
+ count as executing).
+ --thread-pool-stall-limit=#
+ Maximum query execution time in milliseconds,before an
+ executing non-yielding thread is considered stalled.If a
+ worker thread is stalled, additional worker thread may be
+ created to handle remaining clients.
--thread-stack=# The stack size for each thread
--time-format=name The TIME format (ignored)
--timed-mutexes Specify whether to time mutexes (only InnoDB mutexes are
@@ -1192,6 +1211,10 @@ table-definition-cache 400
table-open-cache 400
tc-heuristic-recover COMMIT
thread-cache-size 0
+thread-pool-idle-timeout 60
+thread-pool-max-threads 500
+thread-pool-oversubscribe 3
+thread-pool-stall-limit 500
thread-stack 294912
time-format %H:%i:%s
timed-mutexes FALSE
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 6b0e044a491..33e10f29201 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -2791,8 +2791,8 @@ UNLOCK TABLES;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
-RETURN a+b */;;
+CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
+RETURN a+b ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2808,11 +2808,11 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1
+CREATE DEFINER=`root`@`localhost` FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1
begin
set f1= concat( 'hello', f1 );
return f1;
-end */;;
+end ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2828,8 +2828,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER="root"@"localhost"*/ /*!50003 PROCEDURE "a'b"()
-select 1 */;;
+CREATE DEFINER="root"@"localhost" PROCEDURE "a'b"()
+select 1 ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2845,8 +2845,8 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
-BEGIN SELECT a+b INTO c; end */;;
+CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
+BEGIN SELECT a+b INTO c; end ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -2862,10 +2862,10 @@ DELIMITER ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT)
+CREATE DEFINER=`root`@`localhost` PROCEDURE `bug9056_proc2`(OUT a INT)
BEGIN
select sum(id) from t1 into a;
-END */;;
+END ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
@@ -3851,8 +3851,8 @@ create procedure mysqldump_test_db.sp1() select 'hello';
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
-/*!50003 CREATE*/ /*!50020 DEFINER=`user1`@`%`*/ /*!50003 PROCEDURE `sp1`()
-select 'hello' */;;
+CREATE DEFINER=`user1`@`%` PROCEDURE `sp1`()
+select 'hello' ;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
diff --git a/mysql-test/r/mysqlslap.result b/mysql-test/r/mysqlslap.result
index 069c9182de2..38a7b0a694e 100644
--- a/mysql-test/r/mysqlslap.result
+++ b/mysql-test/r/mysqlslap.result
@@ -234,8 +234,8 @@ test
# 'bug58090' database should be present.
SHOW DATABASES;
Database
-information_schema
bug58090
+information_schema
mtr
mysql
performance_schema
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 86425825601..c6a806bec80 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -2493,3 +2493,25 @@ i
3
4
DROP TABLE t1;
+CREATE TABLE t1 ( d DATE NOT NULL)
+PARTITION BY RANGE( YEAR(d) ) (
+PARTITION p0 VALUES LESS THAN (1960),
+PARTITION p1 VALUES LESS THAN (1970),
+PARTITION p2 VALUES LESS THAN (1980),
+PARTITION p3 VALUES LESS THAN (1990)
+);
+ALTER TABLE t1 ADD PARTITION IF NOT EXISTS(
+PARTITION `p5` VALUES LESS THAN (2010)
+COMMENT 'APSTART \' APEND'
+);
+ALTER TABLE t1 ADD PARTITION IF NOT EXISTS(
+PARTITION `p5` VALUES LESS THAN (2010)
+COMMENT 'APSTART \' APEND'
+);
+Warnings:
+Note 1517 Duplicate partition name p5
+alter table t1 drop partition if exists p5;
+alter table t1 drop partition if exists p5;
+Warnings:
+Note 1507 Error in list of partitions to DROP
+DROP TABLE t1;
diff --git a/mysql-test/r/partition_debug_sync.result b/mysql-test/r/partition_debug_sync.result
index ad0f6df5ff2..826bca019d5 100644
--- a/mysql-test/r/partition_debug_sync.result
+++ b/mysql-test/r/partition_debug_sync.result
@@ -42,21 +42,18 @@ CREATE TABLE t2
b INTEGER NOT NULL,
KEY (b))
ENGINE = MYISAM
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (2),
+PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (2),
PARTITION p1 VALUES LESS THAN (20),
PARTITION p2 VALUES LESS THAN (100),
-PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
+PARTITION p3 VALUES LESS THAN MAXVALUE);
SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
ALTER TABLE t2 REMOVE PARTITIONING;
# Con default
-SET SESSION debug_dbug= "+d,sleep_before_no_locks_delete_table";
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
-SET SESSION debug_dbug= "-d,sleep_before_no_locks_delete_table";
# Con 1
ERROR 42S02: Table 'test.t2' doesn't exist
SET DEBUG_SYNC= 'RESET';
diff --git a/mysql-test/r/partition_disabled.result b/mysql-test/r/partition_disabled.result
index 2978a3b6d2e..505bec79610 100644
--- a/mysql-test/r/partition_disabled.result
+++ b/mysql-test/r/partition_disabled.result
@@ -3,7 +3,7 @@ FLUSH TABLES;
SELECT * FROM t1;
ERROR HY000: The MariaDB server is running with the --skip-partition option so it cannot execute this statement
TRUNCATE TABLE t1;
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: The MariaDB server is running with the --skip-partition option so it cannot execute this statement
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze Error The MariaDB server is running with the --skip-partition option so it cannot execute this statement
diff --git a/mysql-test/r/partition_example.result b/mysql-test/r/partition_example.result
index 2129eea0818..7b6e9aa5213 100644
--- a/mysql-test/r/partition_example.result
+++ b/mysql-test/r/partition_example.result
@@ -7,7 +7,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='5'
/*!50100 PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
@@ -20,7 +20,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 `VAROPT`='5'
/*!50100 PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1) ENGINE = EXAMPLE,
PARTITION p1 VALUES IN (2) ENGINE = EXAMPLE) */
diff --git a/mysql-test/r/partition_innodb_plugin.result b/mysql-test/r/partition_innodb_plugin.result
index fa2ef5c6c18..ceade2a793c 100644
--- a/mysql-test/r/partition_innodb_plugin.result
+++ b/mysql-test/r/partition_innodb_plugin.result
@@ -67,7 +67,7 @@ LOCK TABLE t1 WRITE;
# ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
# are incompatible with innodb_file_per_table = OFF;
ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
-ERROR HY000: Got error 140 "Wrong create options" from storage engine
+ERROR HY000: Got error 140 "Wrong create options" from storage engine InnoDB
t1#P#p0.ibd
t1.frm
t1.par
diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result
index f0844c0b407..10586ddc548 100644
--- a/mysql-test/r/partition_myisam.result
+++ b/mysql-test/r/partition_myisam.result
@@ -102,7 +102,6 @@ FLUSH TABLES;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Failed to read from the .par file
-test.t1 check Error Incorrect information in file: './test/t1.frm'
test.t1 check error Corrupt
SELECT * FROM t1;
ERROR HY000: Failed to read from the .par file
diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result
index 42dca557b3e..a1da9af675b 100644
--- a/mysql-test/r/partition_not_windows.result
+++ b/mysql-test/r/partition_not_windows.result
@@ -94,4 +94,4 @@ PARTITION p1 DATA DIRECTORY = '/not/existent/p1Data',
PARTITION p2 DATA DIRECTORY = '/not/existent/p2Data',
PARTITION p3 DATA DIRECTORY = '/not/existent/p3Data'
);
-Got one of the listed errors
+ERROR HY000: Can't create/write to file '/not/existent/p0Data/example#P#p0.MYD' (Errcode: 2 "No such file or directory")
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index ec7fd798d4c..f4d473c00d5 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -2235,9 +2235,10 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
# test with an invalid date, which lead to item->null_value is set.
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+1 SIMPLE t1 p20090401 ALL NULL NULL NULL NULL 2 Using where
Warnings:
Warning 1292 Incorrect datetime value: '2009-04-99'
+Warning 1292 Incorrect datetime value: '2009-04-99'
DROP TABLE t1;
CREATE TABLE t1
(a INT NOT NULL AUTO_INCREMENT,
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index 62864d0f16d..0eb49584c4a 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -35,18 +35,21 @@ PLUGIN_LICENSE GPL
LOAD_OPTION ON
PLUGIN_MATURITY Experimental
PLUGIN_AUTH_VERSION 3.14.15.926
-CREATE TABLE t1(a int) ENGINE=EXAMPLE;
+CREATE TABLE t1 (a int) ENGINE=EXAMPLE;
+CREATE TABLE t2 (a int) ENGINE=EXAMPLE;
+FLUSH TABLES;
SELECT * FROM t1;
a
set global example_ulong_var=500;
set global example_enum_var= e1;
show status like 'example%';
Variable_name Value
-example_func_example enum_var is 0, ulong_var is 500, really
+Example_func_example enum_var is 0, ulong_var is 500, really
show variables like 'example%';
Variable_name Value
example_enum_var e1
example_ulong_var 500
+example_varopt_default 5
UNINSTALL SONAME 'ha_example';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
@@ -65,6 +68,10 @@ LOAD_OPTION ON
PLUGIN_MATURITY Experimental
PLUGIN_AUTH_VERSION 0.1
DROP TABLE t1;
+select * from information_schema.plugins where plugin_library like 'ha_example%';
+SELECT * FROM t2;
+ERROR 42000: Unknown storage engine 'EXAMPLE'
+DROP TABLE t2;
UNINSTALL PLUGIN EXAMPLE;
ERROR 42000: PLUGIN EXAMPLE does not exist
UNINSTALL PLUGIN non_exist;
@@ -113,7 +120,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `complex`='c,f,f,f'
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000 `STR`='dskj' `one_or_two`='one' `YESNO`=0
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000 `STR`='dskj' `one_or_two`='one' `YESNO`=0 `VAROPT`='5'
drop table t1;
SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
@@ -127,20 +134,20 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000000000000000000 `one_or_two`='ttt' `YESNO`=SSS
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=10000000000000000000 `one_or_two`='ttt' `YESNO`=SSS `VAROPT`='5'
#alter table
alter table t1 ULL=10000000;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `VAROPT`='5' `ULL`=10000000
alter table t1 change a a int complex='c,c,c';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `complex`='c,c,c'
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `ULL`=10000000
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `one_or_two`='ttt' `YESNO`=SSS `VAROPT`='5' `ULL`=10000000
drop table t1;
#illegal value error
SET SQL_MODE='';
@@ -155,17 +162,38 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ULL`=4660 `VAROPT`='5'
+SET example_varopt_default=33;
select create_options from information_schema.tables where table_schema='test' and table_name='t1';
create_options
-`ULL`=4660
+`ULL`=4660 `VAROPT`='5'
ALTER TABLE t1 ULL=DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='5'
DROP TABLE t1;
+create table t1 (a int) engine=example;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='33'
+drop table t1;
+create table t1 (a int) engine=example varopt=15;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `varopt`=15
+alter table t1 varopt=default;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `VAROPT`='33'
+drop table t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
select 1;
1
diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result
index f8ebf65c0c5..356ac76962a 100644
--- a/mysql-test/r/plugin_auth.result
+++ b/mysql-test/r/plugin_auth.result
@@ -224,7 +224,7 @@ NULL
# in connection plug_con
SELECT @@LOCAL.external_user;
@@LOCAL.external_user
-'plug'@'%'
+plug_dest
# in connection default
## cleanup
DROP USER plug;
diff --git a/mysql-test/r/plugin_auth_qa_2.result b/mysql-test/r/plugin_auth_qa_2.result
index f300ea332cb..aa3a59b4f25 100644
--- a/mysql-test/r/plugin_auth_qa_2.result
+++ b/mysql-test/r/plugin_auth_qa_2.result
@@ -44,7 +44,7 @@ SELECT @@external_user;
NULL
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' 'qa_test_2_user'@'%'
+authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
authenticated_as
@@ -60,7 +60,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_pas
GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' 'qa_test_3_user'@'%'
+qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' qa_test_3_dest
DROP USER qa_test_3_user;
DROP USER qa_test_3_dest;
=== Assign too low values for *length, which should have no effect ====
@@ -70,7 +70,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_pas
GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' 'qa_test_4_user'@'%'
+qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' qa_test_4_dest
DROP USER qa_test_4_user;
DROP USER qa_test_4_dest;
=== Assign empty string especially to authenticated_as (in plugin) ====
diff --git a/mysql-test/r/plugin_auth_qa_3.result b/mysql-test/r/plugin_auth_qa_3.result
index 656975aca30..dd4fb76ff8d 100644
--- a/mysql-test/r/plugin_auth_qa_3.result
+++ b/mysql-test/r/plugin_auth_qa_3.result
@@ -4,7 +4,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_pa
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' 'qa_test_11_user'@'%'
+qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' NULL
exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: NO)
DROP USER qa_test_11_user, qa_test_11_dest;
diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result
index 56894302505..3bc7039583b 100644
--- a/mysql-test/r/ps_11bugs.result
+++ b/mysql-test/r/ps_11bugs.result
@@ -120,7 +120,7 @@ create table t1 (a int primary key);
insert into t1 values (1);
explain select * from t1 where 3 in (select (1+1) union select 1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index 3ca0cf8554f..0a8aea94e8a 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -533,7 +533,7 @@ drop table t2;
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
execute stmt1 ;
-ERROR HY000: Can't find file: './test/t7' (errno: 2 "No such file or directory")
+ERROR 42S02: Table 'test.t7' doesn't exist
create table t7 (a int) ;
execute stmt1 ;
execute stmt1 ;
diff --git a/mysql-test/r/quick_select_4161.result b/mysql-test/r/quick_select_4161.result
new file mode 100644
index 00000000000..862be6055ce
--- /dev/null
+++ b/mysql-test/r/quick_select_4161.result
@@ -0,0 +1,31 @@
+CREATE TABLE t1 (
+event_date date DEFAULT '0000-00-00' NOT NULL,
+type int(11) DEFAULT '0' NOT NULL,
+event_id int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (event_date,type,event_id)
+);
+INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
+('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
+('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
+('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
+('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
+('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
+('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
+('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
+('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
+('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
+('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
+('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
+('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
+('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
+('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
+('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
+('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
+('1999-09-19',100100,37), ('2000-12-18',100700,38);
+set debug_sync='inside_make_join_statistics signal killme wait_for done';
+select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
+set debug_sync='now wait_for killme';
+kill %connection%;
+set debug_sync='now signal done';
+Got one of the listed errors
+drop table t1;
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
index edf05d0c5d3..7433ab8a0c9 100644
--- a/mysql-test/r/rename.result
+++ b/mysql-test/r/rename.result
@@ -14,20 +14,20 @@ select * from t1;
1 table 1
1 table 1
rename table t1 to t2;
-Got one of the listed errors
+ERROR 42S01: Table 't2' already exists
rename table t1 to t1;
-Got one of the listed errors
+ERROR 42S01: Table 't1' already exists
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
-Got one of the listed errors
+ERROR 42S01: Table 't2' already exists
show tables like "t_";
Tables_in_test (t_)
t1
t2
t3
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
-Got one of the listed errors
+ERROR 42S01: Table 't1' already exists
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
-Got one of the listed errors
+ERROR 42S02: Table 'test.t5' doesn't exist
select * from t1;
1 table 1
1 table 1
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 80934a4e01f..f94c958a1be 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -405,7 +405,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1))
SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
a b a b c
1 1 1 2 1
@@ -415,7 +415,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 6 100.00 Using index
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 12 test.t1.a,const,const 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`c` = 1))
SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
a b a b c
1 1 1 2 1
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index 809d652053e..bb6dbd65f84 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -5,8 +5,8 @@ Database Create Database
foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
show schemas;
Database
-information_schema
foo
+information_schema
mtr
mysql
performance_schema
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 378b20829f3..3d16d37c5f1 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -5302,4 +5302,24 @@ INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
a b
drop table t1,t2;
+#
+# Bug mdev-4250: wrong transformation of WHERE condition with OR
+#
+CREATE TABLE t1 (pk int PRIMARY KEY, a int);
+INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+pk a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0))
+DROP TABLE t1;
+SELECT * FROM mysql.time_zone
+WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
+AND Time_zone_id = Time_zone_id
+OR Time_zone_id <> Time_zone_id )
+AND Use_leap_seconds <> 'N';
+Time_zone_id Use_leap_seconds
End of 5.3 tests
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index b5c6f89b87b..467f940c85d 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -5313,6 +5313,26 @@ INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
a b
drop table t1,t2;
+#
+# Bug mdev-4250: wrong transformation of WHERE condition with OR
+#
+CREATE TABLE t1 (pk int PRIMARY KEY, a int);
+INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+pk a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0))
+DROP TABLE t1;
+SELECT * FROM mysql.time_zone
+WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
+AND Time_zone_id = Time_zone_id
+OR Time_zone_id <> Time_zone_id )
+AND Use_leap_seconds <> 'N';
+Time_zone_id Use_leap_seconds
End of 5.3 tests
set join_cache_level=default;
show variables like 'join_cache_level';
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 378b20829f3..3d16d37c5f1 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -5302,4 +5302,24 @@ INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
a b
drop table t1,t2;
+#
+# Bug mdev-4250: wrong transformation of WHERE condition with OR
+#
+CREATE TABLE t1 (pk int PRIMARY KEY, a int);
+INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+pk a
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Note 1003 select 2 AS `pk`,0 AS `a` from `test`.`t1` where ((0 <> 0))
+DROP TABLE t1;
+SELECT * FROM mysql.time_zone
+WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
+AND Time_zone_id = Time_zone_id
+OR Time_zone_id <> Time_zone_id )
+AND Use_leap_seconds <> 'N';
+Time_zone_id Use_leap_seconds
End of 5.3 tests
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 1818713d443..2b7439b09e0 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -198,7 +198,7 @@ show create table t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
diff --git a/mysql-test/r/show_explain.result b/mysql-test/r/show_explain.result
index da132a102e2..be0b1c28b06 100644
--- a/mysql-test/r/show_explain.result
+++ b/mysql-test/r/show_explain.result
@@ -442,9 +442,9 @@ WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using where
-2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 Using where
+2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
-set @show_explain_probe_select_id=2;
+set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
@@ -453,7 +453,7 @@ WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 20 Using where
-2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1 Using where
+2 SUBQUERY t2 const PRIMARY PRIMARY 4 const 1
3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 SELECT * FROM t2 WHERE a =
diff --git a/mysql-test/r/str_to_datetime_457.result b/mysql-test/r/str_to_datetime_457.result
index 4fd0d00691c..630be9ffbaa 100644
--- a/mysql-test/r/str_to_datetime_457.result
+++ b/mysql-test/r/str_to_datetime_457.result
@@ -12,12 +12,12 @@ Warning 1292 Truncated incorrect datetime value: '2012103123595912'
Warning 1292 Truncated incorrect datetime value: '20121031235959123'
select cast(0 as date), cast('0000-00-00' as date), cast('0' as date);
cast(0 as date) cast('0000-00-00' as date) cast('0' as date)
-0000-00-00 0000-00-00 NULL
+0000-00-00 0000-00-00 0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '0'
select extract(hour from '100000:02:03'), extract(hour from '100000:02:03 ');
extract(hour from '100000:02:03') extract(hour from '100000:02:03 ')
-NULL NULL
+0 0
Warnings:
Warning 1292 Truncated incorrect time value: '100000:02:03'
Warning 1292 Truncated incorrect time value: '100000:02:03 '
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 5f9376bba89..b3536661125 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -429,7 +429,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -558,10 +558,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1371,7 +1371,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
@@ -1457,7 +1457,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -1500,7 +1500,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -2973,7 +2973,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N'))
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N')
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index ed07578fa17..1a33fb0c6a3 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -314,7 +314,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`b` = 10) and (`test`.`t2`.`a` = 10))
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10))
drop table t1, t2;
create table t1 (oref char(4), grp int, ie int);
insert into t1 (oref, grp, ie) values
@@ -1416,7 +1416,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
Warnings:
-Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2'))
+Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`))
set @@optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
#
diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result
index 4f85f0faaab..5bae1453a5e 100644
--- a/mysql-test/r/subselect3_jcl6.result
+++ b/mysql-test/r/subselect3_jcl6.result
@@ -324,7 +324,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t1 index_subquery idx idx 5 func 4 100.00 Using where; Full scan on NULL key
Warnings:
Note 1276 Field or reference 'test.t2.oref' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`b` = 10) and (`test`.`t2`.`a` = 10))
+Note 1003 select `test`.`t2`.`oref` AS `oref`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`b`,`test`.`t2`.`oref`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`b`),<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on idx checking NULL where ((`test`.`t1`.`oref` = `test`.`t2`.`oref`) and trigcond(trigcond(((<cache>(`test`.`t2`.`a`) = `test`.`t1`.`ie1`) or isnull(`test`.`t1`.`ie1`)))) and trigcond(trigcond(((<cache>(`test`.`t2`.`b`) = `test`.`t1`.`ie2`) or isnull(`test`.`t1`.`ie2`))))) having (trigcond(<is_not_null_test>(`test`.`t1`.`ie1`)) and trigcond(<is_not_null_test>(`test`.`t1`.`ie2`))))))) AS `Z` from `test`.`t2` where ((`test`.`t2`.`a` = 10) and (`test`.`t2`.`b` = 10))
drop table t1, t2;
create table t1 (oref char(4), grp int, ie int);
insert into t1 (oref, grp, ie) values
@@ -1426,7 +1426,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY c eq_ref PRIMARY PRIMARY 4 test.cona.idContact 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY a eq_ref PRIMARY PRIMARY 4 test.c.idObj 1 100.00 Using index; End temporary
Warnings:
-Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`c`.`idContact` = `test`.`cona`.`idContact`) and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`cona`.`postalStripped` = 'T2H3B2'))
+Note 1003 select `test`.`a`.`idIndividual` AS `idIndividual` from `test`.`t1` `a` semi join (`test`.`t3` `cona` join `test`.`t2` `c`) where ((`test`.`cona`.`postalStripped` = 'T2H3B2') and (`test`.`a`.`idIndividual` = `test`.`c`.`idObj`) and (`test`.`c`.`idContact` = `test`.`cona`.`idContact`))
set @@optimizer_switch=@save_optimizer_switch;
drop table t1,t2,t3;
#
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 0d5209d0ec2..ff768886434 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -869,7 +869,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
f1 f2
@@ -960,7 +960,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
f1 f2
@@ -1055,7 +1055,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
@@ -1146,7 +1146,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
@@ -2012,7 +2012,7 @@ FROM t2 JOIN t3 ON t3.f4 = t2.f4
WHERE t3.f1 = 8
GROUP BY 1, 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 system NULL NULL NULL NULL 1 Using temporary; Using filesort
+1 PRIMARY t3 system NULL NULL NULL NULL 1 Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
@@ -2325,5 +2325,19 @@ ORDER BY alias1.b;
pk b pk b
1 1 1 1
drop table t1, t2, t3;
+#
+# MDEV-4144 simple subquery causes full scan instead of range scan
+#
+CREATE TABLE t1 (id int not null auto_increment, x int not null, primary key(id));
+INSERT INTO t1 (x) VALUES (0),(0),(0);
+EXPLAIN
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+x
+0
+drop table t1;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
diff --git a/mysql-test/r/subselect_exists2in.result b/mysql-test/r/subselect_exists2in.result
new file mode 100644
index 00000000000..efbbe08cede
--- /dev/null
+++ b/mysql-test/r/subselect_exists2in.result
@@ -0,0 +1,865 @@
+drop table if exists t1,t2,t3;
+set optimizer_switch='exists_to_in=on';
+#
+# LP BUG#884644 exists2in broke name resolution
+#
+CREATE TABLE t1 (f1 integer);
+SELECT * FROM t1 WHERE EXISTS (SELECT NO_SUCH_TABLE.NO_SUCH_FIELD FROM t1);
+ERROR 42S22: Unknown column 'NO_SUCH_TABLE.NO_SUCH_FIELD' in 'field list'
+drop table t1;
+#
+# LP BUG#884657 Wrong result with exists2in , correlated subquery
+#
+CREATE TABLE t1 ( a varchar(1)) ;
+INSERT INTO t1 VALUES ('c'),('b');
+CREATE TABLE t2 ( b varchar(1)) ;
+INSERT INTO t2 VALUES ('v'),('v'),('c'),(NULL),('x'),('i'),('e'),('p'),('s'),('j'),('z'),('c'),('a'),('q'),('y'),(NULL),('r'),('v'),(NULL),('r');
+CREATE TABLE t3 ( a int NOT NULL , b varchar(1)) ;
+INSERT INTO t3 VALUES (29,'c');
+SELECT *
+FROM t1, t2
+WHERE EXISTS (
+SELECT a
+FROM t3
+WHERE t3.b = t1.a
+AND t3.b <> t2.b
+);
+a b
+c v
+c v
+c x
+c i
+c e
+c p
+c s
+c j
+c z
+c a
+c q
+c y
+c r
+c v
+c r
+INSERT INTO t3 VALUES (2,'c');
+alter table t1 add index aa (a);
+alter table t3 add index bb (b);
+-- EXIST to IN then semijoin (has priority over IN to EXISTS)
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+a
+c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index aa aa 4 NULL 2 100.00 Using index
+1 PRIMARY t3 ALL bb NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t3`) where (`test`.`t3`.`b` = `test`.`t1`.`a`)
+-- EXIST to IN then IN to EXISTS
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+a
+c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL aa 4 NULL 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t3`.`b` from `test`.`t3` where (<cache>(`test`.`t1`.`a`) = `test`.`t3`.`b`)))
+-- EXIST2IN then MATERIALIZATION
+set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+a
+c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL aa 4 NULL 2 100.00 Using where; Using index
+2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t3`.`b` from `test`.`t3` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`b`)))))
+-- NO EXIST2IN
+set optimizer_switch='exists_to_in=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+a
+c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL aa 4 NULL 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t3 ALL bb NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where exists(select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`b` = `test`.`t1`.`a`))
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+drop table t1,t2,t3;
+#
+# From group_min_max.test
+#
+create table t1 (
+a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+);
+insert into t1 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
+create index idx_t1_0 on t1 (a1);
+create index idx_t1_1 on t1 (a1,a2,b,c);
+create index idx_t1_2 on t1 (a1,a2,b);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+create table t2 (
+a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
+);
+insert into t2 select * from t1;
+insert into t2 (a1, a2, b, c, d) values
+('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
+('a','a','a',NULL,'xyz'),
+('a','a','b',NULL,'xyz'),
+('a','b','a',NULL,'xyz'),
+('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
+('d','b','b',NULL,'xyz'),
+('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
+('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),
+('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
+('a','a','a',NULL,'xyz'),
+('a','a','b',NULL,'xyz'),
+('a','b','a',NULL,'xyz'),
+('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
+('d','b','b',NULL,'xyz'),
+('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
+('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz');
+create index idx_t2_0 on t2 (a1);
+create index idx_t2_1 on t2 (a1,a2,b,c);
+create index idx_t2_2 on t2 (a1,a2,b);
+analyze table t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status Table is already up to date
+create table t3 (
+a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
+);
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+create index idx_t3_0 on t3 (a1);
+create index idx_t3_1 on t3 (a1,a2,b,c);
+create index idx_t3_2 on t3 (a1,a2,b);
+analyze table t3;
+Table Op Msg_type Msg_text
+test.t3 analyze status Table is already up to date
+explain select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+where t2.c in (select c from t3 where t3.c > t1.b) and
+t2.c > 'b1' )
+group by a1,a2,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
+2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
+2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join)
+select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+where t2.c in (select c from t3 where t3.c > t1.b) and
+t2.c > 'b1' )
+group by a1,a2,b;
+a1 a2 b c min(c) max(c)
+a a a a111 a111 d111
+a a b e112 e112 h112
+a b a i121 i121 l121
+a b b m122 m122 p122
+b a a a211 a211 d211
+b a b e212 e212 h212
+b b a i221 i221 l221
+b b b m222 m222 p222
+c a a a311 a311 d311
+c a b e312 e312 h312
+c b a i321 i321 l321
+c b b m322 m322 p322
+d a a a411 a411 d411
+d a b e412 e412 h412
+d b a i421 i421 l421
+d b b m422 m422 p422
+explain select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+where t2.c in (select c from t3 where t3.c > t1.c) and
+t2.c > 'b1' )
+group by a1,a2,b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
+2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index
+2 DEPENDENT SUBQUERY t3 index NULL idx_t3_1 10 NULL 192 Using where; Using index; FirstMatch(t2); Using join buffer (flat, BNL join)
+select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+where t2.c in (select c from t3 where t3.c > t1.c) and
+t2.c > 'b1' )
+group by a1,a2,b;
+a1 a2 b c min(c) max(c)
+a a a a111 a111 d111
+a a b e112 e112 h112
+a b a i121 i121 l121
+a b b m122 m122 p122
+b a a a211 a211 d211
+b a b e212 e212 h212
+b b a i221 i221 l221
+b b b m222 m222 p222
+c a a a311 a311 d311
+c a b e312 e312 h312
+c b a i321 i321 l321
+c b b m322 m322 o322
+d a a a411 a411 d411
+d a b e412 e412 h412
+d b a i421 i421 l421
+d b b m422 m422 o422
+drop table t1, t2, t3;
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (7),(0);
+CREATE TABLE t2 ( b INT );
+INSERT INTO t2 VALUES (0),(8);
+SELECT * FROM t1 WHERE
+EXISTS ( SELECT * FROM t2 WHERE b = a )
+OR a > 0;
+a
+7
+0
+explain extended
+SELECT * FROM t1 WHERE
+EXISTS ( SELECT * FROM t2 WHERE b = a )
+OR a > 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,`test`.`t1`.`a` in ( <materialize> (select `test`.`t2`.`b` from `test`.`t2` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`b`)))))) or (`test`.`t1`.`a` > 0))
+drop tables t1,t2;
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1),(5);
+CREATE TABLE t2 ( b INT ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+CREATE TABLE t3 ( c INT );
+INSERT INTO t3 VALUES (4),(5);
+SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
+explain extended
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
+3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
+Note 1003 select (select 1 from dual where (not(((1 is not null) and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery3>`.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+1
+1
+SET optimizer_switch='exists_to_in=on,subquery_cache=off';
+explain extended
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
+3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
+Note 1003 select (select 1 from dual where (not(((1 is not null) and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` is not null) ), <primary_index_lookup>(1 in <temporary table> on distinct_key where ((1 = `<subquery3>`.`c`))))))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+1
+1
+SET optimizer_switch='exists_to_in=off,subquery_cache=off';
+explain extended
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+2 SUBQUERY t2 system NULL NULL NULL NULL 1 100.00
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
+Note 1003 select (select 1 from dual where (not(exists(select `test`.`t3`.`c` from `test`.`t3` where (`test`.`t3`.`c` = 1))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+1
+1
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+drop table t1,t2,t3;
+# multi condition test
+CREATE TABLE t1 ( a varchar(1), a1 varchar(1)) ;
+INSERT INTO t1 VALUES ('c', 'c'), ('b', 'b');
+CREATE TABLE t3 ( a int NOT NULL , b varchar(1), b1 varchar(1)) ;
+INSERT INTO t3 VALUES (29,'c','c');
+INSERT INTO t3 VALUES (2,'c','c');
+alter table t1 add index aa (a,a1);
+alter table t3 add index bb (b,b1);
+-- EXIST to IN then semijoin (has priority over IN to EXISTS)
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+a a1
+c c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 index bb bb 8 NULL 2 100.00 Using where; Using index; LooseScan
+1 PRIMARY t1 ref aa aa 8 test.t3.b,test.t3.b1 2 100.00 Using index
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t3`.`b`) and (`test`.`t1`.`a1` = `test`.`t3`.`b1`))
+-- EXIST to IN then IN to EXISTS
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+a a1
+c c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL aa 8 NULL 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t3 index_subquery bb bb 8 func,func 2 100.00 Using index; Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`a1`),<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t3 on bb where ((<cache>(`test`.`t1`.`a`) = `test`.`t3`.`b`) and (<cache>(`test`.`t1`.`a1`) = `test`.`t3`.`b1`)))))
+-- EXIST2IN then MATERIALIZATION
+set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+a a1
+c c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL aa 8 NULL 2 100.00 Using where; Using index
+2 MATERIALIZED t3 index NULL bb 8 NULL 2 100.00 Using index
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where <in_optimizer>((`test`.`t1`.`a`,`test`.`t1`.`a1`),(`test`.`t1`.`a`,`test`.`t1`.`a1`) in ( <materialize> (select `test`.`t3`.`b`,`test`.`t3`.`b1` from `test`.`t3` where 1 ), <primary_index_lookup>(`test`.`t1`.`a` in <temporary table> on distinct_key where ((`test`.`t1`.`a` = `<subquery2>`.`b`) and (`test`.`t1`.`a1` = `<subquery2>`.`b1`)))))
+-- NO EXIST2IN
+set optimizer_switch='exists_to_in=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+a a1
+c c
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL aa 8 NULL 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t3 ref bb bb 8 test.t1.a,test.t1.a1 2 100.00 Using index
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a1' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a1` AS `a1` from `test`.`t1` where exists(select 1 from `test`.`t3` where ((`test`.`t3`.`b` = `test`.`t1`.`a`) and (`test`.`t3`.`b1` = `test`.`t1`.`a1`)))
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+drop table t1,t3;
+#
+# MDEV-159 Assertion about not marked for read failed in
+# String* Field_varstring::val_str(String*, String*)
+#
+SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
+SET optimizer_switch='in_to_exists=on,exists_to_in=on';
+CREATE TABLE t1 ( a VARCHAR(1) );
+INSERT INTO t1 VALUES ('k'),('m');
+CREATE TABLE t2 ( b INT,
+c VARCHAR(1),
+d VARCHAR(1) NOT NULL );
+INSERT INTO t2 VALUES
+(4,'j','j'),(6,'v','v');
+CREATE ALGORITHM=MERGE VIEW v AS SELECT * FROM t2 WHERE b < 1;
+SELECT c FROM v
+WHERE EXISTS (
+SELECT * FROM t1, t2
+WHERE a <= v.d AND b = v.b
+);
+c
+explain extended
+SELECT c FROM v
+WHERE EXISTS (
+SELECT * FROM t1, t2
+WHERE a <= v.d AND b = v.b
+);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1276 Field or reference 'v.d' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'v.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t2`.`c` AS `c` from `test`.`t2` where (<in_optimizer>(`test`.`t2`.`b`,<exists>(select `test`.`t2`.`b` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <= `test`.`t2`.`d`) and (<cache>(`test`.`t2`.`b`) = `test`.`t2`.`b`)))) and (`test`.`t2`.`b` < 1))
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+drop view v;
+drop table t1,t2;
+#
+# MDEV-160 Exists2In: Crash in in hp_movelink with subquery_cache=ON
+#
+SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
+CREATE TABLE t1 (
+a VARCHAR(3) NOT NULL,
+b VARCHAR(50)
+);
+INSERT INTO t1 VALUES
+('USA','Chinese'),('USA','English'),
+('FRA','French'),('ITA','Italian');
+CREATE TABLE t2 ( c VARCHAR(3) );
+INSERT INTO t2 VALUES ('USA'),('FRA');
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+SELECT * FROM t1, t2
+WHERE a <= alias2.a AND c = alias1.b
+) OR alias1 .a = 'foo';
+a b a b
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+SELECT * FROM t1, t2
+WHERE a <= alias2.a AND c = alias1.a
+) OR alias1 .a = 'foo';
+a b a b
+USA Chinese USA Chinese
+USA English USA Chinese
+FRA French USA Chinese
+USA Chinese USA English
+USA English USA English
+FRA French USA English
+USA Chinese FRA French
+USA English FRA French
+FRA French FRA French
+USA Chinese ITA Italian
+USA English ITA Italian
+FRA French ITA Italian
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-160 Exists2In: Crash in in hp_movelink with subquery_cache=ON
+#
+SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
+CREATE TABLE t1 (
+a VARCHAR(3) NOT NULL,
+b VARCHAR(50)
+);
+INSERT INTO t1 VALUES
+('USA','Chinese'),('USA','English'),
+('FRA','French'),('ITA','Italian');
+CREATE TABLE t2 ( c VARCHAR(3) );
+INSERT INTO t2 VALUES ('USA'),('FRA');
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+SELECT * FROM t1, t2
+WHERE a <= alias2.a AND c = alias1.b
+) OR alias1 .a = 'foo';
+a b a b
+explain extended
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+SELECT * FROM t1, t2
+WHERE a <= alias2.a AND c = alias1.b
+) OR alias1 .a = 'foo';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 4 100.00
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1276 Field or reference 'test.alias2.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.alias1.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias1`.`b` AS `b`,`test`.`alias2`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t1` `alias2` where (<expr_cache><`test`.`alias1`.`b`,`test`.`alias2`.`a`>(<in_optimizer>(`test`.`alias1`.`b`,<exists>(select `test`.`t2`.`c` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` <= `test`.`alias2`.`a`) and (<cache>(`test`.`alias1`.`b`) = `test`.`t2`.`c`))))) or (`test`.`alias1`.`a` = 'foo'))
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-245 Exists2In: Wrong result (extra rows) with
+# exists_to_in=ON, materialization=OFF, NOT EXISTS subquery
+#
+SET optimizer_switch='materialization=off,exists_to_in=on';
+CREATE TABLE t1 ( a INT ) ;
+INSERT INTO t1 VALUES (0),(8),(1);
+CREATE TABLE t2 ( b INT ) ;
+INSERT INTO t2 VALUES (1),(2),(3);
+SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b = a );
+a
+0
+8
+explain extended
+SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b = a );
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (not(((`test`.`t1`.`a` is not null) and <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where ((`test`.`t2`.`b` is not null) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`b`))))))))
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-243 Wrong result (extra or missing rows) with
+# exists_to_in + materialization, EXISTS subquery
+#
+SET optimizer_switch='index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=on';
+CREATE TABLE t1 ( a VARCHAR(1), b VARCHAR(1) );
+INSERT INTO t1 VALUES ('v','v'),('s','v');
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+a b
+s v
+explain extended
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY alias ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(alias); Using join buffer (flat, BNL join)
+Warnings:
+Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`alias`.`b`) and (`test`.`alias`.`b` > `test`.`alias`.`a`))
+SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
+SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+a b
+s v
+explain extended
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY alias ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` where <in_optimizer>(`test`.`alias`.`b`,<exists>(select `test`.`t1`.`a` from `test`.`t1` where ((`test`.`t1`.`a` > `test`.`alias`.`a`) and (<cache>(`test`.`alias`.`b`) = `test`.`t1`.`a`))))
+SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=on';
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+a b
+s v
+explain extended
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY alias ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; End temporary
+Warnings:
+Note 1276 Field or reference 'test.alias.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.alias.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`alias`.`a` AS `a`,`test`.`alias`.`b` AS `b` from `test`.`t1` `alias` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`alias`.`b`) and (`test`.`alias`.`b` > `test`.`alias`.`a`))
+drop table t1;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-403 Wrong result (missing rows) with subquery in
+# EXISTS and an OR condition outside
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (2),(3);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(3);
+SET optimizer_switch = 'exists_to_in=off,in_to_exists=on';
+SELECT * FROM t1 AS alias1, t2 AS alias2
+WHERE EXISTS (
+SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
+) OR a = 5;
+a b
+3 1
+SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
+SELECT * FROM t1 AS alias1, t2 AS alias2
+WHERE EXISTS (
+SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
+) OR a = 5;
+a b
+3 1
+explain extended
+SELECT * FROM t1 AS alias1, t2 AS alias2
+WHERE EXISTS (
+SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
+) OR a = 5;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.alias1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.alias2.b' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`alias1`.`a` AS `a`,`test`.`alias2`.`b` AS `b` from `test`.`t1` `alias1` join `test`.`t2` `alias2` where (<expr_cache><`test`.`alias1`.`a`,`test`.`alias2`.`b`>(<in_optimizer>(`test`.`alias1`.`a`,<exists>(select `test`.`t2`.`b` from `test`.`t2` where ((`test`.`t2`.`b` > `test`.`alias2`.`b`) and (<cache>(`test`.`alias1`.`a`) = `test`.`t2`.`b`))))) or (`test`.`alias1`.`a` = 5))
+drop table t1, t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-404: Wrong result (extra rows) with STRAIGHT_JOIN,
+# EXISTS subquery, NOT NULL column
+# (same as above)
+#
+SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
+CREATE TABLE t1 (a INT, b VARCHAR(1) NOT NULL);
+INSERT INTO t1 VALUES (1,'s'),(2,'e');
+SELECT STRAIGHT_JOIN * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS ( SELECT 1 FROM t1 WHERE b < alias2.b AND a = alias1.a );
+a b a b
+2 e 1 s
+drop table t1;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-3800: ORDER BY doesn't work with exists_to_in=ON on
+# a query with EXISTS subquery and OR condition
+#
+SET optimizer_switch = 'in_to_exists=on,exists_to_in=on';
+CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'j'),(6,'v'),(3,'c');
+CREATE TABLE t2 (c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('b'),('y');
+SELECT a FROM t1
+WHERE EXISTS (
+SELECT 1 FROM t2 WHERE c = b
+) OR b NOT IN ('U')
+ORDER BY a;
+a
+3
+4
+6
+select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`b` in (select `test`.`t2`.`c` from `test`.`t2` where 1 ) or (`test`.`t1`.`b` <> 'U') order by `test`.`t1`.`a`;
+a
+3
+4
+6
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# correct calculation of reserved items (postreview-fix)
+#
+create table t1 (col1 int, col2 int, col3 int);
+insert into t1 values (1,2,3),(2,3,4),(4,5,6);
+create table t2 as select * from t1;
+explain extended
+select * from t1 where exists (select col2 from t2 where t2.col1=t1.col1 and t2.col2=t1.col2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.col1' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.col2' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t1`.`col2` AS `col2`,`test`.`t1`.`col3` AS `col3` from `test`.`t1` semi join (`test`.`t2`) where 1
+select * from t1 where exists (select col2 from t2 where t2.col1=t1.col1 and t2.col2=t1.col2);
+col1 col2 col3
+1 2 3
+2 3 4
+4 5 6
+drop table t1,t2;
+#
+# MDEV-3879: Exists2In: Wrong result (extra row) and unexpected
+# warning with exists_to_in=on and a NOT EXISTS subquery
+#
+SET optimizer_switch = 'exists_to_in=on';
+CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3,'y'),(6,'w');
+CREATE TABLE t2 (a2 INT, b2 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3,'y'),(6,'d');
+SELECT * FROM t1
+WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b2 = b1 AND a2 = a1 );
+a1 b1
+6 w
+drop table t1, t2;
+#
+# MDEV-3880: Wrong result (missing rows) with exists_to_in=on,
+# LEFT JOIN and NOT EXISTS subquery.
+# (Duplicate of above MDEV-3879).
+#
+SET optimizer_switch = 'exists_to_in=on';
+CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'b'),(5,'y');
+CREATE TABLE t2 (b2 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('z'),('b');
+CREATE TABLE t3 (a3 INT, b3 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4,'j'),(6,'v');
+SELECT * FROM t1 LEFT JOIN t2 ON ( b2 = b1 )
+WHERE NOT EXISTS ( SELECT * FROM t3 WHERE b3 = b2 AND a3 = a1 ) ;
+a1 b1 b2
+4 b b
+5 y NULL
+drop table t1, t2, t3;
+#
+# MDEV-3881: Endless loop and crash in Item_ref::real_item with
+# exists_to_in=on, NOT EXISTS subquery, merge view or from subquery,
+# constant table
+#
+SET optimizer_switch = 'exists_to_in=on';
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8);
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2;
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4),(6);
+SELECT * FROM t1, v1 WHERE NOT EXISTS ( SELECT * FROM t3 WHERE c = b ) AND a = b;
+a b
+drop view v1;
+drop table t1, t2, t3;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8);
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4),(6);
+SELECT * FROM t1, ( SELECT * FROM t2 ) alias WHERE NOT EXISTS ( SELECT * FROM t3 WHERE c = b ) AND a = b;
+a b
+drop table t1, t2, t3;
+#
+# MDEV-3906: Server crashes in Dependency_marker::visit_field
+# on 2nd execution of PS with exists_to_in and NOT EXISTS subquery
+#
+SET optimizer_switch='exists_to_in=on';
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(7);
+PREPARE stmt FROM '
+SELECT * FROM t1 AS alias
+WHERE NOT EXISTS ( SELECT * FROM t1 WHERE t1.a = alias.a )
+';
+EXECUTE stmt;
+a
+EXECUTE stmt;
+a
+drop table t1;
+#
+# MDEV-3904: Assertion `in_subs->has_strategy()' failed in
+# JOIN::choose_subquery_plan on 2nd execution of PS with
+# exists_to_in+semijoin, EXISTS subquery, MERGE view or FROM subquery
+#
+SET optimizer_switch='in_to_exists=on,semijoin=on,exists_to_in=on';
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4),(6);
+CREATE ALGORITHM=MERGE VIEW v AS
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE b = a );
+PREPARE stmt FROM ' SELECT * FROM v ';
+EXECUTE stmt;
+a
+EXECUTE stmt;
+a
+drop view v;
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-3903: Server crashes in Item_cond::fix_fields on 2nd execution
+# of a prepared stmt with exists_to_in+materialization+semijoin,
+# EXISTS subquery, STRAIGHT_JOIN
+#
+SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+PREPARE stmt FROM
+'SELECT STRAIGHT_JOIN * FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE b = a )';
+EXECUTE stmt;
+a
+EXECUTE stmt;
+a
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+#
+# MDEV-4152: Wrong result (missing rows) with exists_to_in=on,
+# inner joins
+#
+SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
+CREATE TABLE t1 (i INT, c1 CHAR(5), c2 CHAR(5), t1_field VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'test1','test2','f'), (2,'test3','test4','d');
+CREATE TABLE t2 (t2_field VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('m'), ('b');
+CREATE TABLE t3 (t3_field VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('b'),('c');
+SELECT * FROM t1, t2 outer_t2
+WHERE EXISTS ( SELECT 1 FROM t2, t3 WHERE t3_field = outer_t2.t2_field AND t2_field <= t1_field );
+i c1 c2 t1_field t2_field
+1 test1 test2 f b
+2 test3 test4 d b
+drop table t1,t2,t3;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+set optimizer_switch=default;
diff --git a/mysql-test/r/subselect_exists2in_costmat.result b/mysql-test/r/subselect_exists2in_costmat.result
new file mode 100644
index 00000000000..a46996d9bad
--- /dev/null
+++ b/mysql-test/r/subselect_exists2in_costmat.result
@@ -0,0 +1,103 @@
+set @subselect_mat_cost=@@optimizer_switch;
+set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
+set long_query_time=0.1;
+drop database if exists world;
+set names utf8;
+create database world;
+use world;
+CREATE TABLE Country (
+Code char(3) NOT NULL default '',
+Name char(52) NOT NULL default '',
+SurfaceArea float(10,2) NOT NULL default '0.00',
+Population int(11) NOT NULL default '0',
+Capital int(11) default NULL,
+PRIMARY KEY (Code),
+UNIQUE INDEX (Name)
+);
+CREATE TABLE City (
+ID int(11) NOT NULL auto_increment,
+Name char(35) NOT NULL default '',
+Country char(3) NOT NULL default '',
+Population int(11) NOT NULL default '0',
+PRIMARY KEY (ID),
+INDEX (Population),
+INDEX (Country)
+);
+CREATE TABLE CountryLanguage (
+Country char(3) NOT NULL default '',
+Language char(30) NOT NULL default '',
+Percentage float(3,1) NOT NULL default '0.0',
+PRIMARY KEY (Country, Language),
+INDEX (Percentage)
+);
+Make the schema and data more diverse by adding more indexes, nullable
+columns, and NULL data.
+create index SurfaceArea on Country(SurfaceArea);
+create index Language on CountryLanguage(Language);
+create index CityName on City(Name);
+alter table City change population population int(11) null default 0;
+select max(id) from City into @max_city_id;
+insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL);
+SELECT COUNT(*) FROM Country;
+COUNT(*)
+239
+SELECT COUNT(*) FROM City;
+COUNT(*)
+4080
+SELECT COUNT(*) FROM CountryLanguage;
+COUNT(*)
+984
+set @@optimizer_switch = 'exists_to_in=on,in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
+
+1. Subquery in a disjunctive WHERE clause of the outer query.
+
+
+Q1.1m:
+MATERIALIZATION: there are too many rows in the outer query
+to be looked up in the inner table.
+EXPLAIN
+SELECT Name FROM Country
+WHERE (EXISTS (select 1 from City where City.Population > 100000 and
+Code = Country) OR
+Name LIKE 'L%') AND
+surfacearea > 1000000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY Country ALL Name,SurfaceArea NULL NULL NULL 239 Using where
+2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4080 Using where
+SELECT Name FROM Country
+WHERE (EXISTS (select 1 from City where City.Population > 100000 and
+Code = Country) OR
+Name LIKE 'L%') AND
+surfacearea > 1000000;
+Name
+Algeria
+Angola
+Argentina
+Australia
+Bolivia
+Brazil
+Egypt
+South Africa
+Ethiopia
+Indonesia
+India
+Iran
+Canada
+Kazakstan
+China
+Colombia
+Congo, The Democratic Republic of the
+Libyan Arab Jamahiriya
+Mali
+Mauritania
+Mexico
+Mongolia
+Niger
+Peru
+Saudi Arabia
+Sudan
+Chad
+Russian Federation
+United States
+drop database world;
+set optimizer_switch=@subselect_mat_cost;
diff --git a/mysql-test/r/subselect_exists_to_in.result b/mysql-test/r/subselect_exists_to_in.result
new file mode 100644
index 00000000000..579277f11f9
--- /dev/null
+++ b/mysql-test/r/subselect_exists_to_in.result
@@ -0,0 +1,7021 @@
+select @@optimizer_switch like '%exists_to_in=on%';
+@@optimizer_switch like '%exists_to_in=on%'
+0
+set optimizer_switch='exists_to_in=on';
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12;
+drop view if exists v2;
+set @subselect_tmp=@@optimizer_switch;
+set @@optimizer_switch=ifnull(@optimizer_switch_for_subselect_test,
+"semijoin=on,firstmatch=on,loosescan=on,semijoin_with_cache=on,partial_match_rowid_merge=off,partial_match_table_scan=off");
+set join_cache_level=1;
+set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
+select (select 2);
+(select 2)
+2
+explain extended select (select 2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select 2 AS `(select 2)`
+SELECT (SELECT 1) UNION SELECT (SELECT 2);
+(SELECT 1)
+1
+2
+explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1249 Select 4 was reduced during optimization
+Note 1003 select 1 AS `(SELECT 1)` union select 2 AS `(SELECT 2)`
+SELECT (SELECT (SELECT 0 UNION SELECT 0));
+(SELECT (SELECT 0 UNION SELECT 0))
+0
+explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+4 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select (select 0 union select 0) AS `(SELECT (SELECT 0 UNION SELECT 0))`
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
+ERROR 42S22: Reference 'a' not supported (forward reference in item list)
+SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b;
+ERROR 42S22: Reference 'b' not supported (forward reference in item list)
+SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a;
+(SELECT 1) MAX(1)
+1 1
+SELECT (SELECT a) as a;
+ERROR 42S22: Reference 'a' not supported (forward reference in item list)
+EXPLAIN EXTENDED SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
+Note 1276 Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select 1 AS `1` from dual having ((select 1) = 1)
+SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
+1
+1
+SELECT (SELECT 1), a;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
+a
+1
+SELECT 1 FROM (SELECT (SELECT a) b) c;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id);
+id
+1
+SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT 1 IN (SELECT 1);
+1 IN (SELECT 1)
+1
+SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
+1
+1
+select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
+ERROR HY000: Incorrect usage of PROCEDURE and subquery
+SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
+ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
+SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
+ERROR 42S22: Unknown column 'a' in 'field list'
+SELECT (SELECT 1,2,3) = ROW(1,2,3);
+(SELECT 1,2,3) = ROW(1,2,3)
+1
+SELECT (SELECT 1,2,3) = ROW(1,2,1);
+(SELECT 1,2,3) = ROW(1,2,1)
+0
+SELECT (SELECT 1,2,3) < ROW(1,2,1);
+(SELECT 1,2,3) < ROW(1,2,1)
+0
+SELECT (SELECT 1,2,3) > ROW(1,2,1);
+(SELECT 1,2,3) > ROW(1,2,1)
+1
+SELECT (SELECT 1,2,3) = ROW(1,2,NULL);
+(SELECT 1,2,3) = ROW(1,2,NULL)
+NULL
+SELECT ROW(1,2,3) = (SELECT 1,2,3);
+ROW(1,2,3) = (SELECT 1,2,3)
+1
+SELECT ROW(1,2,3) = (SELECT 1,2,1);
+ROW(1,2,3) = (SELECT 1,2,1)
+0
+SELECT ROW(1,2,3) < (SELECT 1,2,1);
+ROW(1,2,3) < (SELECT 1,2,1)
+0
+SELECT ROW(1,2,3) > (SELECT 1,2,1);
+ROW(1,2,3) > (SELECT 1,2,1)
+1
+SELECT ROW(1,2,3) = (SELECT 1,2,NULL);
+ROW(1,2,3) = (SELECT 1,2,NULL)
+NULL
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a');
+(SELECT 1.5,2,'a') = ROW(1.5,2,'a')
+1
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b');
+(SELECT 1.5,2,'a') = ROW(1.5,2,'b')
+0
+SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b');
+(SELECT 1.5,2,'a') = ROW('1.5b',2,'b')
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '1.5b'
+SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a');
+(SELECT 'b',2,'a') = ROW(1.5,2,'a')
+0
+SELECT (SELECT 1.5,2,'a') = ROW(1.5,'2','a');
+(SELECT 1.5,2,'a') = ROW(1.5,'2','a')
+1
+SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a');
+(SELECT 1.5,'c','a') = ROW(1.5,2,'a')
+0
+SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT 1 as a,(SELECT a+a) b,(SELECT b);
+a b (SELECT b)
+1 2 2
+create table t1 (a int);
+create table t2 (a int, b int);
+create table t3 (a int);
+create table t4 (a int not null, b int not null);
+insert into t1 values (2);
+insert into t2 values (1,7),(2,7);
+insert into t4 values (4,8),(3,8),(5,9);
+select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1;
+ERROR 42S22: Reference 'a1' not supported (forward reference in item list)
+select (select a from t1 where t1.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a) a
+NULL 1
+2 2
+select (select a from t1 where t1.a=t2.b), a from t2;
+(select a from t1 where t1.a=t2.b) a
+NULL 1
+NULL 2
+select (select a from t1), a, (select 1 union select 2 limit 1) from t2;
+(select a from t1) a (select 1 union select 2 limit 1)
+2 1 1
+2 2 1
+select (select a from t3), a from t2;
+(select a from t3) a
+NULL 1
+NULL 2
+select * from t2 where t2.a=(select a from t1);
+a b
+2 7
+insert into t3 values (6),(7),(3);
+select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1);
+a b
+1 7
+2 7
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3;
+a b
+1 7
+2 7
+3 8
+(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
+a b
+1 7
+2 7
+4 8
+3 8
+explain extended (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using filesort
+3 UNION t4 ALL NULL NULL NULL NULL 3 100.00 Using where
+4 SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
+NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) from `test`.`t2`)) order by `a`)
+select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
+(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
+3 1
+7 2
+select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+(select t3.a from t3 where a<8 order by 1 desc limit 1) a
+7 2
+set @tmp_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='derived_merge=off,derived_with_keys=off';
+explain extended select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00
+3 DERIVED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort
+Warnings:
+Note 1003 select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+set optimizer_switch=@tmp_optimizer_switch;
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
+a
+2
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
+a
+2
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
+a
+select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+8 7.5000
+8 4.5000
+9 7.5000
+explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1276 Field or reference 'test.t4.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select `test`.`t4`.`b` AS `b`,<expr_cache><`test`.`t4`.`a`>((select avg((`test`.`t2`.`a` + (select min(`test`.`t3`.`a`) from `test`.`t3` where (`test`.`t3`.`a` >= `test`.`t4`.`a`)))) from `test`.`t2`)) AS `(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)` from `test`.`t4`
+select * from t3 where exists (select * from t2 where t2.b=t3.a);
+a
+7
+select * from t3 where not exists (select * from t2 where t2.b=t3.a);
+a
+6
+3
+select * from t3 where a in (select b from t2);
+a
+7
+select * from t3 where a not in (select b from t2);
+a
+6
+3
+select * from t3 where a = some (select b from t2);
+a
+7
+select * from t3 where a <> any (select b from t2);
+a
+6
+3
+select * from t3 where a = all (select b from t2);
+a
+7
+select * from t3 where a <> all (select b from t2);
+a
+6
+3
+insert into t2 values (100, 5);
+select * from t3 where a < any (select b from t2);
+a
+6
+3
+select * from t3 where a < all (select b from t2);
+a
+3
+select * from t3 where a >= any (select b from t2);
+a
+6
+7
+explain extended select * from t3 where a >= any (select b from t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(`test`.`t2`.`b`) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+select * from t3 where a >= all (select b from t2);
+a
+7
+delete from t2 where a=100;
+select * from t3 where a in (select a,b from t2);
+ERROR 21000: Operand should contain 1 column(s)
+select * from t3 where a in (select * from t2);
+ERROR 21000: Operand should contain 1 column(s)
+insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10);
+select b,max(a) as ma from t4 group by b having b < (select max(t2.a) from t2 where t2.b=t4.b);
+b ma
+insert into t2 values (2,10);
+select b,max(a) as ma from t4 group by b having ma < (select max(t2.a) from t2 where t2.b=t4.b);
+b ma
+10 1
+delete from t2 where a=2 and b=10;
+select b,max(a) as ma from t4 group by b having b >= (select max(t2.a) from t2 where t2.b=t4.b);
+b ma
+7 12
+create table t5 (a int);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+insert into t5 values (5);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+insert into t5 values (2);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+explain extended select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00
+2 DEPENDENT SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
+3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t2.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select <expr_cache><`test`.`t2`.`a`>((select 2 from dual where (2 = `test`.`t2`.`a`) union select `test`.`t5`.`a` from `test`.`t5` where (`test`.`t5`.`a` = `test`.`t2`.`a`))) AS `(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a)`,`test`.`t2`.`a` AS `a` from `test`.`t2`
+select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
+ERROR 21000: Subquery returns more than 1 row
+create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq));
+create table t7( uq int primary key, name char(25));
+insert into t7 values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
+insert into t6 values (1,1),(1,2),(2,2),(1,3);
+select * from t6 where exists (select * from t7 where uq = clinic_uq);
+patient_uq clinic_uq
+1 1
+1 2
+2 2
+explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
+1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where (`test`.`t6`.`clinic_uq` = `test`.`t7`.`uq`)
+select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
+ERROR 23000: Column 'a' in field list is ambiguous
+drop table t1,t2,t3;
+CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
+INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
+CREATE TABLE t2 (a varchar(20),b int NOT NULL default '0');
+INSERT INTO t2 VALUES ('W','1'),('A','3'),('J','2');
+CREATE TABLE t1 (a varchar(20),b date NOT NULL default '0000-00-00');
+INSERT INTO t1 VALUES ('W','1732-02-22'),('A','1735-10-30'),('J','1743-04-13');
+SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1);
+a b
+W 1732-02-22
+SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
+a b
+W 1
+SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
+a b
+W a
+CREATE TABLE `t8` (
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+`email` varchar(60) character set latin1 NOT NULL default '',
+PRIMARY KEY (`pseudo`),
+UNIQUE KEY `email` (`email`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
+INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
+INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
+EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
+4 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
+2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
+3 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
+Warnings:
+Note 1003 select 'joce' AS `pseudo`,(select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
+t8 WHERE pseudo='joce');
+ERROR 21000: Operand should contain 1 column(s)
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
+pseudo='joce');
+ERROR 21000: Operand should contain 1 column(s)
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
+pseudo
+joce
+SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%');
+ERROR 21000: Subquery returns more than 1 row
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8;
+CREATE TABLE `t1` (
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`pseudo`,`date`,`topic`),
+KEY `topic` (`topic`)
+) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (topic,date,pseudo) VALUES
+('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
+EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
+Warnings:
+Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')
+EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index
+Warnings:
+Note 1003 select (select distinct `test`.`t1`.`date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')`
+SELECT DISTINCT date FROM t1 WHERE date='2002-08-03';
+date
+2002-08-03
+SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03');
+(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')
+2002-08-03
+SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
+1
+1
+1
+1
+SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
+ERROR 21000: Subquery returns more than 1 row
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL topic 3 NULL 2 100.00 Using index
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
+drop table t1;
+CREATE TABLE `t1` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
+INSERT INTO t1 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
+CREATE TABLE `t2` (
+`mot` varchar(30) NOT NULL default '',
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) NOT NULL default '',
+PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`)
+) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO t2 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
+select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
+a
+40143
+SELECT numeropost,maxnumrep FROM t1 WHERE exists (SELECT 1 FROM t2 WHERE (mot='joce') AND date >= '2002-10-21' AND t1.numeropost = t2.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
+numeropost maxnumrep
+43506 2
+40143 1
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) b;
+ERROR 42S22: Unknown column 'a' in 'having clause'
+SELECT 1 IN (SELECT 1 FROM t2 HAVING a);
+ERROR 42S22: Unknown column 'a' in 'having clause'
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+mot topic date pseudo
+SELECT * from t2 where topic IN (SELECT SUM(topic) FROM t1);
+mot topic date pseudo
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+mot topic date pseudo
+SELECT * from t2 where topic = any (SELECT SUM(topic) FROM t1);
+mot topic date pseudo
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic);
+mot topic date pseudo
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100) from t2;
+mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 4100)
+joce 40143 2002-10-22 joce 1
+joce 43506 2002-10-22 joce 1
+SELECT * from t2 where topic = all (SELECT SUM(topic) FROM t2);
+mot topic date pseudo
+SELECT * from t2 where topic <> any (SELECT SUM(topic) FROM t2);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+joce 43506 2002-10-22 joce
+SELECT * from t2 where topic IN (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+SELECT * from t2 where topic = any (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+SELECT * from t2 where topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000);
+mot topic date pseudo
+joce 40143 2002-10-22 joce
+SELECT *, topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000) from t2;
+mot topic date pseudo topic = all (SELECT topic FROM t2 GROUP BY topic HAVING topic < 41000)
+joce 40143 2002-10-22 joce 1
+joce 43506 2002-10-22 joce 0
+drop table t1,t2;
+CREATE TABLE `t1` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM ROW_FORMAT=FIXED;
+INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1);
+select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
+ERROR 21000: Subquery returns more than 1 row
+select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
+ERROR 21000: Subquery returns more than 1 row
+show warnings;
+Level Code Message
+Error 1242 Subquery returns more than 1 row
+Error 1028 Sort aborted: Subquery returns more than 1 row
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+(select * from t1) union (select * from t1) order by (select a from t1 limit 1);
+a
+1
+2
+3
+drop table t1;
+CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
+INSERT INTO t1 VALUES ();
+SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b');
+ERROR 21000: Subquery returns more than 1 row
+drop table t1;
+CREATE TABLE `t1` (
+`numeropost` mediumint(8) unsigned NOT NULL default '0',
+`numreponse` int(10) unsigned NOT NULL auto_increment,
+`pseudo` varchar(35) NOT NULL default '',
+PRIMARY KEY (`numeropost`,`numreponse`),
+UNIQUE KEY `numreponse` (`numreponse`),
+KEY `pseudo` (`pseudo`,`numeropost`)
+) ENGINE=MyISAM;
+SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a;
+ERROR 42S22: Reference 'numreponse' not supported (forward reference in item list)
+SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a;
+ERROR 42S22: Unknown column 'a' in 'having clause'
+SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a;
+numreponse (SELECT numeropost FROM t1 HAVING numreponse=1)
+INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
+EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
+ERROR 21000: Subquery returns more than 1 row
+SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1');
+ERROR 21000: Subquery returns more than 1 row
+EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+Warnings:
+Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
+EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+Warnings:
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
+drop table t1;
+CREATE TABLE t1 (a int(1));
+INSERT INTO t1 VALUES (1);
+SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
+1
+1
+drop table t1;
+create table t1 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t1 values (0, 10),(1, 11),(2, 12);
+insert into t2 values (1, 21),(2, 22),(3, 23);
+select * from t1;
+a b
+0 10
+1 11
+2 12
+update t1 set b= (select b from t1);
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+update t1 set b= (select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+update t1 set b= (select b from t2 where t1.a = t2.a);
+select * from t1;
+a b
+0 NULL
+1 21
+2 22
+drop table t1, t2;
+create table t1 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t1 values (0, 10),(1, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t1;
+a b
+0 10
+1 11
+2 12
+select * from t1 where b = (select b from t2 where t1.a = t2.a);
+a b
+2 12
+delete from t1 where b in (select b from t1);
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+delete from t1 where b = (select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+delete from t1 where b = (select b from t2 where t1.a = t2.a);
+select * from t1;
+a b
+0 10
+1 11
+drop table t1, t2;
+create table t11 (a int NOT NULL, b int, primary key (a));
+create table t12 (a int NOT NULL, b int, primary key (a));
+create table t2 (a int NOT NULL, b int, primary key (a));
+insert into t11 values (0, 10),(1, 11),(2, 12);
+insert into t12 values (33, 10),(22, 11),(2, 12);
+insert into t2 values (1, 21),(2, 12),(3, 23);
+select * from t11;
+a b
+0 10
+1 11
+2 12
+select * from t12;
+a b
+33 10
+22 11
+2 12
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
+ERROR HY000: You can't specify target table 't12' for update in FROM clause
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
+ERROR 21000: Subquery returns more than 1 row
+delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
+select * from t11;
+a b
+0 10
+1 11
+select * from t12;
+a b
+33 10
+22 11
+drop table t11, t12, t2;
+CREATE TABLE t1 (x int) ENGINE=MyISAM;
+create table t2 (a int) ENGINE=MyISAM;
+create table t3 (b int);
+insert into t2 values (1);
+insert into t3 values (1),(2);
+INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+INSERT INTO t1 (x) VALUES ((SELECT b FROM t3));
+ERROR 21000: Subquery returns more than 1 row
+INSERT INTO t1 (x) VALUES ((SELECT a FROM t2));
+select * from t1;
+x
+1
+insert into t2 values (1);
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
+select * from t1;
+x
+1
+2
+INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2;
+select * from t1;
+x
+1
+2
+3
+3
+INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2;
+select * from t1;
+x
+1
+2
+3
+3
+11
+11
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
+ERROR 42S22: Unknown column 'x' in 'field list'
+INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
+select * from t1;
+x
+1
+2
+3
+3
+11
+11
+2
+drop table t1, t2, t3;
+CREATE TABLE t1 (x int not null, y int, primary key (x)) ENGINE=MyISAM;
+create table t2 (a int);
+create table t3 (a int);
+insert into t2 values (1);
+insert into t3 values (1),(2);
+select * from t1;
+x y
+replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2));
+ERROR HY000: You can't specify target table 't1' for update in FROM clause
+replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2));
+ERROR 21000: Subquery returns more than 1 row
+replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2));
+select * from t1;
+x y
+1 2
+replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+2 FROM t2));
+select * from t1;
+x y
+1 3
+replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a FROM t2));
+select * from t1;
+x y
+1 3
+4 1
+replace DELAYED into t1 (x, y) VALUES ((SELECT a+3 FROM t2), (SELECT a+1 FROM t2));
+select * from t1;
+x y
+1 3
+4 2
+replace LOW_PRIORITY into t1 (x, y) VALUES ((SELECT a+1 FROM t2), (SELECT a FROM t2));
+select * from t1;
+x y
+1 3
+4 2
+2 1
+drop table t1, t2, t3;
+SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *);
+ERROR HY000: No tables used
+CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (1),(2);
+SELECT * FROM t2 WHERE id IN (SELECT 1);
+id
+1
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using index
+Warnings:
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = 1)
+SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
+id
+1
+SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
+id
+2
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ref id id 5 const 1 100.00 Using where; Using index
+Warnings:
+Note 1249 Select 3 was reduced during optimization
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where <expr_cache><`test`.`t2`.`id`>(<in_optimizer>(`test`.`t2`.`id`,<exists>(select 1 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(1)) union select 3 having (<cache>(`test`.`t2`.`id`) = <ref_null_helper>(3)))))
+SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
+id
+SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
+id
+2
+INSERT INTO t2 VALUES ((SELECT * FROM t2));
+ERROR HY000: You can't specify target table 't2' for update in FROM clause
+INSERT INTO t2 VALUES ((SELECT id FROM t2));
+ERROR HY000: You can't specify target table 't2' for update in FROM clause
+SELECT * FROM t2;
+id
+1
+2
+CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 values (1),(1);
+UPDATE t2 SET id=(SELECT * FROM t1);
+ERROR 21000: Subquery returns more than 1 row
+drop table t2, t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+select 1 IN (SELECT * from t1);
+1 IN (SELECT * from t1)
+1
+select 10 IN (SELECT * from t1);
+10 IN (SELECT * from t1)
+0
+select NULL IN (SELECT * from t1);
+NULL IN (SELECT * from t1)
+NULL
+update t1 set a=NULL where a=2;
+select 1 IN (SELECT * from t1);
+1 IN (SELECT * from t1)
+1
+select 3 IN (SELECT * from t1);
+3 IN (SELECT * from t1)
+1
+select 10 IN (SELECT * from t1);
+10 IN (SELECT * from t1)
+NULL
+select 1 > ALL (SELECT * from t1);
+1 > ALL (SELECT * from t1)
+0
+select 10 > ALL (SELECT * from t1);
+10 > ALL (SELECT * from t1)
+NULL
+select 1 > ANY (SELECT * from t1);
+1 > ANY (SELECT * from t1)
+NULL
+select 10 > ANY (SELECT * from t1);
+10 > ANY (SELECT * from t1)
+1
+drop table t1;
+create table t1 (a varchar(20));
+insert into t1 values ('A'),('BC'),('DEF');
+select 'A' IN (SELECT * from t1);
+'A' IN (SELECT * from t1)
+1
+select 'XYZS' IN (SELECT * from t1);
+'XYZS' IN (SELECT * from t1)
+0
+select NULL IN (SELECT * from t1);
+NULL IN (SELECT * from t1)
+NULL
+update t1 set a=NULL where a='BC';
+select 'A' IN (SELECT * from t1);
+'A' IN (SELECT * from t1)
+1
+select 'DEF' IN (SELECT * from t1);
+'DEF' IN (SELECT * from t1)
+1
+select 'XYZS' IN (SELECT * from t1);
+'XYZS' IN (SELECT * from t1)
+NULL
+select 'A' > ALL (SELECT * from t1);
+'A' > ALL (SELECT * from t1)
+0
+select 'XYZS' > ALL (SELECT * from t1);
+'XYZS' > ALL (SELECT * from t1)
+NULL
+select 'A' > ANY (SELECT * from t1);
+'A' > ANY (SELECT * from t1)
+NULL
+select 'XYZS' > ANY (SELECT * from t1);
+'XYZS' > ANY (SELECT * from t1)
+1
+drop table t1;
+create table t1 (a float);
+insert into t1 values (1.5),(2.5),(3.5);
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+0
+select NULL IN (SELECT * from t1);
+NULL IN (SELECT * from t1)
+NULL
+update t1 set a=NULL where a=2.5;
+select 1.5 IN (SELECT * from t1);
+1.5 IN (SELECT * from t1)
+1
+select 3.5 IN (SELECT * from t1);
+3.5 IN (SELECT * from t1)
+1
+select 10.5 IN (SELECT * from t1);
+10.5 IN (SELECT * from t1)
+NULL
+select 1.5 > ALL (SELECT * from t1);
+1.5 > ALL (SELECT * from t1)
+0
+select 10.5 > ALL (SELECT * from t1);
+10.5 > ALL (SELECT * from t1)
+NULL
+select 1.5 > ANY (SELECT * from t1);
+1.5 > ANY (SELECT * from t1)
+NULL
+select 10.5 > ANY (SELECT * from t1);
+10.5 > ANY (SELECT * from t1)
+1
+explain extended select (select a+1) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1249 Select 2 was reduced during optimization
+Note 1003 select (`test`.`t1`.`a` + 1) AS `(select a+1)` from `test`.`t1`
+select (select a+1) from t1;
+(select a+1)
+2.5
+NULL
+4.5
+drop table t1;
+CREATE TABLE t1 (a int(11) NOT NULL default '0', PRIMARY KEY (a));
+CREATE TABLE t2 (a int(11) default '0', INDEX (a));
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t2 VALUES (1),(2),(3);
+SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
+a t1.a in (select t2.a from t2)
+1 1
+2 1
+3 1
+4 0
+explain extended SELECT t1.a, t1.a in (select t2.a from t2) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
+2 SUBQUERY t2 index_subquery a a 5 func 2 100.00 Using index
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`a`) in t2 on a checking NULL having <is_not_null_test>(`test`.`t2`.`a`))))) AS `t1.a in (select t2.a from t2)` from `test`.`t1`
+CREATE TABLE t3 (a int(11) default '0');
+INSERT INTO t3 VALUES (1),(2),(3);
+SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
+a t1.a in (select t2.a from t2,t3 where t3.a=t2.a)
+1 1
+2 1
+3 1
+4 0
+explain extended SELECT t1.a, t1.a in (select t2.a from t2,t3 where t3.a=t2.a) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL PRIMARY 4 NULL 4 100.00 Using index
+2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using where; Using index
+2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`a` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`)))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
+drop table t1,t2,t3;
+# check correct NULL Processing for normal IN/ALL/ANY
+# and 2 ways of max/min optimization
+create table t1 (a int);
+insert into t1 values (1), (100), (NULL), (1000);
+create table t2 (a int not null);
+# subselect returns empty set (for NULL and non-NULL left part)
+select a, a in (select * from t2) from t1;
+a a in (select * from t2)
+1 0
+100 0
+NULL 0
+1000 0
+select a, a > any (select * from t2) from t1;
+a a > any (select * from t2)
+1 0
+100 0
+NULL 0
+1000 0
+select a, a > all (select * from t2) from t1;
+a a > all (select * from t2)
+1 1
+100 1
+NULL 1
+1000 1
+select a from t1 where a in (select * from t2);
+a
+select a from t1 where a > any (select * from t2);
+a
+select a from t1 where a > all (select * from t2);
+a
+1
+100
+NULL
+1000
+select a from t1 where a in (select * from t2 group by a);
+a
+select a from t1 where a > any (select * from t2 group by a);
+a
+select a from t1 where a > all (select * from t2 group by a);
+a
+1
+100
+NULL
+1000
+insert into t2 values (1),(200);
+# sebselect returns non-empty set without NULLs
+select a, a in (select * from t2) from t1;
+a a in (select * from t2)
+1 1
+100 0
+NULL NULL
+1000 0
+select a, a > any (select * from t2) from t1;
+a a > any (select * from t2)
+1 0
+100 1
+NULL NULL
+1000 1
+select a, a > all (select * from t2) from t1;
+a a > all (select * from t2)
+1 0
+100 0
+NULL NULL
+1000 1
+select a from t1 where a in (select * from t2);
+a
+1
+select a from t1 where a > any (select * from t2);
+a
+100
+1000
+select a from t1 where a > all (select * from t2);
+a
+1000
+select a from t1 where a in (select * from t2 group by a);
+a
+1
+select a from t1 where a > any (select * from t2 group by a);
+a
+100
+1000
+select a from t1 where a > all (select * from t2 group by a);
+a
+1000
+drop table t2;
+create table t2 (a int);
+insert into t2 values (1),(NULL),(200);
+# sebselect returns non-empty set with NULLs
+select a, a in (select * from t2) from t1;
+a a in (select * from t2)
+1 1
+100 NULL
+NULL NULL
+1000 NULL
+select a, a > any (select * from t2) from t1;
+a a > any (select * from t2)
+1 NULL
+100 1
+NULL NULL
+1000 1
+select a, a > all (select * from t2) from t1;
+a a > all (select * from t2)
+1 0
+100 0
+NULL NULL
+1000 NULL
+select a from t1 where a in (select * from t2);
+a
+1
+select a from t1 where a > any (select * from t2);
+a
+100
+1000
+select a from t1 where a > all (select * from t2);
+a
+select a from t1 where a in (select * from t2 group by a);
+a
+1
+select a from t1 where a > any (select * from t2 group by a);
+a
+100
+1000
+select a from t1 where a > all (select * from t2 group by a);
+a
+drop table t1, t2;
+create table t1 (a float);
+select 10.5 IN (SELECT * from t1 LIMIT 1);
+ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
+ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+drop table t1;
+create table t1 (a int, b int, c varchar(10));
+create table t2 (a int);
+insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
+insert into t2 values (1),(2),(NULL);
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2;
+a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
+1 1 a
+2 0 b
+NULL NULL NULL
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
+a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
+1 0 a
+2 1 b
+NULL NULL NULL
+select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2;
+a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
+1 0 a
+2 0 b
+NULL NULL NULL
+drop table t1,t2;
+create table t1 (a int, b real, c varchar(10));
+insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
+select ROW(1, 1, 'a') IN (select a,b,c from t1);
+ROW(1, 1, 'a') IN (select a,b,c from t1)
+1
+select ROW(1, 2, 'a') IN (select a,b,c from t1);
+ROW(1, 2, 'a') IN (select a,b,c from t1)
+0
+select ROW(1, 1, 'a') IN (select b,a,c from t1);
+ROW(1, 1, 'a') IN (select b,a,c from t1)
+1
+select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null);
+ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null)
+1
+select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null);
+ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null)
+0
+select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
+ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null)
+1
+select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
+ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a')
+1
+select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
+ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a')
+0
+select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
+ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a')
+1
+select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
+ERROR 42000: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+do @a:=(SELECT a from t1);
+select @a;
+@a
+1
+set @a:=2;
+set @a:=(SELECT a from t1);
+select @a;
+@a
+1
+drop table t1;
+do (SELECT a from t1);
+ERROR 42S02: Table 'test.t1' doesn't exist
+set @a:=(SELECT a from t1);
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE TABLE t1 (a int, KEY(a));
+HANDLER t1 OPEN;
+HANDLER t1 READ a=((SELECT 1));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1))' at line 1
+HANDLER t1 CLOSE;
+drop table t1;
+create table t1 (a int);
+create table t2 (b int);
+insert into t1 values (1),(2);
+insert into t2 values (1);
+select a from t1 where a in (select a from t1 where a in (select b from t2));
+a
+1
+drop table t1, t2;
+create table t1 (a int, b int);
+create table t2 like t1;
+insert into t1 values (1,2),(1,3),(1,4),(1,5);
+insert into t2 values (1,2),(1,3);
+select * from t1 where row(a,b) in (select a,b from t2);
+a b
+1 2
+1 3
+drop table t1, t2;
+CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
+select * from t1;
+i
+2
+drop table t1;
+CREATE TABLE t1 (a int(1));
+EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+Warnings:
+Note 1003 select (select rand() from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
+EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+Warnings:
+Note 1003 select (select encrypt('test') from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
+EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
+Warnings:
+Note 1003 select (select benchmark(1,1) from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
+drop table t1;
+CREATE TABLE `t1` (
+`mot` varchar(30) character set latin1 NOT NULL default '',
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
+KEY `pseudo` (`pseudo`,`date`,`topic`),
+KEY `topic` (`topic`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+CREATE TABLE `t2` (
+`mot` varchar(30) character set latin1 NOT NULL default '',
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
+KEY `pseudo` (`pseudo`,`date`,`topic`),
+KEY `topic` (`topic`)
+) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+CREATE TABLE `t3` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test');
+Warnings:
+Warning 1265 Data truncated for column 'date' at row 1
+Warning 1265 Data truncated for column 'date' at row 2
+INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test');
+Warnings:
+Warning 1265 Data truncated for column 'date' at row 1
+Warning 1265 Data truncated for column 'date' at row 2
+INSERT INTO t3 VALUES (1,1);
+SELECT DISTINCT topic FROM t2 WHERE NOT EXISTS(SELECT * FROM t3 WHERE
+numeropost=topic);
+topic
+2
+select * from t1;
+mot topic date pseudo
+joce 1 0000-00-00 joce
+test 2 0000-00-00 test
+DELETE FROM t1 WHERE topic IN (SELECT DISTINCT topic FROM t2 WHERE NOT
+EXISTS(SELECT * FROM t3 WHERE numeropost=topic));
+select * from t1;
+mot topic date pseudo
+joce 1 0000-00-00 joce
+drop table t1, t2, t3;
+SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
+a (SELECT a)
+1 1
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(1) NOT NULL DEFAULT '0',
+ `(SELECT 1)` int(1) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(1) NOT NULL DEFAULT '0',
+ `(SELECT a)` int(1) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(1) NOT NULL DEFAULT '0',
+ `(SELECT a+0)` int(3) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
+select * from t1;
+a
+2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1)
+from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
+2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
+3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() from `test`.`t1` limit 1) from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
+drop table t1;
+select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
+ERROR 42S02: Table 'test.t1' doesn't exist
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+name char(35) NOT NULL default '',
+t2 char(3) NOT NULL default '',
+District char(20) NOT NULL default '',
+Population int(11) NOT NULL default '0',
+PRIMARY KEY (ID)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (130,'Sydney','AUS','New South Wales',3276207);
+INSERT INTO t1 VALUES (131,'Melbourne','AUS','Victoria',2865329);
+INSERT INTO t1 VALUES (132,'Brisbane','AUS','Queensland',1291117);
+CREATE TABLE t2 (
+Code char(3) NOT NULL default '',
+Name char(52) NOT NULL default '',
+Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
+Region char(26) NOT NULL default '',
+SurfaceArea float(10,2) NOT NULL default '0.00',
+IndepYear smallint(6) default NULL,
+Population int(11) NOT NULL default '0',
+LifeExpectancy float(3,1) default NULL,
+GNP float(10,2) default NULL,
+GNPOld float(10,2) default NULL,
+LocalName char(45) NOT NULL default '',
+GovernmentForm char(45) NOT NULL default '',
+HeadOfState char(60) default NULL,
+Capital int(11) default NULL,
+Code2 char(2) NOT NULL default '',
+PRIMARY KEY (Code)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('AUS','Australia','Oceania','Australia and New Zealand',7741220.00,1901,18886000,79.8,351182.00,392911.00,'Australia','Constitutional Monarchy, Federation','Elisabeth II',135,'AU');
+INSERT INTO t2 VALUES ('AZE','Azerbaijan','Asia','Middle East',86600.00,1991,7734000,62.9,4127.00,4100.00,'Azärbaycan','Federal Republic','Heydär Äliyev',144,'AZ');
+select t2.Continent, t1.Name, t1.Population from t2 LEFT JOIN t1 ON t2.Code = t1.t2 where t1.Population IN (select max(t1.Population) AS Population from t1, t2 where t1.t2 = t2.Code group by Continent);
+Continent Name Population
+Oceania Sydney 3276207
+drop table t1, t2;
+CREATE TABLE `t1` (
+`id` mediumint(8) unsigned NOT NULL auto_increment,
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`id`),
+UNIQUE KEY `pseudo` (`pseudo`)
+) ENGINE=MyISAM PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (pseudo) VALUES ('test');
+SELECT 0 IN (SELECT 1 FROM t1 a);
+0 IN (SELECT 1 FROM t1 a)
+0
+EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from dual where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+INSERT INTO t1 (pseudo) VALUES ('test1');
+SELECT 0 IN (SELECT 1 FROM t1 a);
+0 IN (SELECT 1 FROM t1 a)
+0
+EXPLAIN EXTENDED SELECT 0 IN (SELECT 1 FROM t1 a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+Warnings:
+Note 1003 select <in_optimizer>(0,<exists>(select 1 from `test`.`t1` `a` where (0 = 1))) AS `0 IN (SELECT 1 FROM t1 a)`
+drop table t1;
+CREATE TABLE `t1` (
+`i` int(11) NOT NULL default '0',
+PRIMARY KEY (`i`)
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
+UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
+UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
+ERROR 42S22: Unknown column 't.i' in 'field list'
+select * from t1;
+i
+3
+drop table t1;
+CREATE TABLE t1 (
+id int(11) default NULL
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
+CREATE TABLE t2 (
+id int(11) default NULL,
+name varchar(15) default NULL
+) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
+update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
+select * from t2;
+id name
+4 vita
+1 lenka
+2 lenka
+1 lenka
+drop table t1,t2;
+create table t1 (a int, unique index indexa (a));
+insert into t1 values (-1), (-4), (-2), (NULL);
+select -10 IN (select a from t1 FORCE INDEX (indexa));
+-10 IN (select a from t1 FORCE INDEX (indexa))
+NULL
+drop table t1;
+create table t1 (id int not null auto_increment primary key, salary int, key(salary));
+insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
+explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
+drop table t1;
+CREATE TABLE t1 (
+ID int(10) unsigned NOT NULL auto_increment,
+SUB_ID int(3) unsigned NOT NULL default '0',
+REF_ID int(10) unsigned default NULL,
+REF_SUB int(3) unsigned default '0',
+PRIMARY KEY (ID,SUB_ID),
+UNIQUE KEY t1_PK (ID,SUB_ID),
+KEY t1_FK (REF_ID,REF_SUB),
+KEY t1_REFID (REF_ID)
+) ENGINE=MyISAM CHARSET=cp1251;
+INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
+SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
+REF_ID
+DROP TABLE t1;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,0), (2,0), (3,0);
+insert into t2 values (1,1), (2,1), (3,1), (2,2);
+update ignore t1 set b=(select b from t2 where t1.a=t2.a);
+Warnings:
+Warning 1242 Subquery returns more than 1 row
+select * from t1;
+a b
+1 1
+2 NULL
+3 1
+drop table t1, t2;
+CREATE TABLE `t1` (
+`id` mediumint(8) unsigned NOT NULL auto_increment,
+`pseudo` varchar(35) NOT NULL default '',
+`email` varchar(60) NOT NULL default '',
+PRIMARY KEY (`id`),
+UNIQUE KEY `email` (`email`),
+UNIQUE KEY `pseudo` (`pseudo`)
+) ENGINE=MyISAM CHARSET=latin1 PACK_KEYS=1 ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 (id,pseudo,email) VALUES (1,'test','test'),(2,'test1','test1');
+SELECT pseudo as a, pseudo as b FROM t1 GROUP BY (SELECT a) ORDER BY (SELECT id*1);
+a b
+test test
+test1 test1
+drop table if exists t1;
+(SELECT 1 as a) UNION (SELECT 1) ORDER BY (SELECT a+0);
+a
+1
+create table t1 (a int not null, b int, primary key (a));
+create table t2 (a int not null, primary key (a));
+create table t3 (a int not null, b int, primary key (a));
+insert into t1 values (1,10), (2,20), (3,30), (4,40);
+insert into t2 values (2), (3), (4), (5);
+insert into t3 values (10,3), (20,4), (30,5);
+select * from t2 where t2.a in (select a from t1);
+a
+2
+3
+4
+explain extended select * from t2 where t2.a in (select a from t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
+1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+a
+2
+4
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
+1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+a
+2
+3
+explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index
+1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+drop table t1, t2, t3;
+create table t1 (a int, b int, index a (a,b));
+create table t2 (a int, index a (a));
+create table t3 (a int, b int, index a (a));
+insert into t1 values (1,10), (2,20), (3,30), (4,40);
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+insert into t1
+select rand()*100000+200,rand()*100000 from t0 A, t0 B, t0 C, t0 D;
+insert into t2 values (2), (3), (4), (5);
+insert into t3 values (10,3), (20,4), (30,5);
+select * from t2 where t2.a in (select a from t1);
+a
+2
+3
+4
+explain extended select * from t2 where t2.a in (select a from t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
+1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using index; FirstMatch(t2)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where (`test`.`t1`.`a` = `test`.`t2`.`a`)
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+a
+2
+4
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
+1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+a
+2
+3
+explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
+1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
+1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
+insert into t1 values (3,31);
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+a
+2
+3
+4
+select * from t2 where t2.a in (select a from t1 where t1.b <> 30 and t1.b <> 31);
+a
+2
+4
+explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 index a a 5 NULL 4 100.00 Using where; Using index
+1 PRIMARY t1 ref a a 5 test.t2.a 101 100.00 Using where; Using index; FirstMatch(t2)
+Warnings:
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` <> 30))
+drop table t0, t1, t2, t3;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+create table t3 (a int, b int);
+insert into t1 values (0,100),(1,2), (1,3), (2,2), (2,7), (2,-1), (3,10);
+insert into t2 values (0,0), (1,1), (2,1), (3,1), (4,1);
+insert into t3 values (3,3), (2,2), (1,1);
+select a,(select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1) from t3;
+a (select count(distinct t1.b) as sum from t1,t2 where t1.a=t2.a and t2.b > 0 and t1.a <= t3.b group by t1.a order by sum limit 1)
+3 1
+2 2
+1 2
+drop table t1,t2,t3;
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1);
+s1
+1
+drop table t1,t2;
+create table t1 (s1 int);
+create table t2 (s1 int);
+insert into t1 values (1);
+insert into t2 values (1);
+update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
+ERROR 42S22: Unknown column 'x.s1' in 'field list'
+DROP TABLE t1, t2;
+CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
+s2 CHAR(5) COLLATE latin1_swedish_ci);
+INSERT INTO t1 VALUES ('z','?');
+select * from t1 where s1 > (select max(s2) from t1);
+ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '>'
+select * from t1 where s1 > any (select max(s2) from t1);
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin1_german1_ci,IMPLICIT) for operation '<'
+drop table t1;
+create table t1(toid int,rd int);
+create table t2(userid int,pmnew int,pmtotal int);
+insert into t2 values(1,0,0),(2,0,0);
+insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
+select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
+userid pmtotal pmnew calc_total calc_new
+1 0 0 9 3
+2 0 0 4 2
+drop table t1, t2;
+create table t1 (s1 char(5));
+select (select 'a','b' from t1 union select 'a','b' from t1) from t1;
+ERROR 21000: Operand should contain 1 column(s)
+insert into t1 values ('tttt');
+select * from t1 where ('a','b')=(select 'a','b' from t1 union select 'a','b' from t1);
+s1
+tttt
+explain extended (select * from t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 (select 'tttt' AS `s1` from dual)
+(select * from t1);
+s1
+tttt
+drop table t1;
+create table t1 (s1 char(5), index s1(s1));
+create table t2 (s1 char(5), index s1(s1));
+insert into t1 values ('a1'),('a2'),('a3');
+insert into t2 values ('a1'),('a2');
+select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+s1 s1 NOT IN (SELECT s1 FROM t2)
+a1 0
+a2 0
+a3 1
+select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
+s1 s1 = ANY (SELECT s1 FROM t2)
+a1 1
+a2 1
+a3 0
+select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
+s1 s1 <> ALL (SELECT s1 FROM t2)
+a1 0
+a2 0
+a3 1
+select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+s1 s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')
+a1 0
+a2 1
+a3 1
+explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+Warnings:
+Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
+explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+Warnings:
+Note 1003 select `test`.`t1`.`s1` AS `s1`,<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
+explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
+Warnings:
+Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
+explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
+2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
+Warnings:
+Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<expr_cache><`test`.`t1`.`s1`>(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`)))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
+drop table t1,t2;
+create table t2 (a int, b int not null);
+create table t3 (a int);
+insert into t3 values (6),(7),(3);
+select * from t3 where a >= all (select b from t2);
+a
+6
+7
+3
+explain extended select * from t3 where a >= all (select b from t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+select * from t3 where a >= some (select b from t2);
+a
+explain extended select * from t3 where a >= some (select b from t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+select * from t3 where a >= all (select b from t2 group by 1);
+a
+6
+7
+3
+explain extended select * from t3 where a >= all (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,((select max(NULL) from `test`.`t2`) > <cache>(`test`.`t3`.`a`))))
+select * from t3 where a >= some (select b from t2 group by 1);
+a
+explain extended select * from t3 where a >= some (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 0.00 const row not found
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <nop>(<in_optimizer>(`test`.`t3`.`a`,((select min(NULL) from `test`.`t2`) <= <cache>(`test`.`t3`.`a`))))
+select * from t3 where NULL >= any (select b from t2);
+a
+explain extended select * from t3 where NULL >= any (select b from t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
+select * from t3 where NULL >= any (select b from t2 group by 1);
+a
+explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
+select * from t3 where NULL >= some (select b from t2);
+a
+explain extended select * from t3 where NULL >= some (select b from t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
+select * from t3 where NULL >= some (select b from t2 group by 1);
+a
+explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where 0
+insert into t2 values (2,2), (2,1), (3,3), (3,1);
+select * from t3 where a > all (select max(b) from t2 group by a);
+a
+6
+7
+explain extended select * from t3 where a > all (select max(b) from t2 group by a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary
+Warnings:
+Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>(<in_optimizer>(`test`.`t3`.`a`,(<max>(select max(`test`.`t2`.`b`) from `test`.`t2` group by `test`.`t2`.`a`) >= <cache>(`test`.`t3`.`a`))))
+drop table t2, t3;
+CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
+INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
+CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647;
+INSERT INTO `t2` (`db_id`, `name`, `primary_uid`, `secondary_uid`) VALUES (18, 'Not Set 1', 0, 0),(19, 'Valid', 1, 2),(20, 'Valid 2', 1, 2),(21, 'Should Not Return', 1, 2),(26, 'Not Set 2', 0, 0),(-1, 'ALL DB\'S', 0, 0);
+CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ;
+INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
+CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
+select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
+dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
+-1 Valid 1
+-1 Valid 2 1
+-1 Should Not Return 0
+SELECT dbid, name FROM t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND ((date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')) AND t4.task_id = taskid;
+dbid name
+-1 Valid
+-1 Valid 2
+drop table t1,t2,t3,t4;
+CREATE TABLE t1 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES (1),(5);
+CREATE TABLE t2 (id int(11) default NULL) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES (2),(6);
+select * from t1 where (1,2,6) in (select * from t2);
+ERROR 21000: Operand should contain 3 column(s)
+DROP TABLE t1,t2;
+create table t1 (s1 int);
+insert into t1 values (1);
+insert into t1 values (2);
+set sort_buffer_size = (select s1 from t1);
+ERROR 21000: Subquery returns more than 1 row
+do (select * from t1);
+Warnings:
+Error 1242 Subquery returns more than 1 row
+drop table t1;
+create table t1 (s1 char);
+insert into t1 values ('e');
+select * from t1 where 'f' > any (select s1 from t1);
+s1
+e
+select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
+s1
+e
+explain extended select * from t1 where 'f' > any (select s1 from t1 union select s1 from t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1 100.00
+2 SUBQUERY t1 system NULL NULL NULL NULL 1 100.00
+3 UNION t1 system NULL NULL NULL NULL 1 100.00
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 select 'e' AS `s1` from dual where 1
+drop table t1;
+CREATE TABLE t1 (number char(11) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t1 VALUES ('69294728265'),('18621828126'),('89356874041'),('95895001874');
+CREATE TABLE t2 (code char(5) NOT NULL default '',UNIQUE KEY code (code)) ENGINE=MyISAM CHARSET=latin1;
+INSERT INTO t2 VALUES ('1'),('1226'),('1245'),('1862'),('18623'),('1874'),('1967'),('6');
+select c.number as phone,(select p.code from t2 p where c.number like concat(p.code, '%') order by length(p.code) desc limit 1) as code from t1 c;
+phone code
+69294728265 6
+18621828126 1862
+89356874041 NULL
+95895001874 NULL
+drop table t1, t2;
+create table t1 (s1 int);
+create table t2 (s1 int);
+select * from t1 where (select count(*) from t2 where t1.s2) = 1;
+ERROR 42S22: Unknown column 't1.s2' in 'where clause'
+select * from t1 where (select count(*) from t2 group by t1.s2) = 1;
+ERROR 42S22: Unknown column 't1.s2' in 'group statement'
+select count(*) from t2 group by t1.s2;
+ERROR 42S22: Unknown column 't1.s2' in 'group statement'
+drop table t1, t2;
+CREATE TABLE t1(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC VARCHAR(20) DEFAULT NULL,PRIMARY KEY (COLA, COLB));
+CREATE TABLE t2(COLA FLOAT NOT NULL,COLB FLOAT NOT NULL,COLC CHAR(1) NOT NULL,PRIMARY KEY (COLA));
+INSERT INTO t1 VALUES (1,1,'1A3240'), (1,2,'4W2365');
+INSERT INTO t2 VALUES (100, 200, 'C');
+SELECT DISTINCT COLC FROM t1 WHERE COLA = (SELECT COLA FROM t2 WHERE COLB = 200 AND COLC ='C' LIMIT 1);
+COLC
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a int(1));
+INSERT INTO t1 VALUES (1),(1),(1),(1),(1),(2),(3),(4),(5);
+SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
+(SELECT a)
+1
+2
+3
+4
+5
+DROP TABLE t1;
+create table t1 (a int, b decimal(13, 3));
+insert into t1 values (1, 0.123);
+select a, (select max(b) from t1) into outfile "../../tmp/subselect.out.file.1" from t1;
+delete from t1;
+load data infile "../../tmp/subselect.out.file.1" into table t1;
+select * from t1;
+a b
+1 0.123
+drop table t1;
+CREATE TABLE `t1` (
+`id` int(11) NOT NULL auto_increment,
+`id_cns` tinyint(3) unsigned NOT NULL default '0',
+`tipo` enum('','UNO','DUE') NOT NULL default '',
+`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
+`particolare` mediumint(8) unsigned NOT NULL default '0',
+`generale` mediumint(8) unsigned NOT NULL default '0',
+`bis` tinyint(3) unsigned NOT NULL default '0',
+PRIMARY KEY (`id`),
+UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
+UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
+);
+INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
+CREATE TABLE `t2` (
+`id` tinyint(3) unsigned NOT NULL auto_increment,
+`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
+PRIMARY KEY (`id`)
+);
+INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
+SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
+id max_anno_dep PIPPO
+16 1987 1
+50 1990 0
+51 1990 NULL
+DROP TABLE t1, t2;
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+SET SQL_SELECT_LIMIT=1;
+select sum(a) from (select * from t1) as a;
+sum(a)
+6
+select 2 in (select * from t1);
+2 in (select * from t1)
+1
+SET SQL_SELECT_LIMIT=default;
+drop table t1;
+CREATE TABLE t1 (a int, b int, INDEX (a));
+INSERT INTO t1 VALUES (1, 1), (1, 2), (1, 3);
+SELECT * FROM t1 WHERE a = (SELECT MAX(a) FROM t1 WHERE a = 1) ORDER BY b;
+a b
+1 1
+1 2
+1 3
+DROP TABLE t1;
+create table t1(val varchar(10));
+insert into t1 values ('aaa'), ('bbb'),('eee'),('mmm'),('ppp');
+select count(*) from t1 as w1 where w1.val in (select w2.val from t1 as w2 where w2.val like 'm%') and w1.val in (select w3.val from t1 as w3 where w3.val like 'e%');
+count(*)
+0
+drop table t1;
+create table t1 (id int not null, text varchar(20) not null default '', primary key (id));
+insert into t1 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text11'), (12, 'text12');
+select * from t1 where id not in (select id from t1 where id < 8);
+id text
+8 text8
+9 text9
+10 text10
+11 text11
+12 text12
+select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
+id text
+8 text8
+9 text9
+10 text10
+11 text11
+12 text12
+explain extended select * from t1 where id not in (select id from t1 where id < 8);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
+2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
+Warnings:
+Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<expr_cache><`test`.`t1`.`id`>(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`))))))))
+explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
+2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
+Warnings:
+Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<in_optimizer>(1,<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))))
+insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
+create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
+insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
+select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
+id text id text id text
+1 text1 1 text1 1 text1
+2 text2 2 text2 2 text2
+3 text3 3 text3 3 text3
+4 text4 4 text4 4 text4
+5 text5 5 text5 5 text5
+6 text6 6 text6 6 text6
+7 text7 7 text7 7 text7
+8 text8 8 text8 8 text8
+9 text9 9 text9 9 text9
+10 text10 10 text10 10 text10
+11 text11 11 text1 11 text11
+12 text12 12 text2 12 text12
+1000 text1000 NULL NULL 1000 text1000
+1001 text1001 NULL NULL 1000 text1000
+explain extended select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00
+1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
+1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
+Warnings:
+Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
+drop table t1,t2;
+create table t1 (a int);
+insert into t1 values (1);
+explain select benchmark(1000, (select a from t1 where a=sha(rand())));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
+2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1
+drop table t1;
+create table t1(id int);
+create table t2(id int);
+create table t3(flag int);
+select (select * from t3 where id not null) from t1, t2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null) from t1, t2' at line 1
+drop table t1,t2,t3;
+CREATE TABLE t1 (id INT);
+CREATE TABLE t2 (id INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1);
+SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
+id c
+1 1
+2 0
+SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
+id c
+1 1
+2 0
+SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY t1.id;
+id c
+1 1
+2 0
+SELECT id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id) ORDER BY id;
+id c
+1 1
+2 0
+DROP TABLE t1,t2;
+CREATE TABLE t1 ( a int, b int );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+ALTER TABLE t1 ADD INDEX (a);
+SELECT a FROM t1 WHERE a > ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+3
+SELECT a FROM t1 WHERE a < ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+SELECT a FROM t1 WHERE a = ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+SELECT a FROM t1 WHERE a >= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL ( SELECT a FROM t1 WHERE b = 2 );
+a
+1
+3
+SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 HAVING a = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 HAVING a = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 HAVING a = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 HAVING a = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 HAVING a = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 HAVING a = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 HAVING a = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 HAVING a = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 HAVING a = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 HAVING a = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = 2 UNION SELECT a FROM t1 WHERE b = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 HAVING a = 2 UNION SELECT a FROM t1 HAVING a = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE a > ANY (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) > ANY (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE a > ALL (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) > ALL (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) = ALL (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) <> ANY (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 2 column(s)
+SELECT a FROM t1 WHERE a = ANY (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) = ANY (SELECT a,2 FROM t1 WHERE b = 2);
+a
+SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 2 column(s)
+SELECT a FROM t1 WHERE a <> ALL (SELECT a,2 FROM t1 WHERE b = 2);
+ERROR 21000: Operand should contain 1 column(s)
+SELECT a FROM t1 WHERE (1,2) <> ALL (SELECT a,2 FROM t1 WHERE b = 2);
+a
+1
+2
+3
+SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 WHERE b = 2);
+a
+2
+SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 WHERE b = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 HAVING a = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 WHERE b = 2 UNION SELECT a,1 FROM t1 WHERE b = 2);
+a
+2
+SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 WHERE b = 2 UNION SELECT a,1 FROM t1 WHERE b = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE (a,1) = ANY (SELECT a,1 FROM t1 HAVING a = 2 UNION SELECT a,1 FROM t1 HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE (a,1) <> ALL (SELECT a,1 FROM t1 HAVING a = 2 UNION SELECT a,1 FROM t1 HAVING a = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+3
+SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+1
+SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+2
+SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+3
+SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+1
+SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+2
+SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = 2 group by a);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 group by a HAVING a = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 group by a HAVING a = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 group by a HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 group by a HAVING a = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 group by a HAVING a = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 group by a HAVING a = 2);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 group by a HAVING a = 2);
+a
+3
+SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 group by a HAVING a = 2);
+a
+1
+SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 group by a HAVING a = 2);
+a
+2
+SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 group by a HAVING a = 2);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 group by a HAVING a = 2);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 group by a HAVING a = 2);
+a
+1
+3
+SELECT concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a > t1.a), '-') from t1 a;
+concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a > t1.a), '-')
+0-
+0-
+1-
+SELECT concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a < t1.a), '-') from t1 a;
+concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a < t1.a), '-')
+1-
+0-
+0-
+SELECT concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a = t1.a), '-') from t1 a;
+concat(EXISTS(SELECT a FROM t1 WHERE b = 2 and a.a = t1.a), '-')
+0-
+1-
+0-
+DROP TABLE t1;
+CREATE TABLE t1 ( a double, b double );
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
+SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = 2e0);
+a
+3
+SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = 2e0);
+a
+1
+SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = 2e0);
+a
+2
+SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = 2e0);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = 2e0);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = 2e0);
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = 2e0);
+a
+3
+SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = 2e0);
+a
+1
+SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = 2e0);
+a
+2
+SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = 2e0);
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = 2e0);
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = 2e0);
+a
+1
+3
+DROP TABLE t1;
+CREATE TABLE t1 ( a char(1), b char(1));
+INSERT INTO t1 VALUES ('1','1'),('2','2'),('3','3');
+SELECT a FROM t1 WHERE a > ANY (SELECT a FROM t1 WHERE b = '2');
+a
+3
+SELECT a FROM t1 WHERE a < ANY (SELECT a FROM t1 WHERE b = '2');
+a
+1
+SELECT a FROM t1 WHERE a = ANY (SELECT a FROM t1 WHERE b = '2');
+a
+2
+SELECT a FROM t1 WHERE a >= ANY (SELECT a FROM t1 WHERE b = '2');
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ANY (SELECT a FROM t1 WHERE b = '2');
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ANY (SELECT a FROM t1 WHERE b = '2');
+a
+1
+3
+SELECT a FROM t1 WHERE a > ALL (SELECT a FROM t1 WHERE b = '2');
+a
+3
+SELECT a FROM t1 WHERE a < ALL (SELECT a FROM t1 WHERE b = '2');
+a
+1
+SELECT a FROM t1 WHERE a = ALL (SELECT a FROM t1 WHERE b = '2');
+a
+2
+SELECT a FROM t1 WHERE a >= ALL (SELECT a FROM t1 WHERE b = '2');
+a
+2
+3
+SELECT a FROM t1 WHERE a <= ALL (SELECT a FROM t1 WHERE b = '2');
+a
+1
+2
+SELECT a FROM t1 WHERE a <> ALL (SELECT a FROM t1 WHERE b = '2');
+a
+1
+3
+DROP TABLE t1;
+create table t1 (a int, b int);
+insert into t1 values (1,2),(3,4);
+select * from t1 up where exists (select * from t1 where t1.a=up.a);
+a b
+1 2
+3 4
+explain extended select * from t1 up where exists (select * from t1 where t1.a=up.a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY up ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` semi join (`test`.`t1`) where 1
+drop table t1;
+CREATE TABLE t1 (t1_a int);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (t2_a int, t2_b int, PRIMARY KEY (t2_a, t2_b));
+INSERT INTO t2 VALUES (1, 1), (1, 2);
+SELECT * FROM t1, t2 table2 WHERE t1_a = 1 AND table2.t2_a = 1
+HAVING table2.t2_b = (SELECT MAX(t2_b) FROM t2 WHERE t2_a = table2.t2_a);
+t1_a t2_a t2_b
+1 1 2
+DROP TABLE t1, t2;
+CREATE TABLE t1 (id int(11) default NULL,name varchar(10) default NULL);
+INSERT INTO t1 VALUES (1,'Tim'),(2,'Rebecca'),(3,NULL);
+CREATE TABLE t2 (id int(11) default NULL, pet varchar(10) default NULL);
+INSERT INTO t2 VALUES (1,'Fido'),(2,'Spot'),(3,'Felix');
+SELECT a.*, b.* FROM (SELECT * FROM t1) AS a JOIN t2 as b on a.id=b.id;
+id name id pet
+1 Tim 1 Fido
+2 Rebecca 2 Spot
+3 NULL 3 Felix
+drop table t1,t2;
+CREATE TABLE t1 ( a int, b int );
+CREATE TABLE t2 ( c int, d int );
+INSERT INTO t1 VALUES (1,2), (2,3), (3,4);
+SELECT a AS abc, b FROM t1 outr WHERE b =
+(SELECT MIN(b) FROM t1 WHERE a=outr.a);
+abc b
+1 2
+2 3
+3 4
+INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b =
+(SELECT MIN(b) FROM t1 WHERE a=outr.a);
+select * from t2;
+c d
+1 2
+2 3
+3 4
+CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b =
+(SELECT MIN(b) FROM t1 WHERE a=outr.a);
+select * from t3;
+abc b
+1 2
+2 3
+3 4
+prepare stmt1 from "INSERT INTO t2 SELECT a AS abc, b FROM t1 outr WHERE b = (SELECT MIN(b) FROM t1 WHERE a=outr.a);";
+execute stmt1;
+deallocate prepare stmt1;
+select * from t2;
+c d
+1 2
+2 3
+3 4
+1 2
+2 3
+3 4
+drop table t3;
+prepare stmt1 from "CREATE TABLE t3 SELECT a AS abc, b FROM t1 outr WHERE b = (SELECT MIN(b) FROM t1 WHERE a=outr.a);";
+execute stmt1;
+select * from t3;
+abc b
+1 2
+2 3
+3 4
+deallocate prepare stmt1;
+DROP TABLE t1, t2, t3;
+CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t1 values (1);
+CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t2 values (1,2);
+select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
+a C
+1 1
+drop table t1,t2;
+create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
+insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
+create table t2 (a int);
+insert into t2 values (1),(3),(2),(7);
+select a,b from t1 where match(b) against ('Ball') > 0;
+a b
+1 ball
+2 ball games
+select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
+a
+1
+2
+drop table t1,t2;
+CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin);
+CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel);
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000001','601','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000002','602','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000003','603','D0000000001','I0000000001');
+INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000004','101','D0000000001','I0000000001');
+SELECT `IZAVORGANG_ID` FROM t1 WHERE `KUERZEL` IN(SELECT MIN(`KUERZEL`)`Feld1` FROM t1 WHERE `KUERZEL` LIKE'601%'And`IZAANALYSEART_ID`='D0000000001');
+IZAVORGANG_ID
+D0000000001
+drop table t1;
+CREATE TABLE `t1` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
+CREATE TABLE `t2` ( `aid` int(11) NOT NULL default '0', `bid` int(11) NOT NULL default '0', PRIMARY KEY (`aid`,`bid`));
+insert into t1 values (1,1),(1,2),(2,1),(2,2);
+insert into t2 values (1,2),(2,2);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+aid bid
+1 1
+2 1
+alter table t2 drop primary key;
+alter table t2 add key KEY1 (aid, bid);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+aid bid
+1 1
+2 1
+alter table t2 drop key KEY1;
+alter table t2 add primary key (bid, aid);
+select * from t1 where t1.aid not in (select aid from t2 where bid=t1.bid);
+aid bid
+1 1
+2 1
+drop table t1,t2;
+CREATE TABLE t1 (howmanyvalues bigint, avalue int);
+INSERT INTO t1 VALUES (1, 1),(2, 1),(2, 2),(3, 1),(3, 2),(3, 3),(4, 1),(4, 2),(4, 3),(4, 4);
+SELECT howmanyvalues, count(*) from t1 group by howmanyvalues;
+howmanyvalues count(*)
+1 1
+2 2
+3 3
+4 4
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 2
+3 3
+4 4
+CREATE INDEX t1_howmanyvalues_idx ON t1 (howmanyvalues);
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues+1 = a.howmanyvalues+1) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 2
+3 3
+4 4
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 2
+3 3
+4 4
+SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
+howmanyvalues mycount
+1 1
+2 1
+3 1
+4 1
+drop table t1;
+create table t1 (x int);
+select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
+(select b.x from t1 as b where b.x=a.x)
+drop table t1;
+CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `slave` int(10) unsigned NOT NULL default '0', `access` int(10) unsigned NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`));
+INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
+CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
+INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
+SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+ERROR 42S22: Unknown column 'b.sc' in 'field list'
+SELECT b.ac FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
+ac
+700
+NULL
+drop tables t1,t2;
+create table t1 (a int not null, b int not null, c int, primary key (a,b));
+insert into t1 values (1,1,1), (2,2,2), (3,3,3);
+set @b:= 0;
+explain select sum(a) from t1 where b > @b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index
+set @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+do @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+drop table t1;
+set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5);
+insert into t2 values (1,3),(2,1);
+select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b;
+a b (select max(b) from t2 where t1.b=t2.a)
+1 1 3
+1 2 1
+1 3 NULL
+2 4 NULL
+2 5 NULL
+drop table t1, t2;
+create table t1 (id int);
+create table t2 (id int, body text, fulltext (body));
+insert into t1 values(1),(2),(3);
+insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test');
+select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode));
+count(distinct id)
+1
+drop table t2,t1;
+create table t1 (s1 int,s2 int);
+insert into t1 values (20,15);
+select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
+s1 s2
+drop table t1;
+create table t1 (s1 int);
+insert into t1 values (1),(null);
+select * from t1 where s1 < all (select s1 from t1);
+s1
+select s1, s1 < all (select s1 from t1) from t1;
+s1 s1 < all (select s1 from t1)
+1 0
+NULL NULL
+drop table t1;
+CREATE TABLE t1 (
+Code char(3) NOT NULL default '',
+Name char(52) NOT NULL default '',
+Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
+Region char(26) NOT NULL default '',
+SurfaceArea float(10,2) NOT NULL default '0.00',
+IndepYear smallint(6) default NULL,
+Population int(11) NOT NULL default '0',
+LifeExpectancy float(3,1) default NULL,
+GNP float(10,2) default NULL,
+GNPOld float(10,2) default NULL,
+LocalName char(45) NOT NULL default '',
+GovernmentForm char(45) NOT NULL default '',
+HeadOfState char(60) default NULL,
+Capital int(11) default NULL,
+Code2 char(2) NOT NULL default ''
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
+INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
+INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+SELECT DISTINCT Continent AS c FROM t1 outr WHERE
+Code <> SOME ( SELECT Code FROM t1 WHERE Continent = outr.Continent AND
+Population < 200);
+c
+Oceania
+drop table t1;
+create table t1 (a1 int);
+create table t2 (b1 int);
+select * from t1 where a2 > any(select b1 from t2);
+ERROR 42S22: Unknown column 'a2' in 'IN/ALL/ANY subquery'
+select * from t1 where a1 > any(select b1 from t2);
+a1
+drop table t1,t2;
+create table t1 (a integer, b integer);
+select (select * from t1) = (select 1,2);
+(select * from t1) = (select 1,2)
+NULL
+select (select 1,2) = (select * from t1);
+(select 1,2) = (select * from t1)
+NULL
+select row(1,2) = ANY (select * from t1);
+row(1,2) = ANY (select * from t1)
+0
+select row(1,2) != ALL (select * from t1);
+row(1,2) != ALL (select * from t1)
+1
+drop table t1;
+create table t1 (a integer, b integer);
+select row(1,(2,2)) in (select * from t1 );
+ERROR 21000: Operand should contain 2 column(s)
+select row(1,(2,2)) = (select * from t1 );
+ERROR 21000: Operand should contain 2 column(s)
+select (select * from t1) = row(1,(2,2));
+ERROR 21000: Operand should contain 1 column(s)
+drop table t1;
+create table t1 (a integer);
+insert into t1 values (1);
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
+xx 1 = ALL ( select 1 from t1 where 1 = xx )
+1 1
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+drop table t1;
+CREATE TABLE t1 (
+categoryId int(11) NOT NULL,
+courseId int(11) NOT NULL,
+startDate datetime NOT NULL,
+endDate datetime NOT NULL,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL,
+attributes text NOT NULL
+);
+INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
+(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
+(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
+(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
+(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
+CREATE TABLE t2 (
+userId int(11) NOT NULL,
+courseId int(11) NOT NULL,
+date datetime NOT NULL
+);
+INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
+(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
+(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
+(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
+(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
+(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
+CREATE TABLE t3 (
+groupId int(11) NOT NULL,
+parentId int(11) NOT NULL,
+startDate datetime NOT NULL,
+endDate datetime NOT NULL,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL,
+ordering int(11)
+);
+INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
+CREATE TABLE t4 (
+id int(11) NOT NULL,
+groupTypeId int(11) NOT NULL,
+groupKey varchar(50) NOT NULL,
+name text,
+ordering int(11),
+description text,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL
+);
+INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
+(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
+CREATE TABLE t5 (
+userId int(11) NOT NULL,
+groupId int(11) NOT NULL,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL
+);
+INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
+select
+count(distinct t2.userid) pass,
+groupstuff.*,
+count(t2.courseid) crse,
+t1.categoryid,
+t2.courseid,
+date_format(date, '%b%y') as colhead
+from t2
+join t1 on t2.courseid=t1.courseid
+join
+(
+select
+t5.userid,
+parentid,
+parentgroup,
+childid,
+groupname,
+grouptypeid
+from t5
+join
+(
+select t4.id as parentid,
+t4.name as parentgroup,
+t4.id as childid,
+t4.name as groupname,
+t4.grouptypeid
+from t4
+) as gin on t5.groupid=gin.childid
+) as groupstuff on t2.userid = groupstuff.userid
+group by
+groupstuff.groupname, colhead , t2.courseid;
+pass userid parentid parentgroup childid groupname grouptypeid crse categoryid courseid colhead
+1 5141 12 group2 12 group2 5 1 5 12 Aug04
+1 5141 12 group2 12 group2 5 1 1 41 Aug04
+1 5141 12 group2 12 group2 5 1 2 52 Aug04
+1 5141 12 group2 12 group2 5 1 2 53 Aug04
+1 5141 12 group2 12 group2 5 1 3 51 Oct04
+1 5141 12 group2 12 group2 5 1 1 86 Oct04
+1 5141 12 group2 12 group2 5 1 1 87 Oct04
+1 5141 12 group2 12 group2 5 1 2 88 Oct04
+1 5141 12 group2 12 group2 5 1 2 89 Oct04
+drop table t1, t2, t3, t4, t5;
+create table t1 (a int);
+insert into t1 values (1), (2), (3);
+SELECT 1 FROM t1 WHERE (SELECT 1) in (SELECT 1);
+1
+1
+1
+1
+drop table t1;
+create table t1 (a int);
+create table t2 (a int);
+insert into t1 values (1),(2);
+insert into t2 values (0),(1),(2),(3);
+select a from t2 where a in (select a from t1);
+a
+1
+2
+select a from t2 having a in (select a from t1);
+a
+1
+2
+prepare stmt1 from "select a from t2 where a in (select a from t1)";
+execute stmt1;
+a
+1
+2
+execute stmt1;
+a
+1
+2
+deallocate prepare stmt1;
+prepare stmt1 from "select a from t2 having a in (select a from t1)";
+execute stmt1;
+a
+1
+2
+execute stmt1;
+a
+1
+2
+deallocate prepare stmt1;
+drop table t1, t2;
+create table t1 (a int, b int);
+insert into t1 values (1,2);
+select 1 = (select * from t1);
+ERROR 21000: Operand should contain 1 column(s)
+select (select * from t1) = 1;
+ERROR 21000: Operand should contain 2 column(s)
+select (1,2) = (select a from t1);
+ERROR 21000: Operand should contain 2 column(s)
+select (select a from t1) = (1,2);
+ERROR 21000: Operand should contain 1 column(s)
+select (1,2,3) = (select * from t1);
+ERROR 21000: Operand should contain 3 column(s)
+select (select * from t1) = (1,2,3);
+ERROR 21000: Operand should contain 2 column(s)
+drop table t1;
+CREATE TABLE `t1` (
+`itemid` bigint(20) unsigned NOT NULL auto_increment,
+`sessionid` bigint(20) unsigned default NULL,
+`time` int(10) unsigned NOT NULL default '0',
+`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
+NULL default '',
+`data` text collate latin1_general_ci NOT NULL,
+PRIMARY KEY (`itemid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
+CREATE TABLE `t2` (
+`sessionid` bigint(20) unsigned NOT NULL auto_increment,
+`pid` int(10) unsigned NOT NULL default '0',
+`date` int(10) unsigned NOT NULL default '0',
+`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
+PRIMARY KEY (`sessionid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
+SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
+ip count( e.itemid )
+10.10.10.1 1
+drop tables t1,t2;
+create table t1 (fld enum('0','1'));
+insert into t1 values ('1');
+select * from (select max(fld) from t1) as foo;
+max(fld)
+1
+drop table t1;
+set @tmp11867_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='semijoin_with_cache=off';
+CREATE TABLE t1 (one int, two int, flag char(1));
+CREATE TABLE t2 (one int, two int, flag char(1));
+INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
+INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
+SELECT * FROM t1
+WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t2 WHERE flag = 'N');
+one two flag
+5 6 N
+7 8 N
+SELECT * FROM t1
+WHERE ROW(one,two) IN (SELECT DISTINCT one,two FROM t1 WHERE flag = 'N');
+one two flag
+5 6 N
+7 8 N
+insert into t2 values (null,null,'N');
+insert into t2 values (null,3,'0');
+insert into t2 values (null,5,'0');
+insert into t2 values (10,null,'0');
+insert into t1 values (10,3,'0');
+insert into t1 values (10,5,'0');
+insert into t1 values (10,10,'0');
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N') as 'test' from t1;
+one two test
+1 2 NULL
+2 3 NULL
+3 4 NULL
+5 6 1
+7 8 1
+10 3 NULL
+10 5 NULL
+10 10 NULL
+SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
+one two
+5 6
+7 8
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N' group by one,two) as 'test' from t1;
+one two test
+1 2 NULL
+2 3 NULL
+3 4 NULL
+5 6 1
+7 8 1
+10 3 NULL
+10 5 NULL
+10 10 NULL
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1;
+one two test
+1 2 0
+2 3 NULL
+3 4 0
+5 6 0
+7 8 0
+10 3 NULL
+10 5 NULL
+10 10 NULL
+SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
+one two test
+1 2 0
+2 3 NULL
+3 4 0
+5 6 0
+7 8 0
+10 3 NULL
+10 5 NULL
+10 10 NULL
+explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0') as 'test' from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N')
+explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<expr_cache><`test`.`t1`.`one`,`test`.`t1`.`two`>(<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one`,`test`.`t2`.`two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`)))) and trigcond(trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`)))))) AS `test` from `test`.`t1`
+DROP TABLE t1,t2;
+set optimizer_switch=@tmp11867_optimizer_switch;
+CREATE TABLE t1 (a char(5), b char(5));
+INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
+SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
+a b
+aaa aaa
+DROP TABLE t1;
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int, b int);
+CREATE TABLE t3 (b int NOT NULL);
+INSERT INTO t1 VALUES (1), (2), (3), (4);
+INSERT INTO t2 VALUES (1,10), (3,30);
+SELECT * FROM t2 LEFT JOIN t3 ON t2.b=t3.b
+WHERE t3.b IS NOT NULL OR t2.a > 10;
+a b b
+SELECT * FROM t1
+WHERE t1.a NOT IN (SELECT a FROM t2 LEFT JOIN t3 ON t2.b=t3.b
+WHERE t3.b IS NOT NULL OR t2.a > 10);
+a
+1
+2
+3
+4
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (f1 INT);
+CREATE TABLE t2 (f2 INT);
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2);
+f1
+1
+SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE 1=0);
+f1
+1
+INSERT INTO t2 VALUES (1);
+INSERT INTO t2 VALUES (2);
+SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0);
+f1
+1
+DROP TABLE t1, t2;
+select 1 from dual where 1 < any (select 2);
+1
+1
+select 1 from dual where 1 < all (select 2);
+1
+1
+select 1 from dual where 2 > any (select 1);
+1
+1
+select 1 from dual where 2 > all (select 1);
+1
+1
+select 1 from dual where 1 < any (select 2 from dual);
+1
+1
+select 1 from dual where 1 < all (select 2 from dual where 1!=1);
+1
+1
+create table t1 (s1 char);
+insert into t1 values (1),(2);
+select * from t1 where (s1 < any (select s1 from t1));
+s1
+1
+select * from t1 where not (s1 < any (select s1 from t1));
+s1
+2
+select * from t1 where (s1 < ALL (select s1+1 from t1));
+s1
+1
+select * from t1 where not(s1 < ALL (select s1+1 from t1));
+s1
+2
+select * from t1 where (s1+1 = ANY (select s1 from t1));
+s1
+1
+select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
+s1
+2
+select * from t1 where (s1 = ALL (select s1/s1 from t1));
+s1
+1
+select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
+s1
+2
+drop table t1;
+create table t1 (
+retailerID varchar(8) NOT NULL,
+statusID int(10) unsigned NOT NULL,
+changed datetime NOT NULL,
+UNIQUE KEY retailerID (retailerID, statusID, changed)
+);
+INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
+INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
+INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
+INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
+select * from t1 r1
+where (r1.retailerID,(r1.changed)) in
+(SELECT r2.retailerId,(max(changed)) from t1 r2
+group by r2.retailerId);
+retailerID statusID changed
+0026 2 2006-01-06 12:25:53
+0037 2 2006-01-06 12:25:53
+0048 1 2006-01-06 12:37:50
+0059 1 2006-01-06 12:37:50
+drop table t1;
+create table t1(a int, primary key (a));
+insert into t1 values (10);
+create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
+insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
+explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using where
+SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
+a a b
+10 3 35989
+explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
+1 PRIMARY r const PRIMARY PRIMARY 4 const 1
+2 SUBQUERY t2 range b b 40 NULL 2 Using index condition
+SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
+ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
+ ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
+a a b
+10 1 359
+drop table t1,t2;
+CREATE TABLE t1 (
+field1 int NOT NULL,
+field2 int NOT NULL,
+field3 int NOT NULL,
+PRIMARY KEY (field1,field2,field3)
+);
+CREATE TABLE t2 (
+fieldA int NOT NULL,
+fieldB int NOT NULL,
+PRIMARY KEY (fieldA,fieldB)
+);
+INSERT INTO t1 VALUES
+(1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
+INSERT INTO t2 VALUES (1,1), (1,2), (1,3);
+SELECT field1, field2, COUNT(*)
+FROM t1 GROUP BY field1, field2;
+field1 field2 COUNT(*)
+1 1 2
+1 2 3
+1 3 1
+SELECT field1, field2
+FROM t1
+GROUP BY field1, field2
+HAVING COUNT(*) >= ALL (SELECT fieldB
+FROM t2 WHERE fieldA = field1);
+field1 field2
+1 2
+SELECT field1, field2
+FROM t1
+GROUP BY field1, field2
+HAVING COUNT(*) < ANY (SELECT fieldB
+FROM t2 WHERE fieldA = field1);
+field1 field2
+1 1
+1 3
+DROP TABLE t1, t2;
+CREATE TABLE t1(a int, INDEX (a));
+INSERT INTO t1 VALUES (1), (3), (5), (7);
+INSERT INTO t1 VALUES (NULL);
+CREATE TABLE t2(a int);
+INSERT INTO t2 VALUES (1),(2),(3);
+EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 SUBQUERY t1 index_subquery a a 5 func 2 Using index; Full scan on NULL key
+SELECT a, a IN (SELECT a FROM t1) FROM t2;
+a a IN (SELECT a FROM t1)
+1 1
+2 NULL
+3 1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a DATETIME);
+INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25');
+CREATE TABLE t2 AS SELECT
+(SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
+FROM t1 WHERE a > '2000-01-01';
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `sub_a` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
+SHOW CREATE TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` datetime DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2);
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) > 0;
+a
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+a
+1
+2
+EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+DROP TABLE t1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (2), (4), (1), (3);
+CREATE TABLE t2 (b int, c int);
+INSERT INTO t2 VALUES
+(2,1), (1,3), (2,1), (4,4), (2,2), (1,4);
+SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 );
+a
+2
+4
+1
+3
+SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1);
+ERROR 21000: Subquery returns more than 1 row
+SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2), a;
+a
+1
+2
+3
+4
+SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 1), a;
+ERROR 21000: Subquery returns more than 1 row
+SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 2);
+b MAX(c)
+1 4
+2 2
+4 4
+SELECT b, MAX(c) FROM t2 GROUP BY b, (SELECT c FROM t2 WHERE b > 1);
+ERROR 21000: Subquery returns more than 1 row
+SELECT a FROM t1 GROUP BY a
+HAVING IFNULL((SELECT b FROM t2 WHERE b > 2),
+(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
+a
+1
+2
+3
+4
+SELECT a FROM t1 GROUP BY a
+HAVING IFNULL((SELECT b FROM t2 WHERE b > 1),
+(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
+ERROR 21000: Subquery returns more than 1 row
+SELECT a FROM t1 GROUP BY a
+HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
+(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b)) > 3;
+a
+4
+SELECT a FROM t1 GROUP BY a
+HAVING IFNULL((SELECT b FROM t2 WHERE b > 4),
+(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b)) > 3;
+ERROR 21000: Subquery returns more than 1 row
+SELECT a FROM t1
+ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 2),
+(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
+a
+1
+2
+3
+4
+SELECT a FROM t1
+ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 1),
+(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
+ERROR 21000: Subquery returns more than 1 row
+SELECT a FROM t1
+ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
+(SELECT c FROM t2 WHERE c=a AND b > 2 ORDER BY b));
+a
+1
+2
+3
+4
+SELECT a FROM t1
+ORDER BY IFNULL((SELECT b FROM t2 WHERE b > 4),
+(SELECT c FROM t2 WHERE c=a AND b > 1 ORDER BY b));
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1,t2;
+create table t1 (df decimal(5,1));
+insert into t1 values(1.1);
+insert into t1 values(2.2);
+select * from t1 where df <= all (select avg(df) from t1 group by df);
+df
+1.1
+select * from t1 where df >= all (select avg(df) from t1 group by df);
+df
+2.2
+drop table t1;
+create table t1 (df decimal(5,1));
+insert into t1 values(1.1);
+select 1.1 * exists(select * from t1);
+1.1 * exists(select * from t1)
+1.1
+drop table t1;
+CREATE TABLE t1 (
+grp int(11) default NULL,
+a decimal(10,2) default NULL);
+insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NULL);
+select * from t1;
+grp a
+1 1.00
+2 2.00
+2 3.00
+3 4.00
+3 5.00
+3 6.00
+NULL NULL
+select min(a) from t1 group by grp;
+min(a)
+NULL
+1.00
+2.00
+4.00
+drop table t1;
+CREATE table t1 ( c1 integer );
+INSERT INTO t1 VALUES ( 1 );
+INSERT INTO t1 VALUES ( 2 );
+INSERT INTO t1 VALUES ( 3 );
+CREATE TABLE t2 ( c2 integer );
+INSERT INTO t2 VALUES ( 1 );
+INSERT INTO t2 VALUES ( 4 );
+INSERT INTO t2 VALUES ( 5 );
+SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2 WHERE c2 IN (1);
+c1 c2
+1 1
+SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2
+WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2 IN ( 1 ) );
+c1 c2
+1 1
+DROP TABLE t1,t2;
+CREATE TABLE t1 ( c1 integer );
+INSERT INTO t1 VALUES ( 1 );
+INSERT INTO t1 VALUES ( 2 );
+INSERT INTO t1 VALUES ( 3 );
+INSERT INTO t1 VALUES ( 6 );
+CREATE TABLE t2 ( c2 integer );
+INSERT INTO t2 VALUES ( 1 );
+INSERT INTO t2 VALUES ( 4 );
+INSERT INTO t2 VALUES ( 5 );
+INSERT INTO t2 VALUES ( 6 );
+CREATE TABLE t3 ( c3 integer );
+INSERT INTO t3 VALUES ( 7 );
+INSERT INTO t3 VALUES ( 8 );
+SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
+WHERE EXISTS (SELECT c3 FROM t3 WHERE c2 IS NULL );
+c1 c2
+2 NULL
+3 NULL
+DROP TABLE t1,t2,t3;
+CREATE TABLE `t1` (
+`itemid` bigint(20) unsigned NOT NULL auto_increment,
+`sessionid` bigint(20) unsigned default NULL,
+`time` int(10) unsigned NOT NULL default '0',
+`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
+NULL default '',
+`data` text collate latin1_general_ci NOT NULL,
+PRIMARY KEY (`itemid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
+CREATE TABLE `t2` (
+`sessionid` bigint(20) unsigned NOT NULL auto_increment,
+`pid` int(10) unsigned NOT NULL default '0',
+`date` int(10) unsigned NOT NULL default '0',
+`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
+PRIMARY KEY (`sessionid`)
+) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
+INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
+SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
+ip count( e.itemid )
+10.10.10.1 1
+drop tables t1,t2;
+CREATE TABLE t1 (EMPNUM CHAR(3));
+CREATE TABLE t2 (EMPNUM CHAR(3) );
+INSERT INTO t1 VALUES ('E1'),('E2');
+INSERT INTO t2 VALUES ('E1');
+DELETE FROM t1
+WHERE t1.EMPNUM NOT IN
+(SELECT t2.EMPNUM
+FROM t2
+WHERE t1.EMPNUM = t2.EMPNUM);
+select * from t1;
+EMPNUM
+E1
+DROP TABLE t1,t2;
+CREATE TABLE t1(select_id BIGINT, values_id BIGINT);
+INSERT INTO t1 VALUES (1, 1);
+CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
+PRIMARY KEY(select_id,values_id));
+INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5);
+SELECT values_id FROM t1
+WHERE values_id IN (SELECT values_id FROM t2
+WHERE select_id IN (1, 0));
+values_id
+1
+SELECT values_id FROM t1
+WHERE values_id IN (SELECT values_id FROM t2
+WHERE select_id BETWEEN 0 AND 1);
+values_id
+1
+SELECT values_id FROM t1
+WHERE values_id IN (SELECT values_id FROM t2
+WHERE select_id = 0 OR select_id = 1);
+values_id
+1
+DROP TABLE t1, t2;
+create table t1 (fld enum('0','1'));
+insert into t1 values ('1');
+select * from (select max(fld) from t1) as foo;
+max(fld)
+1
+drop table t1;
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (c int, d int);
+CREATE TABLE t3 (e int);
+INSERT INTO t1 VALUES
+(1,10), (2,10), (1,20), (2,20), (3,20), (2,30), (4,40);
+INSERT INTO t2 VALUES
+(2,10), (2,20), (4,10), (5,10), (3,20), (2,40);
+INSERT INTO t3 VALUES (10), (30), (10), (20) ;
+SELECT a, MAX(b), MIN(b) FROM t1 GROUP BY a;
+a MAX(b) MIN(b)
+1 20 10
+2 30 10
+3 20 20
+4 40 40
+SELECT * FROM t2;
+c d
+2 10
+2 20
+4 10
+5 10
+3 20
+2 40
+SELECT * FROM t3;
+e
+10
+30
+10
+20
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>20);
+a
+2
+4
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)<d);
+a
+2
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2 WHERE MAX(b)>d);
+a
+2
+4
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2
+WHERE d >= SOME(SELECT e FROM t3 WHERE MAX(b)=e));
+a
+2
+3
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2
+WHERE EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e <= d));
+a
+2
+3
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2
+WHERE d > SOME(SELECT e FROM t3 WHERE MAX(b)=e));
+a
+2
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2
+WHERE EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e < d));
+a
+2
+SELECT a FROM t1 GROUP BY a
+HAVING a IN (SELECT c FROM t2
+WHERE MIN(b) < d AND
+EXISTS(SELECT e FROM t3 WHERE MAX(b)=e AND e <= d));
+a
+2
+SELECT a, SUM(a) FROM t1 GROUP BY a;
+a SUM(a)
+1 2
+2 6
+3 3
+4 4
+SELECT a FROM t1
+WHERE EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) = c) GROUP BY a;
+a
+3
+4
+SELECT a FROM t1 GROUP BY a
+HAVING EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) = c);
+a
+1
+3
+4
+SELECT a FROM t1
+WHERE a < 3 AND
+EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) != c) GROUP BY a;
+a
+1
+2
+SELECT a FROM t1
+WHERE a < 3 AND
+EXISTS(SELECT c FROM t2 GROUP BY c HAVING SUM(a) != c);
+a
+1
+2
+1
+2
+2
+SELECT t1.a FROM t1 GROUP BY t1.a
+HAVING t1.a < ALL(SELECT t2.c FROM t2 GROUP BY t2.c
+HAVING EXISTS(SELECT t3.e FROM t3 GROUP BY t3.e
+HAVING SUM(t1.a+t2.c) < t3.e/4));
+a
+1
+2
+SELECT t1.a FROM t1 GROUP BY t1.a
+HAVING t1.a > ALL(SELECT t2.c FROM t2
+WHERE EXISTS(SELECT t3.e FROM t3 GROUP BY t3.e
+HAVING SUM(t1.a+t2.c) < t3.e/4));
+a
+4
+SELECT t1.a FROM t1 GROUP BY t1.a
+HAVING t1.a > ALL(SELECT t2.c FROM t2
+WHERE EXISTS(SELECT t3.e FROM t3
+WHERE SUM(t1.a+t2.c) < t3.e/4));
+ERROR HY000: Invalid use of group function
+SELECT t1.a from t1 GROUP BY t1.a HAVING AVG(SUM(t1.b)) > 20;
+ERROR HY000: Invalid use of group function
+SELECT t1.a FROM t1 GROUP BY t1.a
+HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c
+HAVING AVG(t2.c+SUM(t1.b)) > 20);
+a
+2
+3
+4
+SELECT t1.a FROM t1 GROUP BY t1.a
+HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c
+HAVING AVG(SUM(t1.b)) > 20);
+a
+2
+4
+SELECT t1.a, SUM(b) AS sum FROM t1 GROUP BY t1.a
+HAVING t1.a IN (SELECT t2.c FROM t2 GROUP BY t2.c
+HAVING t2.c+sum > 20);
+a sum
+2 60
+3 20
+4 40
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a varchar(5), b varchar(10));
+INSERT INTO t1 VALUES
+('AAA', 5), ('BBB', 4), ('BBB', 1), ('CCC', 2),
+('CCC', 7), ('AAA', 2), ('AAA', 4), ('BBB', 3), ('AAA', 8);
+SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
+a b
+BBB 4
+CCC 7
+AAA 8
+EXPLAIN
+SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary
+ALTER TABLE t1 ADD INDEX(a);
+SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
+a b
+BBB 4
+CCC 7
+AAA 8
+EXPLAIN
+SELECT * FROM t1 WHERE (a,b) = ANY (SELECT a, max(b) FROM t1 GROUP BY a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL a NULL NULL NULL 9 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 9 Using temporary
+DROP TABLE t1;
+create table t1( f1 int,f2 int);
+insert into t1 values (1,1),(2,2);
+select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
+t
+crash1
+crash1
+drop table t1;
+create table t1 (c int, key(c));
+insert into t1 values (1142477582), (1142455969);
+create table t2 (a int, b int);
+insert into t2 values (2, 1), (1, 0);
+delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
+drop table t1, t2;
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
+ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+CREATE VIEW v2 AS SELECT * FROM t1 WHERE no_such_column = (SELECT 1);
+ERROR 42S22: Unknown column 'no_such_column' in 'where clause'
+SELECT * FROM t1 WHERE no_such_column = ANY (SELECT 1);
+ERROR 42S22: Unknown column 'no_such_column' in 'IN/ALL/ANY subquery'
+DROP TABLE t1;
+create table t1 (i int, j bigint);
+insert into t1 values (1, 2), (2, 2), (3, 2);
+select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
+min(i)
+1
+drop table t1;
+CREATE TABLE t1 (i BIGINT UNSIGNED);
+INSERT INTO t1 VALUES (10000000000000000000);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (i BIGINT UNSIGNED);
+INSERT INTO t2 VALUES (10000000000000000000);
+INSERT INTO t2 VALUES (1);
+/* simple test */
+SELECT t1.i FROM t1 JOIN t2 ON t1.i = t2.i;
+i
+10000000000000000000
+1
+/* subquery test */
+SELECT t1.i FROM t1 WHERE t1.i = (SELECT MAX(i) FROM t2);
+i
+10000000000000000000
+/* subquery test with cast*/
+SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
+i
+10000000000000000000
+DROP TABLE t1;
+DROP TABLE t2;
+CREATE TABLE t1 (
+id bigint(20) unsigned NOT NULL auto_increment,
+name varchar(255) NOT NULL,
+PRIMARY KEY (id)
+);
+INSERT INTO t1 VALUES
+(1, 'Balazs'), (2, 'Joe'), (3, 'Frank');
+CREATE TABLE t2 (
+id bigint(20) unsigned NOT NULL auto_increment,
+mid bigint(20) unsigned NOT NULL,
+date date NOT NULL,
+PRIMARY KEY (id)
+);
+INSERT INTO t2 VALUES
+(1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
+(4, 2, '2006-04-20'), (5, 1, '2006-05-01');
+SELECT *,
+(SELECT date FROM t2 WHERE mid = t1.id
+ORDER BY date DESC LIMIT 0, 1) AS date_last,
+(SELECT date FROM t2 WHERE mid = t1.id
+ORDER BY date DESC LIMIT 3, 1) AS date_next_to_last
+FROM t1;
+id name date_last date_next_to_last
+1 Balazs 2006-05-01 NULL
+2 Joe 2006-04-20 NULL
+3 Frank 2006-04-13 NULL
+SELECT *,
+(SELECT COUNT(*) FROM t2 WHERE mid = t1.id
+ORDER BY date DESC LIMIT 1, 1) AS date_count
+FROM t1;
+id name date_count
+1 Balazs NULL
+2 Joe NULL
+3 Frank NULL
+SELECT *,
+(SELECT date FROM t2 WHERE mid = t1.id
+ORDER BY date DESC LIMIT 0, 1) AS date_last,
+(SELECT date FROM t2 WHERE mid = t1.id
+ORDER BY date DESC LIMIT 1, 1) AS date_next_to_last
+FROM t1;
+id name date_last date_next_to_last
+1 Balazs 2006-05-01 2006-03-30
+2 Joe 2006-04-20 2006-04-06
+3 Frank 2006-04-13 NULL
+DROP TABLE t1,t2;
+CREATE TABLE t1 (
+i1 int(11) NOT NULL default '0',
+i2 int(11) NOT NULL default '0',
+t datetime NOT NULL default '0000-00-00 00:00:00',
+PRIMARY KEY (i1,i2,t)
+);
+INSERT INTO t1 VALUES
+(24,1,'2005-03-03 16:31:31'),(24,1,'2005-05-27 12:40:07'),
+(24,1,'2005-05-27 12:40:08'),(24,1,'2005-05-27 12:40:10'),
+(24,1,'2005-05-27 12:40:25'),(24,1,'2005-05-27 12:40:30'),
+(24,2,'2005-03-03 13:43:05'),(24,2,'2005-03-03 16:23:31'),
+(24,2,'2005-03-03 16:31:30'),(24,2,'2005-05-27 12:37:02'),
+(24,2,'2005-05-27 12:40:06');
+CREATE TABLE t2 (
+i1 int(11) NOT NULL default '0',
+i2 int(11) NOT NULL default '0',
+t datetime default NULL,
+PRIMARY KEY (i1)
+);
+INSERT INTO t2 VALUES (24,1,'2006-06-20 12:29:40');
+EXPLAIN
+SELECT * FROM t1,t2
+WHERE t1.t = (SELECT t1.t FROM t1
+WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
+ORDER BY t1.t DESC LIMIT 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 system NULL NULL NULL NULL 1
+1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index
+2 SUBQUERY t1 range PRIMARY PRIMARY 16 NULL 5 Using where; Using index
+SELECT * FROM t1,t2
+WHERE t1.t = (SELECT t1.t FROM t1
+WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
+ORDER BY t1.t DESC LIMIT 1);
+i1 i2 t i1 i2 t
+24 1 2005-05-27 12:40:30 24 1 2006-06-20 12:29:40
+DROP TABLE t1, t2;
+CREATE TABLE t1 (i INT);
+(SELECT i FROM t1) UNION (SELECT i FROM t1);
+i
+SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
+(
+(SELECT i FROM t1) UNION
+(SELECT i FROM t1)
+);
+i
+SELECT * FROM t1
+WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION (SELECT i FROM t1)))' at line 2
+explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
+from t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'union (select t12.i from t1 t12))
+from t1' at line 1
+explain select * from t1 where not exists
+((select t11.i from t1 t11) union (select t12.i from t1 t12));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+3 UNION NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
+insert into t1 (a) values (FLOOR(rand() * 100));
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+insert into t1 (a) select FLOOR(rand() * 100) from t1;
+SELECT a,
+(SELECT REPEAT(' ',250) FROM t1 i1
+WHERE i1.b=t1.a ORDER BY RAND() LIMIT 1) AS a
+FROM t1 ORDER BY a LIMIT 5;
+a a
+0 NULL
+0 NULL
+0 NULL
+0 NULL
+0 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 values (1);
+INSERT INTO t1 VALUES (1,1),(1,2),(2,3),(3,4);
+SELECT (SELECT COUNT(DISTINCT t1.b) from t2) FROM t1 GROUP BY t1.a;
+(SELECT COUNT(DISTINCT t1.b) from t2)
+2
+1
+1
+SELECT (SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+FROM t1 GROUP BY t1.a;
+(SELECT COUNT(DISTINCT t1.b) from t2 union select 1 from t2 where 12 < 3)
+2
+1
+1
+SELECT COUNT(DISTINCT t1.b), (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
+COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b))
+2 2
+1 1
+1 1
+SELECT COUNT(DISTINCT t1.b),
+(SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+FROM t1 GROUP BY t1.a;
+COUNT(DISTINCT t1.b) (SELECT COUNT(DISTINCT t1.b) union select 1 from DUAL where 12 < 3)
+2 2
+1 1
+1 1
+SELECT (
+SELECT (
+SELECT COUNT(DISTINCT t1.b)
+)
+)
+FROM t1 GROUP BY t1.a;
+(
+SELECT (
+SELECT COUNT(DISTINCT t1.b)
+)
+)
+2
+1
+1
+SELECT (
+SELECT (
+SELECT (
+SELECT COUNT(DISTINCT t1.b)
+)
+)
+FROM t1 GROUP BY t1.a LIMIT 1)
+FROM t1 t2
+GROUP BY t2.a;
+(
+SELECT (
+SELECT (
+SELECT COUNT(DISTINCT t1.b)
+)
+)
+FROM t1 GROUP BY t1.a LIMIT 1)
+2
+2
+2
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b int, PRIMARY KEY (b));
+CREATE TABLE t2 (x int auto_increment, y int, z int,
+PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
+create table t3 (a int);
+insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+insert into t1 select RAND()*1000, A.a + 10*(B.a+10*(C.a+10*D.a))
+from t3 A, t3 B, t3 C, t3 D where D.a<3;
+insert into t2(y,z) select t1.b, RAND()*1000 from t1, t3;
+SET SESSION sort_buffer_size = 32 * 1024;
+SELECT SQL_NO_CACHE COUNT(*)
+FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
+FROM t1) t;
+COUNT(*)
+3000
+SET SESSION sort_buffer_size = 8 * 1024 * 1024;
+SELECT SQL_NO_CACHE COUNT(*)
+FROM (SELECT a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
+FROM t1) t;
+COUNT(*)
+3000
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (id char(4) PRIMARY KEY, c int);
+CREATE TABLE t2 (c int);
+INSERT INTO t1 VALUES ('aa', 1);
+INSERT INTO t2 VALUES (1);
+SELECT * FROM t1
+WHERE EXISTS (SELECT c FROM t2 WHERE c=1
+UNION
+SELECT c from t2 WHERE c=t1.c);
+id c
+aa 1
+INSERT INTO t1 VALUES ('bb', 2), ('cc', 3), ('dd',1);
+SELECT * FROM t1
+WHERE EXISTS (SELECT c FROM t2 WHERE c=1
+UNION
+SELECT c from t2 WHERE c=t1.c);
+id c
+aa 1
+bb 2
+cc 3
+dd 1
+INSERT INTO t2 VALUES (2);
+CREATE TABLE t3 (c int);
+INSERT INTO t3 VALUES (1);
+SELECT * FROM t1
+WHERE EXISTS (SELECT t2.c FROM t2 JOIN t3 ON t2.c=t3.c WHERE t2.c=1
+UNION
+SELECT c from t2 WHERE c=t1.c);
+id c
+aa 1
+bb 2
+cc 3
+dd 1
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1(f1 int);
+CREATE TABLE t2(f2 int, f21 int, f3 timestamp);
+INSERT INTO t1 VALUES (1),(1),(2),(2);
+INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11"), (2,2,"2004-02-29 11:11:11");
+SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1;
+sq
+2
+4
+SELECT (SELECT SUM(1) FROM t2 ttt GROUP BY t2.f3 LIMIT 1) AS tt FROM t2;
+tt
+2
+2
+PREPARE stmt1 FROM 'SELECT ((SELECT f2 FROM t2 WHERE f21=f1 LIMIT 1) * COUNT(f1)) AS sq FROM t1 GROUP BY f1';
+EXECUTE stmt1;
+sq
+2
+4
+EXECUTE stmt1;
+sq
+2
+4
+DEALLOCATE PREPARE stmt1;
+SELECT f2, AVG(f21),
+(SELECT t.f3 FROM t2 AS t WHERE t2.f2=t.f2 AND t.f3=MAX(t2.f3)) AS test
+FROM t2 GROUP BY f2;
+f2 AVG(f21) test
+1 1.0000 2004-02-29 11:11:11
+2 2.0000 2004-02-29 11:11:11
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b INT, c CHAR(10) NOT NULL);
+INSERT INTO t1 VALUES
+(1,1,'a'), (1,2,'b'), (1,3,'c'), (1,4,'d'), (1,5,'e'),
+(2,1,'f'), (2,2,'g'), (2,3,'h'), (3,4,'i'), (3,3,'j'),
+(3,2,'k'), (3,1,'l'), (1,9,'m');
+SELECT a, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b)) AS test
+FROM t1 GROUP BY a;
+a MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+DROP TABLE IF EXISTS t1xt2;
+CREATE TABLE t1 (
+id_1 int(5) NOT NULL,
+t varchar(4) DEFAULT NULL
+);
+CREATE TABLE t2 (
+id_2 int(5) NOT NULL,
+t varchar(4) DEFAULT NULL
+);
+CREATE TABLE t1xt2 (
+id_1 int(5) NOT NULL,
+id_2 int(5) NOT NULL
+);
+INSERT INTO t1 VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd');
+INSERT INTO t2 VALUES (2, 'bb'), (3, 'cc'), (4, 'dd'), (12, 'aa');
+INSERT INTO t1xt2 VALUES (2, 2), (3, 3), (4, 4);
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
+id_1
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
+id_1
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
+id_1
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
+id_1
+1
+2
+3
+4
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1)));
+id_1
+1
+2
+3
+4
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 where t1.id_1 = t1xt2.id_1))));
+id_1
+1
+2
+3
+4
+insert INTO t1xt2 VALUES (1, 12);
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
+id_1
+1
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
+id_1
+1
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
+id_1
+1
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
+id_1
+2
+3
+4
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
+id_1
+2
+3
+4
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
+id_1
+2
+3
+4
+insert INTO t1xt2 VALUES (2, 12);
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
+id_1
+1
+2
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
+id_1
+1
+2
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
+id_1
+1
+2
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN (SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1));
+id_1
+3
+4
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN ((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1)));
+id_1
+3
+4
+SELECT DISTINCT t1.id_1 FROM t1 WHERE
+(12 NOT IN (((SELECT t1xt2.id_2 FROM t1xt2 WHERE t1.id_1 = t1xt2.id_1))));
+id_1
+3
+4
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t1xt2;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3), (1), (2);
+SELECT 'this is ' 'a test.' AS col1, a AS col2 FROM t1;
+col1 col2
+this is a test. 3
+this is a test. 1
+this is a test. 2
+SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
+col1 t2
+this is a test. 3
+this is a test. 1
+this is a test. 2
+DROP table t1;
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+SELECT COUNT(*), a,
+(SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
+FROM t1 GROUP BY a;
+COUNT(*) a (SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
+2 2 2
+3 3 3
+1 4 1
+SELECT COUNT(*), a,
+(SELECT MIN(m) FROM t2 WHERE m = count(*))
+FROM t1 GROUP BY a;
+COUNT(*) a (SELECT MIN(m) FROM t2 WHERE m = count(*))
+2 2 2
+3 3 3
+1 4 1
+SELECT COUNT(*), a
+FROM t1 GROUP BY a
+HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1;
+COUNT(*) a
+2 2
+3 3
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b int);
+CREATE TABLE t2 (m int, n int);
+INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
+INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
+SELECT COUNT(*) c, a,
+(SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a)
+FROM t1 GROUP BY a;
+c a (SELECT GROUP_CONCAT(COUNT(a)) FROM t2 WHERE m = a)
+2 2 2
+3 3 3
+1 4 1,1
+SELECT COUNT(*) c, a,
+(SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
+FROM t1 GROUP BY a;
+c a (SELECT GROUP_CONCAT(COUNT(a)+1) FROM t2 WHERE m = a)
+2 2 3
+3 3 4
+1 4 2,2
+DROP table t1,t2;
+CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
+INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
+(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
+(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
+SELECT a, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=MAX(t1.b + 0)) as test
+FROM t1 GROUP BY a;
+a MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+SELECT a x, MAX(b),
+(SELECT t.c FROM t1 AS t WHERE x=t.a AND t.b=MAX(t1.b + 0)) as test
+FROM t1 GROUP BY a;
+x MAX(b) test
+1 9 m
+2 3 h
+3 4 i
+SELECT a, AVG(b),
+(SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.b=AVG(t1.b)) AS test
+FROM t1 WHERE t1.d=0 GROUP BY a;
+a AVG(b) test
+1 4.0000 d
+2 2.0000 g
+3 2.5000 NULL
+SELECT tt.a,
+(SELECT (SELECT c FROM t1 as t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1) FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+FROM t1 as tt;
+a test
+1 n
+1 n
+1 n
+1 n
+1 n
+1 n
+1 n
+2 o
+2 o
+2 o
+2 o
+3 p
+3 p
+3 p
+3 p
+3 p
+SELECT tt.a,
+(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1)
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1) as test
+FROM t1 as tt GROUP BY tt.a;
+a test
+1 n
+2 o
+3 p
+SELECT tt.a, MAX(
+(SELECT (SELECT t.c FROM t1 AS t WHERE t1.a=t.a AND t.d=MAX(t1.b + tt.a)
+LIMIT 1)
+FROM t1 WHERE t1.a=tt.a GROUP BY a LIMIT 1)) as test
+FROM t1 as tt GROUP BY tt.a;
+a test
+1 n
+2 o
+3 p
+DROP TABLE t1;
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+a
+1
+2
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+a
+SELECT a FROM t1 t0
+WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+a
+1
+2
+SET @@sql_mode='ansi';
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+ERROR HY000: Invalid use of group function
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+ERROR HY000: Invalid use of group function
+SELECT a FROM t1 t0
+WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+ERROR HY000: Invalid use of group function
+SET @@sql_mode=default;
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 values (1),(1),(1),(1);
+CREATE TABLE t2 (x INT);
+INSERT INTO t1 values (1000),(1001),(1002);
+SELECT SUM( (SELECT COUNT(a) FROM t2) ) FROM t1;
+ERROR HY000: Invalid use of group function
+SELECT SUM( (SELECT SUM(COUNT(a)) FROM t2) ) FROM t1;
+ERROR HY000: Invalid use of group function
+SELECT COUNT(1) FROM DUAL;
+COUNT(1)
+1
+SELECT SUM( (SELECT AVG( (SELECT t1.a FROM t2) ) FROM DUAL) ) FROM t1;
+ERROR HY000: Invalid use of group function
+SELECT
+SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING t1.a < 12) ) FROM t2) )
+FROM t1;
+ERROR HY000: Invalid use of group function
+SELECT t1.a as XXA,
+SUM( (SELECT AVG( (SELECT COUNT(*) FROM t1 t HAVING XXA < 12) ) FROM t2) )
+FROM t1;
+ERROR HY000: Invalid use of group function
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int, b int, KEY (a));
+INSERT INTO t1 VALUES (1,1),(2,1);
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT COUNT(*) FROM t1 GROUP BY b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ref a a 5 const 1 Using where; Using index
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+DROP TABLE t1;
+CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id));
+INSERT INTO t1 VALUES
+(3,'FL'), (2,'GA'), (4,'FL'), (1,'GA'), (5,'NY'), (7,'FL'), (6,'NY');
+CREATE TABLE t2 (id int NOT NULL, INDEX idx(id));
+INSERT INTO t2 VALUES (7), (5), (1), (3);
+SELECT id, st FROM t1
+WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
+id st
+3 FL
+1 GA
+7 FL
+SELECT id, st FROM t1
+WHERE st IN ('GA','FL') AND EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
+GROUP BY id;
+id st
+1 GA
+3 FL
+7 FL
+SELECT id, st FROM t1
+WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id);
+id st
+2 GA
+4 FL
+SELECT id, st FROM t1
+WHERE st IN ('GA','FL') AND NOT EXISTS(SELECT 1 FROM t2 WHERE t2.id=t1.id)
+GROUP BY id;
+id st
+2 GA
+4 FL
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2);
+EXPLAIN EXTENDED
+SELECT * FROM (SELECT count(*) FROM t1 GROUP BY a) as res;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 100.00
+2 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
+Warnings:
+Note 1003 select `res`.`count(*)` AS `count(*)` from (select count(0) AS `count(*)` from `test`.`t1` group by `test`.`t1`.`a`) `res`
+DROP TABLE t1;
+CREATE TABLE t1 (
+a varchar(255) default NULL,
+b timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+INDEX idx(a,b)
+);
+CREATE TABLE t2 (
+a varchar(255) default NULL
+);
+INSERT INTO t1 VALUES ('abcdefghijk','2007-05-07 06:00:24');
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO `t1` VALUES ('asdf','2007-02-08 01:11:26');
+INSERT INTO `t2` VALUES ('abcdefghijk');
+INSERT INTO `t2` VALUES ('asdf');
+SET session sort_buffer_size=8192;
+SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2;
+d1
+1
+1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+CREATE TABLE t2 (x INTEGER);
+INSERT INTO t1 VALUES (1,11), (2,22), (2,22);
+INSERT INTO t2 VALUES (1), (2);
+SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a;
+ERROR 21000: Subquery returns more than 1 row
+SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a;
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1;
+(SELECT SUM(t1.a)/AVG(t2.x) FROM t2)
+3.3333
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1, 2), (1,3), (1,4), (2,1), (2,2);
+SELECT a1.a, COUNT(*) FROM t1 a1 WHERE a1.a = 1
+AND EXISTS( SELECT a2.a FROM t1 a2 WHERE a2.a = a1.a)
+GROUP BY a1.a;
+a COUNT(*)
+1 3
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1;
+(SELECT SUM(t1.a) FROM t2 WHERE a=0)
+NULL
+SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1;
+ERROR 21000: Subquery returns more than 1 row
+SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1;
+(SELECT SUM(t1.a) FROM t2 WHERE a=1)
+3
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a1 INT, a2 INT);
+CREATE TABLE t2 (b1 INT, b2 INT);
+INSERT INTO t1 VALUES (100, 200);
+INSERT INTO t1 VALUES (101, 201);
+INSERT INTO t2 VALUES (101, 201);
+INSERT INTO t2 VALUES (103, 203);
+SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
+((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL
+0
+0
+DROP TABLE t1, t2;
+CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5));
+INSERT INTO t1 VALUES (0x41,0x41), (0x42,0x42), (0x43,0x43);
+SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
+s1 s2
+SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1);
+s1 s2
+CREATE INDEX I1 ON t1 (s1);
+CREATE INDEX I2 ON t1 (s2);
+SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
+s1 s2
+SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1);
+s1 s2
+TRUNCATE t1;
+INSERT INTO t1 VALUES (0x41,0x41);
+SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1);
+s1 s2
+DROP TABLE t1;
+CREATE TABLE t1 (a1 VARBINARY(2) NOT NULL DEFAULT '0', PRIMARY KEY (a1));
+CREATE TABLE t2 (a2 BINARY(2) default '0', INDEX (a2));
+CREATE TABLE t3 (a3 BINARY(2) default '0');
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+INSERT INTO t2 VALUES (1),(2),(3);
+INSERT INTO t3 VALUES (1),(2),(3);
+SELECT LEFT(t2.a2, 1) FROM t2,t3 WHERE t3.a3=t2.a2;
+LEFT(t2.a2, 1)
+1
+2
+3
+SELECT t1.a1, t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2) FROM t1;
+a1 t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2)
+1 0
+2 0
+3 0
+4 0
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a1 BINARY(3) PRIMARY KEY, b1 VARBINARY(3));
+CREATE TABLE t2 (a2 VARBINARY(3) PRIMARY KEY);
+CREATE TABLE t3 (a3 VARBINARY(3) PRIMARY KEY);
+INSERT INTO t1 VALUES (1,10), (2,20), (3,30), (4,40);
+INSERT INTO t2 VALUES (2), (3), (4), (5);
+INSERT INTO t3 VALUES (10), (20), (30);
+SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3;
+LEFT(t1.a1,1)
+1
+2
+3
+SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3);
+a2
+DROP TABLE t1, t2, t3;
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='semijoin_with_cache=off';
+SET optimizer_switch='materialization=off';
+CREATE TABLE t1 (a CHAR(1), b VARCHAR(10));
+INSERT INTO t1 VALUES ('a', 'aa');
+INSERT INTO t1 VALUES ('a', 'aaa');
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
+a b
+CREATE INDEX I1 ON t1 (a);
+CREATE INDEX I2 ON t1 (b);
+EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where
+1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1)
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
+a b
+CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
+INSERT INTO t2 SELECT * FROM t1;
+CREATE INDEX I1 ON t2 (a);
+CREATE INDEX I2 ON t2 (b);
+EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL I2 NULL NULL NULL 2 Using where
+1 PRIMARY t2 ref I1 I1 4 test.t2.b 2 Using where; Using index; FirstMatch(t2)
+SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
+a b
+EXPLAIN
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL I2 NULL NULL NULL 2 Using where
+1 PRIMARY t1 ref I1 I1 2 test.t1.b 2 Using where; Using index; FirstMatch(t1)
+SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
+a b
+DROP TABLE t1,t2;
+SET optimizer_switch= @save_optimizer_switch;
+CREATE TABLE t1(a INT, b INT);
+INSERT INTO t1 VALUES (1,1), (1,2), (2,3), (2,4);
+EXPLAIN
+SELECT a AS out_a, MIN(b) FROM t1
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
+GROUP BY a;
+ERROR 42S22: Unknown column 'out_a' in 'where clause'
+SELECT a AS out_a, MIN(b) FROM t1
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = out_a)
+GROUP BY a;
+ERROR 42S22: Unknown column 'out_a' in 'where clause'
+EXPLAIN
+SELECT a AS out_a, MIN(b) FROM t1 t1_outer
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
+GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1_outer ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT a AS out_a, MIN(b) FROM t1 t1_outer
+WHERE b > (SELECT MIN(b) FROM t1 WHERE a = t1_outer.a)
+GROUP BY a;
+out_a MIN(b)
+1 2
+2 4
+DROP TABLE t1;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+INSERT INTO t2 VALUES (1),(2);
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+2
+2
+2
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` semi join (`test`.`t2`) where 1
+EXPLAIN EXTENDED
+SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
+(SELECT 1 FROM t2 WHERE t1.a = t2.a));
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
+Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
+DROP TABLE t1,t2;
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1(f11 int, f12 int);
+create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
+insert into t1 values(1,1),(2,2), (3, 3);
+insert into t2
+select -1 , (@a:=(A.a + 10 * (B.a + 10 * (C.a+10*D.a))))/5000 + 1, @a
+from t0 A, t0 B, t0 C, t0 D;
+set session sort_buffer_size= 33*1024;
+select count(*) from t1 where f12 =
+(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);
+count(*)
+3
+drop table t0,t1,t2;
+CREATE TABLE t4 (
+f7 varchar(32) collate utf8_bin NOT NULL default '',
+f10 varchar(32) collate utf8_bin default NULL,
+PRIMARY KEY (f7)
+);
+INSERT INTO t4 VALUES(1,1), (2,null);
+CREATE TABLE t2 (
+f4 varchar(32) collate utf8_bin NOT NULL default '',
+f2 varchar(50) collate utf8_bin default NULL,
+f3 varchar(10) collate utf8_bin default NULL,
+PRIMARY KEY (f4),
+UNIQUE KEY uk1 (f2)
+);
+INSERT INTO t2 VALUES(1,1,null), (2,2,null);
+CREATE TABLE t1 (
+f8 varchar(32) collate utf8_bin NOT NULL default '',
+f1 varchar(10) collate utf8_bin default NULL,
+f9 varchar(32) collate utf8_bin default NULL,
+PRIMARY KEY (f8)
+);
+INSERT INTO t1 VALUES (1,'P',1), (2,'P',1), (3,'R',2);
+CREATE TABLE t3 (
+f6 varchar(32) collate utf8_bin NOT NULL default '',
+f5 varchar(50) collate utf8_bin default NULL,
+PRIMARY KEY (f6)
+);
+INSERT INTO t3 VALUES (1,null), (2,null);
+SELECT
+IF(t1.f1 = 'R', a1.f2, t2.f2) AS a4,
+IF(t1.f1 = 'R', a1.f3, t2.f3) AS f3,
+SUM(
+IF(
+(SELECT VPC.f2
+FROM t2 VPC, t4 a2, t2 a3
+WHERE
+VPC.f4 = a2.f10 AND a3.f2 = a4
+LIMIT 1) IS NULL,
+0,
+t3.f5
+)
+) AS a6
+FROM
+t2, t3, t1 JOIN t2 a1 ON t1.f9 = a1.f4
+GROUP BY a4;
+a4 f3 a6
+1 NULL NULL
+2 NULL NULL
+DROP TABLE t1, t2, t3, t4;
+create table t1 (a float(5,4) zerofill);
+create table t2 (a float(5,4),b float(2,0));
+select t1.a from t1 where
+t1.a= (select b from t2 limit 1) and not
+t1.a= (select a from t2 limit 1) ;
+a
+drop table t1, t2;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+SET @save_join_cache_level=@@join_cache_level;
+SET join_cache_level=0;
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 GROUP BY a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary
+Warnings:
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT min(a) FROM t1 WHERE a > 3 GROUP BY a);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery2> const distinct_key distinct_key 4 const 1 100.00
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+2 MATERIALIZED t1 ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary
+Warnings:
+Note 1003 select 1 AS `1` from <materialize> (select min(`test`.`t1`.`a`) from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a`) join `test`.`t1` where (`<subquery2>`.`min(a)` = 1)
+SET join_cache_level=@save_join_cache_level;
+DROP TABLE t1;
+#
+# Bug#45061: Incorrectly market field caused wrong result.
+#
+CREATE TABLE `C` (
+`int_nokey` int(11) NOT NULL,
+`int_key` int(11) NOT NULL,
+KEY `int_key` (`int_key`)
+);
+INSERT INTO `C` VALUES (9,9), (0,0), (8,6), (3,6), (7,6), (0,4),
+(1,7), (9,4), (0,8), (9,4), (0,7), (5,5), (0,0), (8,5), (8,7),
+(5,2), (1,8), (7,0), (0,9), (9,5);
+SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
+int_nokey int_key
+9 9
+0 0
+5 5
+0 0
+EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY C ALL NULL NULL NULL NULL 20 100.00 Using where
+DROP TABLE C;
+# End of test for bug#45061.
+#
+# Bug #46749: Segfault in add_key_fields() with outer subquery level
+# field references
+#
+CREATE TABLE t1 (
+a int,
+b int,
+UNIQUE (a), KEY (b)
+);
+INSERT INTO t1 VALUES (1,1), (2,1);
+CREATE TABLE st1 like t1;
+INSERT INTO st1 VALUES (1,1), (2,1);
+CREATE TABLE st2 like t1;
+INSERT INTO st2 VALUES (1,1), (2,1);
+EXPLAIN
+SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
+FROM t1
+WHERE a = 230;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT MAX(b), (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
+FROM t1
+WHERE a = 230;
+MAX(b) (SELECT COUNT(*) FROM st1,st2 WHERE st2.b <= t1.b)
+NULL NULL
+DROP TABLE t1, st1, st2;
+#
+# Bug #48709: Assertion failed in sql_select.cc:11782:
+# int join_read_key(JOIN_TAB*)
+#
+CREATE TABLE t1 (pk int PRIMARY KEY, int_key int);
+INSERT INTO t1 VALUES (10,1), (14,1);
+CREATE TABLE t2 (pk int PRIMARY KEY, int_key int);
+INSERT INTO t2 VALUES (3,3), (5,NULL), (7,3);
+# should have eq_ref for t1
+EXPLAIN
+SELECT * FROM t2 outr
+WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2)
+ORDER BY outr.pk;
+id select_type table type possible_keys key key_len ref rows Extra
+x x outr ALL x x x x x x
+x x t1 eq_ref x x x x x x
+x x t2 index x x x x x x
+# should not crash on debug binaries
+SELECT * FROM t2 outr
+WHERE outr.int_key NOT IN (SELECT t1.pk FROM t1, t2)
+ORDER BY outr.pk;
+pk int_key
+3 3
+7 3
+DROP TABLE t1,t2;
+#
+# Bug#12329653
+# EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
+#
+CREATE TABLE t1(a1 int);
+INSERT INTO t1 VALUES (1),(2);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+EXPLAIN EXTENDED
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00
+Warnings:
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
+1
+1
+1
+PREPARE stmt FROM
+'SELECT 1 UNION ALL
+SELECT 1 FROM t1
+ORDER BY
+(SELECT 1 FROM t1 AS t1_0
+ WHERE 1 < SOME (SELECT a1 FROM t1)
+)' ;
+EXECUTE stmt ;
+ERROR 21000: Subquery returns more than 1 row
+EXECUTE stmt ;
+ERROR 21000: Subquery returns more than 1 row
+SET SESSION sql_mode=@old_sql_mode;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+#
+# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
+#
+CREATE TABLE t1(a1 int);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2(a1 int);
+INSERT INTO t2 VALUES (3);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2 FROM t2);
+1
+1
+1
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2);
+1
+1
+1
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2);
+1
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2);
+1
+1
+1
+SET SESSION sql_mode=@old_sql_mode;
+DROP TABLE t1, t2;
+#
+# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
+#
+create table t2(i int);
+insert into t2 values(0);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+CREATE VIEW v1 AS
+SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2
+;
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_varchar_key varchar(1) DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY col_varchar_key (col_varchar_key)
+);
+SELECT t1.pk
+FROM t1
+WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 )
+;
+pk
+SET SESSION sql_mode=@old_sql_mode;
+drop table t2, t1;
+drop view v1;
+End of 5.0 tests.
+create table t_out (subcase char(3),
+a1 char(2), b1 char(2), c1 char(2));
+create table t_in (a2 char(2), b2 char(2), c2 char(2));
+insert into t_out values ('A.1','2a', NULL, '2a');
+insert into t_out values ('A.3', '2a', NULL, '2a');
+insert into t_out values ('A.4', '2a', NULL, 'xx');
+insert into t_out values ('B.1', '2a', '2a', '2a');
+insert into t_out values ('B.2', '2a', '2a', '2a');
+insert into t_out values ('B.3', '3a', 'xx', '3a');
+insert into t_out values ('B.4', 'xx', '3a', '3a');
+insert into t_in values ('1a', '1a', '1a');
+insert into t_in values ('2a', '2a', '2a');
+insert into t_in values (NULL, '2a', '2a');
+insert into t_in values ('3a', NULL, '3a');
+
+Test general IN semantics (not top-level)
+
+case A.1
+select subcase,
+(a1, b1, c1) IN (select * from t_in where a2 = 'no_match') pred_in,
+(a1, b1, c1) NOT IN (select * from t_in where a2 = 'no_match') pred_not_in
+from t_out where subcase = 'A.1';
+subcase pred_in pred_not_in
+A.1 0 1
+case A.2 - impossible
+case A.3
+select subcase,
+(a1, b1, c1) IN (select * from t_in) pred_in,
+(a1, b1, c1) NOT IN (select * from t_in) pred_not_in
+from t_out where subcase = 'A.3';
+subcase pred_in pred_not_in
+A.3 NULL NULL
+case A.4
+select subcase,
+(a1, b1, c1) IN (select * from t_in) pred_in,
+(a1, b1, c1) NOT IN (select * from t_in) pred_not_in
+from t_out where subcase = 'A.4';
+subcase pred_in pred_not_in
+A.4 0 1
+case B.1
+select subcase,
+(a1, b1, c1) IN (select * from t_in where a2 = 'no_match') pred_in,
+(a1, b1, c1) NOT IN (select * from t_in where a2 = 'no_match') pred_not_in
+from t_out where subcase = 'B.1';
+subcase pred_in pred_not_in
+B.1 0 1
+case B.2
+select subcase,
+(a1, b1, c1) IN (select * from t_in) pred_in,
+(a1, b1, c1) NOT IN (select * from t_in) pred_not_in
+from t_out where subcase = 'B.2';
+subcase pred_in pred_not_in
+B.2 1 0
+case B.3
+select subcase,
+(a1, b1, c1) IN (select * from t_in) pred_in,
+(a1, b1, c1) NOT IN (select * from t_in) pred_not_in
+from t_out where subcase = 'B.3';
+subcase pred_in pred_not_in
+B.3 NULL NULL
+case B.4
+select subcase,
+(a1, b1, c1) IN (select * from t_in) pred_in,
+(a1, b1, c1) NOT IN (select * from t_in) pred_not_in
+from t_out where subcase = 'B.4';
+subcase pred_in pred_not_in
+B.4 0 1
+
+Test IN as top-level predicate, and
+as non-top level for cases A.3, B.3 (the only cases with NULL result).
+
+case A.1
+select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
+where subcase = 'A.1' and
+(a1, b1, c1) IN (select * from t_in where a1 = 'no_match');
+pred_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
+where subcase = 'A.1' and
+(a1, b1, c1) NOT IN (select * from t_in where a1 = 'no_match');
+pred_not_in
+T
+select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
+where subcase = 'A.1' and
+NOT((a1, b1, c1) IN (select * from t_in where a1 = 'no_match'));
+not_pred_in
+T
+case A.3
+select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
+where subcase = 'A.3' and
+(a1, b1, c1) IN (select * from t_in);
+pred_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
+where subcase = 'A.3' and
+(a1, b1, c1) NOT IN (select * from t_in);
+pred_not_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
+where subcase = 'A.3' and
+NOT((a1, b1, c1) IN (select * from t_in));
+not_pred_in
+F
+select case when count(*) > 0 then 'N' else 'wrong result' end as pred_in from t_out
+where subcase = 'A.3' and
+((a1, b1, c1) IN (select * from t_in)) is NULL and
+((a1, b1, c1) NOT IN (select * from t_in)) is NULL;
+pred_in
+N
+case A.4
+select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
+where subcase = 'A.4' and
+(a1, b1, c1) IN (select * from t_in);
+pred_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
+where subcase = 'A.4' and
+(a1, b1, c1) NOT IN (select * from t_in);
+pred_not_in
+T
+select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
+where subcase = 'A.4' and
+NOT((a1, b1, c1) IN (select * from t_in));
+not_pred_in
+T
+case B.1
+select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
+where subcase = 'B.1' and
+(a1, b1, c1) IN (select * from t_in where a1 = 'no_match');
+pred_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
+where subcase = 'B.1' and
+(a1, b1, c1) NOT IN (select * from t_in where a1 = 'no_match');
+pred_not_in
+T
+select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
+where subcase = 'B.1' and
+NOT((a1, b1, c1) IN (select * from t_in where a1 = 'no_match'));
+not_pred_in
+T
+case B.2
+select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
+where subcase = 'B.2' and
+(a1, b1, c1) IN (select * from t_in);
+pred_in
+T
+select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
+where subcase = 'B.2' and
+(a1, b1, c1) NOT IN (select * from t_in);
+pred_not_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
+where subcase = 'B.2' and
+NOT((a1, b1, c1) IN (select * from t_in));
+not_pred_in
+F
+case B.3
+select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
+where subcase = 'B.3' and
+(a1, b1, c1) IN (select * from t_in);
+pred_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
+where subcase = 'B.3' and
+(a1, b1, c1) NOT IN (select * from t_in);
+pred_not_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
+where subcase = 'B.3' and
+NOT((a1, b1, c1) IN (select * from t_in));
+not_pred_in
+F
+select case when count(*) > 0 then 'N' else 'wrong result' end as pred_in from t_out
+where subcase = 'B.3' and
+((a1, b1, c1) IN (select * from t_in)) is NULL and
+((a1, b1, c1) NOT IN (select * from t_in)) is NULL;
+pred_in
+N
+case B.4
+select case when count(*) > 0 then 'T' else 'F' end as pred_in from t_out
+where subcase = 'B.4' and
+(a1, b1, c1) IN (select * from t_in);
+pred_in
+F
+select case when count(*) > 0 then 'T' else 'F' end as pred_not_in from t_out
+where subcase = 'B.4' and
+(a1, b1, c1) NOT IN (select * from t_in);
+pred_not_in
+T
+select case when count(*) > 0 then 'T' else 'F' end as not_pred_in from t_out
+where subcase = 'B.4' and
+NOT((a1, b1, c1) IN (select * from t_in));
+not_pred_in
+T
+drop table t_out;
+drop table t_in;
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+a
+1
+2
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+a
+SELECT a FROM t1 t0
+WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+a
+1
+2
+SET @@sql_mode='ansi';
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 0 GROUP BY a;
+ERROR HY000: Invalid use of group function
+SELECT a FROM t1 WHERE (SELECT COUNT(b) FROM DUAL) > 1 GROUP BY a;
+ERROR HY000: Invalid use of group function
+SELECT a FROM t1 t0
+WHERE (SELECT COUNT(t0.b) FROM t1 t WHERE t.b>20) GROUP BY a;
+ERROR HY000: Invalid use of group function
+SET @@sql_mode=default;
+DROP TABLE t1;
+CREATE TABLE t1 (s1 CHAR(1));
+INSERT INTO t1 VALUES ('a');
+SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
+s1
+a
+DROP TABLE t1;
+CREATE TABLE t1(c INT, KEY(c));
+CREATE TABLE t2(a INT, b INT);
+INSERT INTO t2 VALUES (1, 10), (2, NULL);
+INSERT INTO t1 VALUES (1), (3);
+SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
+a b
+DROP TABLE t1,t2;
+CREATE TABLE t1(pk INT PRIMARY KEY, a INT, INDEX idx(a));
+INSERT INTO t1 VALUES (1, 10), (3, 30), (2, 20);
+CREATE TABLE t2(pk INT PRIMARY KEY, a INT, b INT, INDEX idxa(a));
+INSERT INTO t2 VALUES (2, 20, 700), (1, 10, 200), (4, 10, 100);
+SELECT * FROM t1
+WHERE EXISTS (SELECT DISTINCT a FROM t2 WHERE t1.a < t2.a ORDER BY b);
+pk a
+1 10
+DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), KEY b (b));
+INSERT INTO t1 VALUES (1,NULL), (9,NULL);
+CREATE TABLE t2 (
+a INT,
+b INT,
+c INT,
+d INT,
+PRIMARY KEY (a),
+UNIQUE KEY b (b,c,d),
+KEY b_2 (b),
+KEY c (c),
+KEY d (d)
+);
+INSERT INTO t2 VALUES
+(43, 2, 11 ,30),
+(44, 2, 12 ,30),
+(45, 1, 1 ,10000),
+(46, 1, 2 ,10000),
+(556,1, 32 ,10000);
+CREATE TABLE t3 (
+a INT,
+b INT,
+c INT,
+PRIMARY KEY (a),
+UNIQUE KEY b (b,c),
+KEY c (c),
+KEY b_2 (b)
+);
+INSERT INTO t3 VALUES (1,1,1), (2,32,1);
+explain
+SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 2 Using index
+1 PRIMARY t3 ref b,b_2 b 5 test.t1.a 1 Using index
+2 DEPENDENT SUBQUERY t2 ref b,b_2,c b 10 test.t3.c,test.t1.a 1 Using where; Using index; Using filesort
+SELECT t1.a, (SELECT 1 FROM t2 WHERE t2.b=t3.c AND t2.c=t1.a ORDER BY t2.d LIMIT 1) AS incorrect FROM t1, t3 WHERE t3.b=t1.a;
+a incorrect
+1 1
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int, c int);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+INSERT INTO t1 (id) VALUES (1);
+INSERT INTO t2 (id) VALUES (1);
+CREATE VIEW v1 AS
+SELECT t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+UPDATE v1 SET c=1;
+CREATE VIEW v2 (a,b) AS
+SELECT t2.id, t2.c AS c FROM t1, t2
+WHERE t1.id=t2.id AND 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+INSERT INTO v2(a,b) VALUES (2,2);
+ERROR HY000: CHECK OPTION failed 'test.v2'
+SELECT * FROM v1;
+c
+1
+1
+1
+1
+CREATE VIEW v3 AS
+SELECT t2.c AS c FROM t2
+WHERE 1 IN (SELECT id FROM t1) WITH CHECK OPTION;
+DELETE FROM v3;
+DROP VIEW v1,v2,v3;
+DROP TABLE t1,t2;
+#
+# BUG#37822 Correlated subquery with IN and IS UNKNOWN provides wrong result
+#
+create table t1(id integer primary key, g integer, v integer, s char(1));
+create table t2(id integer primary key, g integer, v integer, s char(1));
+insert into t1 values
+(10, 10, 10, 'l'),
+(20, 20, 20, 'l'),
+(40, 40, 40, 'l'),
+(41, 40, null, 'l'),
+(50, 50, 50, 'l'),
+(51, 50, null, 'l'),
+(60, 60, 60, 'l'),
+(61, 60, null, 'l'),
+(70, 70, 70, 'l'),
+(90, 90, null, 'l');
+insert into t2 values
+(10, 10, 10, 'r'),
+(30, 30, 30, 'r'),
+(50, 50, 50, 'r'),
+(60, 60, 60, 'r'),
+(61, 60, null, 'r'),
+(70, 70, 70, 'r'),
+(71, 70, null, 'r'),
+(80, 80, 80, 'r'),
+(81, 80, null, 'r'),
+(100,100,null, 'r');
+select *
+from t1
+where v in(select v
+from t2
+where t1.g=t2.g) is unknown;
+id g v s
+51 50 NULL l
+61 60 NULL l
+drop table t1, t2;
+#
+# Bug#37822 Correlated subquery with IN and IS UNKNOWN provides wrong result
+#
+create table t1(id integer primary key, g integer, v integer, s char(1));
+create table t2(id integer primary key, g integer, v integer, s char(1));
+insert into t1 values
+(10, 10, 10, 'l'),
+(20, 20, 20, 'l'),
+(40, 40, 40, 'l'),
+(41, 40, null, 'l'),
+(50, 50, 50, 'l'),
+(51, 50, null, 'l'),
+(60, 60, 60, 'l'),
+(61, 60, null, 'l'),
+(70, 70, 70, 'l'),
+(90, 90, null, 'l');
+insert into t2 values
+(10, 10, 10, 'r'),
+(30, 30, 30, 'r'),
+(50, 50, 50, 'r'),
+(60, 60, 60, 'r'),
+(61, 60, null, 'r'),
+(70, 70, 70, 'r'),
+(71, 70, null, 'r'),
+(80, 80, 80, 'r'),
+(81, 80, null, 'r'),
+(100,100,null, 'r');
+select *
+from t1
+where v in(select v
+from t2
+where t1.g=t2.g) is unknown;
+id g v s
+51 50 NULL l
+61 60 NULL l
+drop table t1, t2;
+#
+# Bug#33204: INTO is allowed in subselect, causing inconsistent results
+#
+CREATE TABLE t1( a INT );
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2( a INT, b INT );
+SELECT *
+FROM (SELECT a INTO @var FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT *
+FROM (SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO @var FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2
+) t1a' at line 4
+SELECT * FROM (SELECT a FROM t1 WHERE a = 2) t1a;
+a
+2
+SELECT * FROM (
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+2
+SELECT * FROM (
+SELECT 1 a
+UNION
+SELECT a FROM t1 WHERE a = 2
+UNION
+SELECT a FROM t1 WHERE a = 2
+) t1a;
+a
+1
+2
+SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
+a
+1
+SELECT * FROM (SELECT 1 UNION SELECT 1) t1a;
+1
+1
+SELECT * FROM ((SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM ((SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO @a)) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a)) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO DUMPFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO OUTFILE 'file' )) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO @a))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO DUMPFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO OUTFILE 'file' ))) t1a;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' ))) t1a' at line 1
+SELECT * FROM (SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a LIMIT 1) t1a;
+a
+1
+SELECT * FROM (SELECT 1 a UNION SELECT 1 a ORDER BY a LIMIT 1) t1a;
+a
+1
+SELECT * FROM t1 JOIN (SELECT 1 UNION SELECT 1) alias ON 1;
+a 1
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN ((t1 t1a)) t1a ON 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a ON 1' at line 1
+SELECT * FROM t1 JOIN (t1 t1a) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM t1 JOIN ((t1 t1a)) ON 1;
+a a
+1 1
+2 1
+1 2
+2 2
+SELECT * FROM (t1 t1a);
+a
+1
+2
+SELECT * FROM ((t1 t1a));
+a
+1
+2
+SELECT * FROM t1 JOIN (SELECT 1 t1a) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 t1a)) alias ON 1;
+a t1a
+1 1
+2 1
+SELECT * FROM t1 JOIN (SELECT 1 a) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM t1 JOIN ((SELECT 1 a)) a ON 1;
+a a
+1 1
+2 1
+SELECT * FROM (t1 JOIN (SELECT 1) t1a1 ON 1) t1a2;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't1a2' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 3 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO @a);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @a)' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
+SELECT ( SELECT a FROM t1 WHERE a = 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 ) a
+1 1
+1 2
+SELECT ( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ), a FROM t1;
+( SELECT a FROM t1 WHERE a = 1 UNION SELECT 1 ) a
+1 1
+1 2
+SELECT * FROM t2 WHERE (a, b) IN (SELECT a, b FROM t2);
+a b
+SELECT 1 UNION ( SELECT 1 UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1' at line 1
+SELECT ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+( SELECT 1 UNION SELECT 1 UNION SELECT 1 )
+1
+SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
+((SELECT 1 UNION SELECT 1 UNION SELECT 1))
+1
+SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') UNION SELECT 1 )' at line 1
+SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
+1
+1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
+SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
+SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );
+a
+1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT EXISTS(SELECT 1+1);
+EXISTS(SELECT 1+1)
+1
+SELECT EXISTS(SELECT 1+1 INTO @test);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @test)' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE EXISTS ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @v )' at line 1
+SELECT * FROM t1 WHERE a IN ( SELECT 1 INTO @v );
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @v )' at line 1
+DROP TABLE t1, t2;
+CREATE TABLE t1 (a ENUM('rainbow'));
+INSERT INTO t1 VALUES (),(),(),(),();
+SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
+1
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a LONGBLOB);
+INSERT INTO t1 SET a = 'aaaa';
+INSERT INTO t1 SET a = 'aaaa';
+SELECT 1 FROM t1 GROUP BY
+(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
+1
+1
+DROP TABLE t1;
+#
+# Bug #49512 : subquery with aggregate function crash
+# subselect_single_select_engine::exec()
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES();
+# should not crash
+SELECT 1 FROM t1 WHERE a <> SOME
+(
+SELECT MAX((SELECT a FROM t1 LIMIT 1)) AS d
+FROM t1,t1 a
+);
+1
+DROP TABLE t1;
+#
+# Bug #45989 take 2 : memory leak after explain encounters an
+# error in the query
+#
+CREATE TABLE t1(a LONGTEXT);
+INSERT INTO t1 VALUES (repeat('a',@@global.max_allowed_packet));
+INSERT INTO t1 VALUES (repeat('b',@@global.max_allowed_packet));
+EXPLAIN EXTENDED SELECT DISTINCT 1 FROM t1,
+(SELECT DISTINCTROW a AS away FROM t1 GROUP BY a WITH ROLLUP) AS d1
+WHERE t1.a = d1.a;
+ERROR 42S22: Unknown column 'd1.a' in 'where clause'
+DROP TABLE t1;
+Set up test tables.
+CREATE TABLE t1 (
+t1_id INT UNSIGNED,
+PRIMARY KEY(t1_id)
+) Engine=MyISAM;
+INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
+CREATE TABLE t2 SELECT * FROM t1;
+CREATE TABLE t3 (
+t3_id INT UNSIGNED AUTO_INCREMENT,
+t1_id INT UNSIGNED,
+amount DECIMAL(16,2),
+PRIMARY KEY(t3_id),
+KEY(t1_id)
+) Engine=MyISAM;
+INSERT INTO t3 (t1_id, t3_id, amount)
+VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
+This is the 'inner query' running by itself.
+Produces correct results.
+SELECT
+t1.t1_id,
+IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+t1
+LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+t1.t1_id
+;
+t1_id total_amount
+1 100.00
+2 200.00
+3 0.00
+4 400.00
+5 0.00
+SELECT * FROM (the same inner query)
+Produces correct results.
+SELECT * FROM (
+SELECT
+t1.t1_id,
+IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+t1
+LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+t1.t1_id
+) AS t;
+t1_id total_amount
+1 100.00
+2 200.00
+3 0.00
+4 400.00
+5 0.00
+Now make t2.t1_id part of a key.
+ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
+Same inner query by itself.
+Still correct results.
+SELECT
+t1.t1_id,
+IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+t1
+LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+t1.t1_id;
+t1_id total_amount
+1 100.00
+2 200.00
+3 0.00
+4 400.00
+5 0.00
+SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
+SELECT * FROM (
+SELECT
+t1.t1_id,
+IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+t1
+LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+t1.t1_id
+) AS t;
+t1_id total_amount
+1 100.00
+2 200.00
+3 0.00
+4 400.00
+5 0.00
+DROP TABLE t3;
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Bug #52711: Segfault when doing EXPLAIN SELECT with
+# union...order by (select... where...)
+#
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+# Should not crash
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+# Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+#
+# Bug #58818: Incorrect result for IN/ANY subquery
+# with HAVING condition
+#
+CREATE TABLE t1(i INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE TABLE t1s(i INT);
+INSERT INTO t1s VALUES (10), (20), (30);
+CREATE TABLE t2s(i INT);
+INSERT INTO t2s VALUES (100), (200), (300);
+SELECT * FROM t1
+WHERE t1.i NOT IN
+(
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+);
+i
+1
+2
+3
+SELECT * FROM t1
+WHERE t1.I IN
+(
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+) IS UNKNOWN;
+i
+SELECT * FROM t1
+WHERE NOT t1.I = ANY
+(
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+);
+i
+1
+2
+3
+SELECT * FROM t1
+WHERE t1.i = ANY (
+SELECT STRAIGHT_JOIN t2s.i
+FROM
+t1s LEFT OUTER JOIN t2s ON t2s.i = t1s.i
+HAVING t2s.i = 999
+) IS UNKNOWN;
+i
+DROP TABLE t1,t1s,t2s;
+# LP BUG#675248 - select->prep_where references on freed memory
+CREATE TABLE t1 (a int, b int);
+insert into t1 values (1,1),(0,0);
+CREATE TABLE t2 (c int);
+insert into t2 values (1),(2);
+prepare stmt1 from "select sum(a),(select sum(c) from t2 where table1.b) as sub
+from t1 as table1 group by sub";
+execute stmt1;
+sum(a) sub
+0 NULL
+1 3
+deallocate prepare stmt1;
+prepare stmt1 from "select sum(a),(select sum(c) from t2 having table1.b) as sub
+from t1 as table1";
+execute stmt1;
+sum(a) sub
+1 3
+deallocate prepare stmt1;
+drop table t1,t2;
+#
+# Bug LP#693935/#58727: Assertion failure with
+# a single row subquery returning more than one row
+#
+create table t1 (a char(1) charset utf8);
+insert into t1 values ('a'), ('b');
+create table t2 (a binary(1));
+insert into t2 values ('x'), ('y');
+select * from t2 where a=(select a from t1) and a='x';
+ERROR 21000: Subquery returns more than 1 row
+drop table t1,t2;
+End of 5.1 tests
+#
+# Bug #11765713 58705:
+# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+# CREATED BY OPT_SUM_QUERY
+#
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1)
+);
+ERROR 21000: Subquery returns more than 1 row
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1 where a is null)
+);
+foo
+DROP TABLE t1;
+#
+# Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool):
+# Assertion `file' failed.
+#
+CREATE TABLE t1 (a INT);
+SELECT 1 FROM
+(SELECT ROW(
+(SELECT 1 FROM t1 RIGHT JOIN
+(SELECT 1 FROM t1, t1 t2) AS d ON 1),
+1) FROM t1) AS e;
+ERROR 21000: Operand should contain 1 column(s)
+DROP TABLE t1;
+#
+# Bug#13721076 CRASH WITH TIME TYPE/TIMESTAMP() AND WARNINGS IN SUBQUERY
+#
+CREATE TABLE t1(a TIME NOT NULL);
+INSERT INTO t1 VALUES ('00:00:32');
+SELECT 1 FROM t1 WHERE a >
+(SELECT timestamp(a) AS a FROM t1);
+1
+DROP TABLE t1;
+#
+# No BUG#, a case brought from 5.2's innodb_mysql_lock.test
+#
+create table t1 (i int not null primary key);
+insert into t1 values (1),(2),(3),(4),(5);
+create table t2 (j int not null primary key);
+insert into t2 values (1),(2),(3),(4),(5);
+create table t3 (k int not null primary key);
+insert into t3 values (1),(2),(3);
+create view v2 as select t2.j as j from t2 where t2.j in (select t1.i from t1);
+select * from t3 where k in (select j from v2);
+k
+1
+2
+3
+drop table t1,t2,t3;
+drop view v2;
+#
+# Bug#52068: Optimizer generates invalid semijoin materialization plan
+#
+drop table if exists ot1, ot2, it1, it2;
+CREATE TABLE ot1(a INTEGER);
+INSERT INTO ot1 VALUES(5), (8);
+CREATE TABLE it2(a INTEGER);
+INSERT INTO it2 VALUES(9), (5), (1), (8);
+CREATE TABLE it3(a INTEGER);
+INSERT INTO it3 VALUES(7), (1), (0), (5), (1), (4);
+CREATE TABLE ot4(a INTEGER);
+INSERT INTO ot4 VALUES(1), (3), (5), (7), (9), (7), (3), (1);
+SELECT * FROM ot1,ot4
+WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a
+FROM it2,it3);
+a a
+5 1
+8 1
+5 5
+8 5
+5 7
+8 7
+5 7
+8 7
+5 1
+8 1
+explain SELECT * FROM ot1,ot4
+WHERE (ot1.a,ot4.a) IN (SELECT it2.a,it3.a
+FROM it2,it3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY ot1 ALL NULL NULL NULL NULL 2
+1 PRIMARY ot4 ALL NULL NULL NULL NULL 8 Using join buffer (flat, BNL join)
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
+2 MATERIALIZED it2 ALL NULL NULL NULL NULL 4
+2 MATERIALIZED it3 ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join)
+DROP TABLE IF EXISTS ot1, ot4, it2, it3;
+#
+# Bug#729039: NULL keys used to evaluate subquery
+#
+CREATE TABLE t1 (a int) ;
+INSERT INTO t1 VALUES (NULL), (1), (NULL), (2);
+CREATE TABLE t2 (a int, INDEX idx(a)) ;
+INSERT INTO t2 VALUES (NULL), (1), (NULL);
+SELECT * FROM t1
+WHERE EXISTS (SELECT a FROM t2 USE INDEX () WHERE t2.a = t1.a);
+a
+1
+EXPLAIN
+SELECT * FROM t1
+WHERE EXISTS (SELECT a FROM t2 USE INDEX() WHERE t2.a = t1.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
+SELECT * FROM t1
+WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
+a
+1
+EXPLAIN
+SELECT * FROM t1
+WHERE EXISTS (SELECT a FROM t2 WHERE t2.a = t1.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t2 index idx idx 5 NULL 3 Using index
+DROP TABLE t1,t2;
+#
+# BUG#752992: Wrong results for a subquery with 'semijoin=on'
+#
+CREATE TABLE t1 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
+INSERT INTO t1 VALUES (11,0);
+INSERT INTO t1 VALUES (12,5);
+INSERT INTO t1 VALUES (15,0);
+CREATE TABLE t2 (pk INTEGER PRIMARY KEY, i INTEGER NOT NULL);
+INSERT INTO t2 VALUES (11,1);
+INSERT INTO t2 VALUES (12,2);
+INSERT INTO t2 VALUES (15,4);
+SET @save_join_cache_level=@@join_cache_level;
+SET join_cache_level=0;
+EXPLAIN SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 3
+1 PRIMARY it eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 Using index
+1 PRIMARY t2 index NULL PRIMARY 4 NULL 3 Using index; FirstMatch(it)
+SELECT * FROM t1 WHERE pk IN (SELECT it.pk FROM t2 JOIN t2 AS it ON 1);
+pk i
+11 0
+12 5
+15 0
+SET join_cache_level=@save_join_cache_level;
+DROP table t1,t2;
+#
+# Bug#751350: crash with pushed condition for outer references when
+# there should be none of such conditions
+#
+CREATE TABLE t1 (a int, b int) ;
+INSERT INTO t1 VALUES (0,0),(0,0);
+set @optimizer_switch_save=@@optimizer_switch;
+set @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=on';
+EXPLAIN
+SELECT b FROM t1
+WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
+GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT b FROM t1
+WHERE ('0') IN ( SELECT a FROM t1 GROUP BY a )
+GROUP BY b;
+b
+0
+set @@optimizer_switch=@optimizer_switch_save;
+DROP TABLE t1;
+#
+# Bug #11765713 58705:
+# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+# CREATED BY OPT_SUM_QUERY
+#
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1)
+);
+ERROR 21000: Subquery returns more than 1 row
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1 where a is null)
+);
+foo
+DROP TABLE t1;
+CREATE TABLE t1 (a int(11), b varchar(1));
+INSERT INTO t1 VALUES (2,NULL),(5,'d'),(7,'g');
+SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 );
+a
+5
+SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 GROUP BY b );
+a
+7
+SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 );
+a
+7
+SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 GROUP BY b );
+a
+delete from t1;
+INSERT INTO t1 VALUES (2,NULL),(5,'d'),(7,'g');
+SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+SELECT a FROM t1 WHERE b < ANY ( SELECT b FROM t1 );
+a
+5
+SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 GROUP BY b );
+a
+7
+SELECT a FROM t1 WHERE b > ANY ( SELECT b FROM t1 );
+a
+7
+SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b <= ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b >= ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b = ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 );
+a
+5
+7
+SELECT a FROM t1 WHERE b <> ANY ( SELECT b FROM t1 GROUP BY b );
+a
+5
+7
+SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b < ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b > ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b <= ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b >= ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b = ALL ( SELECT b FROM t1 GROUP BY b );
+a
+SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 );
+a
+SELECT a FROM t1 WHERE b <> ALL ( SELECT b FROM t1 GROUP BY b );
+a
+drop table t1;
+#
+# Fix of lp:780386 (NULL left part with empty ALL subquery).
+#
+CREATE TABLE t1 ( f11 int) ;
+INSERT IGNORE INTO t1 VALUES (0),(0);
+CREATE TABLE t2 ( f3 int, f10 int, KEY (f10,f3)) ;
+INSERT IGNORE INTO t2 VALUES (NULL,NULL),(5,0);
+DROP TABLE IF EXISTS t3;
+Warnings:
+Note 1051 Unknown table 't3'
+CREATE TABLE t3 ( f3 int) ;
+INSERT INTO t3 VALUES (0),(0);
+SELECT a1.f3 AS r FROM t2 AS a1 , t1 WHERE a1.f3 < ALL ( SELECT f3 FROM t3 WHERE f3 = 1 ) ;
+r
+NULL
+5
+NULL
+5
+DROP TABLE t1, t2, t3;
+#
+# Bug#12763207 - ASSERT IN SUBSELECT::SINGLE_VALUE_TRANSFORMER
+#
+CREATE TABLE t1(a1 int);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2(a1 int);
+INSERT INTO t2 VALUES (3);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2 FROM t2);
+1
+1
+1
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 2.0 FROM t2);
+1
+1
+1
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT 'a' FROM t2);
+1
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t2);
+1
+1
+1
+SET SESSION sql_mode=@old_sql_mode;
+DROP TABLE t1, t2;
+create table t2(i int);
+insert into t2 values(0);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+CREATE VIEW v1 AS
+SELECT 'f' FROM t2 UNION SELECT 'x' FROM t2
+;
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_varchar_key varchar(1) DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY col_varchar_key (col_varchar_key)
+);
+SELECT t1.pk
+FROM t1
+WHERE t1.col_varchar_key < ALL ( SELECT * FROM v1 )
+;
+pk
+SET SESSION sql_mode=@old_sql_mode;
+drop table t2, t1;
+drop view v1;
+#
+# BUG#50257: Missing info in REF column of the EXPLAIN
+# lines for subselects
+#
+CREATE TABLE t1 (a INT, b INT, INDEX (a));
+INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20);
+EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 SUBQUERY t1 ref a a 5 const 1 Using index
+DROP TABLE t1;
+#
+# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
+# (duplicate of LP bug #888456)
+#
+CREATE TABLE t1 (f1 varchar(1));
+INSERT INTO t1 VALUES ('v'),('s');
+CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key));
+INSERT INTO t2 VALUES ('j'),('v'),('c'),('m'),('d'),
+('d'),('y'),('t'),('d'),('s');
+EXPLAIN
+SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
+WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
+WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY table1 ALL NULL NULL NULL NULL 2
+1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index
+SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
+WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
+WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
+f1 f1_key
+v j
+s j
+v v
+s v
+v c
+s c
+v m
+s m
+v d
+s d
+v d
+s d
+v y
+s y
+v t
+s t
+v d
+s d
+v s
+s s
+DROP TABLE t1,t2;
+#
+# LP bug 919427: EXPLAIN for a query over a single-row table
+# with IN subquery in WHERE condition
+#
+CREATE TABLE ot (
+col_int_nokey int(11),
+col_varchar_nokey varchar(1)
+) ;
+INSERT INTO ot VALUES (1,'x');
+CREATE TABLE it1(
+col_int_key int(11),
+col_varchar_key varchar(1),
+KEY idx_cvk_cik (col_varchar_key,col_int_key)
+);
+INSERT INTO it1 VALUES (NULL,'x'), (NULL,'f');
+CREATE TABLE it2 (
+col_int_key int(11),
+col_varchar_key varchar(1),
+col_varchar_key2 varchar(1),
+KEY idx_cvk_cvk2_cik (col_varchar_key, col_varchar_key2, col_int_key),
+KEY idx_cvk_cik (col_varchar_key, col_int_key)
+);
+INSERT INTO it2 VALUES (NULL,'x','x'), (NULL,'f','f');
+EXPLAIN
+SELECT col_int_nokey FROM ot
+WHERE col_varchar_nokey IN
+(SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY ot system NULL NULL NULL NULL 1
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+2 MATERIALIZED it1 ref idx_cvk_cik idx_cvk_cik 9 const,const 1 Using where; Using index
+SELECT col_int_nokey FROM ot
+WHERE col_varchar_nokey IN
+(SELECT col_varchar_key FROM it1 WHERE col_int_key IS NULL);
+col_int_nokey
+1
+EXPLAIN
+SELECT col_int_nokey FROM ot
+WHERE (col_varchar_nokey, 'x') IN
+(SELECT col_varchar_key, col_varchar_key2 FROM it2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY ot system NULL NULL NULL NULL 1
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1
+2 MATERIALIZED it2 ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 Using where; Using index
+SELECT col_int_nokey FROM ot
+WHERE (col_varchar_nokey, 'x') IN
+(SELECT col_varchar_key, col_varchar_key2 FROM it2);
+col_int_nokey
+1
+DROP TABLE ot,it1,it2;
+#
+# MDEV-746
+# Bug#13651009 WRONG RESULT FROM DERIVED TABLE IF THE SUBQUERY
+# HAS AN EMPTY RESULT
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+pk int NOT NULL AUTO_INCREMENT,
+col_int_nokey int NOT NULL,
+col_int_key int NOT NULL,
+col_time_key time NOT NULL,
+col_varchar_key varchar(1) NOT NULL,
+col_varchar_nokey varchar(1) NOT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_time_key (col_time_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
+SET @var2:=4, @var3:=8;
+
+Testcase without inner subquery
+EXPLAIN SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3;
+@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
+SELECT @var3;
+@var3
+8
+EXPLAIN SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE <derived2> system NULL NULL NULL NULL 0 const row not found
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+SELECT * FROM ( SELECT @var3:=12, sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR
+sq4_alias1.col_varchar_key = @var3 ) AS alias3;
+@var3:=12 pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
+SELECT @var3;
+@var3
+8
+
+Testcase with inner subquery; crashed WL#6095
+SET @var3=8;
+EXPLAIN SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
+SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3));
+pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
+EXPLAIN SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+3 DEPENDENT SUBQUERY c_sq1_alias1 system PRIMARY NULL NULL NULL 1
+SELECT * FROM ( SELECT sq4_alias1.*
+FROM t1 AS sq4_alias1
+WHERE (sq4_alias1.col_varchar_key , sq4_alias1.col_varchar_nokey)
+NOT IN
+(SELECT c_sq1_alias1.col_varchar_key AS c_sq1_field1,
+c_sq1_alias1.col_varchar_nokey AS c_sq1_field2
+FROM t2 AS c_sq1_alias1
+WHERE (c_sq1_alias1.col_int_nokey != @var2
+OR c_sq1_alias1.pk != @var3)) ) AS alias3;
+pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
+DROP TABLE t1,t2;
+End of 5.2 tests
+#
+# BUG#779885: Crash in eliminate_item_equal with materialization=on in
+#
+CREATE TABLE t1 ( f1 int );
+INSERT INTO t1 VALUES (19), (20);
+CREATE TABLE t2 ( f10 varchar(32) );
+INSERT INTO t2 VALUES ('c'),('d');
+CREATE TABLE t3 ( f10 varchar(32) );
+INSERT INTO t3 VALUES ('a'),('b');
+SELECT *
+FROM t1
+WHERE
+( 't' ) IN (
+SELECT t3.f10
+FROM t3
+JOIN t2
+ON t2.f10 = t3.f10
+);
+f1
+DROP TABLE t1,t2,t3;
+#
+# BUG lp:813473: Wrong result with outer join + NOT IN subquery
+# This bug is a duplicate of Bug#11764086 whose test case is added below
+#
+CREATE TABLE t1 (c int) ;
+INSERT INTO t1 VALUES (5),(6);
+CREATE TABLE t2 (a int, b int) ;
+INSERT INTO t2 VALUES (20,9),(20,9);
+create table t3 (d int, e int);
+insert into t3 values (2, 9), (3,10);
+SET @save_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch='outer_join_with_cache=off';
+EXPLAIN
+SELECT t2.b , t1.c
+FROM t2 LEFT JOIN t1 ON t1.c < 3
+WHERE (t2.b , t1.c) NOT IN (SELECT * from t3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
+SELECT t2.b , t1.c
+FROM t2 LEFT JOIN t1 ON t1.c < 3
+WHERE (t2.b, t1.c) NOT IN (SELECT * from t3);
+b c
+9 NULL
+9 NULL
+SET optimizer_switch=@save_optimizer_switch;
+drop table t1, t2, t3;
+#
+# BUG#50257: Missing info in REF column of the EXPLAIN
+# lines for subselects
+#
+CREATE TABLE t1 (a INT, b INT, INDEX (a));
+INSERT INTO t1 VALUES (3, 10), (2, 20), (7, 10), (5, 20);
+
+set @tmp_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='derived_merge=off,derived_with_keys=off';
+EXPLAIN SELECT * FROM (SELECT * FROM t1 WHERE a=7) t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+2 DERIVED t1 ref a a 5 const 1
+set optimizer_switch=@tmp_optimizer_switch;
+
+EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 SUBQUERY t1 ref a a 5 const 1 Using index
+
+DROP TABLE t1;
+#
+# Bug#11764086: Null left operand to NOT IN in WHERE clause
+# behaves differently than real NULL
+#
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+# Offending query (c.parent_id is NULL for null-complemented rows only)
+SELECT p.id, c.parent_id
+FROM parent p
+LEFT JOIN child c
+ON p.id = c.parent_id
+WHERE c.parent_id NOT IN (
+SELECT parent_id
+FROM child
+WHERE parent_id = 3
+);
+id parent_id
+1 1
+2 NULL
+# Some syntactic variations with IS FALSE and IS NOT TRUE
+SELECT p.id, c.parent_id
+FROM parent p
+LEFT JOIN child c
+ON p.id = c.parent_id
+WHERE c.parent_id IN (
+SELECT parent_id
+FROM child
+WHERE parent_id = 3
+) IS NOT TRUE;
+id parent_id
+1 1
+2 NULL
+SELECT p.id, c.parent_id
+FROM parent p
+LEFT JOIN child c
+ON p.id = c.parent_id
+WHERE c.parent_id IN (
+SELECT parent_id
+FROM child
+WHERE parent_id = 3
+) IS FALSE;
+id parent_id
+1 1
+2 NULL
+DROP TABLE parent, child;
+# End of test for bug#11764086.
+#
+# Bug 11765699 - 58690: !TABLE || (!TABLE->READ_SET ||
+# BITMAP_IS_SET(TABLE->READ_SET, FIELD_INDEX
+#
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0), (1);
+CREATE TABLE t2(
+b TEXT,
+c INT,
+PRIMARY KEY (b(1))
+);
+INSERT INTO t2 VALUES ('a', 2), ('b', 3);
+SELECT 1 FROM t1 WHERE a =
+(SELECT 1 FROM t2 WHERE b =
+(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+ORDER BY b
+);
+1
+SELECT 1 FROM t1 WHERE a =
+(SELECT 1 FROM t2 WHERE b =
+(SELECT 1 FROM t1 t11 WHERE c = 1 OR t1.a = 1 AND 1 = 2)
+GROUP BY b
+);
+1
+DROP TABLE t1, t2;
+#
+# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
+#
+CREATE TABLE t1 (f1 varchar(1));
+INSERT INTO t1 VALUES ('v'),('s');
+CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key));
+INSERT INTO t2 VALUES ('j'),('v'),('c'),('m'),('d'),
+('d'),('y'),('t'),('d'),('s');
+SELECT table1.f1, table2.f1_key
+FROM t1 AS table1, t2 AS table2
+WHERE EXISTS
+(
+SELECT DISTINCT f1_key
+FROM t2
+WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
+f1 f1_key
+v j
+s j
+v v
+s v
+v c
+s c
+v m
+s m
+v d
+s d
+v d
+s d
+v y
+s y
+v t
+s t
+v d
+s d
+v s
+s s
+explain SELECT table1.f1, table2.f1_key
+FROM t1 AS table1, t2 AS table2
+WHERE EXISTS
+(
+SELECT DISTINCT f1_key
+FROM t2
+WHERE f1_key != table2.f1_key AND f1_key >= table1.f1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY table1 ALL NULL NULL NULL NULL 2
+1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index
+DROP TABLE t1,t2;
+#
+# lp:826279: assertion failure with GROUP BY a result of subquery
+#
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (0), (0);
+CREATE TABLE t2 (a int, b int, c int);
+INSERT INTO t2 VALUES (10,7,0), (0,7,0);
+CREATE TABLE t3 (a int, b int);
+INSERT INTO t3 VALUES (10,7), (0,7);
+SELECT SUM(DISTINCT b),
+(SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
+WHERE t.a != 0 AND t2.a != 0)
+FROM (SELECT * FROM t3) AS t
+GROUP BY 2;
+SUM(DISTINCT b) (SELECT t2.a FROM t1 JOIN t2 ON t2.c != 0
+WHERE t.a != 0 AND t2.a != 0)
+7 NULL
+SELECT SUM(DISTINCT b),
+(SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
+FROM (SELECT * FROM t3) AS t
+GROUP BY 2;
+SUM(DISTINCT b) (SELECT t2.a FROM t1,t2 WHERE t.a != 0 or 1=2 LIMIT 1)
+7 NULL
+7 10
+DROP TABLE t1,t2,t3;
+#
+# Bug#12329653
+# EXPLAIN, UNION, PREPARED STATEMENT, CRASH, SQL_FULL_GROUP_BY
+#
+CREATE TABLE t1(a1 int);
+INSERT INTO t1 VALUES (1),(2);
+SELECT @@session.sql_mode INTO @old_sql_mode;
+SET SESSION sql_mode='ONLY_FULL_GROUP_BY';
+SELECT 1 FROM t1 WHERE 1 < SOME (SELECT a1 FROM t1);
+1
+1
+1
+PREPARE stmt FROM
+'SELECT 1 UNION ALL
+SELECT 1 FROM t1
+ORDER BY
+(SELECT 1 FROM t1 AS t1_0
+ WHERE 1 < SOME (SELECT a1 FROM t1)
+)' ;
+EXECUTE stmt ;
+ERROR 21000: Subquery returns more than 1 row
+EXECUTE stmt ;
+ERROR 21000: Subquery returns more than 1 row
+SET SESSION sql_mode=@old_sql_mode;
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+#
+# LP BUG#833777 Performance regression with deeply nested subqueries
+#
+create table t1 (a int not null, b char(10) not null);
+insert into t1 values (1, 'a');
+set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
+select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1)))))))))))))))))))))))))))));
+a
+1
+set @@optimizer_switch=@subselect_tmp;
+drop table t1;
+#
+# LP BUG#894397 Wrong result with in_to_exists, constant table , semijoin=OFF,materialization=OFF
+#
+CREATE TABLE t1 (a varchar(3));
+INSERT INTO t1 VALUES ('AAA'),('BBB');
+CREATE TABLE t2 (a varchar(3));
+INSERT INTO t2 VALUES ('CCC');
+set @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
+SELECT * FROM t1 WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.a < 'ZZZ');
+a
+set @@optimizer_switch=@subselect_tmp;
+drop table t1, t2;
+#
+# LP bug #859375: Assertion `0' failed in st_select_lex_unit::optimize
+# with view , UNION and prepared statement (rewriting fake_select
+# condition).
+#
+CREATE TABLE t1 ( f1 int NOT NULL, f4 varchar(1) NOT NULL) ;
+INSERT INTO t1 VALUES (6,'d'),(7,'y');
+CREATE TABLE t2 ( f1 int NOT NULL, f2 int NOT NULL) ;
+INSERT INTO t2 VALUES (10,7);
+CREATE VIEW v2 AS SELECT * FROM t2;
+PREPARE st1 FROM "
+ SELECT *
+ FROM t1
+ LEFT JOIN v2 ON ( v2.f2 = t1.f1 )
+ WHERE v2.f1 NOT IN (
+ SELECT 1 UNION
+ SELECT 247
+ )
+";
+EXECUTE st1;
+f1 f4 f1 f2
+7 y 10 7
+deallocate prepare st1;
+DROP VIEW v2;
+DROP TABLE t1,t2;
+#
+# LP bug #887458 Crash in subselect_union_engine::no_rows with
+# double UNION and join_cache_level=3,8
+# (IN/ALL/ANY optimizations should not be applied to fake_select)
+CREATE TABLE t2 ( a int, b varchar(1)) ;
+INSERT IGNORE INTO t2 VALUES (8,'y'),(8,'y');
+CREATE TABLE t1 ( b varchar(1)) ;
+INSERT IGNORE INTO t1 VALUES (NULL),(NULL);
+set @save_join_cache_level=@@join_cache_level;
+SET SESSION join_cache_level=3;
+SELECT *
+FROM t1, t2
+WHERE t2.b IN (
+SELECT 'm' UNION
+SELECT 'm'
+) OR t1.b <> SOME (
+SELECT 'v' UNION
+SELECT 't'
+);
+b a b
+set @@join_cache_level= @save_join_cache_level;
+drop table t1,t2;
+#
+# LP bug #885162 Got error 124 from storage engine with UNION inside
+# subquery and join_cache_level=3..8
+# (IN/ALL/ANY optimizations should not be applied to fake_select)
+#
+CREATE TABLE t1 (
+f1 varchar(1) DEFAULT NULL
+);
+INSERT INTO t1 VALUES ('c');
+set @save_join_cache_level=@@join_cache_level;
+SET SESSION join_cache_level=8;
+SELECT * FROM t1 WHERE t1.f1 IN ( SELECT 'k' UNION SELECT 'e' );
+f1
+set @@join_cache_level= @save_join_cache_level;
+drop table t1;
+#
+# LP BUG#747278 incorrect values of the NULL (no rows) single
+# row subquery requested via element_index() interface
+#
+CREATE TABLE t1 (f1a int, f1b int) ;
+INSERT IGNORE INTO t1 VALUES (1,1),(2,2);
+CREATE TABLE t2 ( f2 int);
+INSERT IGNORE INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (f3a int default 1, f3b int default 2);
+INSERT INTO t3 VALUES (1,1),(2,2);
+set @old_optimizer_switch = @@session.optimizer_switch;
+set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,subquery_cache=off,semijoin=off';
+SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+NULL
+SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+NULL
+set @@session.optimizer_switch=@old_optimizer_switch;
+SELECT (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1) FROM t2;
+(SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1) FROM t2;
+(SELECT f3a,f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a,f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1) FROM t2;
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
+(SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1)
+NULL
+SELECT (SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1) FROM t2;
+(SELECT f3a FROM t3 where f3a > 3) IN (SELECT f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1) FROM t2;
+(SELECT f3a,f3a FROM t3 where f3a > 3) IN (SELECT f1a,f1a FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1) FROM t2;
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+NULL
+NULL
+SELECT (SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1);
+(SELECT f3a, f3b FROM t3 where f3a > 3) IN (SELECT f1a, f1b FROM t1)
+NULL
+select (null, null) = (null, null);
+(null, null) = (null, null)
+NULL
+SELECT (SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0);
+(SELECT f3a, f3a FROM t3 where f3a > 3) = (0, 0)
+NULL
+drop tables t1,t2,t3;
+#
+# LP BUG#825051 Wrong result with date/datetime and subquery with GROUP BY and in_to_exists
+#
+CREATE TABLE t1 (a date, KEY (a)) ;
+INSERT INTO t1 VALUES ('2009-01-01'),('2009-02-02');
+set @old_optimizer_switch = @@optimizer_switch;
+SET @@optimizer_switch='semijoin=off,materialization=off,in_to_exists=on,subquery_cache=off';
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
+2 DEPENDENT SUBQUERY t1 index_subquery a a 4 func 2 Using index
+SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
+a
+2009-01-01
+2009-02-02
+SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off';
+EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index NULL a 4 NULL 2 Using where; Using index
+2 MATERIALIZED t1 index NULL a 4 NULL 2 Using index
+SELECT * FROM t1 WHERE a IN (SELECT a AS field1 FROM t1 GROUP BY field1);
+a
+2009-01-01
+2009-02-02
+set @@optimizer_switch=@old_optimizer_switch;
+drop table t1;
+#
+# LP BUG#908269 incorrect condition in case of subqueries depending
+# on constant tables
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1),(5);
+CREATE TABLE t2 ( b INT ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+CREATE TABLE t3 ( c INT );
+INSERT INTO t3 VALUES (4),(5);
+SET optimizer_switch='subquery_cache=off';
+SELECT ( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+( SELECT b FROM t2 WHERE b = a OR EXISTS ( SELECT c FROM t3 WHERE c = b ) )
+1
+NULL
+SELECT ( SELECT b FROM t2 WHERE b = a OR b * 0) FROM t1;
+( SELECT b FROM t2 WHERE b = a OR b * 0)
+1
+NULL
+SELECT ( SELECT b FROM t2 WHERE b = a OR rand() * 0) FROM t1;
+( SELECT b FROM t2 WHERE b = a OR rand() * 0)
+1
+NULL
+drop table t1,t2,t3;
+set optimizer_switch=@subselect_tmp;
+#
+# LP BUG#905353 Wrong non-empty result with a constant table,
+# aggregate function in subquery, MyISAM or Aria
+#
+CREATE TABLE t1 ( a INT ) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+SELECT a FROM t1 WHERE ( SELECT MIN(a) = 100 );
+a
+drop table t1;
+#
+# LP BUG#985667 Wrong result with subquery in SELECT clause, and constant table in
+# main query and implicit grouping
+#
+CREATE TABLE t1 (f1 int) engine=MyISAM;
+INSERT INTO t1 VALUES (7),(8);
+CREATE TABLE t2 (f2 int, f3 varchar(1)) engine=MyISAM;
+INSERT INTO t2 VALUES (3,'f');
+EXPLAIN
+SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT COUNT(f1), (SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
+COUNT(f1) f4
+0 NULL
+EXPLAIN
+SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT COUNT(f1), exists(SELECT f1 FROM t1 WHERE f2 > 0 limit 1) AS f4 FROM t2, t1 WHERE 'v'= f3;
+COUNT(f1) f4
+0 0
+EXPLAIN
+SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT COUNT(f1), f2 > ALL (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
+COUNT(f1) f4
+0 1
+EXPLAIN
+SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT COUNT(f1), f2 IN (SELECT f1 FROM t1 WHERE f2 > 0) AS f4 FROM t2, t1 WHERE 'v'= f3;
+COUNT(f1) f4
+0 0
+drop table t1,t2;
+#
+# LP BUG#1002079 Server crashes in Item_singlerow_subselect::val_int with constant table,
+# HAVING, UNION in subquery
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (7),(0);
+CREATE TABLE t2 (b INT);
+EXPLAIN
+SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 system NULL NULL NULL NULL 0 const row not found
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT SUM(a) AS f1, a AS f2 FROM (t1, t2) HAVING f2 >= ALL (SELECT 4 UNION SELECT 5) AND f1 = 7;
+f1 f2
+drop table t1,t2;
+#
+# LP BUG#1008686 Server crashes in subselect_union_engine::no_rows on SELECT with impossible
+# WHERE and UNION in HAVING
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
+3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 0 HAVING a NOT IN ( SELECT 2 UNION SELECT 5 ) OR min_a != 1;
+min_a a
+EXPLAIN
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT MIN(a) AS min_a, a FROM t1 WHERE 1=2 HAVING a NOT IN ( SELECT a from t1 UNION select a+1 from t1 ) OR min_a != 1;
+min_a a
+drop table t1;
+#
+# MDEV-367: Different results with and without subquery_cache on
+# a query with a constant NOT IN condition
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2),(3);
+set @mdev367_optimizer_switch = @@optimizer_switch;
+set optimizer_switch = 'subquery_cache=on';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+set optimizer_switch = 'subquery_cache=off';
+SELECT * FROM t1 WHERE ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) OR a > 100;
+a
+SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1;
+a ( 3, 3 ) NOT IN ( SELECT NULL, NULL )
+1 NULL
+2 NULL
+3 NULL
+set optimizer_switch=@mdev367_optimizer_switch;
+DROP TABLE t1;
+#
+# MDEV-521 single value subselect transformation problem
+#
+CREATE TABLE t1 (f1 char(2), PRIMARY KEY (f1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('u1'),('u2');
+SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
+f1
+u1
+u2
+FLUSH TABLES;
+SELECT a.* FROM t1 a WHERE ( SELECT EXISTS ( SELECT 1 FROM t1 b WHERE b.f1 = a.f1 ) );
+f1
+u1
+u2
+DROP TABLE t1;
+# return optimizer switch changed in the beginning of this test
+set optimizer_switch=@subselect_tmp;
+#
+# lp:944706 Query with impossible or constant subquery in WHERE or HAVING is not
+# precomputed and thus not part of optimization
+#
+CREATE TABLE t1 ( a VARCHAR(16), KEY (a) );
+INSERT INTO t1 VALUES ('Abilene'),('Akron'),('Albany'),('Albuquerque'),('Alexandria'),('Allentown'),
+('Amarillo'),('Anaheim'),('Anchorage'),('Ann Arbor'),('Arden-Arcade');
+EXPLAIN
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a ) AS field
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR alias1.a = 'y'
+HAVING field>'B' AND ( 'Moscow' ) IN ( SELECT a FROM t1 );
+field
+EXPLAIN
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 index a a 19 NULL 11 Using where; Using index
+1 PRIMARY alias2 ref a a 19 test.alias1.a 2 Using index
+1 PRIMARY alias3 index NULL a 19 NULL 11 Using index; Using join buffer (flat, BNL join)
+2 SUBQUERY t1 index_subquery a a 19 const 1 Using index; Using where
+SELECT MAX( alias2.a )
+FROM t1 AS alias1, t1 AS alias2, t1 AS alias3
+WHERE alias1.a = alias2.a OR ('Moscow') IN ( SELECT a FROM t1 );
+MAX( alias2.a )
+Arden-Arcade
+drop table t1;
+#
+# MDEV-277 CHEAP SQ: Server crashes in st_join_table::get_examined_rows
+# with semijoin+materialization, IN and = subqueries
+#
+CREATE TABLE t1 (a1 INT);
+INSERT INTO t1 VALUES (4),(6);
+CREATE TABLE t2 (b1 INT);
+INSERT INTO t2 VALUES (1),(7);
+EXPLAIN
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY <subquery3> eq_ref distinct_key distinct_key 4 func 1
+3 MATERIALIZED t1 ALL NULL NULL NULL NULL 2
+3 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+SELECT * FROM t1
+WHERE a1 = (SELECT COUNT(*) FROM t1 WHERE a1 IN (SELECT a1 FROM t1, t2));
+a1
+drop table t1, t2;
+#
+# MDEV-287 CHEAP SQ: A query with subquery in SELECT list, EXISTS,
+# inner joins takes hundreds times longer
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(7);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (4),(5);
+CREATE TABLE t3 (c INT);
+INSERT INTO t3 VALUES (8),(3);
+set @@expensive_subquery_limit= 0;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 6
+Subquery_cache_miss 2
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 8
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 22
+set @@expensive_subquery_limit= default;
+EXPLAIN
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY alias1 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+1 PRIMARY alias3 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join)
+2 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 SUBQUERY t3 ALL NULL NULL NULL NULL 2
+flush status;
+SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+FROM t2 alias1, t1 alias2, t1 alias3;
+(SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3)))
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+show status like "subquery_cache%";
+Variable_name Value
+Subquery_cache_hit 0
+Subquery_cache_miss 0
+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_deleted 0
+Handler_read_rnd_next 16
+drop table t1, t2, t3;
+#
+# MDEV-288 CHEAP SQ: Valgrind warnings "Memory lost" with IN and EXISTS nested subquery, materialization+semijoin
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0),(8);
+CREATE TABLE t2 (b INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+EXPLAIN
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
+a
+drop table t1,t2;
+#
+# MDEV-410: EXPLAIN shows type=range, while SHOW EXPLAIN and userstat show full table scan is used
+#
+CREATE TABLE t1 (a VARCHAR(3) PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('USA');
+CREATE TABLE t2 (b INT, c VARCHAR(52), KEY(b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3813,'United States'),(3940,'Russia');
+CREATE TABLE t3 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (12),(22),(9),(45);
+create table t4 like t3;
+insert into t4 select * from t3;
+# This should not show range access for table t2
+explain
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY t2 ALL b NULL NULL NULL 2 Using where
+1 PRIMARY t3 ref d d 5 test.t2.b 2 Using where; Using index
+3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+set @tmp_mdev410=@@global.userstat;
+set global userstat=on;
+flush table_statistics;
+flush index_statistics;
+SELECT MIN(b) FROM ( SELECT * FROM t1, t2, t3 WHERE d = b ) AS alias1
+WHERE SLEEP(0.1) OR c < 'p' OR b = ( SELECT MIN(b) FROM t2 );
+MIN(b)
+NULL
+# The following shows that t2 was indeed scanned with a full scan.
+show table_statistics;
+Table_schema Table_name Rows_read Rows_changed Rows_changed_x_#indexes
+test t1 2 0 0
+test t2 3 0 0
+show index_statistics;
+Table_schema Table_name Index_name Rows_read
+test t2 b 1
+set global userstat=@tmp_mdev410;
+DROP TABLE t1,t2,t3,t4;
+#
+# MDEV-430: Server crashes in select_describe on EXPLAIN with
+# materialization+semijoin, 2 nested subqueries, aggregate functions
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
+#
+# MDEV-435: Expensive subqueries may be evaluated during optimization in merge_key_fields
+#
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8),(0);
+CREATE TABLE t2 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'j'),(6,'v');
+CREATE TABLE t3 (d VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('b'),('c');
+EXPLAIN
+SELECT * FROM t1
+WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index
+2 SUBQUERY <subquery3> ALL distinct_key NULL NULL NULL 1
+2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
+3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2
+SELECT * FROM t1
+WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10;
+a
+drop table t1, t2, t3;
+#
+# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
+#
+CREATE TABLE t1 (a INT, KEY(a));
+INSERT INTO t1 VALUES (1),(8);
+CREATE TABLE t2 (b INT, KEY(b));
+INSERT INTO t2 VALUES (45),(17),(20);
+EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t1 index a a 5 NULL 2 Using where; Using index
+2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
+DROP TABLE t1,t2;
+set optimizer_switch=default;
+select @@optimizer_switch like '%exists_to_in=on%';
+@@optimizer_switch like '%exists_to_in=on%'
+0
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 8932acf8ffd..0b339738432 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -372,7 +372,7 @@ SELECT SUM( c )
FROM t2
WHERE (SELECT DISTINCT b FROM t3) > 0);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using where; Using index
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using temporary
SELECT *
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 9bb26e8a6e0..53334dbc32b 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -1896,7 +1896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (`test`.`t1`.`b` = 7) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
SELECT * FROM t1
WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
a b
diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result
index 8c95c8637aa..24640154c59 100644
--- a/mysql-test/r/subselect_mat_cost_bugs.result
+++ b/mysql-test/r/subselect_mat_cost_bugs.result
@@ -100,7 +100,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t2 index c3 c3 9 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join)
Warnings:
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on((2 and (`test`.`t1a`.`c2` = `test`.`t1b`.`pk`))) where ((`test`.`t1`.`pk` <> 0) and (<cache>(`test`.`t1`.`c1`) = `test`.`t1a`.`c1`) and (`test`.`t2`.`c3` = `test`.`t1b`.`c4`)))))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` where <expr_cache><`test`.`t1`.`c1`,`test`.`t1`.`pk`>(<in_optimizer>(`test`.`t1`.`c1`,<exists>(select `test`.`t1a`.`c1` from `test`.`t1b` join `test`.`t2` left join `test`.`t1a` on(((`test`.`t1a`.`c2` = `test`.`t1b`.`pk`) and 2)) where ((`test`.`t1`.`pk` <> 0) and (<cache>(`test`.`t1`.`c1`) = `test`.`t1a`.`c1`) and (`test`.`t2`.`c3` = `test`.`t1b`.`c4`)))))
SELECT pk
FROM t1
WHERE c1 IN
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index ba3b8e791d2..ce9a4ad444f 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -436,7 +436,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -565,10 +565,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1378,7 +1378,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
@@ -1464,7 +1464,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -1507,7 +1507,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -2979,7 +2979,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`two` = `test`.`t1`.`two`) and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`flag` = 'N'))
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N') and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`two` = `test`.`t1`.`two`))
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
@@ -6913,7 +6913,7 @@ INSERT INTO t2 VALUES (1),(2);
EXPLAIN
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 13467916039..e017e67cfe6 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -432,7 +432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -561,10 +561,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1374,7 +1374,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index a75c6dc5966..492321c5d81 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -435,7 +435,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -564,10 +564,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1377,7 +1377,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
@@ -1463,7 +1463,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t3`.`a` = `test`.`t1`.`b`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
drop table t1, t2, t3;
create table t1 (a int, b int, index a (a,b));
create table t2 (a int, index a (a));
@@ -1506,7 +1506,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 index a a 5 NULL 3 100.00 Using where; Using index
1 PRIMARY t1 ref a a 10 test.t2.a,test.t3.a 116 100.00 Using index; FirstMatch(t2)
Warnings:
-Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`a` = `test`.`t2`.`a`) and (`test`.`t1`.`b` = `test`.`t3`.`a`))
+Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1` join `test`.`t3`) where ((`test`.`t1`.`b` = `test`.`t3`.`a`) and (`test`.`t1`.`a` = `test`.`t2`.`a`))
insert into t1 values (3,31);
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
a
@@ -2979,7 +2979,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 func,func 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 9 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`flag` = 'N'))
+Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where (`test`.`t2`.`flag` = 'N')
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 34cdb17e23e..eb92936e85d 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -432,7 +432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -561,10 +561,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1374,7 +1374,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index d9fa9853da5..92c626eca61 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -74,7 +74,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where
1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`))
subqueries within outer joins go into ON expr.
explAin extended
select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10));
@@ -84,7 +84,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))))) where 1
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
explAin extended
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
@@ -93,7 +93,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,`test`.`t2`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t2`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t2`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t1`.`A` = `<suBquery2>`.`pk`))))))) where 1
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
explain select * from
t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
@@ -501,7 +501,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where
1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`) and (`test`.`t1`.`pk` = `test`.`t0`.`pk`))
+Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`))
SELECT vkey FROM t0 WHERE pk IN
(SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey);
vkey
@@ -814,7 +814,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0);
pk
1
@@ -824,7 +824,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0);
pk
2
@@ -833,7 +833,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0);
pk
1
@@ -843,7 +843,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0);
pk
1
@@ -853,7 +853,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0);
pk
1
@@ -863,7 +863,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0);
pk
1
@@ -873,7 +873,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0);
pk
1
@@ -883,7 +883,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0);
pk
1
@@ -893,7 +893,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0);
pk
1
@@ -1994,7 +1994,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t1`.`f2` = `test`.`t2`.`f2`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t4`.`f2` = `test`.`t2`.`f3`))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t4`.`f2` = `test`.`t2`.`f3`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`))
SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4);
f1 f2 f3 f3
2 0 0 0
@@ -2783,6 +2783,16 @@ a b
deallocate prepare stmt;
drop table t1,t2;
#
+# MDEV-4335: Unexpected results when selecting on information_schema
+#
+CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
+INSERT INTO t1 VALUES ('mysql'),('information_schema');
+SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
+db
+mysql
+information_schema
+DROP TABLE t1;
+#
# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
#
CREATE TABLE t1 (
diff --git a/mysql-test/r/subselect_sj2.result b/mysql-test/r/subselect_sj2.result
index 97e36cd705c..c4b9933ae07 100644
--- a/mysql-test/r/subselect_sj2.result
+++ b/mysql-test/r/subselect_sj2.result
@@ -456,7 +456,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2)
Warnings:
Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t1`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`))
+Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`))
update t1 set a=3, b=11 where a=4;
update t2 set b=11 where a=3;
select * from t0 where t0.a in
diff --git a/mysql-test/r/subselect_sj2_jcl6.result b/mysql-test/r/subselect_sj2_jcl6.result
index e4030b8138b..d9b9815133c 100644
--- a/mysql-test/r/subselect_sj2_jcl6.result
+++ b/mysql-test/r/subselect_sj2_jcl6.result
@@ -468,7 +468,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
Warnings:
Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t1`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`))
+Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`))
update t1 set a=3, b=11 where a=4;
update t2 set b=11 where a=3;
# Not anymore:
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index f69befc8608..c91ee67a717 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -458,7 +458,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ref a a 5 test.t0.a 1 100.00 Using where; FirstMatch(t2)
Warnings:
Note 1276 Field or reference 'test.t0.a' of SELECT #2 was resolved in SELECT #1
-Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t1`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`))
+Note 1003 select `test`.`t0`.`a` AS `a` from `test`.`t2` semi join (`test`.`t1`) join `test`.`t0` where ((`test`.`t2`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`a` = `test`.`t0`.`a`) and (`test`.`t1`.`b` = `test`.`t2`.`b`))
update t1 set a=3, b=11 where a=4;
update t2 set b=11 where a=3;
select * from t0 where t0.a in
@@ -1124,3 +1124,267 @@ AND ( 6 ) IN
ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
DROP TABLE t1, t2;
set max_join_size= @tmp_906385;
+#
+# mdev-3995: Wrong result for semijoin with materialization
+#
+set @save_optimizer_switch=@@optimizer_switch;
+CREATE TABLE t1 (
+cat_id int(10) unsigned NOT NULL,
+PRIMARY KEY (cat_id)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+(709411),(709412),(709413),(709414),(709416),(709417),(709418),(709419),(709421),(709422),
+(709424),(709425),(709427),(709428),(709429),(709431),(709432),(709433),(709434),(709435),
+(709438),(709439),(709441),(709442),(709443),(709444),(709445),(709446),(709447),(709450),
+(709451),(709454),(709455),(709456),(709457),(709459),(709460),(709461),(709462),(709463),
+(709464),(709465),(709467),(709469),(709470),(709471),(709472),(709473),(709474),(709475),
+(709476),(709477),(709478),(709479),(709480),(709481),(709483),(709484),(709485),(709487),
+(709490),(709491),(709492),(709493),(709494),(709495),(709496),(709497),(709498),(709499),
+(709500),(709501),(709502),(709503),(709504),(709505),(709506),(709507),(709509),(709510),
+(709511),(709512),(709513),(709514),(709515),(709516),(709517),(709518),(709519),(709520),
+(709521),(709522),(709523),(709524),(709525),(709526),(709527),(709528),(709529),(709530),
+(709531),(709532),(709533),(709534),(709535),(709536),(709537),(709538),(709539),(709540),
+(709541),(709542),(709543),(709544),(709545),(709546),(709548),(709549),(709551),(709552),
+(709553),(709555),(709556),(709557),(709558),(709559),(709560),(709561),(709562),(709563),
+(709564),(709565),(709566),(709567),(709568),(709569),(709570),(709571),(709572),(709573),
+(709574),(709575),(709576),(709577),(709578),(709579),(709580),(709581),(709582),(709583),
+(709584),(709585),(709586),(709587),(709588),(709590),(709591),(709592),(709593),(709594),
+(709595),(709596),(709597),(709598),(709600),(709601),(709602),(709603),(709604),(709605),
+(709606),(709608),(709609),(709610),(709611),(709612),(709613),(709614),(709615),(709616),
+(709617),(709618),(709619),(709620),(709621),(709622),(709623),(709624),(709625),(709626),
+(709627),(709628),(709629),(709630),(709631),(709632),(709633),(709634),(709635),(709637),
+(709638),(709639),(709640),(709641),(709642),(709643),(709644),(709645),(709646),(709649),
+(709650),(709651),(709652),(709653),(709654),(709655),(709656),(709657),(709658),(709659);
+CREATE TABLE t2 (
+cat_id int(10) NOT NULL,
+KEY cat_id (cat_id)
+) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+(708742),(708755),(708759),(708761),(708766),(708769),(708796),(708798),(708824),(708825),
+(708838),(708844),(708861),(708882),(708887),(708889),(708890),(709586),(709626);
+CREATE TABLE t3 (
+sack_id int(10) unsigned NOT NULL,
+kit_id tinyint(3) unsigned NOT NULL DEFAULT '0',
+cat_id int(10) unsigned NOT NULL,
+PRIMARY KEY (sack_id,kit_id,cat_id)
+) ENGINE=MyISAM;
+INSERT INTO t3 VALUES
+(33479,6,708523),(33479,6,708632),(33479,6,709085),(33479,6,709586),(33479,6,709626);
+CREATE TABLE t4 (
+cat_id int(10) unsigned NOT NULL,
+KEY cat_id (cat_id)
+) ENGINE=MyISAM;
+INSERT INTO t4 (cat_id) SELECT cat_id from t2;
+set optimizer_switch='materialization=off';
+EXPLAIN
+SELECT count(*) FROM t1, t3
+WHERE t1.cat_id = t3.cat_id AND
+t3.cat_id IN (SELECT cat_id FROM t2) AND
+t3.sack_id = 33479 AND t3.kit_id = 6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 4 Using index
+1 PRIMARY t2 ref cat_id cat_id 4 test.t3.cat_id 2 Using where; Using index; FirstMatch(t3)
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.cat_id 1 Using where; Using index
+SELECT count(*) FROM t1, t3
+WHERE t1.cat_id = t3.cat_id AND
+t3.cat_id IN (SELECT cat_id FROM t2) AND
+t3.sack_id = 33479 AND t3.kit_id = 6;
+count(*)
+2
+set optimizer_switch='materialization=on';
+EXPLAIN
+SELECT count(*) FROM t1, t3
+WHERE t1.cat_id = t3.cat_id AND
+t3.cat_id IN (SELECT cat_id FROM t4) AND
+t3.sack_id = 33479 AND t3.kit_id = 6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 4 Using index
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index
+2 MATERIALIZED t4 index cat_id cat_id 4 NULL 19 Using index
+SELECT count(*) FROM t1, t3
+WHERE t1.cat_id = t3.cat_id AND
+t3.cat_id IN (SELECT cat_id FROM t4) AND
+t3.sack_id = 33479 AND t3.kit_id = 6;
+count(*)
+2
+EXPLAIN
+SELECT count(*) FROM t1, t3
+WHERE t1.cat_id = t3.cat_id AND
+t3.cat_id IN (SELECT cat_id FROM t2) AND
+t3.sack_id = 33479 AND t3.kit_id = 6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ref PRIMARY PRIMARY 5 const,const 4 Using index
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where
+1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 Using index
+2 MATERIALIZED t2 index cat_id cat_id 4 NULL 19 Using index
+SELECT count(*) FROM t1, t3
+WHERE t1.cat_id = t3.cat_id AND
+t3.cat_id IN (SELECT cat_id FROM t2) AND
+t3.sack_id = 33479 AND t3.kit_id = 6;
+count(*)
+2
+DROP TABLE t1,t2,t3,t4;
+set optimizer_switch=@save_optimizer_switch;
+#
+# mdev-3913: LEFT JOIN with materialized multi-table IN subquery in WHERE
+#
+set @save_optimizer_switch=@@optimizer_switch;
+CREATE TABLE t1 (a1 char(1), b1 char(1), index idx(b1,a1));
+INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y');
+INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y');
+CREATE TABLE t2 (a2 char(1), b2 char(1));
+INSERT INTO t2 VALUES ('y','y'),('y','y'),('w','w');
+CREATE TABLE t3 (a3 int);
+INSERT INTO t3 VALUES (8),(6);
+CREATE TABLE t4 (a4 char(1), b4 char(1));
+INSERT INTO t4 VALUES ('y','y'),('y','y'),('w','w');
+set optimizer_switch='materialization=off';
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Start temporary
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index; End temporary
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on((`test`.`t2`.`a2` = `test`.`t4`.`a4`)) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`))
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+a1 b1 a2 b2
+g y y y
+g y y y
+g y y y
+g y y y
+set optimizer_switch='materialization=on';
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 100.00
+1 PRIMARY t1 ref idx idx 2 test.t4.a4 1 100.00 Using index
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00
+2 MATERIALIZED t4 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t1`.`b1` = `test`.`t4`.`a4`) and (`test`.`t2`.`a2` = `test`.`t4`.`a4`))) where ((`test`.`t4`.`b4` = `test`.`t4`.`a4`) and (`test`.`t1`.`b1` = `test`.`t4`.`a4`))
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+a1 b1 a2 b2
+g y y y
+g y y y
+g y y y
+g y y y
+DROP TABLE t1,t2,t3,t4;
+set optimizer_switch=@save_optimizer_switch;
+#
+# mdev-4172: LEFT JOIN with materialized multi-table IN subquery in WHERE
+# and OR in ON condition
+#
+set @save_optimizer_switch=@@optimizer_switch;
+CREATE TABLE t1 (a1 int, c1 varchar(1));
+INSERT t1 VALUES (7,'v'), (3,'y');
+CREATE TABLE t2 (c2 varchar(1));
+INSERT INTO t2 VALUES ('y'), ('y');
+CREATE TABLE t3 (c3 varchar(1));
+INSERT INTO t3 VALUES
+('j'), ('v'), ('c'), ('m'), ('d'),
+('d'), ('y'), ('t'), ('d'), ('s');
+CREATE TABLE t4 (a4 int, c4 varchar(1));
+INSERT INTO t4 SELECT * FROM t1;
+set optimizer_switch='materialization=off';
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; Using join buffer (flat, BNL join)
+1 PRIMARY t3 ALL NULL NULL NULL NULL 10 100.00 Using where; End temporary; Using join buffer (flat, BNL join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where ((`test`.`t4`.`c4` = `test`.`t1`.`c1`) and (`test`.`t3`.`c3` = `test`.`t1`.`c1`))
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+a1 c1 c2
+3 y y
+3 y y
+7 v NULL
+set optimizer_switch='materialization=on';
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+2 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00
+2 MATERIALIZED t3 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t4`) left join `test`.`t2` on(((`test`.`t2`.`c2` = `test`.`t1`.`c1`) or (`test`.`t1`.`c1` > 'z'))) where (`test`.`t3`.`c3` = `test`.`t4`.`c4`)
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+a1 c1 c2
+3 y y
+3 y y
+7 v NULL
+DROP TABLE t1,t2,t3,t4;
+set optimizer_switch=@save_optimizer_switch;
+#
+# mdev-4177: materialization of a subquery whose WHERE condition is OR
+# formula with two disjucts such that the second one is always false
+#
+set @save_optimizer_switch=@@optimizer_switch;
+set @save_join_cache_level=@@join_cache_level;
+CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (7), (4), (8), (4);
+CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7), (5);
+CREATE TABLE t3 (i3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (7), (2), (9);
+set join_cache_level=3;
+set optimizer_switch='materialization=off,semijoin=off';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 5 100.00 Using where
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00
+2 DEPENDENT SUBQUERY t3 hash_ALL NULL #hash#$hj 5 func 3 100.00 Using where; Using join buffer (flat, BNLH join)
+Warnings:
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` where <expr_cache><`test`.`t1`.`i1`>(<in_optimizer>(`test`.`t1`.`i1`,<exists>(select `test`.`t3`.`i3` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (<cache>(`test`.`t1`.`i1`) = `test`.`t3`.`i3`)))))
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+i1
+7
+set optimizer_switch='materialization=on,semijoin=on';
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 100.00
+1 PRIMARY t1 hash_ALL NULL #hash#$hj 5 test.t2.i2 5 100.00 Using where; Using join buffer (flat, BNLH join)
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
+Warnings:
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`))
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+i1
+7
+EXPLAIN EXTENDED
+SELECT * FROM t1
+WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3 100.00
+1 PRIMARY t1 hash_ALL NULL #hash#$hj 5 test.t2.i2 5 100.00 Using where; Using join buffer (flat, BNLH join)
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
+Warnings:
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t3`.`i3` > 0))
+SELECT * FROM t1
+WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
+i1
+7
+SELECT * FROM t1
+WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 7 AND i3 = i2 OR 1=2);
+i1
+DROP TABLE t1,t2,t3;
+set join_cache_level= @save_join_cache_level;
+set optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index 1ca8b44a0b8..04a54c9a371 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -87,7 +87,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t10 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY t12 eq_ref PRIMARY PRIMARY 4 test.t10.a 1 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t10`.`pk` = `test`.`t1`.`a`) and (`test`.`t12`.`pk` = `test`.`t10`.`a`))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t10` join `test`.`t12` join `test`.`t1` where ((`test`.`t12`.`pk` = `test`.`t10`.`a`) and (`test`.`t10`.`pk` = `test`.`t1`.`a`))
subqueries within outer joins go into ON expr.
explAin extended
select * from t1 left join (t2 A, t2 B) on ( A.A= t1.A And B.A in (select pk from t10));
@@ -97,7 +97,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY B ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (incrementAl, BNL join)
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on((<in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`A`.`A` = `test`.`t1`.`A`))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`A`.`A` AS `A`,`test`.`A`.`B` AS `B`,`test`.`B`.`A` AS `A`,`test`.`B`.`B` AS `B` from `test`.`t1` left join (`test`.`t2` `A` join `test`.`t2` `B`) on(((`test`.`A`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`B`.`A`,`test`.`B`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`B`.`A` in <temporAry tABle> on distinct_key where ((`test`.`B`.`A` = `<suBquery2>`.`pk`))))))) where 1
t2 should be wrapped into OJ-nest, so we have "t1 LJ (t2 J t10)"
explAin extended
select * from t1 left join t2 on (t2.A= t1.A And t2.A in (select pk from t10));
@@ -106,7 +106,7 @@ id select_type tABle type possiBle_keys key key_len ref rows filtered ExtrA
1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join Buffer (flAt, BNL join)
2 MATERIALIZED t10 index PRIMARY PRIMARY 4 NULL 10 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on((<in_optimizer>(`test`.`t2`.`A`,`test`.`t2`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t2`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t2`.`A` = `<suBquery2>`.`pk`))))) And (`test`.`t2`.`A` = `test`.`t1`.`A`))) where 1
+Note 1003 select `test`.`t1`.`A` AS `A`,`test`.`t1`.`B` AS `B`,`test`.`t2`.`A` AS `A`,`test`.`t2`.`B` AS `B` from `test`.`t1` left join `test`.`t2` on(((`test`.`t2`.`A` = `test`.`t1`.`A`) And <in_optimizer>(`test`.`t1`.`A`,`test`.`t1`.`A` in ( <mAteriAlize> (select `test`.`t10`.`pk` from `test`.`t10` ), <primAry_index_lookup>(`test`.`t1`.`A` in <temporAry tABle> on distinct_key where ((`test`.`t1`.`A` = `<suBquery2>`.`pk`))))))) where 1
we shouldn't flatten if we're going to get a join of > MAX_TABLES.
explain select * from
t1 s00, t1 s01, t1 s02, t1 s03, t1 s04,t1 s05,t1 s06,t1 s07,t1 s08,t1 s09,
@@ -514,7 +514,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t0.pk 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
1 PRIMARY t2 ref vkey vkey 4 test.t1.vnokey 2 100.00 Using index; FirstMatch(t1)
Warnings:
-Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`) and (`test`.`t1`.`pk` = `test`.`t0`.`pk`))
+Note 1003 select `test`.`t0`.`vkey` AS `vkey` from `test`.`t0` `t1` semi join (`test`.`t0` `t2`) join `test`.`t0` where ((`test`.`t1`.`pk` = `test`.`t0`.`pk`) and (`test`.`t2`.`vkey` = `test`.`t1`.`vnokey`))
SELECT vkey FROM t0 WHERE pk IN
(SELECT t1.pk FROM t0 t1 JOIN t0 t2 ON t2.vkey = t1.vnokey);
vkey
@@ -827,7 +827,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`c` = `test`.`t1`.`c`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, c) IN (SELECT b, c FROM t2 WHERE pk > 0);
pk
1
@@ -837,7 +837,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`d` = `test`.`t1`.`d`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, d) IN (SELECT b, d FROM t2 WHERE pk > 0);
pk
2
@@ -846,7 +846,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`e` = `test`.`t1`.`e`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, e) IN (SELECT b, e FROM t2 WHERE pk > 0);
pk
1
@@ -856,7 +856,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`f` = `test`.`t1`.`f`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, f) IN (SELECT b, f FROM t2 WHERE pk > 0);
pk
1
@@ -866,7 +866,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`g` = `test`.`t1`.`g`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, g) IN (SELECT b, g FROM t2 WHERE pk > 0);
pk
1
@@ -876,7 +876,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`h` = `test`.`t1`.`h`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, h) IN (SELECT b, h FROM t2 WHERE pk > 0);
pk
1
@@ -886,7 +886,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`i` = `test`.`t1`.`i`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0);
pk
1
@@ -896,7 +896,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`j` = `test`.`t1`.`j`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, j) IN (SELECT b, j FROM t2 WHERE pk > 0);
pk
1
@@ -906,7 +906,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan; FirstMatch(t1); Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`pk` > 0))
+Note 1003 select `test`.`t1`.`pk` AS `pk` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`b` = `test`.`t1`.`b`) and (`test`.`t2`.`k` = `test`.`t1`.`k`) and (`test`.`t2`.`pk` > 0))
SELECT pk FROM t1 WHERE (b, k) IN (SELECT b, k FROM t2 WHERE pk > 0);
pk
1
@@ -2008,7 +2008,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (incremental, BNL join)
2 MATERIALIZED t4 index f2 f2 5 NULL 2 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t1`.`f2` = `test`.`t2`.`f2`) and (`test`.`t3`.`f1` = `test`.`t1`.`f1`))
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2`,`test`.`t2`.`f3` AS `f3`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` semi join (`test`.`t4`) join `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`f1` = `test`.`t1`.`f1`) and (`test`.`t1`.`f2` = `test`.`t2`.`f2`))
SELECT * FROM t1 NATURAL LEFT JOIN (t2, t3) WHERE t2.f3 IN (SELECT * FROM t4);
f1 f2 f3 f3
2 0 0 0
@@ -2797,6 +2797,16 @@ a b
deallocate prepare stmt;
drop table t1,t2;
#
+# MDEV-4335: Unexpected results when selecting on information_schema
+#
+CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
+INSERT INTO t1 VALUES ('mysql'),('information_schema');
+SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
+db
+information_schema
+mysql
+DROP TABLE t1;
+#
# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
#
CREATE TABLE t1 (
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index 20fee7fb7f8..717d6832415 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -86,7 +86,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,min(`test`.`t2`.`b2`) from `test`.`t2` where (`test`.`t2`.`b1` > '0') group by `test`.`t2`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`))
select * from t1 where (a1, a2) in (select b1, min(b2) from t2 where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -120,7 +120,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2i index it2i1,it2i2,it2i3 it2i3 # NULL 5 50.00 Using where; Using index; LooseScan
1 PRIMARY t1i ref _it1_idx _it1_idx # _ref_ 1 100.00
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0'))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0'))
select * from t1i where (a1, a2) in (select b1, b2 from t2i where b1 > '0');
a1 a2
1 - 01 2 - 01
@@ -132,7 +132,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`max(b2)` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`max(b2)` = `test`.`t1i`.`a2`))
select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -144,7 +144,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 #
2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`min(b2)` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1i`.`a2`))
select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -156,7 +156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2i range NULL it2i3 9 NULL 3 100.00 Using index for group-by
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`max(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`max(b2)` = `test`.`t1`.`a2`))
select * from t1 where (a1, a2) in (select b1, max(b2) from t2i group by b1);
a1 a2
1 - 01 2 - 01
@@ -188,7 +188,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where (`test`.`t2i`.`b1` > '0') group by `test`.`t2i`.`b1`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`min(b2)` = `test`.`t1`.`a2`))
select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1);
a1 a2
1 - 01 2 - 01
@@ -236,7 +236,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`<subquery2>`.`b2` = `test`.`t1`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1`.`a1`))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` order by `test`.`t2`.`b1`,`test`.`t2`.`b2`) join `test`.`t1` where ((`<subquery2>`.`b1` = `test`.`t1`.`a1`) and (`<subquery2>`.`b2` = `test`.`t1`.`a2`))
select * from t1 where (a1, a2) in (select b1, b2 from t2 order by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -248,7 +248,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1i.a1,test.t1i.a2 1 100.00
2 MATERIALIZED t2i index NULL it2i3 18 NULL 5 100.00 Using index
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`<subquery2>`.`b2` = `test`.`t1i`.`a2`) and (`<subquery2>`.`b1` = `test`.`t1i`.`a1`))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (select `test`.`t2i`.`b1`,`test`.`t2i`.`b2` from `test`.`t2i` order by `test`.`t2i`.`b1`,`test`.`t2i`.`b2`) join `test`.`t1i` where ((`<subquery2>`.`b1` = `test`.`t1i`.`a1`) and (`<subquery2>`.`b2` = `test`.`t1i`.`a2`))
select * from t1i where (a1, a2) in (select b1, b2 from t2i order by b1, b2);
a1 a2
1 - 01 2 - 01
@@ -305,7 +305,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2`.`b1` > '0') and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2`.`b1` > '0') and (`test`.`t3`.`c2` > '0'))
select * from t1
where (a1, a2) in (select b1, b2 from t2 where b1 > '0') and
(a1, a2) in (select c1, c2 from t3
@@ -324,7 +324,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3i ref it3i1,it3i2,it3i3 # # # 1 100.00 #
1 PRIMARY t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 #
Warnings:
-Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0'))
+Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0'))
select * from t1i
where (a1, a2) in (select b1, b2 from t2i where b1 > '0') and
(a1, a2) in (select c1, c2 from t3i
@@ -349,7 +349,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))
select * from t1
where (a1, a2) in (select b1, b2 from t2
where b2 in (select c2 from t3 where c2 LIKE '%02') or
@@ -375,7 +375,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where
Warnings:
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3c`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t3c`.`c1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t3c`.`c2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3c`.`c2` > '0'))
select * from t1
where (a1, a2) in (select b1, b2 from t2
where b2 in (select c2 from t3 t3a where c1 = a1) or
@@ -413,7 +413,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
7 UNION t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 #
NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL #
Warnings:
-Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')))
+Note 1003 (select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%02') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery3>`.`c2`)))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3`.`c2` from `test`.`t3` where (`test`.`t3`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))) and (`test`.`t3`.`c2` > '0'))) union (select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where ((`test`.`t1i`.`a1` = `test`.`t2i`.`b1`) and (`test`.`t3i`.`c1` = `test`.`t2i`.`b1`) and (`test`.`t2i`.`b1` = `test`.`t2i`.`b1`) and (`test`.`t1i`.`a2` = `test`.`t2i`.`b2`) and (`test`.`t3i`.`c2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b2` = `test`.`t2i`.`b2`) and (`test`.`t2i`.`b1` > '0') and (`test`.`t2i`.`b2` > '0')))
(select * from t1
where (a1, a2) in (select b1, b2 from t2
where b2 in (select c2 from t3 where c2 LIKE '%02') or
@@ -443,7 +443,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) where ((`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0'))
select * from t1
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
(a1, a2) in (select c1, c2 from t3
@@ -467,7 +467,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where ((`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and (`test`.`t3`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0'))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2i`.`b2` = `test`.`t3`.`c2`) and <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),<exists>(select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where ((`test`.`t1`.`a1` > '0') and (<cache>(`test`.`t1`.`a1`) = `test`.`t1`.`a1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t1`.`a2`)) union select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where ((`test`.`t2`.`b1` < '9') and (<cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`) and (<cache>(`test`.`t1`.`a2`) = `test`.`t2`.`b2`))))) and (`test`.`t3`.`c2` > '0'))
select * from t1, t3
where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and
(c1, c2) in (select c1, c2 from t3
@@ -513,7 +513,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1276 Field or reference 'test.t1.a1' of SELECT #3 was resolved in SELECT #1
Note 1276 Field or reference 'test.t1.a2' of SELECT #6 was resolved in SELECT #1
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3` `t3c`) where ((`test`.`t2i`.`b1` = `test`.`t1`.`a1`) and (`test`.`t3c`.`c1` = `test`.`t1`.`a1`) and (`test`.`t2`.`b1` = `test`.`t1`.`a1`) and (`test`.`t2i`.`b2` = `test`.`t1`.`a2`) and (`test`.`t3c`.`c2` = `test`.`t1`.`a2`) and (`test`.`t2`.`b2` = `test`.`t1`.`a2`) and (<expr_cache><`test`.`t2`.`b2`,`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t2`.`b2`,<exists>(select `test`.`t3a`.`c2` from `test`.`t3` `t3a` where ((`test`.`t3a`.`c1` = `test`.`t1`.`a1`) and (<cache>(`test`.`t2`.`b2`) = `test`.`t3a`.`c2`))))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (select `test`.`t3b`.`c2` from `test`.`t3` `t3b` where (`test`.`t3b`.`c2` like '%03') ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where ((`test`.`t2`.`b2` = `<subquery4>`.`c2`))))))))
explain extended
select * from t1 where (a1, a2) in (select '1 - 01', '2 - 01');
id select_type table type possible_keys key key_len ref rows filtered Extra
@@ -633,7 +633,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_16 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_16 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t1_16`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_16`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_16`.`a2`,7) AS `left(a2,7)` from `test`.`t1_16` semi join (`test`.`t2_16`) where ((`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t1_16`.`a1` > '0'))
select left(a1,7), left(a2,7)
from t1_16
where (a1,a2) in (select b1, b2 from t2_16 where b1 > '0');
@@ -700,7 +700,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where ((`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6)) and (`test`.`t3`.`c2` > '0') and (concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8)))
+Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t3` join `test`.`t2_16` join `test`.`t2` join `test`.`t1_16`) where ((`test`.`t2`.`b1` = `test`.`t3`.`c1`) and (`test`.`t2_16`.`b1` = `test`.`t1_16`.`a1`) and (`test`.`t2_16`.`b2` = `test`.`t1_16`.`a2`) and (`test`.`t2`.`b2` = substr(`test`.`t1_16`.`a2`,1,6)) and (`test`.`t3`.`c2` > '0') and (concat(`test`.`t1`.`a1`,'x') = left(`test`.`t1_16`.`a1`,8)))
drop table t1_16, t2_16, t3_16;
set @blob_len = 512;
set @suffix_len = @blob_len - @prefix_len;
@@ -748,7 +748,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_512 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_512 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b2` = `test`.`t1_512`.`a2`) and (`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t1_512`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_512`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_512`.`a2`,7) AS `left(a2,7)` from `test`.`t1_512` semi join (`test`.`t2_512`) where ((`test`.`t2_512`.`b1` = `test`.`t1_512`.`a1`) and (`test`.`t2_512`.`b2` = `test`.`t1_512`.`a2`) and (`test`.`t1_512`.`a1` > '0'))
select left(a1,7), left(a2,7)
from t1_512
where (a1,a2) in (select b1, b2 from t2_512 where b1 > '0');
@@ -844,7 +844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1024 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_1024 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2`) and (`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t1_1024`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_1024`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1024`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1024` semi join (`test`.`t2_1024`) where ((`test`.`t2_1024`.`b1` = `test`.`t1_1024`.`a1`) and (`test`.`t2_1024`.`b2` = `test`.`t1_1024`.`a2`) and (`test`.`t1_1024`.`a1` > '0'))
select left(a1,7), left(a2,7)
from t1_1024
where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0');
@@ -939,7 +939,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1_1025 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t2_1025 ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2`) and (`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t1_1025`.`a1` > '0'))
+Note 1003 select left(`test`.`t1_1025`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1_1025`.`a2`,7) AS `left(a2,7)` from `test`.`t1_1025` semi join (`test`.`t2_1025`) where ((`test`.`t2_1025`.`b1` = `test`.`t1_1025`.`a1`) and (`test`.`t2_1025`.`b2` = `test`.`t1_1025`.`a2`) and (`test`.`t1_1025`.`a1` > '0'))
select left(a1,7), left(a2,7)
from t1_1025
where (a1,a2) in (select b1, b2 from t2_1025 where b1 > '0');
@@ -1027,7 +1027,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1bb ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t2bb ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
Warnings:
-Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where ((`test`.`t2bb`.`b2` = `test`.`t1bb`.`a2`) and (`test`.`t2bb`.`b1` = `test`.`t1bb`.`a1`))
+Note 1003 select conv(`test`.`t1bb`.`a1`,10,2) AS `bin(a1)`,`test`.`t1bb`.`a2` AS `a2` from `test`.`t1bb` semi join (`test`.`t2bb`) where ((`test`.`t2bb`.`b1` = `test`.`t1bb`.`a1`) and (`test`.`t2bb`.`b2` = `test`.`t1bb`.`a2`))
select bin(a1), a2
from t1bb
where (a1, a2) in (select b1, b2 from t2bb);
@@ -1934,7 +1934,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
Warnings:
-Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (`test`.`t1`.`b` = 7) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
+Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from <materialize> (select max(`test`.`t2`.`c`) from `test`.`t2`) join `test`.`t1` where ((`test`.`t1`.`b` = 7) and (`test`.`t1`.`a` = `<subquery2>`.`MAX(c)`) and (<cache>(isnull(`<subquery2>`.`MAX(c)`)) or (`<subquery2>`.`MAX(c)` = 7)))
SELECT * FROM t1
WHERE a IN (SELECT MAX(c) FROM t2) AND b=7 AND (a IS NULL OR a=b);
a b
diff --git a/mysql-test/r/sum_distinct-big.result b/mysql-test/r/sum_distinct-big.result
index d4933b31f80..2d350826ac8 100644
--- a/mysql-test/r/sum_distinct-big.result
+++ b/mysql-test/r/sum_distinct-big.result
@@ -1,4 +1,8 @@
DROP TABLE IF EXISTS t1, t2;
+set @save_tmp_table_size=@@tmp_table_size;
+set @save_max_heap_table_size=@@max_heap_table_size;
+set @save_storage_engine=@@storage_engine;
+set storage_engine=MYISAM;
CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER);
INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
@@ -120,3 +124,57 @@ sm
536887296
DROP TABLE t1;
DROP TABLE t2;
+SET @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=@save_max_heap_table_size;
+#
+# Bug mdev-4311: COUNT(DISTINCT...) requiring a file for Unique
+# (bug #68749)
+#
+set @save_storage_engine=@@storage_engine;
+set storage_engine=INNODB;
+CREATE TABLE t1 (id INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (id INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 SELECT id+1 FROM t1;
+INSERT INTO t1 SELECT id+2 FROM t1;
+INSERT INTO t1 SELECT id+4 FROM t1;
+INSERT INTO t1 SELECT id+8 FROM t1;
+INSERT INTO t1 SELECT id+16 FROM t1;
+INSERT INTO t1 SELECT id+32 FROM t1;
+INSERT INTO t1 SELECT id+64 FROM t1;
+INSERT INTO t1 SELECT id+128 FROM t1;
+INSERT INTO t1 SELECT id+256 FROM t1;
+INSERT INTO t1 SELECT id+512 FROM t1;
+INSERT INTO t1 SELECT id+1024 FROM t1;
+INSERT INTO t1 SELECT id+2048 FROM t1;
+INSERT INTO t1 SELECT id+4096 FROM t1;
+INSERT INTO t1 SELECT id+8192 FROM t1;
+INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t2 VALUE(NULL);
+# With default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+set @@tmp_table_size=1024*256;
+# With reduced tmp_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+set @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=1024*256;
+# With reduced max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+SET @@max_heap_table_size=@save_max_heap_table_size;
+# Back to default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+DROP TABLE t1,t2;
+set storage_engine=@save_storage_engine;
diff --git a/mysql-test/r/temporal_scale_4283.result b/mysql-test/r/temporal_scale_4283.result
new file mode 100644
index 00000000000..685a6192a97
--- /dev/null
+++ b/mysql-test/r/temporal_scale_4283.result
@@ -0,0 +1,12 @@
+create table t1 (a int);
+insert into t1 values (4),(8);
+select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1;
+100 mod timestampadd( week, a, '2002-05-20' )
+100
+drop table t1;
+create table t1 (i int);
+insert into t1 values (2),(4);
+select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1;
+convert_tz( '2001-03-21', 'utc', 'met' ) mod i
+0
+drop table t1;
diff --git a/mysql-test/r/truncate_badse.result b/mysql-test/r/truncate_badse.result
new file mode 100644
index 00000000000..16f44f180ed
--- /dev/null
+++ b/mysql-test/r/truncate_badse.result
@@ -0,0 +1,13 @@
+install plugin example soname 'ha_example';
+create table t1 (a int) engine=example;
+select 1;
+1
+1
+uninstall plugin example;
+flush tables;
+select count(*) from information_schema.plugins where plugin_name='example';
+count(*)
+0
+truncate table t1;
+ERROR 42000: Unknown storage engine 'EXAMPLE'
+drop table t1;
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 8a85cd53b2a..2d4a290751f 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -136,7 +136,7 @@ select @d:=1311;
1311
select year(@d), month(@d), day(@d), cast(@d as date);
year(@d) month(@d) day(@d) cast(@d as date)
-NULL NULL NULL NULL
+0 0 0 0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '1311'
Warning 1292 Incorrect datetime value: '1311'
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 811fbacaf59..05cdcf7e256 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -573,7 +573,7 @@ CAST('NULL' AS DATE) < CAST('2008-01-01' AS DATE) n7,
CAST('2008-01-01' AS DATE) < CAST('NULL' AS DATE) n8,
CAST('NULL' AS DATE) < CAST('NULL' AS DATE) n9;
n1 n2 n3 n4 n5 n6 n7 n8 n9
-0 0 1 NULL NULL NULL NULL NULL NULL
+0 0 1 1 1 0 1 0 0
Warnings:
Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
@@ -585,6 +585,8 @@ Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
+Warning 1292 Incorrect datetime value: 'NULL'
+Warning 1292 Incorrect datetime value: 'NULL'
End of 5.0 tests
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
@@ -651,6 +653,19 @@ SELECT * FROM t1;
dt1
DROP TABLE t1;
End of 5.1 tests
+create table t1 (d date, t time) engine=myisam;
+insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31');
+select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond;
+cond group_concat( d )
+0000-00-00 00:00:00 2000-12-03
+0000-00-00 00:00:00 2008-05-03
+Warnings:
+Warning 1292 Incorrect datetime value: '22:55:23'
+Warning 1292 Incorrect datetime value: '10:19:31'
+Warning 1292 Incorrect datetime value: '22:55:23'
+Warning 1292 Incorrect datetime value: '10:19:31'
+drop table t1;
+End of 5.3 tests
#
# Start of 5.5 tests
#
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index 813f912c5af..d373d14c089 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1854,3 +1854,18 @@ a
DROP TABLE t1;
End of 5.1 tests
+#
+# MDEV-4241: Assertion failure: scale >= 0 && precision > 0 &&
+# scale <= precision in decimal_bin_size
+#
+CREATE TABLE t1 (
+f1 enum('1','2','3','4','5')
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+SELECT AVG(f1) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def AVG(f1) 246 7 6 Y 32896 4 63
+AVG(f1)
+1.5000
+drop table t1;
+End of 5.3 tests
diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result
index ec63cc0d98c..d565bb2dbd6 100644
--- a/mysql-test/r/upgrade.result
+++ b/mysql-test/r/upgrade.result
@@ -33,26 +33,28 @@ show create database `#mysql50#mysqltest-1`;
ERROR 42000: Unknown database '#mysql50#mysqltest-1'
show tables in `mysqltest1`;
Tables_in_mysqltest1
-t1
t-1
+t1
show tables in `mysqltest-1`;
Tables_in_mysqltest-1
-t1
t-1
+t1
drop database `mysqltest1`;
drop database `mysqltest-1`;
-drop table if exists `txu@0023p@0023p1`;
-drop table if exists `txu#p#p1`;
create table `txu#p#p1` (s1 int);
insert into `txu#p#p1` values (1);
select * from `txu@0023p@0023p1`;
ERROR 42S02: Table 'test.txu@0023p@0023p1' doesn't exist
create table `txu@0023p@0023p1` (s1 int);
-ERROR 42S01: Table '#mysql50#txu@0023p@0023p1' already exists
+show tables;
+Tables_in_test
+txu#p#p1
+txu@0023p@0023p1
select * from `txu#p#p1`;
s1
1
drop table `txu#p#p1`;
+drop table `txu@0023p@0023p1`;
#
# Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
#
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index 27a0d7f0a1b..f428d460d39 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -18,6 +18,7 @@ master-bin.000001 # User var # # @`var2`=_binary 0x61 COLLATE binary
master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2)
master-bin.000001 # Query # # COMMIT
flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -56,4 +57,5 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t1;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 6cbbe934bde..78ed5bb65d5 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -461,8 +461,42 @@ GROUP BY @b:=(SELECT COUNT(*) > t2.a);
@a:=MIN(t1.a)
1
DROP TABLE t1;
+SET @bug12408412=1;
+SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412;
End of 5.1 tests
-DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0);
+SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
+AS b FROM t1 GROUP BY a;
+b
+1
+SELECT @a;
+@a
+1
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT, f2 INT);
+INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (1);
+SET @var=NULL;
+SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
+LIMIT 1;
+@var:=(SELECT f2 FROM t2 WHERE @var)
+NULL
+SELECT @var;
+@var
+NULL
+DROP TABLE t1, t2;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(1),(3);
+SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a;
+b
+1
+SELECT @a;
+@a
+1
+DROP TABLE t1;
+End of 5.2 tests
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
INSERT INTO t1 SET f1 = NULL ;
SET @aux = NULL ;
@@ -530,9 +564,9 @@ SELECT @a;
@a
1
DROP TABLE t1;
+End of 5.5 tests
#
# Check that used memory extends if we set a variable
#
set @var= repeat('a',20000);
1
-End of 5.5 tests
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index 29986344f88..bba63e73c56 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -1483,16 +1483,6 @@ SELECT @@GLOBAL.server_id;
@@GLOBAL.server_id
0
SET GLOBAL server_id = @old_server_id;
-SELECT @@GLOBAL.INIT_CONNECT, @@GLOBAL.INIT_CONNECT IS NULL;
-@@GLOBAL.INIT_CONNECT @@GLOBAL.INIT_CONNECT IS NULL
- 1
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES ();
-SET @bug42778= @@sql_safe_updates;
-SET @@sql_safe_updates= 0;
-DELETE FROM t1 ORDER BY (@@GLOBAL.INIT_CONNECT) ASC LIMIT 10;
-SET @@sql_safe_updates= @bug42778;
-DROP TABLE t1;
#
# BUG#10206 - InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback
#
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 1e5e91b272c..ef4bcc33c48 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1423,7 +1423,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on(((`test`.`t1`.`a` = `test`.`t3`.`a`) and (`test`.`t2`.`a` = `test`.`t3`.`a`)))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join `test`.`t2` on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1
create view v1 (a) as select a from t1;
create view v2 (a) as select a from t2;
create view v4 (a,b) as select v1.a as a, v2.a as b from v1 left join v2 on (v1.a=v2.a);
@@ -1438,7 +1438,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on(((`test`.`t1`.`a` = `test`.`t3`.`a`) and (`test`.`t2`.`a` = `test`.`t3`.`a`)))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1
+Note 1003 select `test`.`t3`.`a` AS `a`,`test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `b` from `test`.`t3` left join (`test`.`t1` left join (`test`.`t2`) on((`test`.`t2`.`a` = `test`.`t3`.`a`))) on((`test`.`t1`.`a` = `test`.`t3`.`a`)) where 1
prepare stmt1 from "select * from t3 left join v4 on (t3.a = v4.a);";
execute stmt1;
a a b
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index dc624a07f4f..d0cdd858d4a 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -16,7 +16,7 @@ CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,1);
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
DROP TABLE t1;
CREATE DATABASE `TESTDB`;
diff --git a/mysql-test/suite/archive/archive.result b/mysql-test/suite/archive/archive.result
index 98608a95f37..a491b5bb9ee 100644
--- a/mysql-test/suite/archive/archive.result
+++ b/mysql-test/suite/archive/archive.result
@@ -6257,7 +6257,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily
DELETE FROM t2;
-ERROR HY000: Table storage engine for 't2' doesn't have this option
+ERROR HY000: Storage engine ARCHIVE of the table `test`.`t2` doesn't have this option
SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5 fld6
1 000001 00 Omaha teethe neat
@@ -8689,7 +8689,7 @@ auto fld1 companynr fld3 fld4 fld5 fld6
3 011402 37 Romans scholastics jarring
4 011403 37 intercepted audiology tinily
TRUNCATE TABLE t2;
-ERROR HY000: Table storage engine for 't2' doesn't have this option
+ERROR HY000: Storage engine ARCHIVE of the table `test`.`t2` doesn't have this option
SELECT * FROM t2;
auto fld1 companynr fld3 fld4 fld5 fld6
1 000001 00 Omaha teethe neat
@@ -12701,12 +12701,12 @@ CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH
-8666 15
+550 15
INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH
-8700 4350
+584 292
DROP TABLE t1;
SET @save_join_buffer_size= @@join_buffer_size;
SET @@join_buffer_size= 8192;
@@ -12749,21 +12749,12 @@ SELECT * FROM t1;
col1 col2
DROP TABLE t1;
#
-# BUG#48757 - missing .ARZ file causes server crash
-#
-CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
-FLUSH TABLE t1;
-SELECT * FROM t1;
-ERROR HY000: Can't find file: 't1' (errno: 2 "No such file or directory")
-DROP TABLE t1;
-ERROR 42S02: Unknown table 't1'
-#
# Ensure that TRUNCATE fails for non-empty archive tables.
#
CREATE TABLE t1 (a INT) ENGINE=ARCHIVE;
INSERT INTO t1 VALUES (1);
TRUNCATE TABLE t1;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine ARCHIVE of the table `test`.`t1` doesn't have this option
DROP TABLE t1;
#
# BUG#46565 - repair of partition fail for archive engine
@@ -12785,38 +12776,6 @@ a
2
DROP TABLE t1;
#
-# Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
-#
-DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a int) ENGINE=ARCHIVE;
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) DEFAULT NULL
-) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
-INSERT INTO t1 VALUES (1);
-OPTIMIZE TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 optimize status OK
-FLUSH TABLES;
-INSERT INTO t1 VALUES (2);
-SELECT * FROM t1 ORDER BY a;
-a
-1
-2
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) DEFAULT NULL
-) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
-DROP TABLE t1;
-#
-# BUG#58205 - Valgrind failure in fn_format when called from
-# archive_discover
-#
-CREATE TABLE `a/../`(a INT) ENGINE=ARCHIVE;
-DROP TABLE `a/../`;
-#
# BUG#57162 - valgrind errors, random data when returning
# ordered data from archive tables
#
@@ -12856,9 +12815,37 @@ DROP TABLE t1;
#
create table t1 (a int, b char(50)) engine=archive;
select * from t1;
+a b
+flush tables;
+select * from t1;
ERROR HY000: Table 't1' is marked as crashed and should be repaired
show warnings;
Level Code Message
Warning 127 Got error 127 when reading table `test`.`t1`
Error 1194 Table 't1' is marked as crashed and should be repaired
drop table t1;
+create temporary table t1 (a int) engine=archive;
+insert t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+alter table t1 add column b varchar(10);
+select * from t1;
+a b
+1 NULL
+2 NULL
+3 NULL
+show create table t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` varchar(10) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
+drop table t1;
diff --git a/mysql-test/suite/archive/archive.test b/mysql-test/suite/archive/archive.test
index 5dd85bf1aba..1114eb4e89a 100644
--- a/mysql-test/suite/archive/archive.test
+++ b/mysql-test/suite/archive/archive.test
@@ -3,7 +3,6 @@
# Taken FROM the select test
#
-- source include/have_archive.inc
--- source include/have_binlog_format_mixed_or_statement.inc
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired");
@@ -1670,17 +1669,6 @@ DROP TABLE t1;
remove_file $MYSQLD_DATADIR/test/t1.ARM;
--echo #
---echo # BUG#48757 - missing .ARZ file causes server crash
---echo #
-CREATE TABLE t1(a INT) ENGINE=ARCHIVE;
-FLUSH TABLE t1;
---remove_file $MYSQLD_DATADIR/test/t1.ARZ
---error ER_FILE_NOT_FOUND
-SELECT * FROM t1;
---error ER_BAD_TABLE_ERROR
-DROP TABLE t1;
-
---echo #
--echo # Ensure that TRUNCATE fails for non-empty archive tables.
--echo #
CREATE TABLE t1 (a INT) ENGINE=ARCHIVE;
@@ -1713,34 +1701,6 @@ SELECT * FROM t1;
DROP TABLE t1;
--echo #
---echo # Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
---echo #
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1 (a int) ENGINE=ARCHIVE;
-SHOW CREATE TABLE t1;
-INSERT INTO t1 VALUES (1);
-OPTIMIZE TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/t1.frm;
-FLUSH TABLES;
-INSERT INTO t1 VALUES (2);
-SELECT * FROM t1 ORDER BY a;
-SHOW CREATE TABLE t1;
-DROP TABLE t1;
-
---echo #
---echo # BUG#58205 - Valgrind failure in fn_format when called from
---echo # archive_discover
---echo #
-CREATE TABLE `a/../`(a INT) ENGINE=ARCHIVE;
-remove_file $MYSQLD_DATADIR/test/a@002f@002e@002e@002f.frm;
-DROP TABLE `a/../`;
-
---echo #
--echo # BUG#57162 - valgrind errors, random data when returning
--echo # ordered data from archive tables
--echo #
@@ -1774,9 +1734,24 @@ DROP TABLE t1;
--echo # BUG#917689 Using wrong archive table causes crash
--echo #
create table t1 (a int, b char(50)) engine=archive;
+select * from t1; # open the table to create the frm
+flush tables; # and close the table again
--remove_file $MYSQLD_DATADIR/test/t1.ARZ
copy_file std_data/t917689.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
---error 1194
+--error ER_CRASHED_ON_USAGE
select * from t1;
show warnings;
drop table t1;
+
+#
+# temporary archive
+#
+create temporary table t1 (a int) engine=archive;
+insert t1 values (1),(2),(3);
+select * from t1;
+show create table t1;
+alter table t1 add column b varchar(10);
+select * from t1;
+show create table t1;
+drop table t1;
+
diff --git a/mysql-test/suite/archive/discover.result b/mysql-test/suite/archive/discover.result
new file mode 100644
index 00000000000..59e79664eb6
--- /dev/null
+++ b/mysql-test/suite/archive/discover.result
@@ -0,0 +1,125 @@
+create table t1 (a int) engine=archive;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+insert t1 values (1);
+show tables;
+Tables_in_test
+t1
+#
+# simple discover on use
+#
+flush tables;
+insert t1 values (2);
+select * from t1;
+a
+1
+2
+t1.ARZ
+t1.frm
+#
+# show tables
+#
+create table t2 (a int) engine=archive;
+select * from t2;
+a
+flush tables;
+show tables;
+Tables_in_test
+t1
+t2
+t1.ARZ
+t2.ARZ
+t2.frm
+#
+# show full tables
+#
+flush tables;
+show full tables;
+Tables_in_test Table_type
+t1 BASE TABLE
+t2 BASE TABLE
+t1.ARZ
+t2.ARZ
+t2.frm
+#
+# discover on truncate
+#
+flush tables;
+truncate table t1;
+ERROR HY000: Storage engine ARCHIVE of the table `test`.`t1` doesn't have this option
+t1.ARZ
+t1.frm
+t2.ARZ
+t2.frm
+#
+# discover on rename
+#
+flush tables;
+rename table t2 to t0;
+t0.ARZ
+t1.ARZ
+t1.frm
+#
+# discover on HA_ERR_TABLE_DEF_CHANGED
+#
+alter table t1 modify a int default 5;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+#
+# discover on drop
+#
+flush tables;
+drop table t1;
+t0.ARZ
+#
+# discover of table non-existance on drop
+#
+select * from t0;
+a
+flush tables;
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+drop table t0;
+show status like 'Handler_discover';
+Variable_name Value
+Handler_discover 7
+#
+# Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
+#
+create table t1 (a int) engine=archive;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+insert into t1 values (1);
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+flush tables;
+insert into t1 values (2);
+select * from t1 order by a;
+a
+1
+2
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
+drop table t1;
+#
+# BUG#58205 - Valgrind failure in fn_format when called from
+# archive_discover
+#
+create table `a/../`(a int) engine=archive;
+select * from `a/../`;
+a
+flush tables;
+drop table `a/../`;
diff --git a/mysql-test/suite/archive/discover.test b/mysql-test/suite/archive/discover.test
new file mode 100644
index 00000000000..0b7e521185d
--- /dev/null
+++ b/mysql-test/suite/archive/discover.test
@@ -0,0 +1,104 @@
+-- source include/have_archive.inc
+let $mysqld_datadir= `select @@datadir`;
+
+create table t1 (a int) engine=archive;
+show create table t1;
+insert t1 values (1);
+show tables;
+
+--echo #
+--echo # simple discover on use
+--echo #
+remove_file $mysqld_datadir/test/t1.frm;
+flush tables;
+insert t1 values (2);
+select * from t1;
+--list_files $mysqld_datadir/test
+
+--echo #
+--echo # show tables
+--echo #
+create table t2 (a int) engine=archive;
+select * from t2;
+remove_file $mysqld_datadir/test/t1.frm;
+flush tables;
+show tables;
+--list_files $mysqld_datadir/test
+
+--echo #
+--echo # show full tables
+--echo #
+flush tables;
+show full tables;
+--list_files $mysqld_datadir/test
+
+--echo #
+--echo # discover on truncate
+--echo #
+flush tables;
+--error ER_ILLEGAL_HA
+truncate table t1;
+--list_files $mysqld_datadir/test
+
+--echo #
+--echo # discover on rename
+--echo #
+remove_file $mysqld_datadir/test/t2.frm;
+flush tables;
+rename table t2 to t0;
+--list_files $mysqld_datadir/test
+
+--echo #
+--echo # discover on HA_ERR_TABLE_DEF_CHANGED
+--echo #
+copy_file $mysqld_datadir/test/t1.ARZ $MYSQL_TMP_DIR/t1.ARZ;
+alter table t1 modify a int default 5;
+remove_file $mysqld_datadir/test/t1.ARZ;
+copy_file $MYSQL_TMP_DIR/t1.ARZ $mysqld_datadir/test/t1.ARZ;
+remove_file $MYSQL_TMP_DIR/t1.ARZ;
+show create table t1;
+
+--echo #
+--echo # discover on drop
+--echo #
+remove_file $mysqld_datadir/test/t1.frm;
+flush tables;
+drop table t1;
+--list_files $mysqld_datadir/test
+
+--echo #
+--echo # discover of table non-existance on drop
+--echo #
+select * from t0;
+remove_file $mysqld_datadir/test/t0.ARZ;
+flush tables;
+--error ER_NO_SUCH_TABLE
+select * from t1;
+drop table t0;
+--list_files $mysqld_datadir/test
+show status like 'Handler_discover';
+
+--echo #
+--echo # Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
+--echo #
+
+create table t1 (a int) engine=archive;
+show create table t1;
+insert into t1 values (1);
+optimize table t1;
+remove_file $mysqld_datadir/test/t1.frm;
+flush tables;
+insert into t1 values (2);
+select * from t1 order by a;
+show create table t1;
+drop table t1;
+
+--echo #
+--echo # BUG#58205 - Valgrind failure in fn_format when called from
+--echo # archive_discover
+--echo #
+create table `a/../`(a int) engine=archive;
+select * from `a/../`; flush tables;
+remove_file $mysqld_datadir/test/a@002f@002e@002e@002f.frm;
+drop table `a/../`;
+
diff --git a/mysql-test/suite/archive/partition_archive.result b/mysql-test/suite/archive/partition_archive.result
index 186a7930251..7b3c01694da 100644
--- a/mysql-test/suite/archive/partition_archive.result
+++ b/mysql-test/suite/archive/partition_archive.result
@@ -15,10 +15,10 @@ ENGINE = ARCHIVE;
INSERT INTO t1 VALUES(CURRENT_DATE);
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DATA_LENGTH INDEX_LENGTH
-8658 0
+535 0
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DATA_LENGTH INDEX_LENGTH
-8658 0
+535 0
DROP TABLE t1;
drop database if exists db99;
drop table if exists t1;
@@ -30,6 +30,7 @@ partition by list (a)
(partition p0 values in (1), partition p1 values in (2));
insert into t1 values (1), (2);
create index inx on t1 (a);
+ERROR HY000: Can't create table `db99`.`#sql-temporary` (errno: 1 "Operation not permitted")
alter table t1 add partition (partition p2 values in (3));
alter table t1 drop partition p2;
use test;
diff --git a/mysql-test/suite/archive/partition_archive.test b/mysql-test/suite/archive/partition_archive.test
index 6f6a26c018a..be2abeada73 100644
--- a/mysql-test/suite/archive/partition_archive.test
+++ b/mysql-test/suite/archive/partition_archive.test
@@ -47,7 +47,8 @@ engine=archive
partition by list (a)
(partition p0 values in (1), partition p1 values in (2));
insert into t1 values (1), (2);
---error 0, ER_CANT_CREATE_TABLE
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/ /Not owner/Operation not permitted/
+--error ER_CANT_CREATE_TABLE
create index inx on t1 (a);
alter table t1 add partition (partition p2 values in (3));
alter table t1 drop partition p2;
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index f84995cac3b..26eab9f141d 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -29,6 +29,7 @@ a
1
3
==== Test --base64-output=never on a binlog with row events ====
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -51,6 +52,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
==== Test non-matching FD event and Row event ====
BINLOG '
4CdYRw8BAAAAYgAAAGYAAAAAAAQANS4xLjE1LW5kYi02LjEuMjQtZGVidWctbG9nAAAAAAAAAAAA
diff --git a/mysql-test/suite/binlog/r/binlog_checkpoint.result b/mysql-test/suite/binlog/r/binlog_checkpoint.result
index 02fa8c12310..44fa80d620f 100644
--- a/mysql-test/suite/binlog/r/binlog_checkpoint.result
+++ b/mysql-test/suite/binlog/r/binlog_checkpoint.result
@@ -89,6 +89,22 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
master-bin.000003 # Binlog_checkpoint # # master-bin.000001
master-bin.000003 # Binlog_checkpoint # # master-bin.000003
+*** MDEV-4322: Broken XID counting during binlog rotation ***
+SET @old_dbug= @@global.DEBUG_DBUG;
+SET GLOBAL debug_dbug="+d,inject_binlog_background_thread_before_mark_xid_done";
+FLUSH LOGS;
+INSERT INTO t1 VALUES (30, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR injected_binlog_background_thread";
+SET GLOBAL debug_dbug= @old_dbug;
+INSERT INTO t1 VALUES (31, REPEAT("x", 4100));
+show binary logs;
+Log_name File_size
+master-bin.000001 #
+master-bin.000002 #
+master-bin.000003 #
+master-bin.000004 #
+master-bin.000005 #
+master-bin.000006 #
DROP TABLE t1, t2;
SET GLOBAL max_binlog_size= @old_max_binlog_size;
SET GLOBAL innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
index bf65bab602d..9824707a8c0 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
@@ -15,6 +15,7 @@ set timestamp=@a+1;
insert into t1 values(null, "f");
--- Local --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -85,8 +86,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- offset --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -154,8 +157,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -203,8 +208,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -245,8 +252,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start and stop positions ---
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -271,8 +280,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -320,8 +331,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -362,9 +375,11 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Local with 2 binlogs on command line --
flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -456,8 +471,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- offset --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -546,8 +563,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -616,8 +635,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -701,8 +722,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -771,8 +794,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -813,8 +838,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Remote --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -885,8 +912,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- offset --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -954,8 +983,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1002,8 +1033,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1044,8 +1077,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start and stop positions ---
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1069,8 +1104,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1118,8 +1155,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1160,8 +1199,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Remote with 2 binlogs on command line --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1253,8 +1294,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- offset --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1343,8 +1386,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1412,8 +1457,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1486,8 +1533,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- start-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1556,8 +1605,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- stop-datetime --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1598,8 +1649,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- to-last-log --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1680,6 +1733,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- end of test --
drop table t1;
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index 8f481b25251..4fcb0fca9c0 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -328,6 +328,7 @@ INSERT INTO t2 SET b=1;
UPDATE t1, t2 SET t1.a=10, t2.a=20;
DROP TABLE t1,t2;
flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -4137,3 +4138,4 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
index 3227ad3d661..dd09a398922 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
@@ -2245,6 +2245,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -3788,6 +3789,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
@@ -3870,6 +3872,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -4081,6 +4084,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
@@ -4239,6 +4243,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -4752,6 +4757,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
@@ -4802,6 +4808,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -4861,6 +4868,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
index 8338e48459a..66f4cce5f05 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
@@ -2245,6 +2245,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -3810,6 +3811,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
@@ -3892,6 +3894,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -4109,6 +4112,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
@@ -4267,6 +4271,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -4790,6 +4795,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
@@ -4840,6 +4846,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -4901,6 +4908,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
index f2f1ed00431..fc356a9ace3 100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
@@ -124,6 +124,7 @@ FLUSH LOGS;
#
# Call mysqlbinlog to display the log file contents.
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -465,6 +466,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# Cleanup.
#
diff --git a/mysql-test/suite/binlog/r/binlog_old_versions.result b/mysql-test/suite/binlog/r/binlog_old_versions.result
index a4850b835c8..169a23b2019 100644
--- a/mysql-test/suite/binlog/r/binlog_old_versions.result
+++ b/mysql-test/suite/binlog/r/binlog_old_versions.result
@@ -38,21 +38,6 @@ SELECT COUNT(*) FROM t3;
COUNT(*)
17920
DROP TABLE t1, t3;
-==== Read binlog from alcatel tree (mysql-5.1-wl2325-5.0-drop6) ====
-SELECT * FROM t1 ORDER BY a;
-a b
-0 last_insert_id
-1 one
-3 last stm in trx: next event should be xid
-4 four
-781729 random
-SELECT * FROM t2 ORDER BY a;
-a b
-3 first stm in trx
-SELECT COUNT(*) FROM t3;
-COUNT(*)
-17920
-DROP TABLE t1, t2, t3;
==== Read binlog from ndb tree (mysql-5.1-telco-6.1) ====
SELECT * FROM t1 ORDER BY a;
a b
diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result
index 8b9ccee7a93..5df4a0af16f 100644
--- a/mysql-test/suite/binlog/r/binlog_row_annotate.result
+++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result
@@ -61,6 +61,7 @@ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
# - INSERT INTO test2.t2 VALUES (1), (2), (3)
# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
#####################################################################################
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -283,12 +284,14 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
#####################################################################################
# mysqlbinlog --database=test1
# The following Annotate should appear in this output:
# - DELETE test1.t1, test2.t2 FROM <...>
#####################################################################################
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -430,11 +433,13 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
#####################################################################################
# mysqlbinlog --skip-annotate-row-events
# No Annotates should appear in this output
#####################################################################################
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -643,6 +648,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
#####################################################################################
# mysqlbinlog --read-from-remote-server
@@ -653,6 +659,7 @@ ROLLBACK /* added by mysqlbinlog */;
# - INSERT INTO test2.t2 VALUES (1), (2), (3)
# - DELETE xtest1.xt1, test2.t2 FROM <...> (with one subsequent Table map)
#####################################################################################
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -875,12 +882,14 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
#####################################################################################
# mysqlbinlog --read-from-remote-server --database=test1
# The following Annotate should appear in this output:
# - DELETE test1.t1, test2.t2 FROM <...>
#####################################################################################
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1022,11 +1031,13 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
#####################################################################################
# mysqlbinlog --read-from-remote-server --skip-annotate-row-events
# No Annotates should appear in this output
#####################################################################################
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1230,3 +1241,4 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
index 733e5e1c0ab..4e107c087ef 100644
--- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
@@ -10,6 +10,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -32,4 +33,5 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t2;
diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
index f2dedaa633a..6973985e6c3 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
@@ -28,6 +28,7 @@ flush logs;
# --rewrite-db = test1->new_test1
# --rewrite-db = test3->new_test3
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -217,6 +218,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
#
# mysqlbinlog output
# --base64-output = decode-rows
@@ -224,6 +226,7 @@ ROLLBACK /* added by mysqlbinlog */;
# --rewrite-db = test3->new_test3
# --read-from-remote-server
#
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -413,6 +416,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
DROP DATABASE test1;
DROP DATABASE test2;
DROP DATABASE test3;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
index cfeca4811cb..506c1e4ed53 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
@@ -10,6 +10,7 @@ master-bin.000001 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_
master-bin.000001 # Query # # use `test`; insert into t2 values (@v)
master-bin.000001 # Query # # COMMIT
flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -37,4 +38,5 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
drop table t2;
diff --git a/mysql-test/suite/binlog/std_data/ver_5_1-wl2325_r.001 b/mysql-test/suite/binlog/std_data/ver_5_1-wl2325_r.001
deleted file mode 100644
index 47071c011f9..00000000000
--- a/mysql-test/suite/binlog/std_data/ver_5_1-wl2325_r.001
+++ /dev/null
Binary files differ
diff --git a/mysql-test/suite/binlog/std_data/ver_5_1-wl2325_s.001 b/mysql-test/suite/binlog/std_data/ver_5_1-wl2325_s.001
deleted file mode 100644
index 4302bfed879..00000000000
--- a/mysql-test/suite/binlog/std_data/ver_5_1-wl2325_s.001
+++ /dev/null
Binary files differ
diff --git a/mysql-test/suite/binlog/t/binlog_checkpoint.test b/mysql-test/suite/binlog/t/binlog_checkpoint.test
index 8c84e51c4df..4fa40b23547 100644
--- a/mysql-test/suite/binlog/t/binlog_checkpoint.test
+++ b/mysql-test/suite/binlog/t/binlog_checkpoint.test
@@ -113,8 +113,33 @@ connection default;
--source include/show_binlog_events.inc
-# Cleanup
+--echo *** MDEV-4322: Broken XID counting during binlog rotation ***
+
+# Test that binlog shutdown waits for any pending binlog checkpoints to have time to complete.
+
connection default;
+# We will use debug_sync to setup a wait inside the background processing
+# of binlog checkpoints. The wait is newer resumed, and will eventually
+# time out. If server shutdown does not wait for checkpoint processing to
+# complete, we will get an assert.
+#
+# It is a bit tricky to inject the wait properly as it has to happen in a
+# background thread during shutdown. So we first inject a DBUG to set the
+# debug_sync wait in the correct thread, then wait to be signalled that
+# the inject happened so that we can remove it again from DBUG (else
+# check_testcase will complain).
+
+SET @old_dbug= @@global.DEBUG_DBUG;
+SET GLOBAL debug_dbug="+d,inject_binlog_background_thread_before_mark_xid_done";
+
+FLUSH LOGS;
+INSERT INTO t1 VALUES (30, REPEAT("x", 4100));
+SET DEBUG_SYNC= "now WAIT_FOR injected_binlog_background_thread";
+SET GLOBAL debug_dbug= @old_dbug;
+INSERT INTO t1 VALUES (31, REPEAT("x", 4100));
+--source include/show_binary_logs.inc
+
+
DROP TABLE t1, t2;
SET GLOBAL max_binlog_size= @old_max_binlog_size;
SET GLOBAL innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
diff --git a/mysql-test/suite/binlog/t/binlog_old_versions.test b/mysql-test/suite/binlog/t/binlog_old_versions.test
index b294adbc69d..77b3db31983 100644
--- a/mysql-test/suite/binlog/t/binlog_old_versions.test
+++ b/mysql-test/suite/binlog/t/binlog_old_versions.test
@@ -64,25 +64,6 @@ SELECT COUNT(*) FROM t3;
DROP TABLE t1, t3;
---echo ==== Read binlog from alcatel tree (mysql-5.1-wl2325-5.0-drop6) ====
-
-# In this version, it was not possible to switch between row-based and
-# statement-based binlogging without restarting the server. So, we
-# have two binlogs; one for row based and one for statement based
-# replication.
-
-# Read rbr binlog.
---exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_r.001 | $MYSQL --local-infile=1
-# Read stm binlog.
---exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ suite/binlog/std_data/ver_5_1-wl2325_s.001 | $MYSQL --local-infile=1
-# Show result.
-SELECT * FROM t1 ORDER BY a;
-SELECT * FROM t2 ORDER BY a;
-SELECT COUNT(*) FROM t3;
-# Reset.
-DROP TABLE t1, t2, t3;
-
-
--echo ==== Read binlog from ndb tree (mysql-5.1-telco-6.1) ====
# Read binlog.
diff --git a/mysql-test/suite/csv/csv.result b/mysql-test/suite/csv/csv.result
index d81cf6e28bc..be8ffa8f9e5 100644
--- a/mysql-test/suite/csv/csv.result
+++ b/mysql-test/suite/csv/csv.result
@@ -5379,7 +5379,7 @@ ERROR 42000: The storage engine for the table doesn't support nullable columns
SHOW WARNINGS;
Level Code Message
Error 1178 The storage engine for the table doesn't support nullable columns
-Error 1005 Can't create table 'test.t1' (errno: 138 "Unsupported extension used for table")
+Error 1005 Can't create table `test`.`t1` (errno: 138 "Unsupported extension used for table")
create table t1 (c1 tinyblob not null) engine=csv;
insert into t1 values("This");
update t1 set c1="That" where c1="This";
diff --git a/mysql-test/suite/engines/funcs/disabled.def b/mysql-test/suite/engines/funcs/disabled.def
index 2d8ea2d4ff8..c43b0c92bc9 100644
--- a/mysql-test/suite/engines/funcs/disabled.def
+++ b/mysql-test/suite/engines/funcs/disabled.def
@@ -70,7 +70,6 @@ rpl_replicate_ignore_db : Result Difference Due To Change In .inc file
rpl000017 : Result Difference Due To Change In .inc file
rpl_skip_error : Result Difference Due To Change In .inc file
-rpl_row_until : Test Present in rpl suite as well . Test Fails table with t2 table not found.
rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation.
rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation.
rpl_row_NOW : Result Difference Due To Change In .inc file
@@ -96,4 +95,3 @@ rpl_relayspace : Result Difference Due To Change In .inc file
rpl_row_inexist_tbl : Result Difference Due To Change In .inc file
rpl_sp : Result Difference Due To Change In .inc file
rpl_rbr_to_sbr : Result Difference Due To Change In .inc file
-rpl_row_until : Test Timesout
diff --git a/mysql-test/suite/engines/funcs/r/rpl_row_until.result b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
index d8637578ecc..5629f5c8cdd 100644
--- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result
@@ -1,212 +1,60 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
-create table t1(n int not null auto_increment primary key);
-insert into t1 values (1),(2),(3),(4);
-drop table t1;
-create table t2(n int not null auto_increment primary key);
-insert into t2 values (1),(2);
-insert into t2 values (3),(4);
-drop table t2;
-start slave until master_log_file='master-bin.000001', master_log_pos=311;
-select * from t1;
+include/master-slave.inc
+[connection master]
+CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+DROP TABLE t1;
+CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t2 VALUES (1),(2);
+INSERT INTO t2 VALUES (3),(4);
+DROP TABLE t2;
+include/stop_slave.inc
+RESET SLAVE;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1
+include/wait_for_slave_sql_to_stop.inc
+SELECT * FROM t1;
n
1
2
3
4
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running #
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos 311
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
-select * from t1;
-n 1
-n 2
-n 3
-n 4
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running #
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-no-such-bin.000001
-Until_Log_Pos 291
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
-select * from t2;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running #
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Relay
-Until_Log_File slave-relay-bin.000004
-Until_Log_Pos 728
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-start slave;
-stop slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
-show slave status;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_MYPORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos #
-Relay_Log_File slave-relay-bin.000004
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos #
-Relay_Log_Space #
-Until_Condition Master
-Until_Log_File master-bin.000001
-Until_Log_Pos 740
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
-Last_SQL_Errno 0
-Last_SQL_Error
-Replicate_Ignore_Server_Ids
-Master_Server_Id 1
-start slave until master_log_file='master-bin', master_log_pos=561;
+include/check_slave_param.inc [Exec_Master_Log_Pos]
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
+include/wait_for_slave_sql_to_stop.inc
+SELECT * FROM t1;
+n
+1
+2
+3
+4
+include/check_slave_param.inc [Exec_Master_Log_Pos]
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
+include/wait_for_slave_sql_to_stop.inc
+SELECT * FROM t2;
+n
+1
+2
+include/check_slave_param.inc [Exec_Master_Log_Pos]
+START SLAVE;
+include/wait_for_slave_to_start.inc
+include/stop_slave.inc
+START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
+include/wait_for_slave_param.inc [Until_Log_Pos]
+include/wait_for_slave_sql_to_stop.inc
+include/check_slave_param.inc [Exec_Master_Log_Pos]
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS, RELAY_LOG_POS=RELAY_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001';
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002';
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+START SLAVE;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
Warnings:
-Level Note
-Code 1254
-Message Slave is already running
+Note 1254 Slave is already running
+include/stop_slave.inc
+RESET SLAVE;
+include/rpl_end.inc
diff --git a/mysql-test/suite/engines/funcs/t/rpl_row_until.test b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
index ccd9ce11637..bf38bd487ea 100644
--- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test
@@ -2,90 +2,126 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-# Test is dependent on binlog positions
+# Note: The test is dependent on binlog positions
-# prepare version for substitutions
-let $VERSION=`select version()`;
+# Create some events on master
+connection master;
+CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+DROP TABLE t1;
+# Save master log position for query DROP TABLE t1
+save_master_pos;
+let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
+let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7);
-# stop slave before he will start replication also sync with master
-# for avoiding undetermenistic behaviour
+CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
+# Save master log position for query CREATE TABLE t2
save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
+let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
+
+INSERT INTO t2 VALUES (1),(2);
+save_master_pos;
+# Save master log position for query INSERT INTO t2 VALUES (1),(2);
+let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12);
+sync_slave_with_master;
+
+# Save relay log position for query INSERT INTO t2 VALUES (1),(2);
+let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
connection master;
-# create some events on master
-create table t1(n int not null auto_increment primary key);
-insert into t1 values (1),(2),(3),(4);
-drop table t1;
-create table t2(n int not null auto_increment primary key);
-insert into t2 values (1),(2);
-insert into t2 values (3),(4);
-drop table t2;
-
-# try to replicate all queries until drop of t1
+INSERT INTO t2 VALUES (3),(4);
+DROP TABLE t2;
+# Save master log position for query INSERT INTO t2 VALUES (1),(2);
+let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17);
+sync_slave_with_master;
+
+--source include/stop_slave.inc
+# Reset slave.
+RESET SLAVE;
+--disable_query_log
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+--enable_query_log
+
+# Try to replicate all queries until drop of t1
connection slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=311;
-sleep 2;
-wait_for_slave_to_stop;
-# here table should be still not deleted
-select * from t1;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
-
-# this should fail right after start
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
+--disable_query_log
+eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
+--enable_query_log
+--source include/wait_for_slave_sql_to_stop.inc
+
+# Here table should be still not deleted
+SELECT * FROM t1;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t1
+--source include/check_slave_param.inc
+
+# This should fail right after start
+--replace_result 291 MASTER_LOG_POS
+START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
+--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
-select * from t1;
-sleep 2;
-wait_for_slave_to_stop;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
-
-# try replicate all up to and not including the second insert to t2;
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
-sleep 2;
-wait_for_slave_to_stop;
-select * from t2;
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT
---replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
-show slave status;
+SELECT * FROM t1;
+
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t1
+--source include/check_slave_param.inc
+
+# Try replicate all up to and not including the second insert to t2;
+echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
+--disable_query_log
+eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
+--enable_query_log
+--source include/wait_for_slave_sql_to_stop.inc
+SELECT * FROM t2;
+
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_insert1_t2
+--source include/check_slave_param.inc
# clean up
-start slave;
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
+sync_slave_with_master;
+--source include/stop_slave.inc
-# this should stop immediately as we are already there
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
-sleep 2;
-wait_for_slave_to_stop;
+# This should stop immediately as we are already there
+echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
+--disable_query_log
+eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
+--enable_query_log
+let $slave_param= Until_Log_Pos;
+let $slave_param_value= $master_pos_create_t2;
+--source include/wait_for_slave_param.inc
+--source include/wait_for_slave_sql_to_stop.inc
# here the sql slave thread should be stopped
---vertical_results
---replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
---replace_column 1 # 7 # 9 # 22 # 23 # 33 #
-show slave status;
+--let $slave_param= Exec_Master_Log_Pos
+--let $slave_param_value= $master_pos_drop_t2
+--source include/check_slave_param.inc
#testing various error conditions
+--replace_result 561 MASTER_LOG_POS
--error 1277
-start slave until master_log_file='master-bin', master_log_pos=561;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561;
+--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
--error 1277
-start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12;
--error 1277
-start slave until master_log_file='master-bin.000001';
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001';
--error 1277
-start slave until relay_log_file='slave-relay-bin.000002';
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
+--replace_result 561 MASTER_LOG_POS
--error 1277
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
+START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
# Warning should be given for second command
-start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+START SLAVE;
+--replace_result 740 MASTER_LOG_POS
+START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
+
+--source include/stop_slave.inc
+# Clear slave IO error.
+RESET SLAVE;
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/federated/assisted_discovery.result b/mysql-test/suite/federated/assisted_discovery.result
new file mode 100644
index 00000000000..7a351b9df6f
--- /dev/null
+++ b/mysql-test/suite/federated/assisted_discovery.result
@@ -0,0 +1,37 @@
+CREATE DATABASE federated;
+CREATE DATABASE federated;
+CREATE TABLE t1 (
+`id` int(20) primary key,
+`group` int NOT NULL default 1,
+`a\\b` int NOT NULL default 2,
+`a\\` int unsigned,
+`name` varchar(32) default 'name')
+DEFAULT CHARSET=latin1;
+CREATE TABLE t1 ENGINE=FEDERATED
+CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(20) NOT NULL,
+ `group` int(11) NOT NULL DEFAULT '1',
+ `a\\b` int(11) NOT NULL DEFAULT '2',
+ `a\\` int(10) unsigned DEFAULT NULL,
+ `name` varchar(32) DEFAULT 'name',
+ PRIMARY KEY (`id`)
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'
+INSERT INTO t1 (id, name) VALUES (1, 'foo');
+INSERT INTO t1 (id, name) VALUES (2, 'fee');
+SELECT * FROM t1;
+id group a\\b a\\ name
+1 1 2 NULL foo
+2 1 2 NULL fee
+DROP TABLE t1;
+SELECT * FROM t1;
+id group a\\b a\\ name
+1 1 2 NULL foo
+2 1 2 NULL fee
+DROP TABLE t1;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/assisted_discovery.test b/mysql-test/suite/federated/assisted_discovery.test
new file mode 100644
index 00000000000..9f3abe74ecc
--- /dev/null
+++ b/mysql-test/suite/federated/assisted_discovery.test
@@ -0,0 +1,34 @@
+source include/federated.inc;
+source have_federatedx.inc;
+
+connection slave;
+
+CREATE TABLE t1 (
+ `id` int(20) primary key,
+ `group` int NOT NULL default 1,
+ `a\\b` int NOT NULL default 2,
+ `a\\` int unsigned,
+ `name` varchar(32) default 'name')
+ DEFAULT CHARSET=latin1;
+
+connection master;
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval CREATE TABLE t1 ENGINE=FEDERATED
+ CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (id, name) VALUES (1, 'foo');
+INSERT INTO t1 (id, name) VALUES (2, 'fee');
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
+
+connection slave;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;
+
+source include/federated_cleanup.inc;
+
diff --git a/mysql-test/suite/federated/federated_archive.result b/mysql-test/suite/federated/federated_archive.result
index d67568ec11c..c2f43458126 100644
--- a/mysql-test/suite/federated/federated_archive.result
+++ b/mysql-test/suite/federated/federated_archive.result
@@ -20,13 +20,13 @@ id name
1 foo
2 bar
DELETE FROM federated.t1 WHERE id = 1;
-ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED
+ERROR HY000: Got error 10000 'Error on remote system: 1031: Storage engine ARCHIVE of the table `federated`.`archive_table` doesn'' from FEDERATED
SELECT * FROM federated.t1;
id name
1 foo
2 bar
UPDATE federated.t1 SET name='baz' WHERE id = 1;
-ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED
+ERROR HY000: Got error 10000 'Error on remote system: 1031: Storage engine ARCHIVE of the table `federated`.`archive_table` doesn'' from FEDERATED
SELECT * FROM federated.t1;
id name
1 foo
diff --git a/mysql-test/suite/federated/federated_bug_35333.result b/mysql-test/suite/federated/federated_bug_35333.result
index 74f6f6e8f02..05e4bab8ec5 100644
--- a/mysql-test/suite/federated/federated_bug_35333.result
+++ b/mysql-test/suite/federated/federated_bug_35333.result
@@ -24,14 +24,12 @@ CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
-test t1 BASE TABLE NULL NULL NULL NULL Can't find file: 't1' (errno: 2 "No such file or directory")
+test t1 BASE TABLE NULL NULL NULL NULL Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
Warnings:
-Warning 1017 Can't find file: 't1' (errno: 2 "No such file or directory")
-SHOW WARNINGS;
-Level Code Message
-Warning 1017 Can't find file: 't1' (errno: 2 "No such file or directory")
+Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
DROP TABLE t1;
-ERROR 42S02: Unknown table 't1'
+Warnings:
+Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
#
# Cleanup
#
diff --git a/mysql-test/suite/federated/federated_bug_35333.test b/mysql-test/suite/federated/federated_bug_35333.test
index 6487e10e018..47feefd75a1 100644
--- a/mysql-test/suite/federated/federated_bug_35333.test
+++ b/mysql-test/suite/federated/federated_bug_35333.test
@@ -64,11 +64,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
-SHOW WARNINGS;
---disable_warnings
---error 1051
DROP TABLE t1;
---enable_warnings
--echo #
--echo # Cleanup
diff --git a/mysql-test/suite/federated/federatedx.result b/mysql-test/suite/federated/federatedx.result
index 2ece1a32b4f..5ae2abb46e5 100644
--- a/mysql-test/suite/federated/federatedx.result
+++ b/mysql-test/suite/federated/federatedx.result
@@ -1508,7 +1508,7 @@ id name
1 Monty
2 David
ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL;
-ERROR HY000: Table storage engine for 'alter_me' doesn't have this option
+ERROR HY000: Storage engine FEDERATED of the table `federated`.`alter_me` doesn't have this option
SELECT * FROM federated.alter_me;
id name
1 Monty
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index e161e8ed058..8bf290ba168 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -3,6 +3,19 @@ WHERE table_schema = 'information_schema'
AND table_name <> 'profiling' AND table_name not like 'innodb_%'
ORDER BY table_schema, table_name, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+def information_schema ALL_PLUGINS LOAD_OPTION 11 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
+def information_schema ALL_PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
+def information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION 13 NULL YES varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80) select
+def information_schema ALL_PLUGINS PLUGIN_DESCRIPTION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select
+def information_schema ALL_PLUGINS PLUGIN_LIBRARY 6 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
+def information_schema ALL_PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select
+def information_schema ALL_PLUGINS PLUGIN_LICENSE 10 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80) select
+def information_schema ALL_PLUGINS PLUGIN_MATURITY 12 NO varchar 12 36 NULL NULL NULL utf8 utf8_general_ci varchar(12) select
+def information_schema ALL_PLUGINS PLUGIN_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
+def information_schema ALL_PLUGINS PLUGIN_STATUS 3 NO varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16) select
+def information_schema ALL_PLUGINS PLUGIN_TYPE 4 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80) select
+def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select
+def information_schema ALL_PLUGINS PLUGIN_VERSION 2 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select
def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema CHARACTER_SETS DESCRIPTION 3 NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60) select
@@ -215,7 +228,7 @@ def information_schema PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 N
def information_schema PLUGINS PLUGIN_LICENSE 10 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80) select
def information_schema PLUGINS PLUGIN_MATURITY 12 NO varchar 12 36 NULL NULL NULL utf8 utf8_general_ci varchar(12) select
def information_schema PLUGINS PLUGIN_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PLUGINS PLUGIN_STATUS 3 NO varchar 10 30 NULL NULL NULL utf8 utf8_general_ci varchar(10) select
+def information_schema PLUGINS PLUGIN_STATUS 3 NO varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16) select
def information_schema PLUGINS PLUGIN_TYPE 4 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80) select
def information_schema PLUGINS PLUGIN_TYPE_VERSION 5 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select
def information_schema PLUGINS PLUGIN_VERSION 2 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20) select
@@ -473,6 +486,19 @@ WHERE table_schema = 'information_schema'
AND table_name <> 'profiling' AND table_name not like 'innodb_%'
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
+3.0000 information_schema ALL_PLUGINS PLUGIN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema ALL_PLUGINS PLUGIN_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
+3.0000 information_schema ALL_PLUGINS PLUGIN_STATUS varchar 16 48 utf8 utf8_general_ci varchar(16)
+3.0000 information_schema ALL_PLUGINS PLUGIN_TYPE varchar 80 240 utf8 utf8_general_ci varchar(80)
+3.0000 information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
+3.0000 information_schema ALL_PLUGINS PLUGIN_LIBRARY varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema ALL_PLUGINS PLUGIN_LIBRARY_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
+3.0000 information_schema ALL_PLUGINS PLUGIN_AUTHOR varchar 64 192 utf8 utf8_general_ci varchar(64)
+1.0000 information_schema ALL_PLUGINS PLUGIN_DESCRIPTION longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
+3.0000 information_schema ALL_PLUGINS PLUGIN_LICENSE varchar 80 240 utf8 utf8_general_ci varchar(80)
+3.0000 information_schema ALL_PLUGINS LOAD_OPTION varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema ALL_PLUGINS PLUGIN_MATURITY varchar 12 36 utf8 utf8_general_ci varchar(12)
+3.0000 information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION varchar 80 240 utf8 utf8_general_ci varchar(80)
3.0000 information_schema CHARACTER_SETS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60)
@@ -678,7 +704,7 @@ NULL information_schema PARTITIONS CHECKSUM bigint NULL NULL NULL NULL bigint(21
3.0000 information_schema PARTITIONS TABLESPACE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PLUGINS PLUGIN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PLUGINS PLUGIN_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
-3.0000 information_schema PLUGINS PLUGIN_STATUS varchar 10 30 utf8 utf8_general_ci varchar(10)
+3.0000 information_schema PLUGINS PLUGIN_STATUS varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema PLUGINS PLUGIN_TYPE varchar 80 240 utf8 utf8_general_ci varchar(80)
3.0000 information_schema PLUGINS PLUGIN_TYPE_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
3.0000 information_schema PLUGINS PLUGIN_LIBRARY varchar 64 192 utf8 utf8_general_ci varchar(64)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
index 003f506fee8..ba5166691c1 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
@@ -4,6 +4,19 @@ AND table_name <> 'profiling' AND table_name not like 'innodb_%'
AND table_name not like 'pbxt_%'
ORDER BY table_schema, table_name, column_name;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT
+def information_schema ALL_PLUGINS LOAD_OPTION 11 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
+def information_schema ALL_PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
+def information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION 13 NULL YES varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80)
+def information_schema ALL_PLUGINS PLUGIN_DESCRIPTION 9 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext
+def information_schema ALL_PLUGINS PLUGIN_LIBRARY 6 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
+def information_schema ALL_PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20)
+def information_schema ALL_PLUGINS PLUGIN_LICENSE 10 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80)
+def information_schema ALL_PLUGINS PLUGIN_MATURITY 12 NO varchar 12 36 NULL NULL NULL utf8 utf8_general_ci varchar(12)
+def information_schema ALL_PLUGINS PLUGIN_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
+def information_schema ALL_PLUGINS PLUGIN_STATUS 3 NO varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16)
+def information_schema ALL_PLUGINS PLUGIN_TYPE 4 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80)
+def information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION 5 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20)
+def information_schema ALL_PLUGINS PLUGIN_VERSION 2 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20)
def information_schema CHARACTER_SETS CHARACTER_SET_NAME 1 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32)
def information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME 2 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32)
def information_schema CHARACTER_SETS DESCRIPTION 3 NO varchar 60 180 NULL NULL NULL utf8 utf8_general_ci varchar(60)
@@ -216,7 +229,7 @@ def information_schema PLUGINS PLUGIN_LIBRARY_VERSION 7 NULL YES varchar 20 60 N
def information_schema PLUGINS PLUGIN_LICENSE 10 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80)
def information_schema PLUGINS PLUGIN_MATURITY 12 NO varchar 12 36 NULL NULL NULL utf8 utf8_general_ci varchar(12)
def information_schema PLUGINS PLUGIN_NAME 1 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
-def information_schema PLUGINS PLUGIN_STATUS 3 NO varchar 10 30 NULL NULL NULL utf8 utf8_general_ci varchar(10)
+def information_schema PLUGINS PLUGIN_STATUS 3 NO varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16)
def information_schema PLUGINS PLUGIN_TYPE 4 NO varchar 80 240 NULL NULL NULL utf8 utf8_general_ci varchar(80)
def information_schema PLUGINS PLUGIN_TYPE_VERSION 5 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20)
def information_schema PLUGINS PLUGIN_VERSION 2 NO varchar 20 60 NULL NULL NULL utf8 utf8_general_ci varchar(20)
@@ -478,6 +491,19 @@ AND table_name <> 'profiling' AND table_name not like 'innodb_%'
AND table_name not like 'pbxt_%'
ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION;
COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE
+3.0000 information_schema ALL_PLUGINS PLUGIN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema ALL_PLUGINS PLUGIN_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
+3.0000 information_schema ALL_PLUGINS PLUGIN_STATUS varchar 16 48 utf8 utf8_general_ci varchar(16)
+3.0000 information_schema ALL_PLUGINS PLUGIN_TYPE varchar 80 240 utf8 utf8_general_ci varchar(80)
+3.0000 information_schema ALL_PLUGINS PLUGIN_TYPE_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
+3.0000 information_schema ALL_PLUGINS PLUGIN_LIBRARY varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema ALL_PLUGINS PLUGIN_LIBRARY_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
+3.0000 information_schema ALL_PLUGINS PLUGIN_AUTHOR varchar 64 192 utf8 utf8_general_ci varchar(64)
+1.0000 information_schema ALL_PLUGINS PLUGIN_DESCRIPTION longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
+3.0000 information_schema ALL_PLUGINS PLUGIN_LICENSE varchar 80 240 utf8 utf8_general_ci varchar(80)
+3.0000 information_schema ALL_PLUGINS LOAD_OPTION varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema ALL_PLUGINS PLUGIN_MATURITY varchar 12 36 utf8 utf8_general_ci varchar(12)
+3.0000 information_schema ALL_PLUGINS PLUGIN_AUTH_VERSION varchar 80 240 utf8 utf8_general_ci varchar(80)
3.0000 information_schema CHARACTER_SETS CHARACTER_SET_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema CHARACTER_SETS DEFAULT_COLLATE_NAME varchar 32 96 utf8 utf8_general_ci varchar(32)
3.0000 information_schema CHARACTER_SETS DESCRIPTION varchar 60 180 utf8 utf8_general_ci varchar(60)
@@ -683,7 +709,7 @@ NULL information_schema PARTITIONS CHECKSUM bigint NULL NULL NULL NULL bigint(21
3.0000 information_schema PARTITIONS TABLESPACE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PLUGINS PLUGIN_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PLUGINS PLUGIN_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
-3.0000 information_schema PLUGINS PLUGIN_STATUS varchar 10 30 utf8 utf8_general_ci varchar(10)
+3.0000 information_schema PLUGINS PLUGIN_STATUS varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema PLUGINS PLUGIN_TYPE varchar 80 240 utf8 utf8_general_ci varchar(80)
3.0000 information_schema PLUGINS PLUGIN_TYPE_VERSION varchar 20 60 utf8 utf8_general_ci varchar(20)
3.0000 information_schema PLUGINS PLUGIN_LIBRARY varchar 64 192 utf8 utf8_general_ci varchar(64)
diff --git a/mysql-test/suite/funcs_1/r/is_tables_is.result b/mysql-test/suite/funcs_1/r/is_tables_is.result
index 6aa2e3bb93d..6e92285dbaf 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_is.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_is.result
@@ -16,6 +16,29 @@ AND table_name not like 'pbxt_%' AND table_name not like 'xtradb_%'
ORDER BY table_schema,table_name;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
+TABLE_NAME ALL_PLUGINS
+TABLE_TYPE SYSTEM VIEW
+ENGINE MYISAM_OR_MARIA
+VERSION 10
+ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA information_schema
TABLE_NAME CHARACTER_SETS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
@@ -816,6 +839,29 @@ AND table_name not like 'pbxt_%' AND table_name not like 'xtradb_%'
ORDER BY table_schema,table_name;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
+TABLE_NAME ALL_PLUGINS
+TABLE_TYPE SYSTEM VIEW
+ENGINE MYISAM_OR_MARIA
+VERSION 10
+ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA information_schema
TABLE_NAME CHARACTER_SETS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
diff --git a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
index 6aa2e3bb93d..6e92285dbaf 100644
--- a/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_tables_is_embedded.result
@@ -16,6 +16,29 @@ AND table_name not like 'pbxt_%' AND table_name not like 'xtradb_%'
ORDER BY table_schema,table_name;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
+TABLE_NAME ALL_PLUGINS
+TABLE_TYPE SYSTEM VIEW
+ENGINE MYISAM_OR_MARIA
+VERSION 10
+ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA information_schema
TABLE_NAME CHARACTER_SETS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
@@ -816,6 +839,29 @@ AND table_name not like 'pbxt_%' AND table_name not like 'xtradb_%'
ORDER BY table_schema,table_name;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
+TABLE_NAME ALL_PLUGINS
+TABLE_TYPE SYSTEM VIEW
+ENGINE MYISAM_OR_MARIA
+VERSION 10
+ROW_FORMAT DYNAMIC_OR_PAGE
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA information_schema
TABLE_NAME CHARACTER_SETS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 179d0cd814e..f9cdbb13d61 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -2490,8 +2490,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE option()
SELECT * from t1 where f2=f1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option()
-SELECT * from t1 where f2=f1' at line 1
+DROP PROCEDURE option;
CREATE PROCEDURE optionally()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'optionally()
@@ -8548,8 +8547,6 @@ CREATE PROCEDURE sp1()
BEGIN
declare option char;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option char;
-END' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -10773,11 +10770,7 @@ BEGIN
declare option condition for sqlstate '02000';
declare exit handler for option set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option condition for sqlstate '02000';
-declare exit handler for option set @var2' at line 3
DROP PROCEDURE IF EXISTS sp1;
-Warnings:
-Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
declare optionally condition for sqlstate '02000';
@@ -12957,7 +12950,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare option handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option handler for sqlstate '02000' set @var2 = 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '02000' set @var2 = 1;
END' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test
index 3bd3199da4e..69406a57a00 100644
--- a/mysql-test/suite/funcs_1/t/storedproc.test
+++ b/mysql-test/suite/funcs_1/t/storedproc.test
@@ -1507,9 +1507,9 @@ CREATE PROCEDURE on()
CREATE PROCEDURE optimize()
SELECT * from t1 where f2=f1;
---error ER_PARSE_ERROR
CREATE PROCEDURE option()
SELECT * from t1 where f2=f1;
+DROP PROCEDURE option;
--error ER_PARSE_ERROR
CREATE PROCEDURE optionally()
@@ -10171,7 +10171,6 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
BEGIN
declare option char;
@@ -12755,7 +12754,6 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
declare option condition for sqlstate '02000';
diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result
index 95be170b5f8..630b16433a4 100644
--- a/mysql-test/suite/handler/aria.result
+++ b/mysql-test/suite/handler/aria.result
@@ -586,7 +586,7 @@ Note 1051 Unknown table 't1'
create table t1 (a int not null) ENGINE=csv;
--> client 2
handler t1 open;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option
--> client 1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/suite/handler/heap.result b/mysql-test/suite/handler/heap.result
index 8b526335024..55f9fd41c7a 100644
--- a/mysql-test/suite/handler/heap.result
+++ b/mysql-test/suite/handler/heap.result
@@ -586,7 +586,7 @@ Note 1051 Unknown table 't1'
create table t1 (a int not null) ENGINE=csv;
--> client 2
handler t1 open;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option
--> client 1
drop table t1;
create table t1 (a int);
@@ -1728,9 +1728,9 @@ a b
4 40
5 50
HANDLER t1 READ a FIRST;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
HANDLER t1 READ a LAST;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
HANDLER t1 READ b FIRST LIMIT 2;
a b
1 10
@@ -1781,11 +1781,11 @@ create table t1 (f1 integer not null, key (f1)) engine=Memory;
insert into t1 values (1);
HANDLER t1 OPEN;
HANDLER t1 READ f1 NEXT;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
HANDLER t1 READ f1 NEXT;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
HANDLER t1 READ f1 NEXT;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
HANDLER t1 CLOSE;
DROP TABLE t1;
End of 5.3 tests
diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result
index db36640ea39..d4103ddd6ff 100644
--- a/mysql-test/suite/handler/innodb.result
+++ b/mysql-test/suite/handler/innodb.result
@@ -587,7 +587,7 @@ Note 1051 Unknown table 't1'
create table t1 (a int not null) ENGINE=csv;
--> client 2
handler t1 open;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option
--> client 1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result
index 96d21e7373a..cebbc2784df 100644
--- a/mysql-test/suite/handler/interface.result
+++ b/mysql-test/suite/handler/interface.result
@@ -269,7 +269,7 @@ handler t1 open;
lock table t1 write;
alter table t1 engine=csv;
handler t1 read a next;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option
handler t1 close;
unlock tables;
drop table t1;
diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result
index e8abe8047cd..980b87768da 100644
--- a/mysql-test/suite/handler/myisam.result
+++ b/mysql-test/suite/handler/myisam.result
@@ -586,7 +586,7 @@ Note 1051 Unknown table 't1'
create table t1 (a int not null) ENGINE=csv;
--> client 2
handler t1 open;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
+ERROR HY000: Storage engine CSV of the table `test`.`t1` doesn't have this option
--> client 1
drop table t1;
create table t1 (a int);
diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result
index ae562a0dda1..0142cfa66b0 100644
--- a/mysql-test/suite/heap/heap.result
+++ b/mysql-test/suite/heap/heap.result
@@ -738,6 +738,26 @@ SELECT c2 FROM t1;
c2
0
DROP TABLE t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+color enum('GREEN', 'WHITE') DEFAULT NULL,
+ts int,
+PRIMARY KEY (id),
+KEY color (color) USING HASH
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES("1","GREEN",1);
+INSERT INTO t1 VALUES("2","GREEN",1);
+INSERT INTO t1 VALUES("3","GREEN",1);
+INSERT INTO t1 VALUES("4","GREEN",1);
+INSERT INTO t1 VALUES("5","GREEN",1);
+INSERT INTO t1 VALUES("6","GREEN",1);
+DELETE FROM t1 WHERE id = 1;
+INSERT INTO t1 VALUES("7","GREEN", 2);
+DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN';
+SELECT * from t1;
+id color ts
+7 GREEN 2
+DROP TABLE t1;
CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100;
insert into t1 values(1);
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
@@ -790,3 +810,22 @@ select data_length,index_length from information_schema.tables where table_schem
data_length index_length
81024 121024
drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL AUTO_INCREMENT,
+color enum('GREEN', 'WHITE') DEFAULT NULL,
+ts int,
+PRIMARY KEY (id),
+KEY color (color) USING HASH
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES("1","GREEN",1);
+INSERT INTO t1 VALUES("2","GREEN",1);
+INSERT INTO t1 VALUES("3","GREEN",1);
+INSERT INTO t1 VALUES("4","GREEN",1);
+INSERT INTO t1 VALUES("5","GREEN",1);
+INSERT INTO t1 VALUES("6","GREEN",1);
+DELETE FROM t1 WHERE id = 1;
+INSERT INTO t1 VALUES("7","GREEN", 2);
+DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN';
+SELECT * from t1 WHERE ts = 1 AND color = 'GREEN';
+id color ts
+DROP TABLE t1;
diff --git a/mysql-test/suite/heap/heap.test b/mysql-test/suite/heap/heap.test
index 6f5046af139..ef2527beeb0 100644
--- a/mysql-test/suite/heap/heap.test
+++ b/mysql-test/suite/heap/heap.test
@@ -487,6 +487,32 @@ SELECT c2 FROM t1;
DROP TABLE t1;
#
+# BUG#51763 Can't delete rows from MEMORY table with HASH key
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ color enum('GREEN', 'WHITE') DEFAULT NULL,
+ ts int,
+ PRIMARY KEY (id),
+ KEY color (color) USING HASH
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES("1","GREEN",1);
+INSERT INTO t1 VALUES("2","GREEN",1);
+INSERT INTO t1 VALUES("3","GREEN",1);
+INSERT INTO t1 VALUES("4","GREEN",1);
+INSERT INTO t1 VALUES("5","GREEN",1);
+INSERT INTO t1 VALUES("6","GREEN",1);
+DELETE FROM t1 WHERE id = 1;
+INSERT INTO t1 VALUES("7","GREEN", 2);
+DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN';
+SELECT * from t1;
+DROP TABLE t1;
+
+# End of 5.1 tests
+
+#
# Show that MIN_ROWS and MAX_ROWS have an effect on how data_length
# and index_length are allocated.
# Result is different for 32 / 64 bit machines as pointer lengths are different
@@ -537,3 +563,27 @@ insert into t1 select rand(100000000) from t1;
--replace_result 40512 81024 60512 121024
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
drop table t1;
+
+#
+# BUG#51763 Can't delete rows from MEMORY table with HASH key
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ color enum('GREEN', 'WHITE') DEFAULT NULL,
+ ts int,
+ PRIMARY KEY (id),
+ KEY color (color) USING HASH
+) ENGINE=MEMORY DEFAULT CHARSET=utf8;
+
+INSERT INTO t1 VALUES("1","GREEN",1);
+INSERT INTO t1 VALUES("2","GREEN",1);
+INSERT INTO t1 VALUES("3","GREEN",1);
+INSERT INTO t1 VALUES("4","GREEN",1);
+INSERT INTO t1 VALUES("5","GREEN",1);
+INSERT INTO t1 VALUES("6","GREEN",1);
+DELETE FROM t1 WHERE id = 1;
+INSERT INTO t1 VALUES("7","GREEN", 2);
+DELETE FROM t1 WHERE ts = 1 AND color = 'GREEN';
+SELECT * from t1 WHERE ts = 1 AND color = 'GREEN';
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def
index 0e7cd067056..ad1323d4857 100644
--- a/mysql-test/suite/innodb/disabled.def
+++ b/mysql-test/suite/innodb/disabled.def
@@ -9,5 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-
-innodb_bug12400341: variable innodb_trx_rseg_n_slots_debug is removed in MariaDB
+innodb_bug14676111: MDEV-4396
diff --git a/mysql-test/suite/innodb/r/help_url.result b/mysql-test/suite/innodb/r/help_url.result
index 214bf9f4e22..6d2b03f294c 100644
--- a/mysql-test/suite/innodb/r/help_url.result
+++ b/mysql-test/suite/innodb/r/help_url.result
@@ -3,7 +3,7 @@ set global innodb_file_per_table=1, innodb_file_format=Barracuda;
create table t1 (i int) engine=InnoDB;
alter table t1 discard tablespace;
select * from t1;
-ERROR HY000: Got error -1 "Internal error < 0 (Not system error)" from storage engine
+ERROR HY000: Got error -1 "Internal error < 0 (Not system error)" from storage engine InnoDB
InnoDB: http://dev.mysql.com/doc/refman/10.0/en/innodb-troubleshooting.html
drop table t1;
set global innodb_file_per_table=default, innodb_file_format=default;
diff --git a/mysql-test/suite/innodb/r/innodb-create-options.result b/mysql-test/suite/innodb/r/innodb-create-options.result
index c73baa60d42..c32af26c22d 100644
--- a/mysql-test/suite/innodb/r/innodb-create-options.result
+++ b/mysql-test/suite/innodb/r/innodb-create-options.result
@@ -10,11 +10,11 @@ Note 1051 Unknown table 't1'
# 'FIXED' is sent to InnoDB since it is used by MyISAM.
# But it is an invalid mode in InnoDB
CREATE TABLE t1 ( i INT ) ROW_FORMAT=FIXED;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: invalid ROW_FORMAT specifier.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
@@ -46,11 +46,11 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Compact
ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: invalid ROW_FORMAT specifier.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Compact
@@ -58,23 +58,23 @@ t1 Compact
# KEY_BLOCK_SIZE is incompatible with COMPACT, REDUNDANT, & DYNAMIC
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=1;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=2;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
Level Code Message
@@ -104,29 +104,29 @@ t1 Compressed key_block_size=16
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT );
ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: invalid ROW_FORMAT specifier.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
Level Code Message
@@ -146,11 +146,11 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Compact row_format=COMPACT
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
Level Code Message
@@ -158,11 +158,11 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Redundant row_format=REDUNDANT
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
SHOW WARNINGS;
Level Code Message
@@ -170,11 +170,11 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Dynamic row_format=DYNAMIC
ALTER TABLE t1 KEY_BLOCK_SIZE=8;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
Level Code Message
@@ -212,23 +212,23 @@ t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
ALTER TABLE t1 ROW_FORMAT=COMPACT;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
Level Code Message
@@ -250,11 +250,11 @@ t1 Compact row_format=COMPACT
# Test 6) StrictMode=ON, CREATE with an invalid KEY_BLOCK_SIZE.
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
# Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
# and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope
# and that they can be set to default values during strict mode.
@@ -263,23 +263,23 @@ DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
Level Code Message
@@ -298,34 +298,34 @@ CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
SHOW WARNINGS;
Level Code Message
ALTER TABLE t1 KEY_BLOCK_SIZE=8;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SET GLOBAL innodb_file_format=Barracuda;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET GLOBAL innodb_file_format=Antelope;
ALTER TABLE t1 ADD COLUMN f1 INT;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
@@ -340,23 +340,23 @@ SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=OFF;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=16;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
Level Code Message
@@ -375,23 +375,23 @@ CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
SHOW WARNINGS;
Level Code Message
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=COMPACT;
SHOW WARNINGS;
Level Code Message
@@ -415,12 +415,12 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET GLOBAL innodb_file_per_table=OFF;
ALTER TABLE t1 ADD COLUMN f1 INT;
-ERROR HY000: Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1005 Can't create table '#sql-temporary' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index 0f004772153..9130b3a4ef2 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -545,7 +545,7 @@ t4 CREATE TABLE `t4` (
CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t3 add constraint dc foreign key (a) references t1(a);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 121 "Duplicate key on write or update")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
@@ -956,7 +956,7 @@ Table Op Msg_type Msg_text
test.t1 check status OK
explain select * from t1 where b like 'adfd%';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
+1 SIMPLE t1 range b b 769 NULL 11 Using where
drop table t1;
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
@@ -1146,17 +1146,17 @@ PRIMARY KEY (c1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-zip.result b/mysql-test/suite/innodb/r/innodb-zip.result
index 8f920b9212e..3f0c8b43f0c 100644
--- a/mysql-test/suite/innodb/r/innodb-zip.result
+++ b/mysql-test/suite/innodb/r/innodb-zip.result
@@ -203,11 +203,11 @@ drop table t1;
set innodb_strict_mode = on;
create table t1 (id int primary key) engine = innodb key_block_size = 0;
create table t2 (id int primary key) engine = innodb key_block_size = 9;
-ERROR HY000: Can't create table 'test.t2' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.t2' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t2` (errno: 140 "Wrong create options")
create table t3 (id int primary key) engine = innodb key_block_size = 1;
create table t4 (id int primary key) engine = innodb key_block_size = 2;
create table t5 (id int primary key) engine = innodb key_block_size = 4;
@@ -237,25 +237,25 @@ create table t1 (id int primary key) engine = innodb
key_block_size = 8 row_format = compressed;
create table t2 (id int primary key) engine = innodb
key_block_size = 8 row_format = redundant;
-ERROR HY000: Can't create table 'test.t2' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t2` (errno: 140 "Wrong create options")
create table t3 (id int primary key) engine = innodb
key_block_size = 8 row_format = compact;
-ERROR HY000: Can't create table 'test.t3' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t3' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
create table t4 (id int primary key) engine = innodb
key_block_size = 8 row_format = dynamic;
-ERROR HY000: Can't create table 'test.t4' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t4' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
create table t5 (id int primary key) engine = innodb
key_block_size = 8 row_format = default;
SELECT table_schema, table_name, row_format, data_length, index_length
@@ -268,28 +268,28 @@ test t5 Compressed 8192 0
drop table t1, t5;
create table t1 (id int primary key) engine = innodb
key_block_size = 9 row_format = redundant;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 140 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = compact;
-ERROR HY000: Can't create table 'test.t2' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 140 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t2` (errno: 140 "Wrong create options")
create table t2 (id int primary key) engine = innodb
key_block_size = 9 row_format = dynamic;
-ERROR HY000: Can't create table 'test.t2' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
Warning 140 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t2` (errno: 140 "Wrong create options")
SELECT table_schema, table_name, row_format, data_length, index_length
FROM information_schema.tables WHERE engine='innodb';
table_schema table_name row_format data_length index_length
@@ -297,47 +297,47 @@ mysql innodb_index_stats Compact 16384 0
mysql innodb_table_stats Compact 16384 0
set global innodb_file_per_table = off;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
create table t2 (id int primary key) engine = innodb key_block_size = 2;
-ERROR HY000: Can't create table 'test.t2' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t2' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t2` (errno: 140 "Wrong create options")
create table t3 (id int primary key) engine = innodb key_block_size = 4;
-ERROR HY000: Can't create table 'test.t3' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t3' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
create table t4 (id int primary key) engine = innodb key_block_size = 8;
-ERROR HY000: Can't create table 'test.t4' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t4' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
create table t5 (id int primary key) engine = innodb key_block_size = 16;
-ERROR HY000: Can't create table 'test.t5' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t5' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
create table t6 (id int primary key) engine = innodb row_format = compressed;
-ERROR HY000: Can't create table 'test.t6' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t6` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t6' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t6` (errno: 140 "Wrong create options")
create table t7 (id int primary key) engine = innodb row_format = dynamic;
-ERROR HY000: Can't create table 'test.t7' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t7` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t7' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t7` (errno: 140 "Wrong create options")
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format, data_length, index_length
@@ -351,47 +351,47 @@ drop table t8, t9;
set global innodb_file_per_table = on;
set global innodb_file_format = `0`;
create table t1 (id int primary key) engine = innodb key_block_size = 1;
-ERROR HY000: Can't create table 'test.t1' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t1' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
create table t2 (id int primary key) engine = innodb key_block_size = 2;
-ERROR HY000: Can't create table 'test.t2' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t2' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t2` (errno: 140 "Wrong create options")
create table t3 (id int primary key) engine = innodb key_block_size = 4;
-ERROR HY000: Can't create table 'test.t3' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t3' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
create table t4 (id int primary key) engine = innodb key_block_size = 8;
-ERROR HY000: Can't create table 'test.t4' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t4` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t4' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t4` (errno: 140 "Wrong create options")
create table t5 (id int primary key) engine = innodb key_block_size = 16;
-ERROR HY000: Can't create table 'test.t5' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t5` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t5' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t5` (errno: 140 "Wrong create options")
create table t6 (id int primary key) engine = innodb row_format = compressed;
-ERROR HY000: Can't create table 'test.t6' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t6` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t6' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t6` (errno: 140 "Wrong create options")
create table t7 (id int primary key) engine = innodb row_format = dynamic;
-ERROR HY000: Can't create table 'test.t7' (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t7` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 140 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t7' (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t7` (errno: 140 "Wrong create options")
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format, data_length, index_length
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index 934311adcaf..da5f77fcdca 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -2525,13 +2525,13 @@ drop table t1;
set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
-ERROR HY000: Can't create table 'test.t1' (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
set foreign_key_checks=1;
drop table t2;
set foreign_key_checks=0;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
-ERROR HY000: Can't create table 'test.t2' (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
set foreign_key_checks=1;
drop table t1;
set foreign_key_checks=0;
diff --git a/mysql-test/suite/innodb/r/innodb_bug12400341.result b/mysql-test/suite/innodb/r/innodb_bug12400341.result
index 551e94f5e77..86eaa83980d 100644
--- a/mysql-test/suite/innodb/r/innodb_bug12400341.result
+++ b/mysql-test/suite/innodb/r/innodb_bug12400341.result
@@ -1,4 +1,6 @@
call mtr.add_suppression("InnoDB: Warning: cannot find a free slot for an undo log. Do you have too");
+set @old_innodb_undo_logs = @@innodb_undo_logs;
+set global innodb_undo_logs=1;
show variables like "max_connections";
Variable_name Value
max_connections 64
@@ -15,7 +17,7 @@ select count(*) from information_schema.processlist;
count(*)
33
CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
-ERROR HY000: Can't create table 'mysqltest.testtable' (errno: 177)
+ERROR HY000: Can't create table `mysqltest`.`testtable` (errno: 177 "Too many active concurrent transactions")
select count(*) from information_schema.processlist;
count(*)
33
@@ -23,3 +25,4 @@ select count(*) from information_schema.processlist;
count(*)
33
drop database mysqltest;
+set global innodb_undo_logs = @old_innodb_undo_logs;
diff --git a/mysql-test/suite/innodb/r/innodb_bug14147491.result b/mysql-test/suite/innodb/r/innodb_bug14147491.result
new file mode 100644
index 00000000000..6279f85f676
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug14147491.result
@@ -0,0 +1,17 @@
+CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
+CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
+# Create and populate the table to be corrupted
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
+INSERT INTO t1 (b) VALUES ('corrupt me');
+INSERT INTO t1 (b) VALUES ('corrupt me');
+# Restart server to flush buffers
+# Corrupt the table
+Munged a string.
+Munged a string.
+# Write file to make mysql-test-run.pl expect crash and restart
+SELECT * FROM t1;
+ERROR HY000: Lost connection to MySQL server during query
+# Turn on reconnect
+# Wait for server to fully start
+# Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug14676111.result b/mysql-test/suite/innodb/r/innodb_bug14676111.result
new file mode 100644
index 00000000000..ebecd1d00cb
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug14676111.result
@@ -0,0 +1,53 @@
+drop table if exists t1;
+CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
+set global innodb_limit_optimistic_insert_debug = 2;
+insert into t1 values (1);
+insert into t1 values (5);
+insert into t1 values (4);
+insert into t1 values (3);
+insert into t1 values (2);
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+DATA_LENGTH / 16384
+10.0000
+delete from t1 where a=4;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+DATA_LENGTH / 16384
+8.0000
+delete from t1 where a=5;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+DATA_LENGTH / 16384
+5.0000
+set global innodb_limit_optimistic_insert_debug = 10000;
+delete from t1 where a=2;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+DATA_LENGTH / 16384
+3.0000
+insert into t1 values (2);
+delete from t1 where a=2;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+DATA_LENGTH / 16384
+2.0000
+insert into t1 values (2);
+delete from t1 where a=2;
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+DATA_LENGTH / 16384
+1.0000
+drop table t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug46000.result b/mysql-test/suite/innodb/r/innodb_bug46000.result
index 9ee0c935d71..f3dff71539b 100644
--- a/mysql-test/suite/innodb/r/innodb_bug46000.result
+++ b/mysql-test/suite/innodb/r/innodb_bug46000.result
@@ -6,7 +6,7 @@ show warnings;
Level Code Message
Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
-Error 1005 Can't create table 'test.bug46000' (errno: -1 "Internal error < 0 (Not system error)")
+Error 1005 Can't create table `test`.`bug46000` (errno: -1 "Internal error < 0 (Not system error)")
create table bug46000(id int) engine=innodb;
create index GEN_CLUST_INDEX on bug46000(id);
ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
diff --git a/mysql-test/suite/innodb/r/innodb_bug47777.result b/mysql-test/suite/innodb/r/innodb_bug47777.result
index fbba47edcfc..6625c400d84 100644
--- a/mysql-test/suite/innodb/r/innodb_bug47777.result
+++ b/mysql-test/suite/innodb/r/innodb_bug47777.result
@@ -3,11 +3,11 @@ insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
count(*)
1
-update bug47777 set c2=GeomFromText('POINT(1 1)');
+update bug47777 set c2=GeomFromText('linestring(1 1)');
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
count(*)
0
-select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+select count(*) from bug47777 where c2 = GeomFromText('linestring(1 1)');
count(*)
1
drop table bug47777;
diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result
index 36b37e4ccd8..21c1234d7d3 100644
--- a/mysql-test/suite/innodb/r/innodb_gis.result
+++ b/mysql-test/suite/innodb/r/innodb_gis.result
@@ -598,4 +598,4 @@ create table t1 (a int not null, b linestring not null, unique key b (b(12)));
create unique index a on t1(a);
drop table t1;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
-ERROR HY000: The used table type doesn't support SPATIAL indexes
+ERROR HY000: The storage engine InnoDB doesn't support SPATIAL indexes
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index be2b4b28f6a..7247b26e86b 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -343,7 +343,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
explain select distinct f1, f2 from t1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
+1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index
drop table t1;
CREATE TABLE t1 (id int(11) NOT NULL PRIMARY KEY, name varchar(20),
INDEX (name));
@@ -630,12 +630,13 @@ a
DROP TABLE t1,t2,t3;
create table t1 (a int) engine=innodb;
select * from bug29807;
-ERROR 42S02: Table 'test.bug29807' doesn't exist
+ERROR 42S02: Table 'test.bug29807' doesn't exist in engine
drop table t1;
drop table bug29807;
-ERROR 42S02: Unknown table 'bug29807'
-create table bug29807 (a int);
-drop table bug29807;
+Warnings:
+Warning 155 Table 'test.bug29807' doesn't exist in engine
+call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal");
+call mtr.add_suppression("Cannot find or open table test\/bug29807 from");
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
switch to connection c1
diff --git a/mysql-test/suite/innodb/t/help_url.test b/mysql-test/suite/innodb/t/help_url.test
index 2c70cd296cc..075d1180649 100644
--- a/mysql-test/suite/innodb/t/help_url.test
+++ b/mysql-test/suite/innodb/t/help_url.test
@@ -2,6 +2,7 @@
# MDEV-4273 MYSQL_VERSION_MAJOR.MYSQL_VERSION_MINOR not replaced
#
--source include/have_innodb.inc
+--source include/not_embedded.inc
call mtr.add_suppression('InnoDB: Error');
diff --git a/mysql-test/suite/innodb/t/innodb-create-options.test b/mysql-test/suite/innodb/t/innodb-create-options.test
index 12c24820031..0f8e6f8dda2 100644
--- a/mysql-test/suite/innodb/t/innodb-create-options.test
+++ b/mysql-test/suite/innodb/t/innodb-create-options.test
@@ -96,10 +96,10 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=0;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
@@ -141,25 +141,25 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
--echo # Test 3) StrictMode=ON, ALTER with each ROW_FORMAT & a valid non-zero KEY_BLOCK_SIZE
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT );
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=FIXED KEY_BLOCK_SIZE=1;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=COMPACT KEY_BLOCK_SIZE=2;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=DYNAMIC KEY_BLOCK_SIZE=4;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=REDUNDANT KEY_BLOCK_SIZE=8;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
@@ -173,26 +173,26 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 KEY_BLOCK_SIZE=4;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 KEY_BLOCK_SIZE=8;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
@@ -213,20 +213,20 @@ CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=2;
SHOW CREATE TABLE t1;
ALTER TABLE t1 ADD COLUMN f1 INT;
SHOW CREATE TABLE t1;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=COMPACT;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
@@ -276,29 +276,29 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 KEY_BLOCK_SIZE=8;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
SET GLOBAL innodb_file_format=Barracuda;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET GLOBAL innodb_file_format=Antelope;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD COLUMN f1 INT;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
@@ -337,20 +337,20 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 KEY_BLOCK_SIZE=1;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=COMPACT;
SHOW WARNINGS;
@@ -365,10 +365,10 @@ SET GLOBAL innodb_file_per_table=ON;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET GLOBAL innodb_file_per_table=OFF;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD COLUMN f1 INT;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ / - .*[0-9]*)/)/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
SHOW WARNINGS;
ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index cea9055b873..a8ef524c3e9 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb/t/innodb-index.test
@@ -250,7 +250,7 @@ insert into t2 values (1,1,1,1,1);
commit;
alter table t4 add constraint dc foreign key (a) references t1(a);
show create table t4;
---replace_regex /'test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
# a foreign key 'test/dc' already exists
--error ER_CANT_CREATE_TABLE
alter table t3 add constraint dc foreign key (a) references t1(a);
@@ -620,20 +620,20 @@ CREATE TABLE t2(
PRIMARY KEY (c1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
+--replace_regex /#sql-[0-9a-f_]+/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb/t/innodb-zip.test
index 7e2e2d1d3c9..67bcda7697e 100644
--- a/mysql-test/suite/innodb/t/innodb-zip.test
+++ b/mysql-test/suite/innodb/t/innodb-zip.test
@@ -1,9 +1,5 @@
-- source include/have_innodb.inc
-if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.1.8-29.3 or earlier
-}
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test
index 4e5d6d7ce90..532870fd29c 100644
--- a/mysql-test/suite/innodb/t/innodb.test
+++ b/mysql-test/suite/innodb/t/innodb.test
@@ -4,11 +4,6 @@
# .\sync\sync0sync.c line 324
# is fixed
-if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.1.8-29.3 or earlier
-}
-
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
diff --git a/mysql-test/suite/innodb/t/innodb_bug12400341.test b/mysql-test/suite/innodb/t/innodb_bug12400341.test
index 2ab1be81f6d..b9f8c503dc5 100644
--- a/mysql-test/suite/innodb/t/innodb_bug12400341.test
+++ b/mysql-test/suite/innodb/t/innodb_bug12400341.test
@@ -14,6 +14,9 @@ set @old_innodb_trx_rseg_n_slots_debug = @@innodb_trx_rseg_n_slots_debug;
set global innodb_trx_rseg_n_slots_debug = 32;
--enable_query_log
+set @old_innodb_undo_logs = @@innodb_undo_logs;
+set global innodb_undo_logs=1;
+
show variables like "max_connections";
show variables like "innodb_thread_concurrency";
show variables like "innodb_file_per_table";
@@ -98,6 +101,8 @@ while ($c)
#
drop database mysqltest;
+set global innodb_undo_logs = @old_innodb_undo_logs;
+
--disable_query_log
set global innodb_trx_rseg_n_slots_debug = @old_innodb_trx_rseg_n_slots_debug;
--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt b/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt
new file mode 100644
index 00000000000..6b82baca147
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug14147491-master.opt
@@ -0,0 +1 @@
+--innodb_file_per_table=1 --skip-stack-trace --skip-core-file
diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test
new file mode 100644
index 00000000000..ee3519c53fc
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test
@@ -0,0 +1,75 @@
+#
+# Test opening a corrupted table.
+#
+
+# Don't test under valgrind, memory leaks will occur
+source include/not_valgrind.inc;
+# Avoid CrashReporter popup on Mac
+source include/not_crashrep.inc;
+# Don't test under embedded
+source include/not_embedded.inc;
+# Require InnoDB
+source include/have_innodb.inc;
+
+CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
+CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
+
+--echo # Create and populate the table to be corrupted
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
+INSERT INTO t1 (b) VALUES ('corrupt me');
+--disable_query_log
+--let $i = 10
+while ($i)
+{
+ INSERT INTO t1 (b) VALUES (REPEAT('abcdefghijklmnopqrstuvwxyz', 100));
+ dec $i;
+}
+--enable_query_log
+INSERT INTO t1 (b) VALUES ('corrupt me');
+
+--echo # Restart server to flush buffers
+source include/restart_mysqld.inc;
+
+--echo # Corrupt the table
+let $MYSQLD_DATADIR=`select @@datadir`;
+let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+
+perl;
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+
+my $ibd_file = $ENV{'t1_IBD'};
+
+my $chunk;
+my $len;
+
+sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
+
+while ($len = sysread IBD_FILE, $chunk, 1024)
+{
+ if ($chunk =~ s/corrupt me/korrupt me/)
+ {
+ print "Munged a string.\n";
+ sysseek IBD_FILE, -$len, SEEK_CUR;
+ syswrite IBD_FILE, $chunk, $len;
+ }
+}
+
+close IBD_FILE;
+EOF
+
+--echo # Write file to make mysql-test-run.pl expect crash and restart
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--error 2013
+SELECT * FROM t1;
+
+--echo # Turn on reconnect
+--enable_reconnect
+
+--echo # Wait for server to fully start
+--source include/wait_until_connected_again.inc
+
+--echo # Cleanup
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test
new file mode 100644
index 00000000000..fadd111fdc9
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test
@@ -0,0 +1,128 @@
+# Test for bug #14676111: WRONG PAGE_LEVEL WRITTEN FOR UPPER THAN FATHER PAGE AT BTR_LIFT_PAGE_UP()
+
+-- source include/have_innodb.inc
+-- source include/have_debug.inc
+
+if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
+{
+ --skip Test requires InnoDB built with UNIV_DEBUG definition.
+}
+
+--disable_query_log
+set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
+--enable_query_log
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
+
+let $wait_condition=
+ SELECT VARIABLE_VALUE < 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+ WHERE VARIABLE_NAME = 'INNODB_PURGE_TRX_ID_AGE';
+
+#
+# make 4 leveled straight tree
+#
+set global innodb_limit_optimistic_insert_debug = 2;
+insert into t1 values (1);
+insert into t1 values (5);
+#current tree form
+# (1, 5)
+
+insert into t1 values (4);
+#records in a page is limited to 2 artificially. root rise occurs
+#current tree form
+# (1, 5)
+#(1, 4) (5)
+
+insert into t1 values (3);
+#current tree form
+# (1, 5)
+# (1, 4) (5)
+#(1, 3) (4) (5)
+
+insert into t1 values (2);
+#current tree form
+# (1, 5)
+# (1, 4) (5)
+# (1, 3) (4) (5)
+#(1, 2) (3) (4) (5)
+
+analyze table t1;
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+
+delete from t1 where a=4;
+--source include/wait_condition.inc
+#deleting 1 record of 2 records don't cause merge artificially.
+#current tree form
+# (1, 5)
+# (1) (5)
+# (1, 3) (5)
+#(1, 2) (3) (5)
+
+analyze table t1;
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+
+delete from t1 where a=5;
+--source include/wait_condition.inc
+#deleting 1 record of 2 records don't cause merge artificially.
+#current tree form
+# (1)
+# (1)
+# (1, 3) <- lift up this level next, when deleting node ptr
+#(1, 2) (3) <- merged next
+
+analyze table t1;
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+
+#
+# cause merge at level 0
+#
+
+#disable the artificial limitation of records in a page
+set global innodb_limit_optimistic_insert_debug = 10000;
+delete from t1 where a=2;
+--source include/wait_condition.inc
+#merge page occurs. and lift up occurs.
+#current tree form
+# (1)
+# (1)
+# (1, 3)
+
+analyze table t1;
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+
+insert into t1 values (2);
+#current tree form
+# (1)
+# (1) <- lift up this level next, because it is not root
+# (1, 2, 3)
+
+delete from t1 where a=2;
+--source include/wait_condition.inc
+#current tree form
+# (1)
+# (1, 3)
+
+analyze table t1;
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+
+insert into t1 values (2);
+#current tree form
+# (1)
+# (1, 2, 3) <- lift up this level next, because the father is root
+
+delete from t1 where a=2;
+--source include/wait_condition.inc
+#current tree form
+# (1, 3)
+
+analyze table t1;
+select DATA_LENGTH / 16384 from information_schema.TABLES where TABLE_SCHEMA = 'test' and TABLE_NAME = 't1';
+
+drop table t1;
+
+--disable_query_log
+set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
+--enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug47777.test b/mysql-test/suite/innodb/t/innodb_bug47777.test
index d00509c3814..575d84b97e9 100644
--- a/mysql-test/suite/innodb/t/innodb_bug47777.test
+++ b/mysql-test/suite/innodb/t/innodb_bug47777.test
@@ -14,11 +14,11 @@ insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
# Update table bug47777 should be successful.
-update bug47777 set c2=GeomFromText('POINT(1 1)');
+update bug47777 set c2=GeomFromText('linestring(1 1)');
# Verify the row get updated successfully. The original
-# c2 value should be changed to GeomFromText('POINT(1 1)').
+# c2 value should be changed to GeomFromText('linestring(1 1)').
select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
-select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+select count(*) from bug47777 where c2 = GeomFromText('linestring(1 1)');
drop table bug47777;
diff --git a/mysql-test/suite/innodb/t/innodb_bug53591.test b/mysql-test/suite/innodb/t/innodb_bug53591.test
index f0ed4b93c32..9a1c2afbccb 100644
--- a/mysql-test/suite/innodb/t/innodb_bug53591.test
+++ b/mysql-test/suite/innodb/t/innodb_bug53591.test
@@ -1,9 +1,5 @@
--source include/have_innodb.inc
-if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.1.8-29.3 or earlier
-}
let $file_format=`select @@innodb_file_format`;
let $file_per_table=`select @@innodb_file_per_table`;
diff --git a/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test b/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
index 776f5dae517..d7540dff36d 100644
--- a/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
+++ b/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
@@ -14,10 +14,6 @@
# #
######################################################################
-if (`select plugin_auth_version <= "1.1.8-29.3" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in XtraDB 1.1.8-29.3 or earlier
-}
# Save innodb variables
let $innodb_file_format_orig=`select @@innodb_file_format`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_sjis.result b/mysql-test/suite/jp/r/jp_create_db_sjis.result
index b7c09fbfbe9..93524e1c443 100644
--- a/mysql-test/suite/jp/r/jp_create_db_sjis.result
+++ b/mysql-test/suite/jp/r/jp_create_db_sjis.result
@@ -9,12 +9,12 @@ CREATE DATABASE `ƒ\\•\`;
SELECT schema_name from information_schema.schemata where schema_name <> 'mtr';
schema_name
information_schema
-ƒ\\•\
-“ú–{Œê
-ÆÎݺÞ
mysql
performance_schema
test
+ƒ\\•\
+“ú–{Œê
+ÆÎݺÞ
USE `ÆÎݺÞ`;
USE `“ú–{Œê`;
USE `ƒ\\•\`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_ucs2.result b/mysql-test/suite/jp/r/jp_create_db_ucs2.result
index 3832ff5a0c7..c6a2ff78b4f 100644
--- a/mysql-test/suite/jp/r/jp_create_db_ucs2.result
+++ b/mysql-test/suite/jp/r/jp_create_db_ucs2.result
@@ -10,12 +10,12 @@ CREATE DATABASE `íÜíÝíÞ`;
SELECT schema_name from information_schema.schemata where schema_name <> 'mtr';
schema_name
information_schema
-ÆüËܸì
-íÜíÝíÞ
-ŽÆŽÎŽÝŽºŽÞ
mysql
performance_schema
test
+ÆüËܸì
+íÜíÝíÞ
+ŽÆŽÎŽÝŽºŽÞ
USE `ŽÆŽÎŽÝŽºŽÞ`;
USE `ÆüËܸì`;
USE `íÜíÝíÞ`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_ujis.result b/mysql-test/suite/jp/r/jp_create_db_ujis.result
index d6bf31336fd..e5e0c2f1ad8 100644
--- a/mysql-test/suite/jp/r/jp_create_db_ujis.result
+++ b/mysql-test/suite/jp/r/jp_create_db_ujis.result
@@ -9,12 +9,12 @@ CREATE DATABASE `íÜíÝíÞ`;
SELECT schema_name from information_schema.schemata where schema_name <> 'mtr';
schema_name
information_schema
-ÆüËܸì
-íÜíÝíÞ
-ŽÆŽÎŽÝŽºŽÞ
mysql
performance_schema
test
+ÆüËܸì
+íÜíÝíÞ
+ŽÆŽÎŽÝŽºŽÞ
USE `ŽÆŽÎŽÝŽºŽÞ`;
USE `ÆüËܸì`;
USE `íÜíÝíÞ`;
diff --git a/mysql-test/suite/jp/r/jp_create_db_utf8.result b/mysql-test/suite/jp/r/jp_create_db_utf8.result
index 62202d43df0..f07a36fd7c7 100644
--- a/mysql-test/suite/jp/r/jp_create_db_utf8.result
+++ b/mysql-test/suite/jp/r/jp_create_db_utf8.result
@@ -9,12 +9,12 @@ CREATE DATABASE `龔龖龗`;
SELECT schema_name from information_schema.schemata where schema_name <> 'mtr';
schema_name
information_schema
-日本語
-龔龖龗
-ニホï¾ï½ºï¾ž
mysql
performance_schema
test
+日本語
+龔龖龗
+ニホï¾ï½ºï¾ž
USE `ニホï¾ï½ºï¾ž`;
USE `日本語`;
USE `龔龖龗`;
diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
index f4593f2f10a..ee7135c4851 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
+++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result
@@ -766,35 +766,35 @@ SPATIAL KEY (line)
) row_format=dynamic;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
-("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
-("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
-("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
-("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
-("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
-("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
-("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
-("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
-("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
-("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
-("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
-("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
-("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
-("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
-("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
-("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
-("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
-("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
-("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
-("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
-("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
-("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
-("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
-("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
-("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
-("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
-("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
-("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
-("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")),
+("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")),
+("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")),
+("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")),
+("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")),
+("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")),
+("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")),
+("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")),
+("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")),
+("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")),
+("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")),
+("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")),
+("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")),
+("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")),
+("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")),
+("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")),
+("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")),
+("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")),
+("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")),
+("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")),
+("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")),
+("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")),
+("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.test b/mysql-test/suite/maria/maria-gis-rtree-dynamic.test
index 166c88cab36..668d393d0b8 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.test
+++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.test
@@ -135,35 +135,35 @@ CREATE TABLE t1 (
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
- ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
- ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
- ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
- ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
- ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
- ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
- ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
- ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
- ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
- ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
- ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
- ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
- ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
- ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
- ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
- ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
- ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
- ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
- ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
- ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
- ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
- ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
- ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+ ("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+ ("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")),
+ ("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")),
+ ("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+ ("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+ ("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")),
+ ("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")),
+ ("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")),
+ ("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")),
+ ("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")),
+ ("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")),
+ ("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")),
+ ("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")),
+ ("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")),
+ ("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")),
+ ("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")),
+ ("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+ ("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+ ("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")),
+ ("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")),
+ ("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")),
+ ("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")),
+ ("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")),
+ ("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+ ("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")),
+ ("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")),
+ ("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")),
+ ("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")),
+ ("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.result b/mysql-test/suite/maria/maria-gis-rtree-trans.result
index c4e773c7e0a..dba56204172 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-trans.result
+++ b/mysql-test/suite/maria/maria-gis-rtree-trans.result
@@ -766,35 +766,35 @@ SPATIAL KEY (line)
) transactional=1 row_format=page;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
-("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
-("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
-("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
-("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
-("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
-("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
-("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
-("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
-("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
-("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
-("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
-("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
-("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
-("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
-("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
-("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
-("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
-("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
-("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
-("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
-("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
-("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
-("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
-("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
-("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
-("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
-("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
-("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
-("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")),
+("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")),
+("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")),
+("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")),
+("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")),
+("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")),
+("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")),
+("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")),
+("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")),
+("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")),
+("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")),
+("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")),
+("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")),
+("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")),
+("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")),
+("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")),
+("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")),
+("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")),
+("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")),
+("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")),
+("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")),
+("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")),
+("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.test b/mysql-test/suite/maria/maria-gis-rtree-trans.test
index ec1573c3e29..73f129d8df9 100644
--- a/mysql-test/suite/maria/maria-gis-rtree-trans.test
+++ b/mysql-test/suite/maria/maria-gis-rtree-trans.test
@@ -138,35 +138,35 @@ CREATE TABLE t1 (
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
- ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
- ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
- ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
- ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
- ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
- ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
- ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
- ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
- ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
- ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
- ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
- ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
- ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
- ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
- ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
- ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
- ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
- ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
- ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
- ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
- ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
- ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
- ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+ ("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+ ("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")),
+ ("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")),
+ ("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+ ("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+ ("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")),
+ ("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")),
+ ("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")),
+ ("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")),
+ ("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")),
+ ("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")),
+ ("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")),
+ ("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")),
+ ("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")),
+ ("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")),
+ ("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")),
+ ("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+ ("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+ ("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")),
+ ("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")),
+ ("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")),
+ ("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")),
+ ("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")),
+ ("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+ ("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")),
+ ("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")),
+ ("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")),
+ ("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")),
+ ("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
diff --git a/mysql-test/suite/maria/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result
index 430f240d83e..1a7b08169dc 100644
--- a/mysql-test/suite/maria/maria-gis-rtree.result
+++ b/mysql-test/suite/maria/maria-gis-rtree.result
@@ -766,35 +766,35 @@ SPATIAL KEY (line)
) transactional=0 row_format=page;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
-("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
-("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
-("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
-("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
-("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
-("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
-("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
-("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
-("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
-("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
-("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
-("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
-("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
-("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
-("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
-("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
-("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
-("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
-("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
-("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
-("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
-("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
-("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
-("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
-("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
-("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
-("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
-("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
-("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")),
+("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")),
+("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")),
+("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")),
+("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")),
+("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")),
+("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")),
+("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")),
+("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")),
+("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")),
+("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")),
+("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")),
+("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")),
+("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")),
+("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")),
+("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")),
+("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")),
+("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")),
+("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")),
+("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")),
+("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")),
+("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")),
+("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
drop table t1;
diff --git a/mysql-test/suite/maria/maria-gis-rtree.test b/mysql-test/suite/maria/maria-gis-rtree.test
index beffbfc99fe..a3845adb7b9 100644
--- a/mysql-test/suite/maria/maria-gis-rtree.test
+++ b/mysql-test/suite/maria/maria-gis-rtree.test
@@ -135,35 +135,35 @@ CREATE TABLE t1 (
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES
- ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
- ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
- ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
- ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
- ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
- ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
- ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
- ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
- ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
- ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
- ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
- ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
- ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
- ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
- ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
- ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
- ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
- ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
- ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
- ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
- ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
- ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
- ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
- ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
- ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
- ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+ ("Aadaouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+ ("Aadassiye", "pp", GeomFromText("LINESTRING(35.816667 36.216667)")),
+ ("Aadbel", "pp", GeomFromText("LINESTRING(34.533333 36.100000)")),
+ ("Aadchit", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+ ("Aadchite", "pp", GeomFromText("LINESTRING(33.347222 35.423611)")),
+ ("Aadchit el Qoussair", "pp", GeomFromText("LINESTRING(33.283333 35.483333)")),
+ ("Aaddaye", "pp", GeomFromText("LINESTRING(36.716667 40.833333)")),
+ ("'Aadeissa", "pp", GeomFromText("LINESTRING(32.823889 35.698889)")),
+ ("Aaderup", "pp", GeomFromText("LINESTRING(55.216667 11.766667)")),
+ ("Qalaat Aades", "pp", GeomFromText("LINESTRING(33.503333 35.377500)")),
+ ("A ad'ino", "pp", GeomFromText("LINESTRING(54.812222 38.209167)")),
+ ("Aadi Noia", "pp", GeomFromText("LINESTRING(13.800000 39.833333)")),
+ ("Aad La Macta", "pp", GeomFromText("LINESTRING(35.779444 -0.129167)")),
+ ("Aadland", "pp", GeomFromText("LINESTRING(60.366667 5.483333)")),
+ ("Aadliye", "pp", GeomFromText("LINESTRING(33.366667 36.333333)")),
+ ("Aadloun", "pp", GeomFromText("LINESTRING(33.403889 35.273889)")),
+ ("Aadma", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+ ("Aadma Asundus", "pp", GeomFromText("LINESTRING(58.798333 22.663889)")),
+ ("Aadmoun", "pp", GeomFromText("LINESTRING(34.150000 35.650000)")),
+ ("Aadneram", "pp", GeomFromText("LINESTRING(59.016667 6.933333)")),
+ ("Aadneskaar", "pp", GeomFromText("LINESTRING(58.083333 6.983333)")),
+ ("Aadorf", "pp", GeomFromText("LINESTRING(47.483333 8.900000)")),
+ ("Aadorp", "pp", GeomFromText("LINESTRING(52.366667 6.633333)")),
+ ("Aadouane", "pp", GeomFromText("LINESTRING(32.816667 35.983333)")),
+ ("Aadoui", "pp", GeomFromText("LINESTRING(34.450000 35.983333)")),
+ ("Aadouiye", "pp", GeomFromText("LINESTRING(34.583333 36.183333)")),
+ ("Aadouss", "pp", GeomFromText("LINESTRING(33.512500 35.601389)")),
+ ("Aadra", "pp", GeomFromText("LINESTRING(33.616667 36.500000)")),
+ ("Aadzi", "pp", GeomFromText("LINESTRING(38.100000 64.850000)"));
ALTER TABLE t1 ENABLE KEYS;
INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
diff --git a/mysql-test/suite/maria/maria-recovery-rtree-ft.result b/mysql-test/suite/maria/maria-recovery-rtree-ft.result
index 030421ae06a..5c6c791d8f6 100644
--- a/mysql-test/suite/maria/maria-recovery-rtree-ft.result
+++ b/mysql-test/suite/maria/maria-recovery-rtree-ft.result
@@ -4,7 +4,7 @@ create database mysqltest;
use mysqltest;
* shut down mysqld, removed logs, restarted it
CREATE TABLE t1 (
-line LINESTRING NOT NULL,
+line POINT NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
,SPATIAL key (line)
diff --git a/mysql-test/suite/maria/maria-recovery-rtree-ft.test b/mysql-test/suite/maria/maria-recovery-rtree-ft.test
index 11050ad676a..7112c00e5b7 100644
--- a/mysql-test/suite/maria/maria-recovery-rtree-ft.test
+++ b/mysql-test/suite/maria/maria-recovery-rtree-ft.test
@@ -31,7 +31,7 @@ use mysqltest;
let $mms_tables=2;
CREATE TABLE t1 (
- line LINESTRING NOT NULL,
+ line POINT NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32)
,SPATIAL key (line)
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result
index 6efd87df786..ddd0adade57 100644
--- a/mysql-test/suite/maria/maria.result
+++ b/mysql-test/suite/maria/maria.result
@@ -653,7 +653,7 @@ t1 1 a 1 a A 1000 NULL NULL YES BTREE
alter table t1 engine=heap;
alter table t1 disable keys;
Warnings:
-Note 1031 Table storage engine for 't1' doesn't have this option
+Note 1031 Storage engine MEMORY of the table `test`.`t1` doesn't have this option
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a NULL 500 NULL NULL YES HASH
@@ -2167,19 +2167,19 @@ t1 CREATE TABLE `t1` (
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 TRANSACTIONAL=1
drop table t1;
CREATE TABLE t1 (line LINESTRING NOT NULL) engine=aria;
-INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t1;
Table Checksum
-test.t1 326284887
+test.t1 310616673
CREATE TABLE t2 (line LINESTRING NOT NULL) engine=aria;
-INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t2;
Table Checksum
-test.t2 326284887
+test.t2 310616673
CREATE TABLE t3 select * from t1;
checksum table t3;
Table Checksum
-test.t3 326284887
+test.t3 310616673
drop table t1,t2,t3;
End of 5.1 tests
create table t2(a varchar(255),key(a))engine=aria row_format=dynamic transactional=0;
diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test
index 6ebcf08d952..3fa7d755fe4 100644
--- a/mysql-test/suite/maria/maria.test
+++ b/mysql-test/suite/maria/maria.test
@@ -1437,10 +1437,10 @@ drop table t1;
#
CREATE TABLE t1 (line LINESTRING NOT NULL) engine=aria;
-INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t1;
CREATE TABLE t2 (line LINESTRING NOT NULL) engine=aria;
-INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t2;
CREATE TABLE t3 select * from t1;
checksum table t3;
diff --git a/mysql-test/suite/maria/maria3.result b/mysql-test/suite/maria/maria3.result
index 27d72b75930..b502d71e772 100644
--- a/mysql-test/suite/maria/maria3.result
+++ b/mysql-test/suite/maria/maria3.result
@@ -359,7 +359,7 @@ NULL NULL
0 NULL
0 0
alter table t1 add column d char(0) not null, add key (d);
-ERROR 42000: The used storage engine can't index column 'd'
+ERROR 42000: The storage engine Aria can't index column `d`
drop table t1;
CREATE TABLE t1 (a bit(3));
insert into t1 values (NULL),(0),(1),(2),(3),(4),(5),(6),(7);
diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result
index 5d3143e35bb..b0f340664b7 100644
--- a/mysql-test/suite/parts/r/partition_alter4_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result
@@ -37566,7 +37566,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -38026,7 +38026,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -38497,7 +38497,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -38969,7 +38969,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -39435,7 +39435,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -39907,7 +39907,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -40384,7 +40384,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -40859,7 +40859,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -41324,7 +41324,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -41784,7 +41784,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -42255,7 +42255,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -42727,7 +42727,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -43193,7 +43193,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -43665,7 +43665,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -44142,7 +44142,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -44617,7 +44617,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -52582,7 +52582,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -53042,7 +53042,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -53513,7 +53513,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -53985,7 +53985,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -54451,7 +54451,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -54923,7 +54923,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -55400,7 +55400,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
@@ -55875,7 +55875,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize note Table does not support optimize on partitions. All partitions will be rebuilt and analyzed.
test.t1 optimize status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
diff --git a/mysql-test/suite/percona/percona_innodb_fake_changes.result b/mysql-test/suite/percona/percona_innodb_fake_changes.result
index 5540c76f2e5..434b7283146 100644
--- a/mysql-test/suite/percona/percona_innodb_fake_changes.result
+++ b/mysql-test/suite/percona/percona_innodb_fake_changes.result
@@ -43,7 +43,7 @@ SET autocommit=0;
SET innodb_fake_changes=1;
BEGIN;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
-ERROR HY000: Can't create table 'test.t2' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t2` (errno: 131 "Command not supported by database")
DROP TABLE t1;
ERROR 42S02: Unknown table 't1'
TRUNCATE TABLE t1;
diff --git a/mysql-test/suite/perfschema/r/dml_handler.result b/mysql-test/suite/perfschema/r/dml_handler.result
index 707a1d7071a..41ffa18799f 100644
--- a/mysql-test/suite/perfschema/r/dml_handler.result
+++ b/mysql-test/suite/perfschema/r/dml_handler.result
@@ -11,149 +11,149 @@ SELECT COUNT(*) FROM table_list INTO @table_count;
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=49;
HANDLER performance_schema.users OPEN;
-ERROR HY000: Table storage engine for 'users' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`users` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=48;
HANDLER performance_schema.threads OPEN;
-ERROR HY000: Table storage engine for 'threads' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`threads` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=47;
HANDLER performance_schema.table_lock_waits_summary_by_table OPEN;
-ERROR HY000: Table storage engine for 'table_lock_waits_summary_by_table' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`table_lock_waits_summary_by_table` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=46;
HANDLER performance_schema.table_io_waits_summary_by_table OPEN;
-ERROR HY000: Table storage engine for 'table_io_waits_summary_by_table' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`table_io_waits_summary_by_table` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=45;
HANDLER performance_schema.table_io_waits_summary_by_index_usage OPEN;
-ERROR HY000: Table storage engine for 'table_io_waits_summary_by_index_usage' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`table_io_waits_summary_by_index_usage` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=44;
HANDLER performance_schema.socket_summary_by_instance OPEN;
-ERROR HY000: Table storage engine for 'socket_summary_by_instance' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`socket_summary_by_instance` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=43;
HANDLER performance_schema.socket_summary_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'socket_summary_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`socket_summary_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=42;
HANDLER performance_schema.socket_instances OPEN;
-ERROR HY000: Table storage engine for 'socket_instances' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`socket_instances` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=41;
HANDLER performance_schema.setup_timers OPEN;
-ERROR HY000: Table storage engine for 'setup_timers' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`setup_timers` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=40;
HANDLER performance_schema.setup_objects OPEN;
-ERROR HY000: Table storage engine for 'setup_objects' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`setup_objects` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=39;
HANDLER performance_schema.setup_instruments OPEN;
-ERROR HY000: Table storage engine for 'setup_instruments' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`setup_instruments` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=38;
HANDLER performance_schema.setup_consumers OPEN;
-ERROR HY000: Table storage engine for 'setup_consumers' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`setup_consumers` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=37;
HANDLER performance_schema.setup_actors OPEN;
-ERROR HY000: Table storage engine for 'setup_actors' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`setup_actors` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=36;
HANDLER performance_schema.rwlock_instances OPEN;
-ERROR HY000: Table storage engine for 'rwlock_instances' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`rwlock_instances` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=35;
HANDLER performance_schema.performance_timers OPEN;
-ERROR HY000: Table storage engine for 'performance_timers' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`performance_timers` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=34;
HANDLER performance_schema.objects_summary_global_by_type OPEN;
-ERROR HY000: Table storage engine for 'objects_summary_global_by_type' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`objects_summary_global_by_type` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=33;
HANDLER performance_schema.mutex_instances OPEN;
-ERROR HY000: Table storage engine for 'mutex_instances' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`mutex_instances` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=32;
HANDLER performance_schema.hosts OPEN;
-ERROR HY000: Table storage engine for 'hosts' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`hosts` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=31;
HANDLER performance_schema.file_summary_by_instance OPEN;
-ERROR HY000: Table storage engine for 'file_summary_by_instance' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`file_summary_by_instance` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=30;
HANDLER performance_schema.file_summary_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'file_summary_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`file_summary_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=29;
HANDLER performance_schema.file_instances OPEN;
-ERROR HY000: Table storage engine for 'file_instances' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`file_instances` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=28;
HANDLER performance_schema.events_waits_summary_global_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_waits_summary_global_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_summary_global_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=27;
HANDLER performance_schema.events_waits_summary_by_user_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_waits_summary_by_user_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_summary_by_user_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=26;
HANDLER performance_schema.events_waits_summary_by_thread_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_waits_summary_by_thread_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_summary_by_thread_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=25;
HANDLER performance_schema.events_waits_summary_by_instance OPEN;
-ERROR HY000: Table storage engine for 'events_waits_summary_by_instance' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_summary_by_instance` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=24;
HANDLER performance_schema.events_waits_summary_by_host_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_waits_summary_by_host_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_summary_by_host_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=23;
HANDLER performance_schema.events_waits_summary_by_account_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_waits_summary_by_account_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_summary_by_account_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=22;
HANDLER performance_schema.events_waits_history_long OPEN;
-ERROR HY000: Table storage engine for 'events_waits_history_long' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_history_long` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=21;
HANDLER performance_schema.events_waits_history OPEN;
-ERROR HY000: Table storage engine for 'events_waits_history' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_history` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=20;
HANDLER performance_schema.events_waits_current OPEN;
-ERROR HY000: Table storage engine for 'events_waits_current' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_waits_current` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=19;
HANDLER performance_schema.events_statements_summary_global_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_statements_summary_global_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_summary_global_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=18;
HANDLER performance_schema.events_statements_summary_by_user_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_statements_summary_by_user_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_summary_by_user_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=17;
HANDLER performance_schema.events_statements_summary_by_thread_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_statements_summary_by_thread_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_summary_by_thread_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=16;
HANDLER performance_schema.events_statements_summary_by_host_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_statements_summary_by_host_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_summary_by_host_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=15;
HANDLER performance_schema.events_statements_summary_by_digest OPEN;
-ERROR HY000: Table storage engine for 'events_statements_summary_by_digest' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_summary_by_digest` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=14;
HANDLER performance_schema.events_statements_summary_by_account_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_statements_summary_by_account_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_summary_by_account_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=13;
HANDLER performance_schema.events_statements_history_long OPEN;
-ERROR HY000: Table storage engine for 'events_statements_history_long' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_history_long` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=12;
HANDLER performance_schema.events_statements_history OPEN;
-ERROR HY000: Table storage engine for 'events_statements_history' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_history` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=11;
HANDLER performance_schema.events_statements_current OPEN;
-ERROR HY000: Table storage engine for 'events_statements_current' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_statements_current` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=10;
HANDLER performance_schema.events_stages_summary_global_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_stages_summary_global_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_summary_global_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=9;
HANDLER performance_schema.events_stages_summary_by_user_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_stages_summary_by_user_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_summary_by_user_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=8;
HANDLER performance_schema.events_stages_summary_by_thread_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_stages_summary_by_thread_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_summary_by_thread_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=7;
HANDLER performance_schema.events_stages_summary_by_host_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_stages_summary_by_host_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_summary_by_host_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=6;
HANDLER performance_schema.events_stages_summary_by_account_by_event_name OPEN;
-ERROR HY000: Table storage engine for 'events_stages_summary_by_account_by_event_name' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_summary_by_account_by_event_name` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=5;
HANDLER performance_schema.events_stages_history_long OPEN;
-ERROR HY000: Table storage engine for 'events_stages_history_long' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_history_long` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=4;
HANDLER performance_schema.events_stages_history OPEN;
-ERROR HY000: Table storage engine for 'events_stages_history' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_history` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=3;
HANDLER performance_schema.events_stages_current OPEN;
-ERROR HY000: Table storage engine for 'events_stages_current' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`events_stages_current` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=2;
HANDLER performance_schema.cond_instances OPEN;
-ERROR HY000: Table storage engine for 'cond_instances' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`cond_instances` doesn't have this option
SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=1;
HANDLER performance_schema.accounts OPEN;
-ERROR HY000: Table storage engine for 'accounts' doesn't have this option
+ERROR HY000: Storage engine PERFORMANCE_SCHEMA of the table `performance_schema`.`accounts` doesn't have this option
DROP TEMPORARY TABLE table_list;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate.result b/mysql-test/suite/perfschema/r/event_aggregate.result
index 6863ac6e2ce..a5cfe97f98e 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate.result
@@ -188,8 +188,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -200,31 +200,30 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -300,8 +299,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -315,8 +314,8 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -325,8 +324,8 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -335,19 +334,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -448,13 +446,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -463,39 +461,38 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -589,13 +586,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -607,12 +604,12 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -621,12 +618,12 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -635,19 +632,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -766,65 +762,64 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -936,18 +931,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -957,16 +952,16 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -975,16 +970,16 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -993,19 +988,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1142,76 +1136,75 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1343,72 +1336,71 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
localhost wait/synch/mutex/sql/LOCK_connection_count 1
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1543,67 +1535,66 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
localhost wait/synch/mutex/sql/LOCK_connection_count 2
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1740,62 +1731,61 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
localhost wait/synch/mutex/sql/LOCK_connection_count 3
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1935,56 +1925,55 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2125,56 +2114,55 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2333,38 +2321,37 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2541,20 +2528,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2737,14 +2723,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2933,8 +2918,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -3123,8 +3107,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -3313,8 +3296,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3503,8 +3485,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3693,8 +3674,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3883,8 +3863,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4073,8 +4052,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4263,8 +4241,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4453,8 +4430,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4643,8 +4619,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4833,8 +4808,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -5007,8 +4981,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -5129,8 +5102,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -5215,8 +5187,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
index ad2440bd2d1..42945079ef4 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a.result
@@ -173,8 +173,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -187,25 +187,24 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -271,8 +270,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -288,8 +287,8 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -298,19 +297,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -392,13 +390,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -409,29 +407,28 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -506,13 +503,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -526,12 +523,12 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -540,19 +537,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -643,18 +639,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
@@ -663,33 +659,32 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -773,18 +768,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -796,16 +791,16 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -814,19 +809,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -926,60 +920,59 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1074,56 +1067,55 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
localhost wait/synch/mutex/sql/LOCK_connection_count 1
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1221,51 +1213,50 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
localhost wait/synch/mutex/sql/LOCK_connection_count 2
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1365,46 +1356,45 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
localhost wait/synch/mutex/sql/LOCK_connection_count 3
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1509,38 +1499,37 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1646,38 +1635,37 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1783,38 +1771,37 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1938,20 +1925,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2081,14 +2067,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2224,8 +2209,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2361,8 +2345,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2498,8 +2481,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2635,8 +2617,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2772,8 +2753,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2909,8 +2889,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3046,8 +3025,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3183,8 +3161,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3320,8 +3297,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3457,8 +3433,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3594,8 +3569,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3731,8 +3705,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3852,8 +3825,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3937,8 +3909,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
index 6faff1992c7..12893a8cc2b 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_h.result
@@ -147,8 +147,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -161,21 +161,20 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -232,8 +231,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -249,8 +248,8 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -261,13 +260,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -340,13 +338,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -357,25 +355,24 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -441,13 +438,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -461,12 +458,12 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -477,13 +474,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -565,18 +561,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
@@ -585,29 +581,28 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -682,18 +677,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -705,16 +700,16 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -725,13 +720,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -822,56 +816,55 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -957,52 +950,51 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1091,47 +1083,46 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1222,42 +1213,41 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1353,34 +1343,33 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1477,34 +1466,33 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1601,34 +1589,33 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1745,14 +1732,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1869,14 +1855,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1999,8 +1984,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2123,8 +2107,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2247,8 +2230,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2371,8 +2353,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2495,8 +2476,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2619,8 +2599,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2743,8 +2722,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2867,8 +2845,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2991,8 +2968,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3115,8 +3091,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3239,8 +3214,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3363,8 +3337,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3471,8 +3444,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3543,8 +3515,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
index 87b81a54b6b..bd9a52361a1 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u.result
@@ -158,8 +158,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -174,19 +174,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -242,8 +241,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -261,19 +260,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -336,13 +334,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -355,19 +353,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -423,13 +420,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -445,19 +442,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -520,18 +516,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
@@ -542,19 +538,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -610,18 +605,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -635,19 +630,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -710,23 +704,23 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -735,19 +729,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -805,18 +798,18 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -825,20 +818,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
localhost wait/synch/mutex/sql/LOCK_connection_count 1
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -899,13 +891,13 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -914,20 +906,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
localhost wait/synch/mutex/sql/LOCK_connection_count 2
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -990,8 +981,8 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -1000,20 +991,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
localhost wait/synch/mutex/sql/LOCK_connection_count 3
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1083,20 +1073,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1167,20 +1156,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1251,20 +1239,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1335,20 +1322,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1425,14 +1411,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1515,8 +1500,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1599,8 +1583,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1683,8 +1666,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1767,8 +1749,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1851,8 +1832,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1935,8 +1915,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2019,8 +1998,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2103,8 +2081,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2187,8 +2164,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2271,8 +2247,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2355,8 +2330,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2439,8 +2413,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2523,8 +2496,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2607,8 +2579,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
index 09144e3641b..bb14b14e291 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_a_no_u_no_h.result
@@ -132,8 +132,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -150,13 +150,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -203,8 +202,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -224,13 +223,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -284,13 +282,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -305,13 +303,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -358,13 +355,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -382,13 +379,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -442,18 +438,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
@@ -466,13 +462,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -519,18 +514,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -546,13 +541,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -606,23 +600,23 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -633,13 +627,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -688,18 +681,18 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -710,14 +703,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -769,13 +761,13 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -786,14 +778,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -847,8 +838,8 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
execute dump_waits_user;
@@ -859,14 +850,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -929,14 +919,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1000,14 +989,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1071,14 +1059,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1142,14 +1129,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1213,14 +1199,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1290,8 +1275,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1361,8 +1345,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1432,8 +1415,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1503,8 +1485,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1574,8 +1555,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1645,8 +1625,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1716,8 +1695,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1787,8 +1765,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1858,8 +1835,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -1929,8 +1905,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2000,8 +1975,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2071,8 +2045,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2142,8 +2115,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -2213,8 +2185,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
index e50d2b1f837..0595c50e531 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_h.result
@@ -162,8 +162,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -174,27 +174,26 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -261,8 +260,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -276,8 +275,8 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -286,8 +285,8 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
user2 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -298,13 +297,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -396,13 +394,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -411,35 +409,34 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -524,13 +521,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -542,12 +539,12 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -556,12 +553,12 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
user3 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -572,13 +569,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -688,61 +684,60 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -845,18 +840,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -866,16 +861,16 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -884,16 +879,16 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
user4 wait/synch/mutex/sql/LOCK_user_locks 0
@@ -904,13 +899,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1038,72 +1032,71 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1226,68 +1219,67 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1413,63 +1405,62 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1597,58 +1588,57 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1779,52 +1769,51 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1956,52 +1945,51 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2151,34 +2139,33 @@ execute dump_waits_user;
user event_name count_star
user1 wait/io/file/sql/query_log 5
user1 wait/synch/mutex/sql/LOCK_connection_count 1
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
user2 wait/io/file/sql/query_log 5
user2 wait/synch/mutex/sql/LOCK_connection_count 1
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
user3 wait/io/file/sql/query_log 5
user3 wait/synch/mutex/sql/LOCK_connection_count 1
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
user4 wait/io/file/sql/query_log 5
user4 wait/synch/mutex/sql/LOCK_connection_count 1
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_host;
host event_name count_star
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2348,14 +2335,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2525,14 +2511,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2708,8 +2693,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2885,8 +2869,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -3062,8 +3045,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3239,8 +3221,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3416,8 +3397,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3593,8 +3573,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3770,8 +3749,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3947,8 +3925,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4124,8 +4101,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4301,8 +4277,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4478,8 +4453,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -4639,8 +4613,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -4748,8 +4721,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -4821,8 +4793,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
index 4f1dddb3f16..532fd209e18 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u.result
@@ -173,8 +173,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -185,27 +185,26 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 4
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -271,8 +270,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -286,8 +285,8 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -298,19 +297,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 5
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 2
-localhost wait/synch/rwlock/sql/LOCK_grant 2
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -392,13 +390,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -407,31 +405,30 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 8
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -506,13 +503,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -524,12 +521,12 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -540,19 +537,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 9
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 4
-localhost wait/synch/rwlock/sql/LOCK_grant 4
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -643,53 +639,52 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 12
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -773,18 +768,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -794,16 +789,16 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -814,19 +809,18 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 13
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 6
-localhost wait/synch/rwlock/sql/LOCK_grant 6
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -926,60 +920,59 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 16
localhost wait/synch/mutex/sql/LOCK_connection_count 0
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1074,56 +1067,55 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 17
localhost wait/synch/mutex/sql/LOCK_connection_count 1
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1221,51 +1213,50 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 18
localhost wait/synch/mutex/sql/LOCK_connection_count 2
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1365,46 +1356,45 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 19
localhost wait/synch/mutex/sql/LOCK_connection_count 3
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1507,40 +1497,39 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1644,40 +1633,39 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1801,20 +1789,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1938,20 +1925,19 @@ execute dump_waits_host;
host event_name count_star
localhost wait/io/file/sql/query_log 20
localhost wait/synch/mutex/sql/LOCK_connection_count 4
-localhost wait/synch/mutex/sql/LOCK_user_locks 8
-localhost wait/synch/rwlock/sql/LOCK_grant 8
+localhost wait/synch/mutex/sql/LOCK_user_locks 0
+localhost wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2081,14 +2067,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2224,8 +2209,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2361,8 +2345,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2498,8 +2481,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2635,8 +2617,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2772,8 +2753,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2909,8 +2889,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3046,8 +3025,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3183,8 +3161,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3320,8 +3297,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3457,8 +3433,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3594,8 +3569,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3715,8 +3689,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3800,8 +3773,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3885,8 +3857,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
index 6de38e218ab..76c7311f99c 100644
--- a/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
+++ b/mysql-test/suite/perfschema/r/event_aggregate_no_u_no_h.result
@@ -147,8 +147,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username status
user2 not found
username status
@@ -159,8 +159,8 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -169,13 +169,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 4
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 4
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -232,8 +231,8 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 1
user2 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -247,8 +246,8 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 1
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -261,13 +260,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 5
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 5
-wait/synch/mutex/sql/LOCK_user_locks 2
-wait/synch/rwlock/sql/LOCK_grant 2
+wait/synch/rwlock/sql/LOCK_grant 1
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -340,13 +338,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username status
user3 not found
username status
@@ -355,12 +353,12 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -369,13 +367,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 8
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 8
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -441,13 +438,13 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 1
user3 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -459,12 +456,12 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 1
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -477,13 +474,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 9
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 9
-wait/synch/mutex/sql/LOCK_user_locks 4
-wait/synch/rwlock/sql/LOCK_grant 4
+wait/synch/rwlock/sql/LOCK_grant 2
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -565,34 +561,34 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username status
user4 not found
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -601,13 +597,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 12
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 12
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -682,18 +677,18 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 1
user4 wait/synch/mutex/sql/LOCK_connection_count 0
@@ -703,16 +698,16 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 1
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
@@ -725,13 +720,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 13
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 13
-wait/synch/mutex/sql/LOCK_user_locks 6
-wait/synch/rwlock/sql/LOCK_grant 6
+wait/synch/rwlock/sql/LOCK_grant 3
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -822,41 +816,41 @@ call dump_thread();
username event_name count_star
user1 wait/io/file/sql/query_log 4
user1 wait/synch/mutex/sql/LOCK_connection_count 0
-user1 wait/synch/mutex/sql/LOCK_user_locks 2
-user1 wait/synch/rwlock/sql/LOCK_grant 2
+user1 wait/synch/mutex/sql/LOCK_user_locks 0
+user1 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 4
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -865,13 +859,12 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 16
wait/synch/mutex/sql/LOCK_connection_count 0
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 16
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -957,36 +950,36 @@ user1 not found
username event_name count_star
user2 wait/io/file/sql/query_log 4
user2 wait/synch/mutex/sql/LOCK_connection_count 0
-user2 wait/synch/mutex/sql/LOCK_user_locks 2
-user2 wait/synch/rwlock/sql/LOCK_grant 2
+user2 wait/synch/mutex/sql/LOCK_user_locks 0
+user2 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 4
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -995,14 +988,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 17
wait/synch/mutex/sql/LOCK_connection_count 1
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1091,31 +1083,31 @@ user2 not found
username event_name count_star
user3 wait/io/file/sql/query_log 4
user3 wait/synch/mutex/sql/LOCK_connection_count 0
-user3 wait/synch/mutex/sql/LOCK_user_locks 2
-user3 wait/synch/rwlock/sql/LOCK_grant 2
+user3 wait/synch/mutex/sql/LOCK_user_locks 0
+user3 wait/synch/rwlock/sql/LOCK_grant 1
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 4
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -1124,14 +1116,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 18
wait/synch/mutex/sql/LOCK_connection_count 2
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1222,26 +1213,26 @@ user3 not found
username event_name count_star
user4 wait/io/file/sql/query_log 4
user4 wait/synch/mutex/sql/LOCK_connection_count 0
-user4 wait/synch/mutex/sql/LOCK_user_locks 2
-user4 wait/synch/rwlock/sql/LOCK_grant 2
+user4 wait/synch/mutex/sql/LOCK_user_locks 0
+user4 wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 4
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 0
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -1250,14 +1241,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 19
wait/synch/mutex/sql/LOCK_connection_count 3
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1351,20 +1341,20 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -1373,14 +1363,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1475,20 +1464,20 @@ execute dump_waits_account;
user host event_name count_star
user1 localhost wait/io/file/sql/query_log 5
user1 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user1 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user1 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user1 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user1 localhost wait/synch/rwlock/sql/LOCK_grant 1
user2 localhost wait/io/file/sql/query_log 5
user2 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user2 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user2 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user2 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user2 localhost wait/synch/rwlock/sql/LOCK_grant 1
user3 localhost wait/io/file/sql/query_log 5
user3 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user3 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user3 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user3 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user3 localhost wait/synch/rwlock/sql/LOCK_grant 1
user4 localhost wait/io/file/sql/query_log 5
user4 localhost wait/synch/mutex/sql/LOCK_connection_count 1
-user4 localhost wait/synch/mutex/sql/LOCK_user_locks 2
-user4 localhost wait/synch/rwlock/sql/LOCK_grant 2
+user4 localhost wait/synch/mutex/sql/LOCK_user_locks 0
+user4 localhost wait/synch/rwlock/sql/LOCK_grant 1
execute dump_waits_user;
user event_name count_star
execute dump_waits_host;
@@ -1497,14 +1486,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1621,14 +1609,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1745,14 +1732,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1869,14 +1855,13 @@ execute dump_waits_global;
event_name count_star
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/mutex/sql/LOCK_user_locks 0
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -1999,8 +1984,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2123,8 +2107,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 3
@@ -2247,8 +2230,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2371,8 +2353,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2495,8 +2476,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2619,8 +2599,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2743,8 +2722,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2867,8 +2845,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -2991,8 +2968,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3115,8 +3091,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3239,8 +3214,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
user1 localhost stage/sql/checking permissions 0
@@ -3347,8 +3321,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3419,8 +3392,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
@@ -3491,8 +3463,7 @@ execute dump_waits_history;
event_name count(event_name)
wait/io/file/sql/query_log 20
wait/synch/mutex/sql/LOCK_connection_count 4
-wait/synch/mutex/sql/LOCK_user_locks 8
-wait/synch/rwlock/sql/LOCK_grant 8
+wait/synch/rwlock/sql/LOCK_grant 4
execute dump_stages_account;
user host event_name count_star
execute dump_stages_user;
diff --git a/mysql-test/suite/perfschema/r/func_mutex.result b/mysql-test/suite/perfschema/r/func_mutex.result
index 1c9d0b8a254..657f45d70e9 100644
--- a/mysql-test/suite/perfschema/r/func_mutex.result
+++ b/mysql-test/suite/perfschema/r/func_mutex.result
@@ -70,52 +70,34 @@ Success
TRUNCATE TABLE performance_schema.events_waits_history_long;
TRUNCATE TABLE performance_schema.events_waits_history;
TRUNCATE TABLE performance_schema.events_waits_current;
-SELECT * FROM t1 WHERE id = 1;
-id b
-1 initial value
+show variables like "%not_found%";
+Variable_name Value
SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
-WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
-SELECT * FROM t1;
-id b
-1 initial value
-2 initial value
-3 initial value
-4 initial value
-5 initial value
-6 initial value
-7 initial value
-8 initial value
+WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
+show variables like "%not_found%";
+Variable_name Value
SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
-WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
+WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed;
test_fm1_rw_timed
Success
UPDATE performance_schema.setup_instruments SET enabled = 'NO'
-WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant';
+WHERE NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash';
TRUNCATE TABLE performance_schema.events_waits_history_long;
TRUNCATE TABLE performance_schema.events_waits_history;
TRUNCATE TABLE performance_schema.events_waits_current;
-SELECT * FROM t1 WHERE id = 1;
-id b
-1 initial value
+show variables like "%not_found%";
+Variable_name Value
SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
-WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
-SELECT * FROM t1;
-id b
-1 initial value
-2 initial value
-3 initial value
-4 initial value
-5 initial value
-6 initial value
-7 initial value
-8 initial value
+WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
+show variables like "%not_found%";
+Variable_name Value
SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
-WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
+WHERE (EVENT_NAME = 'LOCK_system_variables_hash'));
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed;
test_fm2_rw_timed
Success
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index 913f98d9663..a50c4ffa297 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -42,12 +42,12 @@ AND EVENT_NAME IN
WHERE NAME LIKE "wait/synch/%")
LIMIT 1;
create table test.t1(a int) engine=performance_schema;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_schema object_name
create table test.t1 like performance_schema.events_waits_current;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
SELECT object_schema, object_name FROM performance_schema.objects_summary_global_by_type
WHERE object_schema='test';
object_schema object_name
diff --git a/mysql-test/suite/perfschema/r/nesting.result b/mysql-test/suite/perfschema/r/nesting.result
index a7b26b34776..cac92025a97 100644
--- a/mysql-test/suite/perfschema/r/nesting.result
+++ b/mysql-test/suite/perfschema/r/nesting.result
@@ -106,140 +106,135 @@ and (end_event_id <= @marker_end)
) all_events
order by relative_event_id asc;
relative_event_id relative_end_event_id event_name comment nesting_event_type relative_nesting_event_id
-0 19 statement/sql/select select "MARKER_BEGIN" as marker NULL NULL
-1 5 stage/sql/init (stage) STATEMENT 0
+0 18 statement/sql/select select "MARKER_BEGIN" as marker NULL NULL
+1 4 stage/sql/init (stage) STATEMENT 0
2 2 wait/io/socket/sql/client_connection recv STAGE 1
3 3 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 1
-4 4 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 1
-5 5 wait/io/file/sql/query_log write STAGE 1
-6 6 stage/sql/checking permissions (stage) STATEMENT 0
-7 7 stage/sql/Opening tables (stage) STATEMENT 0
-8 8 stage/sql/init (stage) STATEMENT 0
-9 9 stage/sql/optimizing (stage) STATEMENT 0
-10 12 stage/sql/executing (stage) STATEMENT 0
-11 11 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 10
-12 12 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 10
-13 13 stage/sql/end (stage) STATEMENT 0
-14 14 stage/sql/query end (stage) STATEMENT 0
-15 15 stage/sql/closing tables (stage) STATEMENT 0
-16 16 stage/sql/freeing items (stage) STATEMENT 0
-17 17 wait/io/socket/sql/client_connection send STATEMENT 0
-18 19 stage/sql/cleaning up (stage) STATEMENT 0
-19 19 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 18
-20 20 idle idle NULL NULL
-21 40 statement/sql/select select "This is simple statement one" as payload NULL NULL
-22 26 stage/sql/init (stage) STATEMENT 21
-23 23 wait/io/socket/sql/client_connection recv STAGE 22
-24 24 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 22
-25 25 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 22
-26 26 wait/io/file/sql/query_log write STAGE 22
-27 27 stage/sql/checking permissions (stage) STATEMENT 21
-28 28 stage/sql/Opening tables (stage) STATEMENT 21
-29 29 stage/sql/init (stage) STATEMENT 21
-30 30 stage/sql/optimizing (stage) STATEMENT 21
-31 33 stage/sql/executing (stage) STATEMENT 21
-32 32 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 31
-33 33 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 31
-34 34 stage/sql/end (stage) STATEMENT 21
-35 35 stage/sql/query end (stage) STATEMENT 21
-36 36 stage/sql/closing tables (stage) STATEMENT 21
-37 37 stage/sql/freeing items (stage) STATEMENT 21
-38 38 wait/io/socket/sql/client_connection send STATEMENT 21
-39 40 stage/sql/cleaning up (stage) STATEMENT 21
-40 40 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 39
-41 41 idle idle NULL NULL
-42 61 statement/sql/select select "This is simple statement two" as payload NULL NULL
-43 47 stage/sql/init (stage) STATEMENT 42
-44 44 wait/io/socket/sql/client_connection recv STAGE 43
-45 45 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 43
-46 46 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 43
-47 47 wait/io/file/sql/query_log write STAGE 43
-48 48 stage/sql/checking permissions (stage) STATEMENT 42
-49 49 stage/sql/Opening tables (stage) STATEMENT 42
-50 50 stage/sql/init (stage) STATEMENT 42
-51 51 stage/sql/optimizing (stage) STATEMENT 42
-52 54 stage/sql/executing (stage) STATEMENT 42
-53 53 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 52
-54 54 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 52
-55 55 stage/sql/end (stage) STATEMENT 42
-56 56 stage/sql/query end (stage) STATEMENT 42
-57 57 stage/sql/closing tables (stage) STATEMENT 42
-58 58 stage/sql/freeing items (stage) STATEMENT 42
-59 59 wait/io/socket/sql/client_connection send STATEMENT 42
-60 61 stage/sql/cleaning up (stage) STATEMENT 42
-61 61 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 60
-62 62 idle idle NULL NULL
-63 80 statement/sql/select select "This is the first part of a multi query" as payload;
+4 4 wait/io/file/sql/query_log write STAGE 1
+5 5 stage/sql/checking permissions (stage) STATEMENT 0
+6 6 stage/sql/Opening tables (stage) STATEMENT 0
+7 7 stage/sql/init (stage) STATEMENT 0
+8 8 stage/sql/optimizing (stage) STATEMENT 0
+9 11 stage/sql/executing (stage) STATEMENT 0
+10 10 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 9
+11 11 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 9
+12 12 stage/sql/end (stage) STATEMENT 0
+13 13 stage/sql/query end (stage) STATEMENT 0
+14 14 stage/sql/closing tables (stage) STATEMENT 0
+15 15 stage/sql/freeing items (stage) STATEMENT 0
+16 16 wait/io/socket/sql/client_connection send STATEMENT 0
+17 18 stage/sql/cleaning up (stage) STATEMENT 0
+18 18 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 17
+19 19 idle idle NULL NULL
+20 38 statement/sql/select select "This is simple statement one" as payload NULL NULL
+21 24 stage/sql/init (stage) STATEMENT 20
+22 22 wait/io/socket/sql/client_connection recv STAGE 21
+23 23 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 21
+24 24 wait/io/file/sql/query_log write STAGE 21
+25 25 stage/sql/checking permissions (stage) STATEMENT 20
+26 26 stage/sql/Opening tables (stage) STATEMENT 20
+27 27 stage/sql/init (stage) STATEMENT 20
+28 28 stage/sql/optimizing (stage) STATEMENT 20
+29 31 stage/sql/executing (stage) STATEMENT 20
+30 30 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 29
+31 31 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 29
+32 32 stage/sql/end (stage) STATEMENT 20
+33 33 stage/sql/query end (stage) STATEMENT 20
+34 34 stage/sql/closing tables (stage) STATEMENT 20
+35 35 stage/sql/freeing items (stage) STATEMENT 20
+36 36 wait/io/socket/sql/client_connection send STATEMENT 20
+37 38 stage/sql/cleaning up (stage) STATEMENT 20
+38 38 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 37
+39 39 idle idle NULL NULL
+40 58 statement/sql/select select "This is simple statement two" as payload NULL NULL
+41 44 stage/sql/init (stage) STATEMENT 40
+42 42 wait/io/socket/sql/client_connection recv STAGE 41
+43 43 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 41
+44 44 wait/io/file/sql/query_log write STAGE 41
+45 45 stage/sql/checking permissions (stage) STATEMENT 40
+46 46 stage/sql/Opening tables (stage) STATEMENT 40
+47 47 stage/sql/init (stage) STATEMENT 40
+48 48 stage/sql/optimizing (stage) STATEMENT 40
+49 51 stage/sql/executing (stage) STATEMENT 40
+50 50 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 49
+51 51 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 49
+52 52 stage/sql/end (stage) STATEMENT 40
+53 53 stage/sql/query end (stage) STATEMENT 40
+54 54 stage/sql/closing tables (stage) STATEMENT 40
+55 55 stage/sql/freeing items (stage) STATEMENT 40
+56 56 wait/io/socket/sql/client_connection send STATEMENT 40
+57 58 stage/sql/cleaning up (stage) STATEMENT 40
+58 58 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 57
+59 59 idle idle NULL NULL
+60 76 statement/sql/select select "This is the first part of a multi query" as payload;
select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
-64 68 stage/sql/init (stage) STATEMENT 63
-65 65 wait/io/socket/sql/client_connection recv STAGE 64
-66 66 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 64
-67 67 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 64
-68 68 wait/io/file/sql/query_log write STAGE 64
-69 69 stage/sql/checking permissions (stage) STATEMENT 63
-70 70 stage/sql/Opening tables (stage) STATEMENT 63
-71 71 stage/sql/init (stage) STATEMENT 63
-72 72 stage/sql/optimizing (stage) STATEMENT 63
-73 75 stage/sql/executing (stage) STATEMENT 63
-74 74 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 73
-75 75 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 73
-76 76 stage/sql/end (stage) STATEMENT 63
-77 77 stage/sql/query end (stage) STATEMENT 63
-78 78 stage/sql/closing tables (stage) STATEMENT 63
-79 80 stage/sql/freeing items (stage) STATEMENT 63
-80 80 wait/io/socket/sql/client_connection send STAGE 79
-81 95 statement/sql/select select "And this is the second part of a multi query" as payload;
+61 64 stage/sql/init (stage) STATEMENT 60
+62 62 wait/io/socket/sql/client_connection recv STAGE 61
+63 63 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 61
+64 64 wait/io/file/sql/query_log write STAGE 61
+65 65 stage/sql/checking permissions (stage) STATEMENT 60
+66 66 stage/sql/Opening tables (stage) STATEMENT 60
+67 67 stage/sql/init (stage) STATEMENT 60
+68 68 stage/sql/optimizing (stage) STATEMENT 60
+69 71 stage/sql/executing (stage) STATEMENT 60
+70 70 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 69
+71 71 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 69
+72 72 stage/sql/end (stage) STATEMENT 60
+73 73 stage/sql/query end (stage) STATEMENT 60
+74 74 stage/sql/closing tables (stage) STATEMENT 60
+75 76 stage/sql/freeing items (stage) STATEMENT 60
+76 76 wait/io/socket/sql/client_connection send STAGE 75
+77 91 statement/sql/select select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
-82 83 stage/sql/init (stage) STATEMENT 81
-83 83 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 82
-84 84 stage/sql/checking permissions (stage) STATEMENT 81
-85 85 stage/sql/Opening tables (stage) STATEMENT 81
-86 86 stage/sql/init (stage) STATEMENT 81
-87 87 stage/sql/optimizing (stage) STATEMENT 81
-88 90 stage/sql/executing (stage) STATEMENT 81
-89 89 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 88
-90 90 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 88
-91 91 stage/sql/end (stage) STATEMENT 81
-92 92 stage/sql/query end (stage) STATEMENT 81
-93 93 stage/sql/closing tables (stage) STATEMENT 81
-94 95 stage/sql/freeing items (stage) STATEMENT 81
-95 95 wait/io/socket/sql/client_connection send STAGE 94
-96 112 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
-97 98 stage/sql/init (stage) STATEMENT 96
-98 98 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 97
-99 99 stage/sql/checking permissions (stage) STATEMENT 96
-100 100 stage/sql/Opening tables (stage) STATEMENT 96
-101 101 stage/sql/init (stage) STATEMENT 96
-102 102 stage/sql/optimizing (stage) STATEMENT 96
-103 105 stage/sql/executing (stage) STATEMENT 96
-104 104 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 103
-105 105 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 103
-106 106 stage/sql/end (stage) STATEMENT 96
-107 107 stage/sql/query end (stage) STATEMENT 96
-108 108 stage/sql/closing tables (stage) STATEMENT 96
-109 109 stage/sql/freeing items (stage) STATEMENT 96
-110 110 wait/io/socket/sql/client_connection send STATEMENT 96
-111 112 stage/sql/cleaning up (stage) STATEMENT 96
-112 112 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 111
-113 113 idle idle NULL NULL
-114 133 statement/sql/select select "MARKER_END" as marker NULL NULL
-115 119 stage/sql/init (stage) STATEMENT 114
-116 116 wait/io/socket/sql/client_connection recv STAGE 115
-117 117 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 115
-118 118 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 115
-119 119 wait/io/file/sql/query_log write STAGE 115
-120 120 stage/sql/checking permissions (stage) STATEMENT 114
-121 121 stage/sql/Opening tables (stage) STATEMENT 114
-122 122 stage/sql/init (stage) STATEMENT 114
-123 123 stage/sql/optimizing (stage) STATEMENT 114
-124 126 stage/sql/executing (stage) STATEMENT 114
-125 125 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 124
-126 126 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 124
-127 127 stage/sql/end (stage) STATEMENT 114
-128 128 stage/sql/query end (stage) STATEMENT 114
-129 129 stage/sql/closing tables (stage) STATEMENT 114
-130 130 stage/sql/freeing items (stage) STATEMENT 114
-131 131 wait/io/socket/sql/client_connection send STATEMENT 114
-132 133 stage/sql/cleaning up (stage) STATEMENT 114
-133 133 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 132
+78 79 stage/sql/init (stage) STATEMENT 77
+79 79 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 78
+80 80 stage/sql/checking permissions (stage) STATEMENT 77
+81 81 stage/sql/Opening tables (stage) STATEMENT 77
+82 82 stage/sql/init (stage) STATEMENT 77
+83 83 stage/sql/optimizing (stage) STATEMENT 77
+84 86 stage/sql/executing (stage) STATEMENT 77
+85 85 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 84
+86 86 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 84
+87 87 stage/sql/end (stage) STATEMENT 77
+88 88 stage/sql/query end (stage) STATEMENT 77
+89 89 stage/sql/closing tables (stage) STATEMENT 77
+90 91 stage/sql/freeing items (stage) STATEMENT 77
+91 91 wait/io/socket/sql/client_connection send STAGE 90
+92 108 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
+93 94 stage/sql/init (stage) STATEMENT 92
+94 94 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 93
+95 95 stage/sql/checking permissions (stage) STATEMENT 92
+96 96 stage/sql/Opening tables (stage) STATEMENT 92
+97 97 stage/sql/init (stage) STATEMENT 92
+98 98 stage/sql/optimizing (stage) STATEMENT 92
+99 101 stage/sql/executing (stage) STATEMENT 92
+100 100 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 99
+101 101 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 99
+102 102 stage/sql/end (stage) STATEMENT 92
+103 103 stage/sql/query end (stage) STATEMENT 92
+104 104 stage/sql/closing tables (stage) STATEMENT 92
+105 105 stage/sql/freeing items (stage) STATEMENT 92
+106 106 wait/io/socket/sql/client_connection send STATEMENT 92
+107 108 stage/sql/cleaning up (stage) STATEMENT 92
+108 108 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 107
+109 109 idle idle NULL NULL
+110 128 statement/sql/select select "MARKER_END" as marker NULL NULL
+111 114 stage/sql/init (stage) STATEMENT 110
+112 112 wait/io/socket/sql/client_connection recv STAGE 111
+113 113 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 111
+114 114 wait/io/file/sql/query_log write STAGE 111
+115 115 stage/sql/checking permissions (stage) STATEMENT 110
+116 116 stage/sql/Opening tables (stage) STATEMENT 110
+117 117 stage/sql/init (stage) STATEMENT 110
+118 118 stage/sql/optimizing (stage) STATEMENT 110
+119 121 stage/sql/executing (stage) STATEMENT 110
+120 120 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 119
+121 121 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 119
+122 122 stage/sql/end (stage) STATEMENT 110
+123 123 stage/sql/query end (stage) STATEMENT 110
+124 124 stage/sql/closing tables (stage) STATEMENT 110
+125 125 stage/sql/freeing items (stage) STATEMENT 110
+126 126 wait/io/socket/sql/client_connection send STATEMENT 110
+127 128 stage/sql/cleaning up (stage) STATEMENT 110
+128 128 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 127
diff --git a/mysql-test/suite/perfschema/r/privilege.result b/mysql-test/suite/perfschema/r/privilege.result
index 55c42c9a149..85e46759f22 100644
--- a/mysql-test/suite/perfschema/r/privilege.result
+++ b/mysql-test/suite/perfschema/r/privilege.result
@@ -152,13 +152,13 @@ before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.setup_instruments;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.events_waits_current;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.file_instances;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
insert into performance_schema.setup_instruments
set name="foo";
ERROR 42000: INSERT command denied to user 'root'@'localhost' for table 'setup_instruments'
@@ -250,13 +250,13 @@ before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_1'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.setup_instruments;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.events_waits_current;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.file_instances;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
insert into performance_schema.setup_instruments
set name="foo";
ERROR 42000: INSERT command denied to user 'pfs_user_1'@'localhost' for table 'setup_instruments'
@@ -348,13 +348,13 @@ before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_2'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.setup_instruments;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.events_waits_current;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.file_instances;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
insert into performance_schema.setup_instruments
set name="foo";
ERROR 42000: INSERT command denied to user 'pfs_user_2'@'localhost' for table 'setup_instruments'
@@ -446,13 +446,13 @@ before insert on performance_schema.file_instances
for each row begin end;
ERROR 42000: Access denied for user 'pfs_user_3'@'localhost' to database 'performance_schema'
create table test.t1(a int) engine=PERFORMANCE_SCHEMA;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.setup_instruments;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.events_waits_current;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
create table test.t1 like performance_schema.file_instances;
-ERROR HY000: Can't create table 'test.t1' (errno: 131 "Command not supported by database")
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
insert into performance_schema.setup_instruments
set name="foo";
ERROR 42000: INSERT command denied to user 'pfs_user_3'@'localhost' for table 'setup_instruments'
diff --git a/mysql-test/suite/perfschema/t/func_mutex.test b/mysql-test/suite/perfschema/t/func_mutex.test
index a6940710626..13e63286e8e 100644
--- a/mysql-test/suite/perfschema/t/func_mutex.test
+++ b/mysql-test/suite/perfschema/t/func_mutex.test
@@ -87,38 +87,38 @@ TRUNCATE TABLE performance_schema.events_waits_history_long;
TRUNCATE TABLE performance_schema.events_waits_history;
TRUNCATE TABLE performance_schema.events_waits_current;
-SELECT * FROM t1 WHERE id = 1;
+show variables like "%not_found%";
SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
- WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
+ WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
-SELECT * FROM t1;
+show variables like "%not_found%";
SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
- WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
+ WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed;
UPDATE performance_schema.setup_instruments SET enabled = 'NO'
-WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant';
+WHERE NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash';
TRUNCATE TABLE performance_schema.events_waits_history_long;
TRUNCATE TABLE performance_schema.events_waits_history;
TRUNCATE TABLE performance_schema.events_waits_current;
-SELECT * FROM t1 WHERE id = 1;
+show variables like "%not_found%";
SET @before_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
- WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
+ WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
-SELECT * FROM t1;
+show variables like "%not_found%";
SET @after_count = (SELECT SUM(TIMER_WAIT)
FROM performance_schema.events_waits_history_long
- WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant'));
+ WHERE (EVENT_NAME = 'LOCK_system_variables_hash'));
SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed;
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index 1c98d43a1f5..af19e8db51d 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -5,10 +5,6 @@
--source include/have_perfschema.inc
--source include/have_innodb.inc
-if (`select version() like '10.0.0-%'`) {
- skip upstream bug#67098;
-}
-
#
# Bug#12790483 OBJECTS_SUMMARY_GLOBAL_BY_TYPE AND RENAME TABLE
#
diff --git a/mysql-test/suite/plugins/r/audit_null.result b/mysql-test/suite/plugins/r/audit_null.result
index 4cf648510e6..2b1b64a9d85 100644
--- a/mysql-test/suite/plugins/r/audit_null.result
+++ b/mysql-test/suite/plugins/r/audit_null.result
@@ -9,8 +9,8 @@ ERROR 42S22: Unknown column 'foobar' in 'field list'
show status like 'audit_null%';
Variable_name Value
Audit_null_called 9
-Audit_null_general_error 1
Audit_null_general_log 3
+Audit_null_general_error 1
Audit_null_general_result 2
create procedure au1(x char(16)) select concat("test1", x);
call au1("-12");
@@ -19,8 +19,8 @@ test1-12
show status like 'audit_null%';
Variable_name Value
Audit_null_called 19
-Audit_null_general_error 1
Audit_null_general_log 7
+Audit_null_general_error 1
Audit_null_general_result 5
uninstall plugin audit_null;
Warnings:
diff --git a/mysql-test/suite/plugins/r/audit_null_debug.result b/mysql-test/suite/plugins/r/audit_null_debug.result
index 2b5fa291f24..86a22135852 100644
--- a/mysql-test/suite/plugins/r/audit_null_debug.result
+++ b/mysql-test/suite/plugins/r/audit_null_debug.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("mysql/plugin.MYI");
+call mtr.add_suppression("Incorrect key file for table.*mysql.plugin.MYI");
SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
install plugin audit_null soname 'adt_null';
ERROR HY000: Incorrect key file for table './mysql/plugin.MYI'; try to repair it
diff --git a/mysql-test/suite/plugins/r/auth_v0100.result b/mysql-test/suite/plugins/r/auth_v0100.result
new file mode 100644
index 00000000000..53affc94947
--- /dev/null
+++ b/mysql-test/suite/plugins/r/auth_v0100.result
@@ -0,0 +1,18 @@
+install soname 'auth_0x0100';
+select plugin_name, plugin_type_version from information_schema.plugins where plugin_type='authentication' order by plugin_name;
+plugin_name plugin_type_version
+auth_0x0100 1.0
+mysql_native_password 2.0
+mysql_old_password 2.0
+create user tt identified via auth_0x0100;
+grant select on test.* to zzzzzzzzzzzzzzzz;
+connect(localhost,tt,,test,MASTER_MYPORT,MASTER_MYSOCK);
+ERROR 28000: Access denied for user 'tt'@'localhost' (using password: YES)
+grant proxy on zzzzzzzzzzzzzzzz to tt;
+select user(), current_user(), @@external_user;
+user() tt@localhost
+current_user() zzzzzzzzzzzzzzzz@%
+@@external_user oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.
+drop user tt;
+drop user zzzzzzzzzzzzzzzz;
+uninstall plugin auth_0x0100;
diff --git a/mysql-test/suite/plugins/r/qc_info.result b/mysql-test/suite/plugins/r/qc_info.result
new file mode 100644
index 00000000000..3e967d55f43
--- /dev/null
+++ b/mysql-test/suite/plugins/r/qc_info.result
@@ -0,0 +1,15 @@
+set global query_cache_size=1355776;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+statement_schema statement_text result_blocks_count result_blocks_size
+test select * from t1 1 512
+drop table t1;
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+statement_schema statement_text result_blocks_count result_blocks_size
+set global query_cache_size= default;
diff --git a/mysql-test/suite/plugins/r/qc_info_priv.result b/mysql-test/suite/plugins/r/qc_info_priv.result
new file mode 100644
index 00000000000..c723eca1ec0
--- /dev/null
+++ b/mysql-test/suite/plugins/r/qc_info_priv.result
@@ -0,0 +1,23 @@
+set global query_cache_size=1355776;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+statement_schema statement_text result_blocks_count result_blocks_size
+test select * from t1 1 512
+create user mysqltest;
+select a from t1;
+a
+1
+2
+3
+select count(*) from information_schema.query_cache_info;
+count(*)
+0
+drop user mysqltest;
+drop table t1;
+set global query_cache_size= default;
diff --git a/mysql-test/suite/plugins/r/show_all_plugins.result b/mysql-test/suite/plugins/r/show_all_plugins.result
new file mode 100644
index 00000000000..8b9a41e0e1f
--- /dev/null
+++ b/mysql-test/suite/plugins/r/show_all_plugins.result
@@ -0,0 +1,35 @@
+flush status;
+show status like '%libraries%';
+Variable_name Value
+Opened_plugin_libraries 0
+select * from information_schema.all_plugins where plugin_library='ha_example.so';
+PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_TYPE_VERSION PLUGIN_LIBRARY PLUGIN_LIBRARY_VERSION PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION PLUGIN_MATURITY PLUGIN_AUTH_VERSION
+EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE 100001.0 ha_example.so 1.4 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
+UNUSABLE 3.14 NOT INSTALLED DAEMON 100001.0 ha_example.so 1.4 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
+show status like '%libraries%';
+Variable_name Value
+Opened_plugin_libraries 1
+show plugins soname 'ha_example.so';
+Name Status Type Library License
+EXAMPLE NOT INSTALLED STORAGE ENGINE ha_example.so GPL
+UNUSABLE NOT INSTALLED DAEMON ha_example.so GPL
+show status like '%libraries%';
+Variable_name Value
+Opened_plugin_libraries 2
+show plugins soname like '%example%';
+Name Status Type Library License
+EXAMPLE NOT INSTALLED STORAGE ENGINE ha_example.so GPL
+UNUSABLE NOT INSTALLED DAEMON ha_example.so GPL
+daemon_example NOT INSTALLED DAEMON libdaemon_example.so GPL
+three_attempts NOT INSTALLED AUTHENTICATION dialog_examples.so GPL
+two_questions NOT INSTALLED AUTHENTICATION dialog_examples.so GPL
+show status like '%libraries%';
+Variable_name Value
+Opened_plugin_libraries 6
+show plugins soname where library = 'ha_example.so';
+Name Status Type Library License
+EXAMPLE NOT INSTALLED STORAGE ENGINE ha_example.so GPL
+UNUSABLE NOT INSTALLED DAEMON ha_example.so GPL
+select variable_value > 10 from information_schema.global_status where variable_name like '%libraries%';
+variable_value > 10
+1
diff --git a/mysql-test/suite/plugins/t/audit_null_debug.test b/mysql-test/suite/plugins/t/audit_null_debug.test
index d9e6cad5524..bd0495843db 100644
--- a/mysql-test/suite/plugins/t/audit_null_debug.test
+++ b/mysql-test/suite/plugins/t/audit_null_debug.test
@@ -5,19 +5,21 @@ if (!$ADT_NULL_SO) {
skip No NULL_AUDIT plugin;
}
-call mtr.add_suppression("mysql/plugin.MYI");
+call mtr.add_suppression("Incorrect key file for table.*mysql.plugin.MYI");
#
# MySQL BUG#14485479 - INSTALL AUDIT PLUGIN HANGS IF WE TRY TO DISABLE AND ENABLED DURING DDL OPERATION
# (a.k.a. audit event caused by the table access during audit plugin initialization)
#
SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
+--replace_result \\ /
--error 126
install plugin audit_null soname 'adt_null';
SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage';
install plugin audit_null soname 'adt_null';
SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
+--replace_result \\ /
--error 126
uninstall plugin audit_null;
SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage';
diff --git a/mysql-test/suite/plugins/t/auth_v0100.test b/mysql-test/suite/plugins/t/auth_v0100.test
new file mode 100644
index 00000000000..3cf93ba67f2
--- /dev/null
+++ b/mysql-test/suite/plugins/t/auth_v0100.test
@@ -0,0 +1,26 @@
+--source include/not_embedded.inc
+
+if (!$AUTH_0X0100_SO) {
+ skip No auth_0x0100 plugin;
+}
+
+install soname 'auth_0x0100';
+
+select plugin_name, plugin_type_version from information_schema.plugins where plugin_type='authentication' order by plugin_name;
+
+create user tt identified via auth_0x0100;
+grant select on test.* to zzzzzzzzzzzzzzzz;
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT
+--error ER_ACCESS_DENIED_ERROR
+connect (c0,localhost,tt);
+
+grant proxy on zzzzzzzzzzzzzzzz to tt;
+connect (c1,localhost,tt);
+connection c1;
+
+--query_vertical select user(), current_user(), @@external_user
+connection default;
+drop user tt;
+drop user zzzzzzzzzzzzzzzz;
+uninstall plugin auth_0x0100;
diff --git a/mysql-test/suite/plugins/t/qc_info.test b/mysql-test/suite/plugins/t/qc_info.test
new file mode 100644
index 00000000000..fc6c9d5af3a
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info.test
@@ -0,0 +1,8 @@
+--source qc_info_init.inc
+
+drop table t1;
+# the query was invalidated
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+
+set global query_cache_size= default;
+
diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc
new file mode 100644
index 00000000000..9422bd7f141
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info_init.inc
@@ -0,0 +1,12 @@
+if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'query_cache_info' and plugin_status='active'`)
+{
+ --skip QUERY_CACHE_INFO plugin is not active
+}
+
+set global query_cache_size=1355776;
+
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+
diff --git a/mysql-test/suite/plugins/t/qc_info_init.opt b/mysql-test/suite/plugins/t/qc_info_init.opt
new file mode 100644
index 00000000000..663de4da7d7
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info_init.opt
@@ -0,0 +1,2 @@
+--loose-query_cache_info
+--plugin-load=$QUERY_CACHE_INFO_SO
diff --git a/mysql-test/suite/plugins/t/qc_info_priv.test b/mysql-test/suite/plugins/t/qc_info_priv.test
new file mode 100644
index 00000000000..31c394107c1
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info_priv.test
@@ -0,0 +1,15 @@
+--source include/not_embedded.inc
+--source qc_info_init.inc
+
+# try an unprivileged user
+create user mysqltest;
+connect (conn1,localhost,mysqltest,,);
+connection conn1;
+select a from t1;
+select count(*) from information_schema.query_cache_info;
+connection default;
+drop user mysqltest;
+drop table t1;
+
+set global query_cache_size= default;
+
diff --git a/mysql-test/suite/plugins/t/show_all_plugins.test b/mysql-test/suite/plugins/t/show_all_plugins.test
new file mode 100644
index 00000000000..1beca12b52c
--- /dev/null
+++ b/mysql-test/suite/plugins/t/show_all_plugins.test
@@ -0,0 +1,26 @@
+if (!$DIALOG_EXAMPLES_SO) { skip requires dialog_examples.so; }
+if (!$HA_EXAMPLE_SO) { skip requires ha_examples.so; }
+if (!$LIBDAEMON_EXAMPLE_SO) { skip requires libdaemon_examples.so; }
+if (!$UDF_EXAMPLE_SO) { skip requires udf_example.so; }
+
+flush status;
+show status like '%libraries%';
+#--sorted_result
+#select * from information_schema.all_plugins;
+#show status like '%libraries%';
+--replace_result .dll .so
+eval select * from information_schema.all_plugins where plugin_library='$HA_EXAMPLE_SO';
+show status like '%libraries%';
+--sorted_result
+--replace_result .dll .so
+eval show plugins soname '$HA_EXAMPLE_SO';
+show status like '%libraries%';
+--sorted_result
+--replace_result .dll .so
+show plugins soname like '%example%';
+show status like '%libraries%';
+--sorted_result
+--replace_result .dll .so
+eval show plugins soname where library = '$HA_EXAMPLE_SO';
+select variable_value > 10 from information_schema.global_status where variable_name like '%libraries%';
+
diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def
index a45fdb47ae6..9eb5f57c7be 100644
--- a/mysql-test/suite/rpl/disabled.def
+++ b/mysql-test/suite/rpl/disabled.def
@@ -13,5 +13,4 @@
rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576
rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
-rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
diff --git a/mysql-test/suite/rpl/r/replace.result b/mysql-test/suite/rpl/r/replace.result
new file mode 100644
index 00000000000..855c54ef8fa
--- /dev/null
+++ b/mysql-test/suite/rpl/r/replace.result
@@ -0,0 +1,22 @@
+include/master-slave.inc
+[connection master]
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136;
+insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0);
+select * from t1;
+pr_id pr_page pr_type test
+136 1 one 0
+137 2 two 0
+replace into t1 (pr_page, pr_type,test) values(1,"one",2);
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+137 2 two 0
+select * from t1;
+pr_id pr_page pr_type test
+138 1 one 2
+137 2 two 0
+drop table t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_EE_err.result b/mysql-test/suite/rpl/r/rpl_EE_err.result
index 5b3f1872c4e..f61ca063b77 100644
--- a/mysql-test/suite/rpl/r/rpl_EE_err.result
+++ b/mysql-test/suite/rpl/r/rpl_EE_err.result
@@ -4,5 +4,5 @@ create table t1 (a int) engine=myisam;
flush tables;
drop table if exists t1;
Warnings:
-Warning 2 Can't find file: 't1' (errno: 2 "No such file or directory")
+Warning 2 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory")
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_bug31076.result b/mysql-test/suite/rpl/r/rpl_bug31076.result
index 1cf8b87f68d..e09960e848e 100644
--- a/mysql-test/suite/rpl/r/rpl_bug31076.result
+++ b/mysql-test/suite/rpl/r/rpl_bug31076.result
@@ -35,6 +35,7 @@ KEY `event_id` (`event_id`),
KEY `visit_id` (`visit_id`),
KEY `data` (`data`)
) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
BINLOG '
@@ -47,6 +48,7 @@ Bk3vRhe0AQAAWgAAABEMyQkQAJlXFwIAAAEABv/AIE4AvvVDAQZN70YAK0Rvd25sb2Fkcy9NeVNR
TC00LjEvbXlzcWwtNC4xLjEyYS13aW4zMi56aXBPaAIC
'/*!*/;
SET INSERT_ID=21231039/*!*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
use track/*!*/;
SET TIMESTAMP=1190087942/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result
index fbe4ba28409..e03257b8901 100644
--- a/mysql-test/suite/rpl/r/rpl_hrtime.result
+++ b/mysql-test/suite/rpl/r/rpl_hrtime.result
@@ -26,6 +26,7 @@ a b c
0000-00-00 00:00:00.0000 0 2022-02-02 02:02:02.65
drop table t1;
include/rpl_end.inc
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -95,3 +96,4 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
diff --git a/mysql-test/suite/rpl/r/rpl_mdev359.result b/mysql-test/suite/rpl/r/rpl_mdev359.result
index f4382f672e4..c0c7bac1175 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev359.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev359.result
@@ -1,7 +1,6 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
SET GLOBAL rpl_semi_sync_master_enabled = ON;
SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont";
INSERT INTO t1 SELECT * FROM t1;
@@ -9,5 +8,4 @@ SET DEBUG_SYNC= "now WAIT_FOR m1_ready";
SET GLOBAL rpl_semi_sync_master_enabled = OFF;
SET DEBUG_SYNC= "now SIGNAL m1_cont";
DROP TABLE t1;
-UNINSTALL PLUGIN rpl_semi_sync_master;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result
index e43ff4303f6..f9504641ffb 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev382.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev382.result
@@ -155,6 +155,7 @@ master-bin.000001 # Query 1 # BEGIN
master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=14
master-bin.000001 # Execute_load_query 1 # use `test`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/f\'le.txt' INTO TABLE `db1``; select 'oops!'`.`t``1` FIELDS TERMINATED BY ',' ENCLOSED BY '\'' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a``1`, `b``2`) SET `c``3`= concat('|', "b""a'z", "!") ;file_id=#
master-bin.000001 # Query 1 # COMMIT
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -198,6 +199,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
SELECT * FROM `db1``; select 'oops!'`.`t``1`;
a`1 b`2 c`3
fo\o bar |b"a'z!
@@ -247,6 +249,7 @@ master-bin.000001 # User var 1 # @```c`=-123450123456789012345678901234567890123
master-bin.000001 # User var 1 # @```d```=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE latin1_swedish_ci
master-bin.000001 # Query 1 # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
master-bin.000001 # Query 1 # COMMIT
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -292,6 +295,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
SELECT * FROM `db1``; select 'oops!'`.t1 ORDER BY a1;
a1 a2 a3 a4 b c d
-9223372036854775808 42 9223372036854775807 18446744073709551615 -1.234560123456789e125 -1234501234567890123456789012345678901234567890123456789.0123456789 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@@ -338,6 +342,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Query 1 # BEGIN
master-bin.000002 # Query 1 # use `test`; INSERT INTO t1 VALUES(1)
master-bin.000002 # Query 1 # COMMIT
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -364,5 +369,6 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_report_port.result b/mysql-test/suite/rpl/r/rpl_report_port.result
index 6a9ac341780..2f422c8b577 100644
--- a/mysql-test/suite/rpl/r/rpl_report_port.result
+++ b/mysql-test/suite/rpl/r/rpl_report_port.result
@@ -2,10 +2,12 @@ include/master-slave.inc
[connection master]
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000]
include/start_slave.inc
+include/wait_for_slave_param.inc [Slave_IO_State]
[Slave restarted with the report-port set to some value]
include/assert.inc [The value shown for the slave's port number is user specified port number which is the value set for report-port.]
include/rpl_restart_server.inc [server_number=2]
include/start_slave.inc
+include/wait_for_slave_param.inc [Slave_IO_State]
[Slave restarted with the report-port set to the value of slave's port number]
include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
index 1a4d5c7574d..1489af830cc 100644
--- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
+++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
@@ -150,6 +150,7 @@ c1 c3 c4 c5
5 2006-02-22 00:00:00 Tested in Texas 11
--- Test 2 position test --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -170,8 +171,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 3 First Remote test --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -201,6 +204,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 4 Second Remote test --
DROP TABLE t1;
@@ -274,6 +278,7 @@ c1 c3 c4 c5
5 2006-02-22 00:00:00 Tested in Texas 11
--- Test 5 LOAD DATA --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -281,8 +286,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 6 reading stdin --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -312,8 +319,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 7 reading stdin w/position --
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -334,6 +343,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
--- Test 8 switch internal charset --
stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index 51859b5b49b..06eb56a40c5 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -1,13 +1,26 @@
include/master-slave.inc
[connection master]
+call mtr.add_suppression("Timeout waiting for reply of binlog");
+call mtr.add_suppression("Read semi-sync reply");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+call mtr.add_suppression("Master server does not support semi-sync");
+call mtr.add_suppression("Semi-sync slave .* reply");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
#
# Uninstall semi-sync plugins on master and slave
#
include/stop_slave.inc
+reset slave;
+set global rpl_semi_sync_master_enabled= 0;
+set global rpl_semi_sync_slave_enabled= 0;
+reset master;
+set global rpl_semi_sync_master_enabled= 0;
+set global rpl_semi_sync_slave_enabled= 0;
#
# Main test of semi-sync replication start here
#
[ on master ]
+set global rpl_semi_sync_master_timeout= 60000;
[ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value
@@ -41,9 +54,7 @@ Rpl_semi_sync_master_status OFF
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
Rpl_semi_sync_master_yes_tx 0
-#
-# INSTALL PLUGIN semi-sync on slave
-#
+reset master;
[ on slave ]
[ default state of semi-sync on slave should be OFF ]
show variables like 'rpl_semi_sync_slave_enabled';
@@ -84,6 +95,16 @@ select CONNECTIONS_NORMAL_SLAVE - CONNECTIONS_NORMAL_SLAVE as 'Should be 0';
Should be 0
0
[ insert records to table ]
+insert t1 values (10);
+insert t1 values (9);
+insert t1 values (8);
+insert t1 values (7);
+insert t1 values (6);
+insert t1 values (5);
+insert t1 values (4);
+insert t1 values (3);
+insert t1 values (2);
+insert t1 values (1);
[ master status after inserts ]
show status like 'Rpl_semi_sync_master_status';
Variable_name Value
@@ -159,6 +180,16 @@ Rpl_semi_sync_master_no_tx 1
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
Rpl_semi_sync_master_yes_tx 14
+delete from t1 where a=10;
+delete from t1 where a=9;
+delete from t1 where a=8;
+delete from t1 where a=7;
+delete from t1 where a=6;
+delete from t1 where a=5;
+delete from t1 where a=4;
+delete from t1 where a=3;
+delete from t1 where a=2;
+delete from t1 where a=1;
insert into t1 values (100);
[ master status should be OFF ]
show status like 'Rpl_semi_sync_master_status';
@@ -278,6 +309,7 @@ Rpl_semi_sync_master_yes_tx 0
[ on slave ]
include/stop_slave.inc
reset slave;
+kill query _tid;
include/start_slave.inc
[ on master ]
create table t1 (a int) engine = ENGINE_TYPE;
@@ -307,6 +339,7 @@ include/stop_slave.inc
reset slave;
[ on master ]
reset master;
+kill query _tid;
set sql_log_bin=0;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
@@ -357,6 +390,7 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status OFF
[ on master ]
+kill query _tid;
[ Semi-sync status on master should be ON ]
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
@@ -385,11 +419,7 @@ Variable_name Value
Rpl_semi_sync_slave_status ON
include/stop_slave.inc
[ on master ]
-set sql_log_bin=0;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-set sql_log_bin=1;
-SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
-Variable_name Value
+set global rpl_semi_sync_master_enabled= 0;
[ on slave ]
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
Variable_name Value
@@ -397,18 +427,10 @@ rpl_semi_sync_slave_enabled ON
include/start_slave.inc
[ on master ]
insert into t1 values (10);
-[ on slave ]
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
-Variable_name Value
-Rpl_semi_sync_slave_status OFF
#
# Test non-semi-sync slave connect to semi-sync master
#
-set sql_log_bin=0;
-INSTALL PLUGIN rpl_semi_sync_master SONAME 'SEMISYNC_MASTER_SO';
set global rpl_semi_sync_master_timeout= 5000;
-/* 5s */
-set sql_log_bin=1;
set global rpl_semi_sync_master_enabled= 1;
[ on slave ]
include/stop_slave.inc
@@ -416,16 +438,8 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
Variable_name Value
Rpl_semi_sync_slave_status OFF
[ uninstall semi-sync slave plugin ]
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
-Variable_name Value
-include/start_slave.inc
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
-Variable_name Value
-include/stop_slave.inc
-[ reinstall semi-sync slave plugin and disable semi-sync ]
-INSTALL PLUGIN rpl_semi_sync_slave SONAME 'SEMISYNC_SLAVE_SO';
set global rpl_semi_sync_slave_enabled= 0;
+[ reinstall semi-sync slave plugin and disable semi-sync ]
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
Variable_name Value
rpl_semi_sync_slave_enabled OFF
@@ -440,11 +454,12 @@ Rpl_semi_sync_slave_status OFF
# Clean up
#
include/stop_slave.inc
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-UNINSTALL PLUGIN rpl_semi_sync_master;
+set global rpl_semi_sync_slave_enabled= 0;
+set global rpl_semi_sync_master_enabled= 0;
change master to master_user='root',master_password='';
include/start_slave.inc
drop table t1;
drop user rpl@127.0.0.1;
flush privileges;
+set global rpl_semi_sync_master_timeout= default;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_event.result b/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
index 1c6d73fe681..456c0c4475a 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_event.result
@@ -1,6 +1,15 @@
include/master-slave.inc
[connection master]
+call mtr.add_suppression("Timeout waiting for reply of binlog");
+call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
+call mtr.add_suppression("Read semi-sync reply");
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
+call mtr.add_suppression("Master server does not support semi-sync");
+call mtr.add_suppression("Semi-sync slave .* reply");
+call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set global rpl_semi_sync_master_enabled = 1;
include/stop_slave.inc
+set global rpl_semi_sync_slave_enabled = 1;
include/start_slave.inc
SET GLOBAL event_scheduler = ON;
CREATE TABLE t1 (i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f varchar(8)) ENGINE=ENGINE_TYPE;
@@ -34,8 +43,8 @@ UPDATE t1 SET f = CONCAT('up_',CONNECTION_ID()) WHERE i = 2;
UPDATE t1 SET f = CONCAT('up_',CONNECTION_ID()) WHERE i = 1;
SET GLOBAL event_scheduler = OFF;
include/stop_slave.inc
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-UNINSTALL PLUGIN rpl_semi_sync_master;
+set global rpl_semi_sync_slave_enabled = 0;
+set global rpl_semi_sync_master_enabled = 0;
include/start_slave.inc
DROP EVENT ev1;
DROP EVENT ev2;
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index c2d3f5ce212..f7b9daf83b8 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -652,6 +652,7 @@ show function status like '%mysqltestbug36570%';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test mysqltestbug36570_f1 FUNCTION root@localhost t t DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
flush logs;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
@@ -1178,6 +1179,7 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
use test;
drop procedure mysqltestbug36570_p1;
drop procedure ` mysqltestbug36570_p2`;
diff --git a/mysql-test/suite/rpl/r/rpl_table_options.result b/mysql-test/suite/rpl/r/rpl_table_options.result
index 423a2b65583..d69570a1709 100644
--- a/mysql-test/suite/rpl/r/rpl_table_options.result
+++ b/mysql-test/suite/rpl/r/rpl_table_options.result
@@ -7,7 +7,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL
-) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1 `ull`=12340 `VAROPT`='5'
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/rpl/r/semisync_memleak_4066.result b/mysql-test/suite/rpl/r/semisync_memleak_4066.result
new file mode 100644
index 00000000000..c599f1426d3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/semisync_memleak_4066.result
@@ -0,0 +1,4 @@
+include/master-slave.inc
+[connection master]
+CREATE TEMPORARY TABLE tmp (i INT);
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/replace.test b/mysql-test/suite/rpl/t/replace.test
new file mode 100644
index 00000000000..36afda0d927
--- /dev/null
+++ b/mysql-test/suite/rpl/t/replace.test
@@ -0,0 +1,24 @@
+#
+# Test of REPLACE with replication
+#
+
+source include/master-slave.inc;
+
+#
+# Test of doing replace on unique key on table with auto_increment
+#
+
+drop table if exists t1;
+CREATE TABLE t1 (pr_id int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, pr_page int(11) NOT NULL, pr_type varbinary(60) NOT NULL, test int, UNIQUE KEY pr_pagetype (pr_page,pr_type)) ENGINE=myisam AUTO_INCREMENT=136;
+insert into t1 (pr_page, pr_type, test) values(1,"one",0),(2,"two",0);
+select * from t1;
+replace into t1 (pr_page, pr_type,test) values(1,"one",2);
+select * from t1;
+sync_slave_with_master;
+connection slave;
+select * from t1;
+connection master;
+drop table t1;
+
+# End of 5.5 tests
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test
index 028ca32636a..4e9517fbf2a 100644
--- a/mysql-test/suite/rpl/t/rpl_bug31076.test
+++ b/mysql-test/suite/rpl/t/rpl_bug31076.test
@@ -40,6 +40,7 @@ CREATE TABLE `visits_events` (
KEY `data` (`data`)
) ENGINE=MyISAM AUTO_INCREMENT=33900731 DEFAULT CHARSET=latin1;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
--delimiter /*!*/;
@@ -119,6 +120,7 @@ SET INSERT_ID=21231039/*!*/;
# 9c90ded 2d 63 6f 6e 6e 65 63 74 6f 72 2d 6a 61 76 61 2d |.connector.java.|
# 9c90dfd 33 2e 30 2e 31 37 2d 67 61 2e 7a 69 70 |3.0.17.ga.zip|
# Query thread_id=28278824 exec_time=0 error_code=0
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
use track/*!*/;
SET TIMESTAMP=1190087942/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
diff --git a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
index 9ebed299956..49c5056c485 100644
--- a/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
+++ b/mysql-test/suite/rpl/t/rpl_err_ignoredtable.test
@@ -43,7 +43,7 @@ insert into t3 values(connection_id());
send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
connection master1;
-let $wait_condition= SELECT a > 1 FROM t2;
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'update%' AND state='User lock';
source include/wait_condition.inc;
select (@id := id) - id from t3;
kill @id;
diff --git a/mysql-test/suite/rpl/t/rpl_mdev359.test b/mysql-test/suite/rpl/t/rpl_mdev359.test
index ef4e41f5291..96c7ac859d9 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev359.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev359.test
@@ -1,4 +1,4 @@
---source include/have_semisync_plugin.inc
+--source include/have_semisync.inc
--source include/not_embedded.inc
--source include/have_debug_sync.inc
--source include/have_binlog_format_mixed_or_statement.inc
@@ -13,7 +13,6 @@
# the code, disable the semisync, and then continue the paused thread.
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
-INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master';
SET GLOBAL rpl_semi_sync_master_enabled = ON;
--connection master1
SET DEBUG_SYNC = "rpl_semisync_master_commit_trx_before_lock SIGNAL m1_ready WAIT_FOR m1_cont";
@@ -29,8 +28,4 @@ SET DEBUG_SYNC= "now SIGNAL m1_cont";
connection master;
DROP TABLE t1;
-disable_warnings;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-enable_warnings;
-
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_report_port.test b/mysql-test/suite/rpl/t/rpl_report_port.test
index 12c34ce01b1..6e728a678ad 100644
--- a/mysql-test/suite/rpl/t/rpl_report_port.test
+++ b/mysql-test/suite/rpl/t/rpl_report_port.test
@@ -32,6 +32,9 @@ connection master;
connection slave;
--source include/start_slave.inc
+--let $slave_param= Slave_IO_State
+--let $slave_param_value= Waiting for master to send event
+--source include/wait_for_slave_param.inc
--echo [Slave restarted with the report-port set to some value]
connection master;
@@ -52,6 +55,9 @@ connection master;
connection slave;
--source include/start_slave.inc
+--let $slave_param= Slave_IO_State
+--let $slave_param_value= Waiting for master to send event
+--source include/wait_for_slave_param.inc
connection master;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test b/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test
index a63844b451c..6db4e2bea04 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test
+++ b/mysql-test/suite/rpl/t/rpl_rotate_purge_deadlock.test
@@ -1,10 +1,10 @@
#
# Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL
#
-source include/master-slave.inc;
source include/have_debug_sync.inc;
source include/have_binlog_format_row.inc;
source include/have_innodb.inc;
+source include/master-slave.inc;
#
# Testing that execution of two concurrent INSERTing connections both
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index b861bb8c8ec..55fefb3aafa 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -13,8 +13,8 @@ let $master_pos_drop_t1= query_get_value(SHOW MASTER STATUS, Position, 1);
DROP TABLE t1;
# Save master log position for query DROP TABLE t1
save_master_pos;
-let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
-let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7);
+let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
+let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 8);
# Save master log position for query CREATE TABLE t2
let $master_pos_create_t2= query_get_value(SHOW MASTER STATUS, Position, 1);
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index ac5511e28a3..aa36d70d4b7 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -1,4 +1,4 @@
-source include/have_semisync_plugin.inc;
+source include/have_semisync.inc;
source include/not_embedded.inc;
source include/have_innodb.inc;
source include/master-slave.inc;
@@ -7,7 +7,6 @@ let $engine_type= InnoDB;
#let $engine_type= MyISAM;
# Suppress warnings that might be generated during the test
-disable_query_log;
connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog");
call mtr.add_suppression("Read semi-sync reply");
@@ -16,7 +15,6 @@ connection slave;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
-enable_query_log;
connection master;
# wait for dying connections (if any) to disappear
@@ -32,27 +30,15 @@ let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connec
--echo # Uninstall semi-sync plugins on master and slave
--echo #
connection slave;
-disable_query_log;
source include/stop_slave.inc;
reset slave;
-disable_warnings;
-error 0,1305;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-error 0,1305;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-enable_warnings;
+set global rpl_semi_sync_master_enabled= 0;
+set global rpl_semi_sync_slave_enabled= 0;
connection master;
reset master;
-set sql_log_bin=0;
-disable_warnings;
-error 0,1305;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-error 0,1305;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-enable_warnings;
-set sql_log_bin=1;
-enable_query_log;
+set global rpl_semi_sync_master_enabled= 0;
+set global rpl_semi_sync_slave_enabled= 0;
--echo #
--echo # Main test of semi-sync replication start here
@@ -61,16 +47,7 @@ enable_query_log;
connection master;
echo [ on master ];
-disable_query_log;
-let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
-if ($value == No such row)
-{
- set sql_log_bin=0;
- eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
- set global rpl_semi_sync_master_timeout= 60000; /* 60s */
- set sql_log_bin=1;
-}
-enable_query_log;
+set global rpl_semi_sync_master_timeout= 60000; # 60s
echo [ default state of semi-sync on master should be OFF ];
show variables like 'rpl_semi_sync_master_enabled';
@@ -116,28 +93,12 @@ show status like 'Rpl_semi_sync_master_status';
--replace_result 305 304
show status like 'Rpl_semi_sync_master_yes_tx';
-disable_query_log;
# reset master to make sure the following test will start with a clean environment
reset master;
-enable_query_log;
-
---echo #
---echo # INSTALL PLUGIN semi-sync on slave
---echo #
connection slave;
echo [ on slave ];
-disable_query_log;
-let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
-if ($value == No such row)
-{
- set sql_log_bin=0;
- eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
- set sql_log_bin=1;
-}
-enable_query_log;
-
echo [ default state of semi-sync on slave should be OFF ];
show variables like 'rpl_semi_sync_slave_enabled';
@@ -177,15 +138,17 @@ let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_conn
replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE;
eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0';
-let $i=10;
echo [ insert records to table ];
-disable_query_log;
-while ($i)
-{
- eval insert into t1 values ($i);
- dec $i;
-}
-enable_query_log;
+insert t1 values (10);
+insert t1 values (9);
+insert t1 values (8);
+insert t1 values (7);
+insert t1 values (6);
+insert t1 values (5);
+insert t1 values (4);
+insert t1 values (3);
+insert t1 values (2);
+insert t1 values (1);
echo [ master status after inserts ];
show status like 'Rpl_semi_sync_master_status';
@@ -271,14 +234,16 @@ show status like 'Rpl_semi_sync_master_yes_tx';
# Semi-sync status on master is now OFF, so all these transactions
# will be replicated asynchronously.
-let $i=10;
-disable_query_log;
-while ($i)
-{
- eval delete from t1 where a=$i;
- dec $i;
-}
-enable_query_log;
+delete from t1 where a=10;
+delete from t1 where a=9;
+delete from t1 where a=8;
+delete from t1 where a=7;
+delete from t1 where a=6;
+delete from t1 where a=5;
+delete from t1 where a=4;
+delete from t1 where a=3;
+delete from t1 where a=2;
+delete from t1 where a=1;
insert into t1 values (100);
@@ -408,9 +373,8 @@ connection master;
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
if ($_tid)
{
- disable_query_log;
+ --replace_result $_tid _tid
eval kill query $_tid;
- enable_query_log;
# After dump thread exit, Rpl_semi_sync_master_clients will be 0
let $status_var= Rpl_semi_sync_master_clients;
@@ -463,9 +427,8 @@ reset master;
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
if ($_tid)
{
- disable_query_log;
+ --replace_result $_tid _tid
eval kill query $_tid;
- enable_query_log;
# After dump thread exit, Rpl_semi_sync_master_clients will be 0
let $status_var= Rpl_semi_sync_master_clients;
@@ -525,9 +488,8 @@ echo [ on master ];
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
if ($_tid)
{
- disable_query_log;
+ --replace_result $_tid _tid
eval kill query $_tid;
- enable_query_log;
# After dump thread exit, Rpl_semi_sync_master_clients will be 0
let $status_var= Rpl_semi_sync_master_clients;
@@ -562,11 +524,7 @@ connection slave;
source include/stop_slave.inc;
connection master;
echo [ on master ];
-set sql_log_bin=0;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-set sql_log_bin=1;
-enable_query_log;
-SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled';
+set global rpl_semi_sync_master_enabled= 0;
connection slave;
echo [ on slave ];
@@ -577,19 +535,13 @@ connection master;
echo [ on master ];
insert into t1 values (10);
sync_slave_with_master;
-echo [ on slave ];
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
--echo #
--echo # Test non-semi-sync slave connect to semi-sync master
--echo #
connection master;
-set sql_log_bin=0;
-replace_result $SEMISYNC_MASTER_SO SEMISYNC_MASTER_SO;
-eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
-set global rpl_semi_sync_master_timeout= 5000; /* 5s */
-set sql_log_bin=1;
+set global rpl_semi_sync_master_timeout= 5000; # 5s
set global rpl_semi_sync_master_enabled= 1;
connection slave;
@@ -598,16 +550,9 @@ source include/stop_slave.inc;
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
echo [ uninstall semi-sync slave plugin ];
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
-source include/start_slave.inc;
-SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
-source include/stop_slave.inc;
+set global rpl_semi_sync_slave_enabled= 0;
echo [ reinstall semi-sync slave plugin and disable semi-sync ];
-replace_result $SEMISYNC_SLAVE_SO SEMISYNC_SLAVE_SO;
-eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
-set global rpl_semi_sync_slave_enabled= 0;
SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled';
SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
source include/start_slave.inc;
@@ -619,14 +564,10 @@ SHOW STATUS LIKE 'Rpl_semi_sync_slave_status';
connection slave;
source include/stop_slave.inc;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
+set global rpl_semi_sync_slave_enabled= 0;
connection master;
-# The dump thread may still be running on the master, and so the following
-# UNINSTALL could generate a warning about the plugin is busy.
-disable_warnings;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-enable_warnings;
+set global rpl_semi_sync_master_enabled= 0;
connection slave;
change master to master_user='root',master_password='';
@@ -639,4 +580,5 @@ sync_slave_with_master;
connection master;
drop user rpl@127.0.0.1;
flush privileges;
+set global rpl_semi_sync_master_timeout= default;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
index b4a9a9e6e59..b8f3c8130be 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_event.test
@@ -1,12 +1,11 @@
-source include/have_semisync_plugin.inc;
+source include/have_semisync.inc;
source include/not_embedded.inc;
-source include/master-slave.inc;
source include/have_innodb.inc;
+source include/master-slave.inc;
let $engine_type= InnoDB;
# Suppress warnings that might be generated during the test
-disable_query_log;
connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog");
call mtr.add_suppression("Semi-sync master .* waiting for slave reply");
@@ -16,33 +15,13 @@ connection slave;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
-enable_query_log;
connection master;
-disable_query_log;
-let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1);
-if ($value == No such row)
-{
- set sql_log_bin=0;
- eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
- SET GLOBAL rpl_semi_sync_master_enabled = 1;
- set sql_log_bin=1;
-}
-enable_query_log;
+set global rpl_semi_sync_master_enabled = 1;
connection slave;
source include/stop_slave.inc;
-
-disable_query_log;
-let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1);
-if ($value == No such row)
-{
- set sql_log_bin=0;
- eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
- SET GLOBAL rpl_semi_sync_slave_enabled = 1;
- set sql_log_bin=1;
-}
-enable_query_log;
+set global rpl_semi_sync_slave_enabled = 1;
source include/start_slave.inc;
@@ -93,18 +72,16 @@ while ($run)
#
connection slave;
source include/stop_slave.inc;
-
-disable_warnings;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
+set global rpl_semi_sync_slave_enabled = 0;
connection master;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-enable_warnings;
+set global rpl_semi_sync_master_enabled = 0;
connection slave;
source include/start_slave.inc;
connection master;
+
DROP EVENT ev1;
DROP EVENT ev2;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001.test b/mysql-test/suite/rpl/t/rpl_stm_000001.test
index 16f89123d75..0805308aa73 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_000001.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_000001.test
@@ -88,7 +88,8 @@ insert into t3 select get_lock('crash_lock%20C', 1) from t2;
connection master;
send update t1 set n = n + get_lock('crash_lock%20C', 2);
connection master1;
-sleep 3;
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'update%' AND state='User lock';
+source include/wait_condition.inc;
select (@id := id) - id from t2;
kill @id;
# We don't drop t3 as this is a temporary table
diff --git a/mysql-test/suite/rpl/t/semisync_memleak_4066.test b/mysql-test/suite/rpl/t/semisync_memleak_4066.test
new file mode 100644
index 00000000000..f888f764b43
--- /dev/null
+++ b/mysql-test/suite/rpl/t/semisync_memleak_4066.test
@@ -0,0 +1,15 @@
+#
+# MDEV-4066 semisync_master + temporary tables causes memory leaks
+#
+source include/have_semisync.inc;
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+connection master;
+
+--connect (con1,localhost,root,,)
+CREATE TEMPORARY TABLE tmp (i INT);
+--disconnect con1
+
+source include/rpl_end.inc;
+
diff --git a/mysql-test/suite/sphinx/sphinx.result b/mysql-test/suite/sphinx/sphinx.result
index 82c76335e0b..5fe11f4671b 100644
--- a/mysql-test/suite/sphinx/sphinx.result
+++ b/mysql-test/suite/sphinx/sphinx.result
@@ -46,9 +46,6 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE ts ref q q 257 const 3 Using where with pushed condition
SET optimizer_switch=@save_optimizer_switch;
drop table ts;
-show status like "sphinx_error%";
-Variable_name Value
-Sphinx_error OFF
show status like "sphinx_total%";
Variable_name Value
Sphinx_total 2
diff --git a/mysql-test/suite/sphinx/sphinx.test b/mysql-test/suite/sphinx/sphinx.test
index 648eec07f63..126131209c5 100644
--- a/mysql-test/suite/sphinx/sphinx.test
+++ b/mysql-test/suite/sphinx/sphinx.test
@@ -26,6 +26,9 @@ explain select * from ts where q=';groupby=attr:gid';
SET optimizer_switch=@save_optimizer_switch;
drop table ts;
-show status like "sphinx_error%";
+#
+# Don't show sphinx error as this is different between sphinx versions
+# show status like "sphinx_error%";
+
show status like "sphinx_total%";
show status like "sphinx_word%";
diff --git a/mysql-test/suite/storage_engine/1st.result b/mysql-test/suite/storage_engine/1st.result
index 6b686c2b2b4..192a8f8f39b 100644
--- a/mysql-test/suite/storage_engine/1st.result
+++ b/mysql-test/suite/storage_engine/1st.result
@@ -4,7 +4,7 @@ SHOW CREATE TABLE t1;
SHOW COLUMNS IN t1;
INSERT INTO t1 VALUES (1,'a');
INSERT INTO t1 (a,b) VALUES (2,'b');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
diff --git a/mysql-test/suite/storage_engine/1st.test b/mysql-test/suite/storage_engine/1st.test
index af7a4503948..c9ebd8b75e4 100644
--- a/mysql-test/suite/storage_engine/1st.test
+++ b/mysql-test/suite/storage_engine/1st.test
@@ -14,7 +14,7 @@
# - CREATE TABLE .. (column1 <column options>, column2 <column options>) ENGINE=<storage_engine>;
# - INSERT INTO TABLE .. VALUES (val1,val2);
# - DROP TABLE ..
-# - SELECT * FROM ..
+# - SELECT a,b FROM ..
# - SHOW CREATE TABLE ..
# - SHOW COLUMNS IN ...
#
@@ -62,10 +62,10 @@ if (!$mysql_errname)
--source unexpected_result.inc
}
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
if ($mysql_errname)
{
- --let $functionality = SELECT * FROM ..
+ --let $functionality = SELECT a,b FROM ..
--source unexpected_result.inc
}
diff --git a/mysql-test/suite/storage_engine/alter_table.result b/mysql-test/suite/storage_engine/alter_table.result
index 6d868a27a36..09696e0e6b6 100644
--- a/mysql-test/suite/storage_engine/alter_table.result
+++ b/mysql-test/suite/storage_engine/alter_table.result
@@ -105,7 +105,7 @@ t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
2 2
4 3
diff --git a/mysql-test/suite/storage_engine/alter_table.test b/mysql-test/suite/storage_engine/alter_table.test
index 023d8927e16..f99792f5766 100644
--- a/mysql-test/suite/storage_engine/alter_table.test
+++ b/mysql-test/suite/storage_engine/alter_table.test
@@ -111,7 +111,7 @@ SHOW CREATE TABLE t1;
--source alter_table.inc
--source mask_engine.inc
SHOW CREATE TABLE t1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DROP TABLE t1;
# Character set, collate
diff --git a/mysql-test/suite/storage_engine/alter_tablespace.result b/mysql-test/suite/storage_engine/alter_tablespace.result
index 5d8709b2357..71ef910b222 100644
--- a/mysql-test/suite/storage_engine/alter_tablespace.result
+++ b/mysql-test/suite/storage_engine/alter_tablespace.result
@@ -4,15 +4,15 @@ ALTER TABLE t1 DISCARD TABLESPACE;
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a) VALUES (1),(2);
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
ALTER TABLE t1 DISCARD TABLESPACE;
-SELECT * FROM t1;
+SELECT a FROM t1;
ERROR HY000: Got error -1 from storage engine
ALTER TABLE t1 IMPORT TABLESPACE;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
diff --git a/mysql-test/suite/storage_engine/alter_tablespace.test b/mysql-test/suite/storage_engine/alter_tablespace.test
index 6c429bb98ea..508639c7dc5 100644
--- a/mysql-test/suite/storage_engine/alter_tablespace.test
+++ b/mysql-test/suite/storage_engine/alter_tablespace.test
@@ -30,7 +30,7 @@ if (!$mysql_errname)
--source create_table.inc
INSERT INTO t1 (a) VALUES (1),(2);
--sorted_result
- SELECT * FROM t1;
+ SELECT a FROM t1;
# http://dev.mysql.com/doc/mysql-enterprise-backup/3.5/en/partial.restoring.single.html
# To get a "clean" backup we need to either use innobackup, or to monitor show engine innodb status,
@@ -64,7 +64,7 @@ EOF
--source alter_table.inc
--let $error_codes = ER_GET_ERRNO
- SELECT * FROM t1;
+ SELECT a FROM t1;
--source check_errors.inc
if ($mysql_errname != ER_GET_ERRNO)
{
@@ -76,7 +76,7 @@ EOF
--let $alter_definition = IMPORT TABLESPACE
--source alter_table.inc
--sorted_result
- SELECT * FROM t1;
+ SELECT a FROM t1;
# Adding a warning suppression based on what InnoDB currently does
# when it attempts to access a table without an *.ibd file
diff --git a/mysql-test/suite/storage_engine/autoinc_secondary.result b/mysql-test/suite/storage_engine/autoinc_secondary.result
index ad2b43bc6fe..28b0a406fff 100644
--- a/mysql-test/suite/storage_engine/autoinc_secondary.result
+++ b/mysql-test/suite/storage_engine/autoinc_secondary.result
@@ -4,7 +4,7 @@ INSERT INTO t1 (b) VALUES ('a'),('b'),('b'),('c'),('a');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
@@ -17,7 +17,7 @@ INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
a 1
a 2
@@ -30,7 +30,7 @@ INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
a 1
a 5
diff --git a/mysql-test/suite/storage_engine/autoinc_secondary.test b/mysql-test/suite/storage_engine/autoinc_secondary.test
index 8b95f1d859e..25fc0f7cfa1 100644
--- a/mysql-test/suite/storage_engine/autoinc_secondary.test
+++ b/mysql-test/suite/storage_engine/autoinc_secondary.test
@@ -25,7 +25,7 @@ if (!$mysql_errname)
INSERT INTO t1 (b) VALUES ('a'),('b'),('b'),('c'),('a');
SELECT LAST_INSERT_ID();
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -45,7 +45,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
SELECT LAST_INSERT_ID();
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -65,7 +65,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES ('a'),('b'),('b'),('c'),('a');
SELECT LAST_INSERT_ID();
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/autoinc_vars.result b/mysql-test/suite/storage_engine/autoinc_vars.result
index a9fd8c8d06c..aca21dfd1c4 100644
--- a/mysql-test/suite/storage_engine/autoinc_vars.result
+++ b/mysql-test/suite/storage_engine/autoinc_vars.result
@@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
@@ -15,7 +15,7 @@ INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
200
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
@@ -28,7 +28,7 @@ INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
850
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
@@ -48,6 +48,6 @@ ERROR 22003: Out of range value for column 'a' at row 1
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
850
-SELECT * FROM t1;
+SELECT a FROM t1;
a
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/autoinc_vars.test b/mysql-test/suite/storage_engine/autoinc_vars.test
index ceafcd7138f..b154fd794d0 100644
--- a/mysql-test/suite/storage_engine/autoinc_vars.test
+++ b/mysql-test/suite/storage_engine/autoinc_vars.test
@@ -25,7 +25,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
SELECT LAST_INSERT_ID();
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
# auto_increment_increment
@@ -34,13 +34,13 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
SELECT LAST_INSERT_ID();
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
SET auto_increment_increment = 50;
INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
SELECT LAST_INSERT_ID();
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -60,7 +60,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES (NULL);
SELECT LAST_INSERT_ID();
--sorted_result
- SELECT * FROM t1;
+ SELECT a FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/autoincrement.result b/mysql-test/suite/storage_engine/autoincrement.result
index bc51a2a82af..44cb8650441 100644
--- a/mysql-test/suite/storage_engine/autoincrement.result
+++ b/mysql-test/suite/storage_engine/autoincrement.result
@@ -8,7 +8,7 @@ t1 CREATE TABLE `t1` (
KEY `a` (`a`)
) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
INSERT INTO t1 (b) VALUES ('a'),('b');
-SELECT * FROM t1 ORDER BY a;
+SELECT a,b FROM t1 ORDER BY a;
a b
1 a
2 b
@@ -16,7 +16,7 @@ SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
INSERT INTO t1 (a,b) VALUES (NULL,'c'),(0,'d');
-SELECT * FROM t1 ORDER BY a;
+SELECT a,b FROM t1 ORDER BY a;
a b
1 a
2 b
@@ -27,7 +27,7 @@ LAST_INSERT_ID()
3
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT INTO t1 (a,b) VALUES (NULL,'e');
-SELECT * FROM t1 ORDER BY a;
+SELECT a,b FROM t1 ORDER BY a;
a b
1 a
2 b
@@ -38,7 +38,7 @@ SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5
INSERT INTO t1 (a,b) VALUES (0,'f');
-SELECT * FROM t1 ORDER BY a;
+SELECT a,b FROM t1 ORDER BY a;
a b
0 f
1 a
@@ -61,7 +61,7 @@ SHOW TABLE STATUS FROM test LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 # # # # # # # # # 8 # # # # # # #
INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j');
-SELECT * FROM t1 ORDER BY a;
+SELECT a,b FROM t1 ORDER BY a;
a b
0 f
1 a
@@ -84,7 +84,7 @@ SHOW TABLE STATUS FROM test LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 # # # # # # # # # 21 # # # # # # #
INSERT INTO t1 (a,b) VALUES (NULL,'l');
-SELECT * FROM t1 ORDER BY a;
+SELECT a,b FROM t1 ORDER BY a;
a b
0 f
1 a
@@ -105,7 +105,7 @@ SHOW TABLE STATUS FROM test LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 # # # # # # # # # 22 # # # # # # #
INSERT INTO t1 (a,b) VALUES (-5,'m');
-SELECT * FROM t1 ORDER BY a;
+SELECT a,b FROM t1 ORDER BY a;
a b
-5 m
0 f
@@ -123,7 +123,7 @@ a b
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN> AUTO_INCREMENT, b <CHAR_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AUTO_INCREMENT = 100;
INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
100 a
101 b
diff --git a/mysql-test/suite/storage_engine/autoincrement.test b/mysql-test/suite/storage_engine/autoincrement.test
index fb07ea55c57..ddb0ab1b464 100644
--- a/mysql-test/suite/storage_engine/autoincrement.test
+++ b/mysql-test/suite/storage_engine/autoincrement.test
@@ -26,22 +26,22 @@ if (!$mysql_errname)
# Automatic values
INSERT INTO t1 (b) VALUES ('a'),('b');
- SELECT * FROM t1 ORDER BY a;
+ SELECT a,b FROM t1 ORDER BY a;
SELECT LAST_INSERT_ID();
INSERT INTO t1 (a,b) VALUES (NULL,'c'),(0,'d');
- SELECT * FROM t1 ORDER BY a;
+ SELECT a,b FROM t1 ORDER BY a;
SELECT LAST_INSERT_ID();
let $sql_mode = `SELECT @@sql_mode`;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT INTO t1 (a,b) VALUES (NULL,'e');
- SELECT * FROM t1 ORDER BY a;
+ SELECT a,b FROM t1 ORDER BY a;
SELECT LAST_INSERT_ID();
INSERT INTO t1 (a,b) VALUES (0,'f');
- SELECT * FROM t1 ORDER BY a;
+ SELECT a,b FROM t1 ORDER BY a;
SELECT LAST_INSERT_ID();
--replace_result $sql_mode <INITIAL_SQL_MODE>
@@ -63,7 +63,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j');
- SELECT * FROM t1 ORDER BY a;
+ SELECT a,b FROM t1 ORDER BY a;
SELECT LAST_INSERT_ID();
--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
@@ -77,7 +77,7 @@ if (!$mysql_errname)
SHOW TABLE STATUS FROM test LIKE 't1';
INSERT INTO t1 (a,b) VALUES (NULL,'l');
- SELECT * FROM t1 ORDER BY a;
+ SELECT a,b FROM t1 ORDER BY a;
SELECT LAST_INSERT_ID();
--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
@@ -87,7 +87,7 @@ if (!$mysql_errname)
# but won't check what happens to the sequence after that, since the behavior is undefined
INSERT INTO t1 (a,b) VALUES (-5,'m');
- SELECT * FROM t1 ORDER BY a;
+ SELECT a,b FROM t1 ORDER BY a;
DROP TABLE t1;
}
@@ -106,7 +106,7 @@ if (!$mysql_errname)
{
INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
SELECT LAST_INSERT_ID();
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/col_opt_default.result b/mysql-test/suite/storage_engine/col_opt_default.result
index 2d0a8508b99..d1f3e9d98c6 100644
--- a/mysql-test/suite/storage_engine/col_opt_default.result
+++ b/mysql-test/suite/storage_engine/col_opt_default.result
@@ -4,7 +4,7 @@ SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
a int(11) # 0
INSERT INTO t1 (a) VALUES (1);
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
ALTER TABLE t1 ADD COLUMN b <CHAR_COLUMN> DEFAULT '';
@@ -13,7 +13,7 @@ Field Type Null Key Default Extra
a int(11) # 0
b char(8) #
INSERT INTO t1 (b) VALUES ('a');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 a
1
diff --git a/mysql-test/suite/storage_engine/col_opt_default.test b/mysql-test/suite/storage_engine/col_opt_default.test
index f59daef37fc..3b28def76db 100644
--- a/mysql-test/suite/storage_engine/col_opt_default.test
+++ b/mysql-test/suite/storage_engine/col_opt_default.test
@@ -25,7 +25,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES (1);
--sorted_result
- SELECT * FROM t1;
+ SELECT a FROM t1;
--let $alter_definition = ADD COLUMN b $char_col DEFAULT ''
--source alter_table.inc
@@ -41,7 +41,7 @@ if (!$mysql_errname)
INSERT INTO t1 (b) VALUES ('a');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
}
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/col_opt_not_null.result b/mysql-test/suite/storage_engine/col_opt_not_null.result
index 49b834efc26..18508e98e8c 100644
--- a/mysql-test/suite/storage_engine/col_opt_not_null.result
+++ b/mysql-test/suite/storage_engine/col_opt_not_null.result
@@ -15,20 +15,20 @@ b0 binary(0) # # # #
b1 binary(1) # # # #
b20 binary(20) # # # #
b255 binary(255) # # # #
-INSERT INTO t1 VALUES ('','','','','');
-INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','','');
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
-INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b0' at row 1
Warning 1265 Data truncated for column 'b1' at row 1
Warning 1265 Data truncated for column 'b20' at row 1
Warning 1265 Data truncated for column 'b255' at row 1
-INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b0' at row 1
@@ -237,29 +237,29 @@ a bit(1) # # #
b bit(20) # # #
c bit(64) # # #
d bit(1) # # #
-INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
BIN(a) HEX(b) c+0
0 FFFFF 18446744073709551615
-INSERT INTO t1 VALUES (1,0,-1,0);
+INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0);
SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
a+0 b+0 c+0
0 1048575 18446744073709551615
1 0 18446744073709551615
-INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0);
SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
a+0 b+0 c+0
1 0 18446744073709551615
1 102 255
-INSERT INTO t1 VALUES (0x10,0,0,1);
+INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-SELECT * FROM t1;
+SELECT a,b,c,d FROM t1;
a b c d
-INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0);
Warnings:
Warning 1264 Out of range value for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c,d FROM t1;
a b c d
DROP TABLE t1;
CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS> NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
@@ -319,7 +319,7 @@ b17m longblob # # #
t tinyblob # # #
m mediumblob # # #
l longblob # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -330,7 +330,7 @@ LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m
1 1 1 1 1 1 1 1 1 1
5 5 5 5 5 5 5 5 5 6
65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
-INSERT INTO t1 VALUES
+INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
@@ -392,23 +392,23 @@ SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
b1 tinyint(1) # # #
b2 tinyint(1) # # #
-INSERT INTO t1 VALUES (1,TRUE);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (1,TRUE);
+SELECT b1,b2 FROM t1;
b1 b2
1 1
-INSERT INTO t1 VALUES (FALSE,0);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (FALSE,0);
+SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
-INSERT INTO t1 VALUES (2,3);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (2,3);
+SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
2 3
-INSERT INTO t1 VALUES (-1,-2);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (-1,-2);
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
@@ -420,28 +420,28 @@ false false
true true
true true
true true
-SELECT * FROM t1 WHERE b1 = TRUE;
+SELECT b1,b2 FROM t1 WHERE b1 = TRUE;
b1 b2
1 1
-SELECT * FROM t1 WHERE b2 = FALSE;
+SELECT b1,b2 FROM t1 WHERE b2 = FALSE;
b1 b2
0 0
-INSERT INTO t1 VALUES ('a','b');
+INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
-SELECT * FROM t1;
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
0 0
1 1
2 3
-INSERT INTO t1 VALUES (128,-129);
+INSERT INTO t1 (b1,b2) VALUES (128,-129);
Warnings:
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b2' at row 1
-SELECT * FROM t1;
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
@@ -499,20 +499,20 @@ c0 char(0) # # #
c1 char(1) # # #
c20 char(20) # # #
c255 char(255) # # #
-INSERT INTO t1 VALUES ('','','','','');
-INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
-SELECT * FROM t1;
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','','');
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT c,c0,c1,c20,c255 FROM t1;
c c0 c1 c20 c255
a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
-INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'c0' at row 1
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c20' at row 1
Warning 1265 Data truncated for column 'c255' at row 1
-INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
Warnings:
Warning 1265 Data truncated for column 'c' at row 2
Warning 1265 Data truncated for column 'c0' at row 2
@@ -523,7 +523,7 @@ Warning 1265 Data truncated for column 'c0' at row 3
Warning 1265 Data truncated for column 'c1' at row 3
Warning 1265 Data truncated for column 'c20' at row 3
Warning 1265 Data truncated for column 'c255' at row 3
-SELECT * FROM t1;
+SELECT c,c0,c1,c20,c255 FROM t1;
c c0 c1 c20 c255
@@ -625,7 +625,7 @@ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that
* MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
-SELECT * FROM t1;
+SELECT v0,v1,v64,v65000 FROM t1;
v0 v1 v64 v65000
@@ -751,18 +751,18 @@ y year(4) # # #
y4 year(4) # # #
y2 year(2) # # #
SET @tm = '2012-04-09 05:27:00';
-INSERT INTO t1 VALUES
+INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
-SELECT * FROM t1;
+SELECT d,dt,ts,t,y,y4,y2 FROM t1;
d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
-INSERT INTO t1 VALUES
+INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
@@ -772,7 +772,7 @@ Warning 1264 Out of range value for column 't' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'y4' at row 1
Warning 1264 Out of range value for column 'y2' at row 1
-SELECT * FROM t1;
+SELECT d,dt,ts,t,y,y4,y2 FROM t1;
d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
@@ -853,7 +853,7 @@ SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
INSERT INTO t1 (c) VALUES (NULL);
-SELECT * FROM t1;
+SELECT c FROM t1;
c
<TIMESTAMP>
DROP TABLE t1;
@@ -959,17 +959,17 @@ Field Type Null Key Default Extra
a enum('') # # #
b enum('test1','test2','test3','test4','test5') # # #
c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
-INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
-SELECT * FROM t1;
+INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2);
+SELECT a,b,c FROM t1;
a b c
test2 4
test5 2
-INSERT INTO t1 VALUES (0,'test6',-1);
+INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
test2 4
@@ -984,14 +984,14 @@ a enum('') # # #
b enum('test1','test2','test3','test4','test5') # # #
c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
e enum('a','A') # # #
-INSERT INTO t1 VALUES ('','test3','75','A');
-SELECT * FROM t1;
+INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A');
+SELECT a,b,c,e FROM t1;
a b c e
a
test2 4 a
test3 75 a
test5 2 a
-SELECT * FROM t1 WHERE b='test2' OR a != '';
+SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != '';
a b c e
test2 4 a
DROP TABLE t1;
@@ -1050,30 +1050,30 @@ n0_0 decimal(10,0) # # #
n1 decimal(1,0) # # #
n20_4 decimal(20,4) # # #
n65_4 decimal(65,4) # # #
-INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
-INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -1084,7 +1084,7 @@ Warning 1264 Out of range value for column 'n' at row 1
Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -1092,7 +1092,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -1104,7 +1104,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -1113,7 +1113,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
Warnings:
Note 1265 Data truncated for column 'd' at row 1
Note 1265 Data truncated for column 'd0' at row 1
@@ -1125,7 +1125,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1
Note 1265 Data truncated for column 'n1' at row 1
Note 1265 Data truncated for column 'n20_4' at row 1
Note 1265 Data truncated for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -1229,8 +1229,8 @@ d1_0 double(1,0) # # #
d10_10 double(10,10) # # #
d53 double(53,0) # # #
d53_10 double(53,10) # # #
-INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 11111111.111
d10_10 0.0123456789
@@ -1241,8 +1241,8 @@ f0 12345.1
f20_3 56789.988
f23_0 123457000
r1_1 0.9
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
99999999999999999999999999999999999999,
99999999999999999999999999999999999999.9999999999999999,
0.9,
@@ -1257,7 +1257,7 @@ INSERT INTO t1 VALUES (
Warnings:
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 0
d 11111111.111
@@ -1288,8 +1288,8 @@ f23_0 1e38
r1_1 0.0
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -1341,7 +1341,7 @@ MAX(f0) 9.999999680285692e37
MAX(f20_3) 99999998430674940.000
MAX(f23_0) 9.999999680285692e37
MAX(r1_1) 0.9
-INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f0' at row 1
@@ -1349,7 +1349,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1
Warning 1264 Out of range value for column 'f23_0' at row 1
Warning 1264 Out of range value for column 'f20_3' at row 1
Warning 1264 Out of range value for column 'd1_0' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -1400,7 +1400,7 @@ r1_1 0.0
r1_1 0.9
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
999999999999999999999999999999999999999,
999999999999999999999999999999999999999.9999999999999999,
1.9,
@@ -1423,7 +1423,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1
Warning 1264 Out of range value for column 'd10_10' at row 1
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -1594,16 +1594,16 @@ b bigint(20) # # #
b0 bigint(20) # # #
b1 bigint(1) # # #
b20 bigint(20) # # #
-INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
-SELECT * FROM t1;
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
-INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
-INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1625,14 +1625,14 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
-INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1654,7 +1654,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1676,7 +1676,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1742,7 +1742,7 @@ Warning 1264 Out of range value for column 'm' at row 4
Warning 1264 Out of range value for column 'm0' at row 4
Warning 1264 Out of range value for column 'm1' at row 4
Warning 1264 Out of range value for column 'm20' at row 4
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
@@ -1912,22 +1912,22 @@ Field Type Null Key Default Extra
a set('') # # #
b set('test1','test2','test3','test4','test5') # # #
c set('01','02','03','04','05','06','07','08','09','10','11','12','13','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','39','40','41','42','43','44','45','46','47','48','49','50''51','52','53','54','55','56','57','58','59','60','61','62','63','64') # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (a,b,c) VALUES
('','test2,test3','01,34,44,,23'),
('',5,2),
(',','test4,test2','');
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
test1,test3 02
test2,test3 01,23,34,44
test2,test4
-INSERT INTO t1 VALUES (0,'test6',-1);
+INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
01,02,03,04,05,06,07,08,09,10,11,12,13,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,39,40,41,42,43,44,45,46,47,48,49,50'51,52,53,54,55,56,57,58,59,60,61,62,63,64
test1,test3 02
@@ -1945,7 +1945,7 @@ c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15'
e set('a','A') # # #
ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS> NOT NULL;
ERROR HY000: Too many strings for column f and SET
-SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
a b c e
test2,test3 01,23,34,44
test2,test4
@@ -2005,7 +2005,7 @@ t17m longtext # # #
tt tinytext # # #
m mediumtext # # #
l longtext # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -2016,7 +2016,7 @@ LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m
1 1 1 1 1 1 1 1 1 1
5 5 5 5 5 5 5 5 5 6
65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
-INSERT INTO t1 VALUES
+INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
Warnings:
Warning 1265 Data truncated for column 't' at row 1
diff --git a/mysql-test/suite/storage_engine/col_opt_not_null.test b/mysql-test/suite/storage_engine/col_opt_not_null.test
index 2cd0e909536..1ec00621518 100644
--- a/mysql-test/suite/storage_engine/col_opt_not_null.test
+++ b/mysql-test/suite/storage_engine/col_opt_not_null.test
@@ -144,7 +144,7 @@ if (!$mysql_errname)
}
--replace_regex /[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}/<TIMESTAMP>/
- SELECT * FROM t1;
+ SELECT c FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/col_opt_null.result b/mysql-test/suite/storage_engine/col_opt_null.result
index ebcb91d0c5f..45982faed61 100644
--- a/mysql-test/suite/storage_engine/col_opt_null.result
+++ b/mysql-test/suite/storage_engine/col_opt_null.result
@@ -15,20 +15,20 @@ b0 binary(0) # # # #
b1 binary(1) # # # #
b20 binary(20) # # # #
b255 binary(255) # # # #
-INSERT INTO t1 VALUES ('','','','','');
-INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','','');
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
-INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b0' at row 1
Warning 1265 Data truncated for column 'b1' at row 1
Warning 1265 Data truncated for column 'b20' at row 1
Warning 1265 Data truncated for column 'b255' at row 1
-INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b0' at row 1
@@ -229,29 +229,29 @@ a bit(1) # # #
b bit(20) # # #
c bit(64) # # #
d bit(1) # # #
-INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
BIN(a) HEX(b) c+0
0 FFFFF 18446744073709551615
-INSERT INTO t1 VALUES (1,0,-1,0);
+INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0);
SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
a+0 b+0 c+0
0 1048575 18446744073709551615
1 0 18446744073709551615
-INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0);
SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
a+0 b+0 c+0
1 0 18446744073709551615
1 102 255
-INSERT INTO t1 VALUES (0x10,0,0,1);
+INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-SELECT * FROM t1;
+SELECT a,b,c,d FROM t1;
a b c d
-INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0);
Warnings:
Warning 1264 Out of range value for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c,d FROM t1;
a b c d
DROP TABLE t1;
CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS> NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
@@ -307,7 +307,7 @@ b17m longblob # # #
t tinyblob # # #
m mediumblob # # #
l longblob # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -318,7 +318,7 @@ LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m
1 1 1 1 1 1 1 1 1 1
5 5 5 5 5 5 5 5 5 6
65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
-INSERT INTO t1 VALUES
+INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
@@ -388,23 +388,23 @@ SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
b1 tinyint(1) # # #
b2 tinyint(1) # # #
-INSERT INTO t1 VALUES (1,TRUE);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (1,TRUE);
+SELECT b1,b2 FROM t1;
b1 b2
1 1
-INSERT INTO t1 VALUES (FALSE,0);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (FALSE,0);
+SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
-INSERT INTO t1 VALUES (2,3);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (2,3);
+SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
2 3
-INSERT INTO t1 VALUES (-1,-2);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (-1,-2);
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
@@ -416,28 +416,28 @@ false false
true true
true true
true true
-SELECT * FROM t1 WHERE b1 = TRUE;
+SELECT b1,b2 FROM t1 WHERE b1 = TRUE;
b1 b2
1 1
-SELECT * FROM t1 WHERE b2 = FALSE;
+SELECT b1,b2 FROM t1 WHERE b2 = FALSE;
b1 b2
0 0
-INSERT INTO t1 VALUES ('a','b');
+INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
-SELECT * FROM t1;
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
0 0
1 1
2 3
-INSERT INTO t1 VALUES (128,-129);
+INSERT INTO t1 (b1,b2) VALUES (128,-129);
Warnings:
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b2' at row 1
-SELECT * FROM t1;
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
@@ -491,20 +491,20 @@ c0 char(0) # # #
c1 char(1) # # #
c20 char(20) # # #
c255 char(255) # # #
-INSERT INTO t1 VALUES ('','','','','');
-INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
-SELECT * FROM t1;
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','','');
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT c,c0,c1,c20,c255 FROM t1;
c c0 c1 c20 c255
a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
-INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'c0' at row 1
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c20' at row 1
Warning 1265 Data truncated for column 'c255' at row 1
-INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
Warnings:
Warning 1265 Data truncated for column 'c' at row 2
Warning 1265 Data truncated for column 'c0' at row 2
@@ -515,7 +515,7 @@ Warning 1265 Data truncated for column 'c0' at row 3
Warning 1265 Data truncated for column 'c1' at row 3
Warning 1265 Data truncated for column 'c20' at row 3
Warning 1265 Data truncated for column 'c255' at row 3
-SELECT * FROM t1;
+SELECT c,c0,c1,c20,c255 FROM t1;
c c0 c1 c20 c255
@@ -613,7 +613,7 @@ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that
* MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
-SELECT * FROM t1;
+SELECT v0,v1,v64,v65000 FROM t1;
v0 v1 v64 v65000
@@ -735,18 +735,18 @@ y year(4) # # #
y4 year(4) # # #
y2 year(2) # # #
SET @tm = '2012-04-09 05:27:00';
-INSERT INTO t1 VALUES
+INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
-SELECT * FROM t1;
+SELECT d,dt,ts,t,y,y4,y2 FROM t1;
d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
-INSERT INTO t1 VALUES
+INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
@@ -756,7 +756,7 @@ Warning 1264 Out of range value for column 't' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'y4' at row 1
Warning 1264 Out of range value for column 'y2' at row 1
-SELECT * FROM t1;
+SELECT d,dt,ts,t,y,y4,y2 FROM t1;
d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
@@ -927,17 +927,17 @@ Field Type Null Key Default Extra
a enum('') # # #
b enum('test1','test2','test3','test4','test5') # # #
c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
-INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
-SELECT * FROM t1;
+INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2);
+SELECT a,b,c FROM t1;
a b c
test2 4
test5 2
-INSERT INTO t1 VALUES (0,'test6',-1);
+INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
test2 4
@@ -952,14 +952,14 @@ a enum('') # # #
b enum('test1','test2','test3','test4','test5') # # #
c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
e enum('a','A') # # #
-INSERT INTO t1 VALUES ('','test3','75','A');
-SELECT * FROM t1;
+INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A');
+SELECT a,b,c,e FROM t1;
a b c e
NULL
test2 4 NULL
test3 75 a
test5 2 NULL
-SELECT * FROM t1 WHERE b='test2' OR a != '';
+SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != '';
a b c e
test2 4 NULL
DROP TABLE t1;
@@ -1014,30 +1014,30 @@ n0_0 decimal(10,0) # # #
n1 decimal(1,0) # # #
n20_4 decimal(20,4) # # #
n65_4 decimal(65,4) # # #
-INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
-INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -1048,7 +1048,7 @@ Warning 1264 Out of range value for column 'n' at row 1
Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -1056,7 +1056,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -1068,7 +1068,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -1077,7 +1077,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
Warnings:
Note 1265 Data truncated for column 'd' at row 1
Note 1265 Data truncated for column 'd0' at row 1
@@ -1089,7 +1089,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1
Note 1265 Data truncated for column 'n1' at row 1
Note 1265 Data truncated for column 'n20_4' at row 1
Note 1265 Data truncated for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -1183,8 +1183,8 @@ d1_0 double(1,0) # # #
d10_10 double(10,10) # # #
d53 double(53,0) # # #
d53_10 double(53,10) # # #
-INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 11111111.111
d10_10 0.0123456789
@@ -1195,8 +1195,8 @@ f0 12345.1
f20_3 56789.988
f23_0 123457000
r1_1 0.9
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
99999999999999999999999999999999999999,
99999999999999999999999999999999999999.9999999999999999,
0.9,
@@ -1211,7 +1211,7 @@ INSERT INTO t1 VALUES (
Warnings:
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 0
d 11111111.111
@@ -1242,8 +1242,8 @@ f23_0 1e38
r1_1 0.0
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -1295,7 +1295,7 @@ MAX(f0) 9.999999680285692e37
MAX(f20_3) 99999998430674940.000
MAX(f23_0) 9.999999680285692e37
MAX(r1_1) 0.9
-INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f0' at row 1
@@ -1303,7 +1303,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1
Warning 1264 Out of range value for column 'f23_0' at row 1
Warning 1264 Out of range value for column 'f20_3' at row 1
Warning 1264 Out of range value for column 'd1_0' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -1354,7 +1354,7 @@ r1_1 0.0
r1_1 0.9
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
999999999999999999999999999999999999999,
999999999999999999999999999999999999999.9999999999999999,
1.9,
@@ -1377,7 +1377,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1
Warning 1264 Out of range value for column 'd10_10' at row 1
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -1540,16 +1540,16 @@ b bigint(20) # # #
b0 bigint(20) # # #
b1 bigint(1) # # #
b20 bigint(20) # # #
-INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
-SELECT * FROM t1;
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
-INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
-INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1571,14 +1571,14 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
-INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1600,7 +1600,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1622,7 +1622,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -1688,7 +1688,7 @@ Warning 1264 Out of range value for column 'm' at row 4
Warning 1264 Out of range value for column 'm0' at row 4
Warning 1264 Out of range value for column 'm1' at row 4
Warning 1264 Out of range value for column 'm20' at row 4
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
@@ -1838,22 +1838,22 @@ Field Type Null Key Default Extra
a set('') # # #
b set('test1','test2','test3','test4','test5') # # #
c set('01','02','03','04','05','06','07','08','09','10','11','12','13','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','39','40','41','42','43','44','45','46','47','48','49','50''51','52','53','54','55','56','57','58','59','60','61','62','63','64') # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (a,b,c) VALUES
('','test2,test3','01,34,44,,23'),
('',5,2),
(',','test4,test2','');
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
test1,test3 02
test2,test3 01,23,34,44
test2,test4
-INSERT INTO t1 VALUES (0,'test6',-1);
+INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
01,02,03,04,05,06,07,08,09,10,11,12,13,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,39,40,41,42,43,44,45,46,47,48,49,50'51,52,53,54,55,56,57,58,59,60,61,62,63,64
test1,test3 02
@@ -1871,7 +1871,7 @@ c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15'
e set('a','A') # # #
ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS> NULL;
ERROR HY000: Too many strings for column f and SET
-SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
a b c e
test2,test3 01,23,34,44 NULL
test2,test4 NULL
@@ -1927,7 +1927,7 @@ t17m longtext # # #
tt tinytext # # #
m mediumtext # # #
l longtext # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -1938,7 +1938,7 @@ LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m
1 1 1 1 1 1 1 1 1 1
5 5 5 5 5 5 5 5 5 6
65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
-INSERT INTO t1 VALUES
+INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
Warnings:
Warning 1265 Data truncated for column 't' at row 1
diff --git a/mysql-test/suite/storage_engine/col_opt_unsigned.result b/mysql-test/suite/storage_engine/col_opt_unsigned.result
index a68aa48ee79..7b5274525ce 100644
--- a/mysql-test/suite/storage_engine/col_opt_unsigned.result
+++ b/mysql-test/suite/storage_engine/col_opt_unsigned.result
@@ -25,15 +25,15 @@ n0_0 decimal(10,0) unsigned # # #
n1 decimal(1,0) unsigned # # #
n20_4 decimal(20,4) unsigned # # #
n65_4 decimal(65,4) unsigned # # #
-INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -45,7 +45,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -57,20 +57,20 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -81,7 +81,7 @@ Warning 1264 Out of range value for column 'n' at row 1
Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
@@ -89,7 +89,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -101,7 +101,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
@@ -110,7 +110,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
Warnings:
Note 1265 Data truncated for column 'd' at row 1
Note 1265 Data truncated for column 'd0' at row 1
@@ -122,7 +122,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1
Note 1265 Data truncated for column 'n1' at row 1
Note 1265 Data truncated for column 'n20_4' at row 1
Note 1265 Data truncated for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
@@ -152,7 +152,7 @@ Warning 1264 Out of range value for column 'b' at row 1
INSERT INTO t1 (a,b) VALUES (-100,100);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 100
1 0
@@ -184,8 +184,8 @@ d1_0 double(1,0) unsigned # # #
d10_10 double(10,10) unsigned # # #
d53 double(53,0) unsigned # # #
d53_10 double(53,10) unsigned # # #
-INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 11111111.111
d10_10 0.0123456789
@@ -196,8 +196,8 @@ f0 12345.1
f20_3 56789.988
f23_0 123457000
r1_1 0.9
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
99999999999999999999999999999999999999,
99999999999999999999999999999999999999.9999999999999999,
0.9,
@@ -212,7 +212,7 @@ INSERT INTO t1 VALUES (
Warnings:
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 0
d 11111111.111
@@ -243,7 +243,7 @@ f23_0 1e38
r1_1 0.0
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f0' at row 1
@@ -255,7 +255,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1
Warning 1264 Out of range value for column 'd10_10' at row 1
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 0
d 0
@@ -307,7 +307,7 @@ MAX(f0) 9.999999680285692e37
MAX(f20_3) 99999998430674940.000
MAX(f23_0) 9.999999680285692e37
MAX(r1_1) 0.9
-INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f0' at row 1
@@ -315,7 +315,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1
Warning 1264 Out of range value for column 'f23_0' at row 1
Warning 1264 Out of range value for column 'f20_3' at row 1
Warning 1264 Out of range value for column 'd1_0' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 0
d 0
@@ -366,7 +366,7 @@ r1_1 0.0
r1_1 0.9
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
999999999999999999999999999999999999999,
999999999999999999999999999999999999999.9999999999999999,
1.9,
@@ -389,7 +389,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1
Warning 1264 Out of range value for column 'd10_10' at row 1
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 0
d 0
@@ -470,7 +470,7 @@ Warning 1264 Out of range value for column 'b' at row 1
INSERT INTO t1 (a,b) VALUES (-100,100);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 100
1 0
@@ -522,15 +522,15 @@ b bigint(20) unsigned # # #
b0 bigint(20) unsigned # # #
b1 bigint(1) unsigned # # #
b20 bigint(20) unsigned # # #
-INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
-SELECT * FROM t1;
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
-INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -552,15 +552,15 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
-SELECT * FROM t1;
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
4294967295 4294967295 4294967295 4294967295 255 255 255 255 65535 65535 65535 65535 16777215 16777215 16777215 16777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
-INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -582,7 +582,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -604,7 +604,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -654,7 +654,7 @@ Warning 1264 Out of range value for column 'm' at row 3
Warning 1264 Out of range value for column 'm0' at row 3
Warning 1264 Out of range value for column 'm1' at row 3
Warning 1264 Out of range value for column 'm20' at row 3
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
@@ -690,7 +690,7 @@ Warning 1264 Out of range value for column 's' at row 1
Warning 1264 Out of range value for column 'm' at row 1
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'b' at row 1
-SELECT * FROM t1;
+SELECT t,s,m,i,b FROM t1;
t s m i b
0 0 0 0 0
255 65535 16777215 4294967295 18446744073709551615
diff --git a/mysql-test/suite/storage_engine/col_opt_unsigned.test b/mysql-test/suite/storage_engine/col_opt_unsigned.test
index e9d4566de7f..62b7b29a507 100644
--- a/mysql-test/suite/storage_engine/col_opt_unsigned.test
+++ b/mysql-test/suite/storage_engine/col_opt_unsigned.test
@@ -29,7 +29,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (1.0,-1.0);
INSERT INTO t1 (a,b) VALUES (-100,100);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -56,7 +56,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (1.0,-1.0);
INSERT INTO t1 (a,b) VALUES (-100,100);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -86,7 +86,7 @@ if (!$mysql_errname)
INSERT INTO t1 (t,s,m,i,b) VALUES (255,65535,16777215,4294967295,18446744073709551615);
INSERT INTO t1 (t,s,m,i,b) VALUES (-1,-1,-1,-1,-1);
--sorted_result
- SELECT * FROM t1;
+ SELECT t,s,m,i,b FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/col_opt_zerofill.result b/mysql-test/suite/storage_engine/col_opt_zerofill.result
index c2445c5bbc7..a35ce4bfe66 100644
--- a/mysql-test/suite/storage_engine/col_opt_zerofill.result
+++ b/mysql-test/suite/storage_engine/col_opt_zerofill.result
@@ -25,15 +25,15 @@ n0_0 decimal(10,0) unsigned zerofill # # #
n1 decimal(1,0) unsigned zerofill # # #
n20_4 decimal(20,4) unsigned zerofill # # #
n65_4 decimal(65,4) unsigned zerofill # # #
-INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -45,7 +45,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -57,20 +57,20 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -81,7 +81,7 @@ Warning 1264 Out of range value for column 'n' at row 1
Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
@@ -89,7 +89,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0000000100 0000123456 0.3 00040000.25 00000000000000000000000000000000123456789123456789.1000100000 0000001024 0000007000 8 0000000000999999.9000 0000000000000000000000000000000000000000009223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -101,7 +101,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
@@ -110,7 +110,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
Warnings:
Note 1265 Data truncated for column 'd' at row 1
Note 1265 Data truncated for column 'd0' at row 1
@@ -122,7 +122,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1
Note 1265 Data truncated for column 'n1' at row 1
Note 1265 Data truncated for column 'n20_4' at row 1
Note 1265 Data truncated for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
0000000000 0000000000 0.0 00000000.00 00000000000000000000000000000000000000000000000000.0000000000 0000000000 0000000000 0 0000000000000000.0000 0000000000000000000000000000000000000000000000000000000000000.0000
@@ -149,7 +149,7 @@ b decimal(10,0) unsigned zerofill # # # #
INSERT INTO t1 (a,b) VALUES (1.1,1234);
Warnings:
Note 1265 Data truncated for column 'a' at row 1
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0000000001 0000001234
DROP TABLE t1;
@@ -180,8 +180,8 @@ d1_0 double(1,0) unsigned zerofill # # #
d10_10 double(10,10) unsigned zerofill # # #
d53 double(53,0) unsigned zerofill # # #
d53_10 double(53,10) unsigned zerofill # # #
-INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 0000012345.1
d 000000000011111111.111
d10_10 0.0123456789
@@ -192,8 +192,8 @@ f0 0000012345.1
f20_3 0000000000056789.988
f23_0 000123457000
r1_1 0.9
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
99999999999999999999999999999999999999,
99999999999999999999999999999999999999.9999999999999999,
0.9,
@@ -208,7 +208,7 @@ INSERT INTO t1 VALUES (
Warnings:
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 0000012345.1
d 0000000000000000000000
d 0000000000000000001e81
@@ -239,7 +239,7 @@ f23_0 000123457000
r1_1 0.0
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f0' at row 1
@@ -251,7 +251,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1
Warning 1264 Out of range value for column 'd10_10' at row 1
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 0000012345.1
d 0000000000000000000000
d 0000000000000000000000
@@ -303,7 +303,7 @@ MAX(f0) 9.999999680285692e37
MAX(f20_3) 99999998430674940.000
MAX(f23_0) 9.999999680285692e37
MAX(r1_1) 0.9
-INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f0' at row 1
@@ -311,7 +311,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1
Warning 1264 Out of range value for column 'f23_0' at row 1
Warning 1264 Out of range value for column 'f20_3' at row 1
Warning 1264 Out of range value for column 'd1_0' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 0000012345.1
d 0000000000000000000000
d 0000000000000000000000
@@ -362,7 +362,7 @@ r1_1 0.0
r1_1 0.9
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
999999999999999999999999999999999999999,
999999999999999999999999999999999999999.9999999999999999,
1.9,
@@ -385,7 +385,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1
Warning 1264 Out of range value for column 'd10_10' at row 1
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 0000012345.1
d 0000000000000000000000
d 0000000000000000000000
@@ -461,7 +461,7 @@ Field Type Null Key Default Extra
a double unsigned zerofill # # # #
b float unsigned zerofill # # # #
INSERT INTO t1 (a,b) VALUES (1,1234.5);
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0000000000000000000001 0000001234.5
DROP TABLE t1;
@@ -512,15 +512,15 @@ b bigint(20) unsigned zerofill # # #
b0 bigint(20) unsigned zerofill # # #
b1 bigint(1) unsigned zerofill # # #
b20 bigint(20) unsigned zerofill # # #
-INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
-SELECT * FROM t1;
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
0000000001 0000000002 3 00000000000000000004 005 006 7 00000000000000000008 00009 00010 11 00000000000000000012 00000013 00000014 15 00000000000000000016 00000000000000000017 00000000000000000018 19 00000000000000000020
2147483647 2147483647 2147483647 00000000002147483647 127 127 127 00000000000000000127 32767 32767 32767 00000000000000032767 08388607 08388607 8388607 00000000000008388607 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807
-INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -542,15 +542,15 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
-SELECT * FROM t1;
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
0000000001 0000000002 3 00000000000000000004 005 006 7 00000000000000000008 00009 00010 11 00000000000000000012 00000013 00000014 15 00000000000000000016 00000000000000000017 00000000000000000018 19 00000000000000000020
2147483647 2147483647 2147483647 00000000002147483647 127 127 127 00000000000000000127 32767 32767 32767 00000000000000032767 08388607 08388607 8388607 00000000000008388607 09223372036854775807 09223372036854775807 9223372036854775807 09223372036854775807
4294967295 4294967295 4294967295 00000000004294967295 255 255 255 00000000000000000255 65535 65535 65535 00000000000000065535 16777215 16777215 16777215 00000000000016777215 18446744073709551615 18446744073709551615 18446744073709551615 18446744073709551615
-INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -572,7 +572,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -594,7 +594,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -644,7 +644,7 @@ Warning 1264 Out of range value for column 'm' at row 3
Warning 1264 Out of range value for column 'm0' at row 3
Warning 1264 Out of range value for column 'm1' at row 3
Warning 1264 Out of range value for column 'm20' at row 3
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
0000000000 0000000000 0 00000000000000000000 000 000 0 00000000000000000000 00000 00000 0 00000000000000000000 00000000 00000000 0 00000000000000000000 00000000000000000000 00000000000000000000 0 00000000000000000000
@@ -673,7 +673,7 @@ m mediumint(8) unsigned zerofill # # # #
i int(10) unsigned zerofill # # # #
b bigint(20) unsigned zerofill # # # #
INSERT INTO t1 (t,s,m,i,b) VALUES (1,10,100,1000,0);
-SELECT * FROM t1;
+SELECT t,s,m,i,b FROM t1;
t s m i b
001 00010 00000100 0000001000 00000000000000000000
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/col_opt_zerofill.test b/mysql-test/suite/storage_engine/col_opt_zerofill.test
index 83b7dcf28c1..0dc1c243673 100644
--- a/mysql-test/suite/storage_engine/col_opt_zerofill.test
+++ b/mysql-test/suite/storage_engine/col_opt_zerofill.test
@@ -27,7 +27,7 @@ if (!$mysql_errname)
SHOW COLUMNS IN t1;
INSERT INTO t1 (a,b) VALUES (1.1,1234);
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -52,7 +52,7 @@ if (!$mysql_errname)
SHOW COLUMNS IN t1;
INSERT INTO t1 (a,b) VALUES (1,1234.5);
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -80,7 +80,7 @@ if (!$mysql_errname)
SHOW COLUMNS IN t1;
INSERT INTO t1 (t,s,m,i,b) VALUES (1,10,100,1000,0);
- SELECT * FROM t1;
+ SELECT t,s,m,i,b FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/delete.result b/mysql-test/suite/storage_engine/delete.result
index 1d84516c86a..d7125a344b7 100644
--- a/mysql-test/suite/storage_engine/delete.result
+++ b/mysql-test/suite/storage_engine/delete.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO
INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
INSERT INTO t1 (a,b) SELECT a, b FROM t1;
DELETE FROM t1 WHERE b IN ('c');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
1 a
@@ -16,7 +16,7 @@ a b
5 e
5 e
DELETE FROM t1 WHERE a < 0 OR b = 'a';
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
10000 foobar
10000 foobar
@@ -27,7 +27,7 @@ a b
5 e
5 e
DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
10000 foobar
10000 foobar
@@ -38,7 +38,7 @@ a b
5 e
CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t2 (c,d) SELECT b, a FROM t1;
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
b 2
b 2
@@ -48,7 +48,7 @@ e 5
foobar 10000
foobar 10000
DELETE t2.* FROM t1, t2 WHERE c < b AND a + d != 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
10000 foobar
10000 foobar
@@ -57,21 +57,21 @@ a b
4 d
5 e
5 e
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
foobar 10000
foobar 10000
DELETE FROM t2, t1.* USING t2, t1 WHERE c = 'foobar' and b = c;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
2 b
2 b
4 d
5 e
5 e
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
DELETE FROM t1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/delete.test b/mysql-test/suite/storage_engine/delete.test
index 802093e2977..e210ec3d17c 100644
--- a/mysql-test/suite/storage_engine/delete.test
+++ b/mysql-test/suite/storage_engine/delete.test
@@ -25,16 +25,16 @@ if ($mysql_errname)
--source unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DELETE FROM t1 WHERE a < 0 OR b = 'a';
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# ORDER BY and LIMIT
DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# Multi-table DELETE
@@ -43,23 +43,23 @@ SELECT * FROM t1;
--source create_table.inc
INSERT INTO t2 (c,d) SELECT b, a FROM t1;
--sorted_result
-SELECT * FROM t2;
+SELECT c,d FROM t2;
DELETE t2.* FROM t1, t2 WHERE c < b AND a + d != 1;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--sorted_result
-SELECT * FROM t2;
+SELECT c,d FROM t2;
DELETE FROM t2, t1.* USING t2, t1 WHERE c = 'foobar' and b = c;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--sorted_result
-SELECT * FROM t2;
+SELECT c,d FROM t2;
DELETE FROM t1;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# Cleanup
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/delete_ignore.result b/mysql-test/suite/storage_engine/delete_ignore.result
index a15c338ea04..aedac761d99 100644
--- a/mysql-test/suite/storage_engine/delete_ignore.result
+++ b/mysql-test/suite/storage_engine/delete_ignore.result
@@ -4,7 +4,7 @@ INSERT INTO t1 (a,b) VALUES (10000,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,
INSERT INTO t1 (a,b) SELECT a, b FROM t1;
CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t2 (c,d) SELECT b, a FROM t1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
1 a
@@ -18,7 +18,7 @@ a b
4 d
5 e
5 e
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
a 1
a 1
@@ -33,7 +33,7 @@ e 5
foobar 10000
foobar 10000
DELETE IGNORE FROM t1 WHERE b IS NOT NULL ORDER BY a LIMIT 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
10000 foobar
@@ -49,10 +49,10 @@ a b
DELETE IGNORE t1.*, t2.* FROM t1, t2 WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
Warnings:
Warning 1242 Subquery returns more than 1 row
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
foobar 10000
foobar 10000
diff --git a/mysql-test/suite/storage_engine/delete_ignore.test b/mysql-test/suite/storage_engine/delete_ignore.test
index fa98ec92029..c1b1926db45 100644
--- a/mysql-test/suite/storage_engine/delete_ignore.test
+++ b/mysql-test/suite/storage_engine/delete_ignore.test
@@ -18,9 +18,9 @@ INSERT INTO t1 (a,b) SELECT a, b FROM t1;
--source create_table.inc
INSERT INTO t2 (c,d) SELECT b, a FROM t1;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--sorted_result
-SELECT * FROM t2;
+SELECT c,d FROM t2;
DELETE IGNORE FROM t1 WHERE b IS NOT NULL ORDER BY a LIMIT 1;
if ($mysql_errname)
@@ -29,13 +29,13 @@ if ($mysql_errname)
--source unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DELETE IGNORE t1.*, t2.* FROM t1, t2 WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--sorted_result
-SELECT * FROM t2;
+SELECT c,d FROM t2;
# Cleanup
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/delete_low_prio.result b/mysql-test/suite/storage_engine/delete_low_prio.result
index be334612a2b..89d08db5450 100644
--- a/mysql-test/suite/storage_engine/delete_low_prio.result
+++ b/mysql-test/suite/storage_engine/delete_low_prio.result
@@ -17,7 +17,7 @@ SLEEP(1)
0
0
connection default;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
connection con1;
@@ -34,7 +34,7 @@ SLEEP(1)
0
0
connection default;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
SET LOW_PRIORITY_UPDATES = 1;
@@ -52,7 +52,7 @@ SLEEP(1)
0
0
connection default;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
disconnect con1;
disconnect con2;
diff --git a/mysql-test/suite/storage_engine/delete_low_prio.test b/mysql-test/suite/storage_engine/delete_low_prio.test
index 34677df5373..f79a055dabe 100644
--- a/mysql-test/suite/storage_engine/delete_low_prio.test
+++ b/mysql-test/suite/storage_engine/delete_low_prio.test
@@ -73,7 +73,7 @@ if ($found)
--connection default
--reap
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
@@ -113,7 +113,7 @@ if ($found)
--connection default
--reap
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
SET LOW_PRIORITY_UPDATES = 1;
@@ -148,7 +148,7 @@ if ($found)
--connection default
--reap
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--disconnect con1
--disconnect con2
diff --git a/mysql-test/suite/storage_engine/delete_quick.result b/mysql-test/suite/storage_engine/delete_quick.result
index 30d4841b51f..7166bcde96c 100644
--- a/mysql-test/suite/storage_engine/delete_quick.result
+++ b/mysql-test/suite/storage_engine/delete_quick.result
@@ -2,24 +2,24 @@ DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX> (a), b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
DELETE QUICK FROM t1 WHERE a = 1 OR b > 'foo';
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
2 b
3 c
4 d
5 e
CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-INSERT INTO t2 SELECT b, a FROM t1;
-SELECT * FROM t2;
+INSERT INTO t2 (c,d) SELECT b, a FROM t1;
+SELECT c,d FROM t2;
c d
b 2
c 3
d 4
e 5
DELETE QUICK FROM t2, t1.* USING t2, t1 WHERE c IS NULL OR a = d;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
DROP TABLE t2;
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/delete_quick.test b/mysql-test/suite/storage_engine/delete_quick.test
index 3b37096de4f..f96fedfd9c5 100644
--- a/mysql-test/suite/storage_engine/delete_quick.test
+++ b/mysql-test/suite/storage_engine/delete_quick.test
@@ -30,20 +30,20 @@ if (!$mysql_errname)
if (!$mysql_errname)
{
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--let $create_definition = c $char_col, d $int_col
--let $table_name = t2
--source create_table.inc
- INSERT INTO t2 SELECT b, a FROM t1;
+ INSERT INTO t2 (c,d) SELECT b, a FROM t1;
--sorted_result
- SELECT * FROM t2;
+ SELECT c,d FROM t2;
DELETE QUICK FROM t2, t1.* USING t2, t1 WHERE c IS NULL OR a = d;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--sorted_result
- SELECT * FROM t2;
+ SELECT c,d FROM t2;
DROP TABLE t2;
}
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/delete_with_keys.result b/mysql-test/suite/storage_engine/delete_with_keys.result
index 6622cc1fb64..e968451b2e2 100644
--- a/mysql-test/suite/storage_engine/delete_with_keys.result
+++ b/mysql-test/suite/storage_engine/delete_with_keys.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (b)) ENGINE=<ST
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
DELETE FROM t1 WHERE b > 'y';
DELETE FROM t1 WHERE a=2;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
3 c
@@ -17,7 +17,7 @@ CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY, b <CHAR_COLUMN>) ENGINE=<STORAGE_EN
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
DELETE FROM t1 WHERE b > 'y';
DELETE FROM t1 WHERE a=2;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
3 c
@@ -30,7 +30,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>, c <INT_COLUMN>, <CUSTOM_INDEX>(a), <CUSTOM_INDEX>(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
1 2 3
4 5 6
diff --git a/mysql-test/suite/storage_engine/delete_with_keys.test b/mysql-test/suite/storage_engine/delete_with_keys.test
index 274801b6d0e..cda0da0653f 100644
--- a/mysql-test/suite/storage_engine/delete_with_keys.test
+++ b/mysql-test/suite/storage_engine/delete_with_keys.test
@@ -29,7 +29,7 @@ if (!$mysql_errname)
DELETE FROM t1 WHERE a=2;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DELETE FROM t1;
}
DROP TABLE t1;
@@ -49,7 +49,7 @@ if (!$mysql_errname)
DELETE FROM t1 WHERE a=2;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DELETE FROM t1;
DROP TABLE t1;
}
@@ -66,7 +66,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);
DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/foreign_keys.result b/mysql-test/suite/storage_engine/foreign_keys.result
index 5374e78d9b1..6c4a3406811 100644
--- a/mysql-test/suite/storage_engine/foreign_keys.result
+++ b/mysql-test/suite/storage_engine/foreign_keys.result
@@ -26,11 +26,11 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
DELETE FROM t1 WHERE a=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
DELETE FROM t2 WHERE a=2;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 c
2 d
-SELECT * FROM t2;
+SELECT a,b FROM t2;
a b
1 a
DROP TABLE t1;
@@ -54,7 +54,7 @@ ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`
INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'a');
INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(4,'e'),(3,'a');
UPDATE t1 SET a=a+1;
-SELECT * FROM t2;
+SELECT a,b FROM t2;
a b
5 a
5 a
@@ -63,7 +63,7 @@ a b
5 d
5 e
DELETE FROM t1 WHERE b='a' LIMIT 2;
-SELECT * FROM t2;
+SELECT a,b FROM t2;
a b
TRUNCATE TABLE t1;
ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`))
diff --git a/mysql-test/suite/storage_engine/foreign_keys.test b/mysql-test/suite/storage_engine/foreign_keys.test
index 643ca8bf6b1..cbadc4c950d 100644
--- a/mysql-test/suite/storage_engine/foreign_keys.test
+++ b/mysql-test/suite/storage_engine/foreign_keys.test
@@ -73,8 +73,9 @@ if (!$mysql_errname)
DELETE FROM t2 WHERE a=2;
--sorted_result
- SELECT * FROM t1;
- SELECT * FROM t2;
+ SELECT a,b FROM t1;
+ --sorted_result
+ SELECT a,b FROM t2;
--let $error_codes = ER_ROW_IS_REFERENCED
DROP TABLE t1;
@@ -119,7 +120,7 @@ if (!$mysql_errname)
--source unexpected_result.inc
}
--sorted_result
- SELECT * FROM t2;
+ SELECT a,b FROM t2;
DELETE FROM t1 WHERE b='a' LIMIT 2;
if ($mysql_errname)
@@ -128,7 +129,7 @@ if (!$mysql_errname)
--source unexpected_result.inc
}
--sorted_result
- SELECT * FROM t2;
+ SELECT a,b FROM t2;
--let $error_codes = ER_TRUNCATE_ILLEGAL_FK
TRUNCATE TABLE t1;
diff --git a/mysql-test/suite/storage_engine/insert.result b/mysql-test/suite/storage_engine/insert.result
index a07a6e8d9a4..2dfe20cb822 100644
--- a/mysql-test/suite/storage_engine/insert.result
+++ b/mysql-test/suite/storage_engine/insert.result
@@ -1,7 +1,7 @@
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 VALUES (100,'foobar'),(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
100 foobar
@@ -10,7 +10,7 @@ a b
4 d
5 e
INSERT t1 VALUE (10,'foo'),(11,'abc');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
10 foo
@@ -21,7 +21,7 @@ a b
4 d
5 e
INSERT INTO t1 (b,a) VALUES ('test',0);
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 test
1 a
@@ -33,7 +33,7 @@ a b
4 d
5 e
INSERT INTO t1 VALUES (DEFAULT,DEFAULT);
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 test
1 a
@@ -46,7 +46,7 @@ a b
5 e
NULL NULL
INSERT t1 (a) VALUE (10),(20);
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 test
1 a
@@ -61,7 +61,7 @@ a b
5 e
NULL NULL
INSERT INTO t1 SET a = 11, b = 'f';
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 test
1 a
@@ -77,7 +77,7 @@ a b
5 e
NULL NULL
INSERT t1 SET b = DEFAULT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 test
1 a
@@ -94,9 +94,9 @@ a b
NULL NULL
NULL NULL
CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t2 SELECT a,b FROM t1;
INSERT INTO t1 (a) SELECT a FROM t2 WHERE b = 'foo';
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 test
1 a
@@ -113,8 +113,8 @@ a b
5 e
NULL NULL
NULL NULL
-INSERT t1 SELECT * FROM t1;
-SELECT * FROM t1;
+INSERT t1 (a,b) SELECT a,b FROM t1;
+SELECT a,b FROM t1;
a b
0 test
0 test
diff --git a/mysql-test/suite/storage_engine/insert.test b/mysql-test/suite/storage_engine/insert.test
index d9076219eb0..1f780eba71f 100644
--- a/mysql-test/suite/storage_engine/insert.test
+++ b/mysql-test/suite/storage_engine/insert.test
@@ -22,40 +22,40 @@ if ($mysql_errname)
--source unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
INSERT t1 VALUE (10,'foo'),(11,'abc');
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
INSERT INTO t1 (b,a) VALUES ('test',0);
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
INSERT INTO t1 VALUES (DEFAULT,DEFAULT);
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
INSERT t1 (a) VALUE (10),(20);
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# INSERT [INTO] .. SET
INSERT INTO t1 SET a = 11, b = 'f';
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
INSERT t1 SET b = DEFAULT;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# INSERT .. SELECT
--let $table_name = t2
--source create_table.inc
-INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t2 SELECT a,b FROM t1;
if ($mysql_errname)
{
--let $functionality = INSERT .. SELECT
@@ -65,11 +65,11 @@ if ($mysql_errname)
INSERT INTO t1 (a) SELECT a FROM t2 WHERE b = 'foo';
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
-INSERT t1 SELECT * FROM t1;
+INSERT t1 (a,b) SELECT a,b FROM t1;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# Cleanup
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/insert_delayed.result b/mysql-test/suite/storage_engine/insert_delayed.result
index 98e149bdf96..528003d8923 100644
--- a/mysql-test/suite/storage_engine/insert_delayed.result
+++ b/mysql-test/suite/storage_engine/insert_delayed.result
@@ -6,17 +6,17 @@ connect con0,localhost,root,,;
SET lock_wait_timeout = 1;
INSERT DELAYED INTO t1 (a,b) VALUES (3,'c');
INSERT DELAYED INTO t1 SET a=4, b='d';
-INSERT DELAYED INTO t1 SELECT 5, 'e';
+INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con0;
connection default;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 f
2 b
UNLOCK TABLES;
FLUSH TABLES;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 f
2 b
diff --git a/mysql-test/suite/storage_engine/insert_delayed.test b/mysql-test/suite/storage_engine/insert_delayed.test
index 7c3c4eec768..ca8bf7eddbb 100644
--- a/mysql-test/suite/storage_engine/insert_delayed.test
+++ b/mysql-test/suite/storage_engine/insert_delayed.test
@@ -41,16 +41,16 @@ if (!$mysql_errname)
INSERT DELAYED INTO t1 SET a=4, b='d';
# DELAYED is ignored with INSERT .. SELECT
--let $error_codes = ER_LOCK_WAIT_TIMEOUT
- INSERT DELAYED INTO t1 SELECT 5, 'e';
+ INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e';
--source check_errors.inc
--disconnect con0
--connection default
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
}
UNLOCK TABLES;
FLUSH TABLES;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# Cleanup
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/insert_high_prio.result b/mysql-test/suite/storage_engine/insert_high_prio.result
index 66378564ff7..4f5a3a443cd 100644
--- a/mysql-test/suite/storage_engine/insert_high_prio.result
+++ b/mysql-test/suite/storage_engine/insert_high_prio.result
@@ -26,7 +26,7 @@ SLEEP(1)
0
0
connection con0;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 f
2 b
@@ -50,7 +50,7 @@ SLEEP(1)
0
0
connection con0;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 f
2 b
diff --git a/mysql-test/suite/storage_engine/insert_high_prio.test b/mysql-test/suite/storage_engine/insert_high_prio.test
index 819e996d468..558e95a6cdf 100644
--- a/mysql-test/suite/storage_engine/insert_high_prio.test
+++ b/mysql-test/suite/storage_engine/insert_high_prio.test
@@ -80,7 +80,7 @@ if ($found)
--connection con0
--reap
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DROP TABLE t1;
@@ -122,7 +122,7 @@ if ($found)
--connection con0
--reap
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--disconnect con1
--disconnect con2
diff --git a/mysql-test/suite/storage_engine/insert_low_prio.result b/mysql-test/suite/storage_engine/insert_low_prio.result
index 561b6296380..1a74a82ea23 100644
--- a/mysql-test/suite/storage_engine/insert_low_prio.result
+++ b/mysql-test/suite/storage_engine/insert_low_prio.result
@@ -25,7 +25,7 @@ SLEEP(1)
0
0
connection con0;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 f
2 b
diff --git a/mysql-test/suite/storage_engine/insert_low_prio.test b/mysql-test/suite/storage_engine/insert_low_prio.test
index 30f47833162..ed30d106016 100644
--- a/mysql-test/suite/storage_engine/insert_low_prio.test
+++ b/mysql-test/suite/storage_engine/insert_low_prio.test
@@ -76,7 +76,7 @@ if ($found)
--connection con0
--reap
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--disconnect con0
--disconnect con1
diff --git a/mysql-test/suite/storage_engine/insert_with_keys.result b/mysql-test/suite/storage_engine/insert_with_keys.result
index db7439c4dbf..39e42b306d2 100644
--- a/mysql-test/suite/storage_engine/insert_with_keys.result
+++ b/mysql-test/suite/storage_engine/insert_with_keys.result
@@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) VALUES (100,'a'), (6,'f');
INSERT INTO t1 (a,b) VALUES (30,'m'),(29,'n');
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0
1 a
@@ -34,7 +34,7 @@ ERROR 23000: Duplicate entry '3' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
INSERT INTO t1 (a,b) VALUES (0,'');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0
1 a
@@ -50,7 +50,7 @@ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
Warnings:
Warning 1062 Duplicate entry '1' for key 'a'
INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'d') ON DUPLICATE KEY UPDATE a = a+10;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0
1 a
@@ -73,7 +73,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
ERROR 23000: Duplicate entry '1-a' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
100 a
@@ -90,7 +90,7 @@ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
Warnings:
Warning 1062 Duplicate entry '1-a' for key 'a'
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE a = a+VALUES(a);
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
100 a
100 b
@@ -122,7 +122,7 @@ ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
INSERT INTO t1 (a,b) VALUES (0,'');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0
1 a
@@ -138,7 +138,7 @@ INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
Warnings:
Warning 1062 Duplicate entry '1' for key 'PRIMARY'
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE b = CONCAT(b,b);
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0
1 aa
diff --git a/mysql-test/suite/storage_engine/insert_with_keys.test b/mysql-test/suite/storage_engine/insert_with_keys.test
index 1959b55c707..c44b6c712e0 100644
--- a/mysql-test/suite/storage_engine/insert_with_keys.test
+++ b/mysql-test/suite/storage_engine/insert_with_keys.test
@@ -24,7 +24,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
INSERT INTO t1 (a,b) VALUES (3,'a'),(0,'');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -49,7 +49,7 @@ if (!$mysql_errname)
--source check_errors.inc
INSERT INTO t1 (a,b) VALUES (0,'');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
if ($mysql_errname)
@@ -63,7 +63,7 @@ if (!$mysql_errname)
}
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -86,12 +86,12 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
--source check_errors.inc
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
INSERT INTO t1 (a,b) VALUES (1,'a'),(12345,'z') ON DUPLICATE KEY UPDATE a = a+VALUES(a);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
INSERT INTO t1 (a,b) VALUES (101,'x'),(101,'x');
@@ -120,7 +120,7 @@ if (!$mysql_errname)
--source check_errors.inc
INSERT INTO t1 (a,b) VALUES (0,'');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
INSERT IGNORE INTO t1 (a,b) VALUES (1,'a'),(12345,'z');
if ($mysql_errname)
@@ -134,7 +134,7 @@ if (!$mysql_errname)
--source unexpected_result.inc
}
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/loaddata.result b/mysql-test/suite/storage_engine/loaddata.result
index 85608cdc32a..2b25435fa7a 100644
--- a/mysql-test/suite/storage_engine/loaddata.result
+++ b/mysql-test/suite/storage_engine/loaddata.result
@@ -1,8 +1,8 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
-FIELDS TERMINATED BY ',';
-SELECT * FROM t1;
+FIELDS TERMINATED BY ',' (a,b);
+SELECT a,b FROM t1;
a b
1 foo
2 bar
@@ -10,8 +10,8 @@ a b
4 abc
LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
CHARACTER SET utf8 COLUMNS TERMINATED BY ','
- ESCAPED BY '/';
-SELECT * FROM t1;
+ ESCAPED BY '/' (a,b);
+SELECT a,b FROM t1;
a b
1 foo
1 foo
@@ -21,46 +21,66 @@ a b
3
4 abc
4 abc
+LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
+FIELDS TERMINATED BY ';'
+ (a) SET b='loaded';
+Warnings:
+Warning 1262 Row 1 was truncated; it contained more data than there were input columns
+Warning 1262 Row 2 was truncated; it contained more data than there were input columns
+Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+SELECT a,b FROM t1;
+a b
+0 loaded
+1 foo
+1 foo
+102 loaded
+2 bar
+2 bar
+3
+3
+4 abc
+4 abc
+5 loaded
LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY ''''
LINES STARTING BY 'prefix:'
-IGNORE 2 LINES
-(a,b);
+IGNORE 2 LINES (a,b);
Warnings:
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0
+0 loaded
1 foo
1 foo
100 foo
+102 loaded
2 bar
2 bar
3
3
4 abc
4 abc
+5 loaded
7 test
-LOAD DATA LOCAL INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1
-FIELDS TERMINATED BY ';'
- (a) SET b='loaded';
-Warnings:
-Warning 1262 Row 1 was truncated; it contained more data than there were input columns
-Warning 1262 Row 2 was truncated; it contained more data than there were input columns
-Warning 1262 Row 3 was truncated; it contained more data than there were input columns
-SELECT * FROM t1;
+LOAD DATA INFILE '<DATADIR>/se_loaddata.dat' INTO TABLE t1;
+SELECT a,b FROM t1;
a b
0
0 loaded
1 foo
1 foo
+1 foo
100 foo
102 loaded
2 bar
2 bar
+2 bar
3
3
+3
+4 abc
4 abc
4 abc
5 loaded
diff --git a/mysql-test/suite/storage_engine/loaddata.test b/mysql-test/suite/storage_engine/loaddata.test
index c413184af00..5a708626c74 100644
--- a/mysql-test/suite/storage_engine/loaddata.test
+++ b/mysql-test/suite/storage_engine/loaddata.test
@@ -22,23 +22,40 @@ EOF
--replace_result $datadir <DATADIR>
eval
LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
- FIELDS TERMINATED BY ',';
+ FIELDS TERMINATED BY ',' (a,b);
if ($mysql_errname)
{
--source unexpected_result.inc
+ --remove_file $datadir/se_loaddata.dat
}
if (!$mysql_errname)
{
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--replace_result $datadir <DATADIR>
eval
LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
CHARACTER SET utf8 COLUMNS TERMINATED BY ','
- ESCAPED BY '/';
+ ESCAPED BY '/' (a,b);
+ --sorted_result
+ SELECT a,b FROM t1;
+
+ --remove_file $datadir/se_loaddata.dat
+ --write_file $datadir/se_loaddata.dat
+5;YYY;
+102;'zzz';
+0;'test';
+EOF
+
+ --replace_result $datadir <DATADIR>
+ eval
+ LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
+ FIELDS TERMINATED BY ';'
+ (a) SET b='loaded';
+
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--remove_file $datadir/se_loaddata.dat
--write_file $datadir/se_loaddata.dat
@@ -57,31 +74,30 @@ EOF
FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY ''''
LINES STARTING BY 'prefix:'
- IGNORE 2 LINES
- (a,b);
+ IGNORE 2 LINES (a,b);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--remove_file $datadir/se_loaddata.dat
--write_file $datadir/se_loaddata.dat
-5;YYY;
-102;'zzz';
-0;'test';
+1 foo
+2 bar
+3
+4 abc
EOF
--replace_result $datadir <DATADIR>
eval
- LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
- FIELDS TERMINATED BY ';'
- (a) SET b='loaded';
-
+ LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
+
+ --remove_file $datadir/se_loaddata.dat
+
}
# Cleanup
---remove_file $datadir/se_loaddata.dat
DROP TABLE t1;
--source cleanup_engine.inc
diff --git a/mysql-test/suite/storage_engine/lock.result b/mysql-test/suite/storage_engine/lock.result
index 73573381110..f20548da12b 100644
--- a/mysql-test/suite/storage_engine/lock.result
+++ b/mysql-test/suite/storage_engine/lock.result
@@ -12,7 +12,7 @@ id2 COUNT(DISTINCT id)
3 1
UPDATE t1 SET id=-1 WHERE id=1;
connection con1;
-SELECT * FROM t1;
+SELECT id,id2 FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
LOCK TABLE t1 READ;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@@ -38,7 +38,7 @@ DROP TABLE IF EXISTS t2;
UNLOCK TABLES;
CREATE TABLE t2 (id <INT_COLUMN>, id2 <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
LOCK TABLE t1 WRITE, t2 WRITE;
-INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t2 (id,id2) SELECT id,id2 FROM t1;
UPDATE t1 SET id=1 WHERE id=-1;
DROP TABLE t1,t2;
CREATE TABLE t1 (i1 <INT_COLUMN>, nr <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
@@ -105,7 +105,7 @@ LOCK TABLE t1 WRITE, t2 WRITE;
CREATE TEMPORARY TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
FLUSH TABLE t1;
DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
UNLOCK TABLES;
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/lock.test b/mysql-test/suite/storage_engine/lock.test
index 16872bdaa7d..7335f8d1d39 100644
--- a/mysql-test/suite/storage_engine/lock.test
+++ b/mysql-test/suite/storage_engine/lock.test
@@ -43,7 +43,7 @@ connection con1;
# With WRITE lock held by connection 'default',
# nobody else can access the table
--let $error_codes = ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1;
+SELECT id,id2 FROM t1;
--source check_errors.inc
--let $error_codes = ER_LOCK_WAIT_TIMEOUT
LOCK TABLE t1 READ;
@@ -94,7 +94,7 @@ UNLOCK TABLES;
--let $create_definition = id $int_col, id2 $int_col
--source create_table.inc
LOCK TABLE t1 WRITE, t2 WRITE;
-INSERT INTO t2 SELECT * FROM t1;
+INSERT INTO t2 (id,id2) SELECT id,id2 FROM t1;
UPDATE t1 SET id=1 WHERE id=-1;
if ($mysql_errname)
{
@@ -232,7 +232,7 @@ LOCK TABLE t1 WRITE, t2 WRITE;
--source create_table.inc
FLUSH TABLE t1;
DROP TEMPORARY TABLE t1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
UNLOCK TABLES;
DROP TABLE t1, t2;
diff --git a/mysql-test/suite/storage_engine/parts/repair_table.result b/mysql-test/suite/storage_engine/parts/repair_table.result
index b156df6d7dc..8b08ee15fd0 100644
--- a/mysql-test/suite/storage_engine/parts/repair_table.result
+++ b/mysql-test/suite/storage_engine/parts/repair_table.result
@@ -10,7 +10,7 @@ INSERT INTO t2 (a,b) SELECT a, b FROM t1;
ALTER TABLE t1 REPAIR PARTITION p0;
Table Op Msg_type Msg_text
test.t1 repair status OK
-INSERT INTO t1 VALUES (3,'c');
+INSERT INTO t1 (a,b) VALUES (3,'c');
ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
Table Op Msg_type Msg_text
test.t1 repair status OK
@@ -22,7 +22,7 @@ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED;
Table Op Msg_type Msg_text
test.t1 repair status OK
-INSERT INTO t1 VALUES (10,'j');
+INSERT INTO t1 (a,b) VALUES (10,'j');
ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM;
Table Op Msg_type Msg_text
test.t1 repair status OK
@@ -76,7 +76,7 @@ Table Op Msg_type Msg_text
test.t1 check Error Failed to read from the .par file
test.t1 check Error Incorrect information in file: './test/t1.frm'
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
ERROR HY000: Failed to read from the .par file
# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
# If you got a difference in error message, just add it to rdiff file
@@ -118,7 +118,7 @@ Table Op Msg_type Msg_text
test.t1 check error Size of datafile is: 26 Should be: 39
test.t1 check error Partition p0 returned error
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
8 h
10 j
@@ -142,7 +142,7 @@ test.t1 check error Record-count is not ok; is 3 Should be: 2
test.t1 check warning Found 3 key parts. Should be: 2
test.t1 check error Partition p0 returned error
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
8 h
10 j
@@ -166,7 +166,7 @@ Table Op Msg_type Msg_text
test.t1 check error Size of datafile is: 39 Should be: 52
test.t1 check error Partition p1 returned error
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
8 h
10 j
@@ -193,7 +193,7 @@ test.t1 check error Record-count is not ok; is 4 Should be: 3
test.t1 check warning Found 4 key parts. Should be: 3
test.t1 check error Partition p1 returned error
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
8 h
10 j
@@ -218,7 +218,7 @@ Restoring <DATADIR>/test/t1.par
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
8 h
10 j
diff --git a/mysql-test/suite/storage_engine/parts/repair_table.test b/mysql-test/suite/storage_engine/parts/repair_table.test
index f77b2ef8de4..06be8de1f56 100644
--- a/mysql-test/suite/storage_engine/parts/repair_table.test
+++ b/mysql-test/suite/storage_engine/parts/repair_table.test
@@ -35,7 +35,7 @@ if (!$mysql_errname)
let $alter_definition = REPAIR PARTITION p0;
--source ../alter_table.inc
- INSERT INTO t1 VALUES (3,'c');
+ INSERT INTO t1 (a,b) VALUES (3,'c');
let $alter_definition = REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
--source ../alter_table.inc
@@ -57,7 +57,7 @@ if (!$mysql_errname)
let $alter_definition = REPAIR PARTITION LOCAL ALL EXTENDED;
--source ../alter_table.inc
- INSERT INTO t1 VALUES (10,'j');
+ INSERT INTO t1 (a,b) VALUES (10,'j');
let $alter_definition = REPAIR PARTITION p1 QUICK USE_FRM;
--source ../alter_table.inc
diff --git a/mysql-test/suite/storage_engine/parts/truncate_table.result b/mysql-test/suite/storage_engine/parts/truncate_table.result
index e46f4c97de5..e3b18d57989 100644
--- a/mysql-test/suite/storage_engine/parts/truncate_table.result
+++ b/mysql-test/suite/storage_engine/parts/truncate_table.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO
TRUNCATE TABLE t1;
INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
TRUNCATE TABLE t1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
@@ -46,23 +46,23 @@ t1 CREATE TABLE `t1` (
) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a)
PARTITIONS 2 */
-SELECT * FROM t1;
+SELECT a,c FROM t1;
a c
1 d
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
ALTER TABLE t1 TRUNCATE PARTITION p0;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
101 g
3 c
-EXPLAIN PARTITIONS SELECT * FROM t1;
+EXPLAIN PARTITIONS SELECT a,b FROM t1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 # # # # # #
INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
ALTER TABLE t1 TRUNCATE PARTITION ALL;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/parts/truncate_table.test b/mysql-test/suite/storage_engine/parts/truncate_table.test
index 20f316d5297..9d921f013f4 100644
--- a/mysql-test/suite/storage_engine/parts/truncate_table.test
+++ b/mysql-test/suite/storage_engine/parts/truncate_table.test
@@ -33,7 +33,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
TRUNCATE TABLE t1;
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -64,7 +64,7 @@ if (!$mysql_errname)
INSERT INTO t1 (c) VALUES ('d');
--source ../mask_engine.inc
SHOW CREATE TABLE t1;
- SELECT * FROM t1;
+ SELECT a,c FROM t1;
DROP TABLE t1;
}
@@ -93,16 +93,16 @@ if (!$mysql_errname)
}
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--replace_column 5 # 6 # 7 # 8 # 9 # 10 #
- EXPLAIN PARTITIONS SELECT * FROM t1;
+ EXPLAIN PARTITIONS SELECT a,b FROM t1;
INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
let $alter_definition = TRUNCATE PARTITION ALL;
--source ../alter_table.inc
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/repair_table.inc b/mysql-test/suite/storage_engine/repair_table.inc
index 83d2f02e20a..be3e5ba35c2 100644
--- a/mysql-test/suite/storage_engine/repair_table.inc
+++ b/mysql-test/suite/storage_engine/repair_table.inc
@@ -64,7 +64,7 @@ INSERT INTO t1 (a,b) VALUES (14,'n');
--source check_errors.inc
CHECK TABLE t1;
--let $error_codes = 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--source check_errors.inc
--enable_warnings
REPAIR TABLE t1;
@@ -143,7 +143,7 @@ if ($have_default_index)
EOF
CHECK TABLE t1;
--let $error_codes = 0,ER_NOT_KEYFILE,144
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--source check_errors.inc
}
}
diff --git a/mysql-test/suite/storage_engine/repair_table.result b/mysql-test/suite/storage_engine/repair_table.result
index f1af943fd7b..a20b9be3ba1 100644
--- a/mysql-test/suite/storage_engine/repair_table.result
+++ b/mysql-test/suite/storage_engine/repair_table.result
@@ -46,7 +46,7 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Incorrect file format 't1'
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
ERROR HY000: Incorrect file format 't1'
# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
# If you got a difference in error message, just add it to rdiff file
@@ -84,7 +84,7 @@ CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check error Size of datafile is: 39 Should be: 65
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
ERROR HY000: Incorrect key file for table 't1'; try to repair it
# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
# If you got a difference in error message, just add it to rdiff file
@@ -99,7 +99,7 @@ Table Op Msg_type Msg_text
test.t1 check warning Table is marked as crashed and last repair failed
test.t1 check error Size of datafile is: 39 Should be: 65
test.t1 check error Corrupt
-SELECT * FROM t1;
+SELECT a,b FROM t1;
ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
# If you got a difference in error message, just add it to rdiff file
diff --git a/mysql-test/suite/storage_engine/replace.result b/mysql-test/suite/storage_engine/replace.result
index c8fbca8f534..85988c740b2 100644
--- a/mysql-test/suite/storage_engine/replace.result
+++ b/mysql-test/suite/storage_engine/replace.result
@@ -1,7 +1,7 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
@@ -9,7 +9,7 @@ a b
4 d
5 e
REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
10 foo
@@ -26,7 +26,7 @@ ERROR 23000: Duplicate entry '2' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
REPLACE INTO t1 (a,b) VALUES (2,'d');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 d
@@ -39,7 +39,7 @@ ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
REPLACE INTO t1 (a,b) VALUES (4,'b');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
3 c
diff --git a/mysql-test/suite/storage_engine/replace.test b/mysql-test/suite/storage_engine/replace.test
index 368ed62a300..0a00734abec 100644
--- a/mysql-test/suite/storage_engine/replace.test
+++ b/mysql-test/suite/storage_engine/replace.test
@@ -13,11 +13,11 @@ DROP TABLE IF EXISTS t1;
REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo');
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DROP TABLE t1;
@@ -37,7 +37,7 @@ if (!$mysql_errname)
--source check_errors.inc
REPLACE INTO t1 (a,b) VALUES (2,'d');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
@@ -58,7 +58,7 @@ if (!$mysql_errname)
--source check_errors.inc
REPLACE INTO t1 (a,b) VALUES (4,'b');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/select.result b/mysql-test/suite/storage_engine/select.result
index d2331f4d869..015ed80b771 100644
--- a/mysql-test/suite/storage_engine/select.result
+++ b/mysql-test/suite/storage_engine/select.result
@@ -144,7 +144,7 @@ a b a b
200 bar 200 bar
200 bar 200 bar
200 bar 200 bar
-SELECT alias1.* FROM ( SELECT * FROM t1 ) alias1, t2 WHERE t2.a IN (100,200);
+SELECT alias1.* FROM ( SELECT a,b FROM t1 ) alias1, t2 WHERE t2.a IN (100,200);
a b
1 z
1 z
@@ -233,7 +233,7 @@ SUM(t2.a)
SELECT MIN(t2.a) FROM t1 RIGHT OUTER JOIN t2 USING (b,a);
MIN(t2.a)
1
-SELECT alias.b FROM t1 NATURAL JOIN ( SELECT * FROM t1 ) alias WHERE b > '';
+SELECT alias.b FROM t1 NATURAL JOIN ( SELECT a,b FROM t1 ) alias WHERE b > '';
b
bar
bar
@@ -247,7 +247,7 @@ z
z
z
z
-SELECT t2.b FROM ( SELECT * FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL;
+SELECT t2.b FROM ( SELECT a,b FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL;
b
bar
bar
@@ -306,15 +306,15 @@ z
z
z
z
-SELECT ( SELECT MIN(a) FROM ( SELECT * FROM t1 ) alias1 ) AS min_a FROM t2;
+SELECT ( SELECT MIN(a) FROM ( SELECT a,b FROM t1 ) alias1 ) AS min_a FROM t2;
min_a
1
1
1
-SELECT * FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 );
+SELECT a,b FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 );
a b
1 z
-SELECT * FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 );
+SELECT a,b FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 );
a b
200 bar
SELECT t2.* FROM t1 t1_outer, t2 WHERE ( t1_outer.a, t2.b ) IN ( SELECT a, b FROM t2 WHERE a = t1_outer.a );
@@ -325,19 +325,19 @@ a b
100 foobar
200 bar
200 bar
-SELECT * FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 );
+SELECT a,b FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 );
a b
100 foobar
200 bar
-SELECT * FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' );
+SELECT a,b FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' );
a b
1 z
100 foobar
-SELECT * FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 );
+SELECT a,b FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 );
a b
1 z
1 z
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE t2.b > t1.b );
+SELECT a,b FROM t1 WHERE EXISTS ( SELECT a,b FROM t2 WHERE t2.b > t1.b );
a b
100 foobar
100 foobar
@@ -371,12 +371,12 @@ a b
100 foobar
200 bar
200 bar
-SELECT * FROM t1 UNION SELECT * FROM t2 UNION DISTINCT SELECT * FROM t1;
+SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION DISTINCT SELECT a,b FROM t1;
a b
1 z
100 foobar
200 bar
-SELECT * FROM t1 UNION SELECT * FROM t2 UNION ALL SELECT * FROM t1;
+SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION ALL SELECT a,b FROM t1;
a b
1 z
1 z
diff --git a/mysql-test/suite/storage_engine/select.test b/mysql-test/suite/storage_engine/select.test
index 528fa64cfb2..34cfd99d344 100644
--- a/mysql-test/suite/storage_engine/select.test
+++ b/mysql-test/suite/storage_engine/select.test
@@ -108,7 +108,7 @@ SELECT t1_1.*, t2.* FROM t2, t1 AS t1_1, t1 AS t1_2
WHERE t1_1.a = t1_2.a AND t2.a = t1_1.a;
--sorted_result
-SELECT alias1.* FROM ( SELECT * FROM t1 ) alias1, t2 WHERE t2.a IN (100,200);
+SELECT alias1.* FROM ( SELECT a,b FROM t1 ) alias1, t2 WHERE t2.a IN (100,200);
--sorted_result
SELECT t1.a FROM { OJ t1 LEFT OUTER JOIN t2 ON t1.a = t2.a+10 };
@@ -134,10 +134,10 @@ SELECT SUM(t2.a) FROM t1 RIGHT JOIN t2 ON t2.b = t1.b;
SELECT MIN(t2.a) FROM t1 RIGHT OUTER JOIN t2 USING (b,a);
--sorted_result
-SELECT alias.b FROM t1 NATURAL JOIN ( SELECT * FROM t1 ) alias WHERE b > '';
+SELECT alias.b FROM t1 NATURAL JOIN ( SELECT a,b FROM t1 ) alias WHERE b > '';
--sorted_result
-SELECT t2.b FROM ( SELECT * FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL;
+SELECT t2.b FROM ( SELECT a,b FROM t1 ) alias NATURAL LEFT JOIN t2 WHERE b IS NOT NULL;
--sorted_result
SELECT t1.*, t2.* FROM t1 NATURAL LEFT OUTER JOIN t2;
@@ -151,15 +151,15 @@ SELECT t1_2.b FROM t1 t1_1 NATURAL RIGHT OUTER JOIN t1 t1_2 INNER JOIN t2;
# Subquery as scalar operand, subquery in the FROM clause
--sorted_result
-SELECT ( SELECT MIN(a) FROM ( SELECT * FROM t1 ) alias1 ) AS min_a FROM t2;
+SELECT ( SELECT MIN(a) FROM ( SELECT a,b FROM t1 ) alias1 ) AS min_a FROM t2;
# Comparison using subqueries
--sorted_result
-SELECT * FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 );
+SELECT a,b FROM t2 WHERE a = ( SELECT MIN(a) FROM t1 );
--sorted_result
-SELECT * FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 );
+SELECT a,b FROM t2 WHERE b LIKE ( SELECT b FROM t1 ORDER BY b LIMIT 1 );
# Subquery with IN, correlated subquery
@@ -169,20 +169,20 @@ SELECT t2.* FROM t1 t1_outer, t2 WHERE ( t1_outer.a, t2.b ) IN ( SELECT a, b FRO
# Subquery with ANY, ALL
--sorted_result
-SELECT * FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 );
+SELECT a,b FROM t2 WHERE b = ANY ( SELECT b FROM t1 WHERE a > 1 );
--sorted_result
-SELECT * FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' );
+SELECT a,b FROM t2 WHERE b > ALL ( SELECT b FROM t1 WHERE b < 'foo' );
# Row subqueries
--sorted_result
-SELECT * FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 );
+SELECT a,b FROM t1 WHERE ROW(a, b) = ( SELECT a, b FROM t2 ORDER BY a, b LIMIT 1 );
# Subquery with EXISTS
--sorted_result
-SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE t2.b > t1.b );
+SELECT a,b FROM t1 WHERE EXISTS ( SELECT a,b FROM t2 WHERE t2.b > t1.b );
# Subquery in ORDER BY
@@ -197,10 +197,10 @@ SELECT a, b FROM t1 HAVING a IN ( SELECT a FROM t2 WHERE b = t1.b );
# Union
--sorted_result
-SELECT * FROM t1 UNION SELECT * FROM t2 UNION DISTINCT SELECT * FROM t1;
+SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION DISTINCT SELECT a,b FROM t1;
--sorted_result
-SELECT * FROM t1 UNION SELECT * FROM t2 UNION ALL SELECT * FROM t1;
+SELECT a,b FROM t1 UNION SELECT a,b FROM t2 UNION ALL SELECT a,b FROM t1;
# Cleanup
diff --git a/mysql-test/suite/storage_engine/select_high_prio.result b/mysql-test/suite/storage_engine/select_high_prio.result
index b3b70df3731..10226ae0f39 100644
--- a/mysql-test/suite/storage_engine/select_high_prio.result
+++ b/mysql-test/suite/storage_engine/select_high_prio.result
@@ -12,7 +12,7 @@ LOCK TABLE t1 READ;
connection con0;
UPDATE t1 SET b = CONCAT(b,b);
connection con2;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
connection con1;
UNLOCK TABLES;
connection con0;
diff --git a/mysql-test/suite/storage_engine/select_high_prio.test b/mysql-test/suite/storage_engine/select_high_prio.test
index 385752e8d4e..49cd91ebbfd 100644
--- a/mysql-test/suite/storage_engine/select_high_prio.test
+++ b/mysql-test/suite/storage_engine/select_high_prio.test
@@ -49,12 +49,12 @@ let $condition = LIKE 'Waiting for table%';
let $wait_timeout = 2;
--source include/wait_show_condition.inc
--send
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--connection con1
let $show_statement = SHOW PROCESSLIST;
let $field = Info;
-let $condition = = 'SELECT * FROM t1';
+let $condition = = 'SELECT a,b FROM t1';
let $wait_timeout = 2;
--source include/wait_show_condition.inc
if (!$found)
diff --git a/mysql-test/suite/storage_engine/truncate_table.result b/mysql-test/suite/storage_engine/truncate_table.result
index 0a774c4b8dd..d8dc5046442 100644
--- a/mysql-test/suite/storage_engine/truncate_table.result
+++ b/mysql-test/suite/storage_engine/truncate_table.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO
TRUNCATE TABLE t1;
INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
TRUNCATE TABLE t1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
@@ -22,7 +22,7 @@ INSERT INTO t1 (c) VALUES ('d');
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 # # # # # # # # # 2 # # # # # # #
-SELECT * FROM t1;
+SELECT a,c FROM t1;
a c
1 d
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/truncate_table.test b/mysql-test/suite/storage_engine/truncate_table.test
index c84fba143b7..a9277b39619 100644
--- a/mysql-test/suite/storage_engine/truncate_table.test
+++ b/mysql-test/suite/storage_engine/truncate_table.test
@@ -19,7 +19,7 @@ if (!$mysql_errname)
{
INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
TRUNCATE TABLE t1;
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
}
DROP TABLE t1;
@@ -51,7 +51,7 @@ if (!$mysql_errname)
--replace_column 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # 14 # 15 # 16 # 17 # 18 #
SHOW TABLE STATUS LIKE 't1';
- SELECT * FROM t1;
+ SELECT a,c FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result
index a52f18fc623..3b0bdb3b560 100644
--- a/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result
+++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_repeatable_read.result
@@ -9,7 +9,7 @@ connection con2;
INSERT INTO t1 (a) VALUES (1);
connection con1;
# If consistent read works on this isolation level (REPEATABLE READ), the following SELECT should not return the value we inserted (1)
-SELECT * FROM t1;
+SELECT a FROM t1;
a
COMMIT;
connection default;
diff --git a/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result
index 8d75ea075a2..691039e8d96 100644
--- a/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result
+++ b/mysql-test/suite/storage_engine/trx/cons_snapshot_serializable.result
@@ -9,7 +9,7 @@ connection con2;
INSERT INTO t1 (a) VALUES (1);
connection con1;
# If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1)
-SELECT * FROM t1;
+SELECT a FROM t1;
a
COMMIT;
connection default;
diff --git a/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc b/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc
index 8dc9d6c4bb1..7f0dfe04214 100644
--- a/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc
+++ b/mysql-test/suite/storage_engine/trx/consistent_snapshot.inc
@@ -38,7 +38,7 @@ if ($mysql_errname)
connection con1;
--echo # If consistent read works on this isolation level ($trx_isolation), the following SELECT should not return the value we inserted (1)
-SELECT * FROM t1;
+SELECT a FROM t1;
COMMIT;
connection default;
diff --git a/mysql-test/suite/storage_engine/trx/delete.result b/mysql-test/suite/storage_engine/trx/delete.result
index 827877a7e30..14e5389dcfb 100644
--- a/mysql-test/suite/storage_engine/trx/delete.result
+++ b/mysql-test/suite/storage_engine/trx/delete.result
@@ -4,7 +4,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'
INSERT INTO t1 (a,b) SELECT a, b FROM t1;
BEGIN;
DELETE FROM t1 WHERE b IN ('c');
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
1 a
@@ -24,7 +24,7 @@ a b
8 h
DELETE FROM t1 WHERE a < 0 OR b = 'a';
COMMIT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
10000 foobar
10000 foobar
@@ -46,7 +46,7 @@ SAVEPOINT spt1;
DELETE FROM t1;
RELEASE SAVEPOINT spt1;
ROLLBACK;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
10000 foobar
10000 foobar
diff --git a/mysql-test/suite/storage_engine/trx/delete.test b/mysql-test/suite/storage_engine/trx/delete.test
index 0898eebb49a..50da1f20153 100644
--- a/mysql-test/suite/storage_engine/trx/delete.test
+++ b/mysql-test/suite/storage_engine/trx/delete.test
@@ -22,11 +22,11 @@ if ($mysql_errname)
--source ../unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DELETE FROM t1 WHERE a < 0 OR b = 'a';
COMMIT;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
BEGIN;
DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
@@ -35,7 +35,7 @@ DELETE FROM t1;
RELEASE SAVEPOINT spt1;
ROLLBACK;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
BEGIN;
DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
diff --git a/mysql-test/suite/storage_engine/trx/insert.result b/mysql-test/suite/storage_engine/trx/insert.result
index 986d63b2a07..1d8aca98687 100644
--- a/mysql-test/suite/storage_engine/trx/insert.result
+++ b/mysql-test/suite/storage_engine/trx/insert.result
@@ -4,7 +4,7 @@ BEGIN;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'foo');
INSERT t1 (a,b) VALUE (10,'foo'),(11,'abc');
COMMIT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
10 foo
@@ -21,7 +21,7 @@ INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
RELEASE SAVEPOINT spt1;
INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
ROLLBACK;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
10 foo
@@ -39,7 +39,7 @@ INSERT t1 SET b = DEFAULT;
ROLLBACK TO SAVEPOINT spt1;
INSERT INTO t1 (b,a) VALUES ('test1',10);
COMMIT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
10 NULL
diff --git a/mysql-test/suite/storage_engine/trx/insert.test b/mysql-test/suite/storage_engine/trx/insert.test
index c458f90b1bb..1a736584b03 100644
--- a/mysql-test/suite/storage_engine/trx/insert.test
+++ b/mysql-test/suite/storage_engine/trx/insert.test
@@ -15,7 +15,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'foo');
INSERT t1 (a,b) VALUE (10,'foo'),(11,'abc');
COMMIT;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
BEGIN;
INSERT INTO t1 (b,a) VALUES ('test',0);
@@ -25,7 +25,7 @@ RELEASE SAVEPOINT spt1;
INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
ROLLBACK;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
BEGIN;
INSERT t1 (a) VALUE (10),(20);
@@ -36,7 +36,7 @@ ROLLBACK TO SAVEPOINT spt1;
INSERT INTO t1 (b,a) VALUES ('test1',10);
COMMIT;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/level_read_committed.result b/mysql-test/suite/storage_engine/trx/level_read_committed.result
index 12c0c2f42a8..ce1b126dc1a 100644
--- a/mysql-test/suite/storage_engine/trx/level_read_committed.result
+++ b/mysql-test/suite/storage_engine/trx/level_read_committed.result
@@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
connection con1;
CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
START TRANSACTION;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
BEGIN;
@@ -14,53 +14,53 @@ INSERT INTO t1 (a) VALUES(1);
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
INSERT INTO t1 (a) VALUES (2);
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
INSERT INTO t1 (a) SELECT a+100 FROM t1;
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
INSERT INTO t1 (a) SELECT a+200 FROM t1;
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
201
202
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
201
202
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
@@ -81,7 +81,7 @@ connection con2;
INSERT INTO t1 (a) VALUES (1);
connection con1;
# If consistent read works on this isolation level (READ COMMITTED), the following SELECT should not return the value we inserted (1)
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
COMMIT;
diff --git a/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result
index 2bf93768b00..68fbe5632cb 100644
--- a/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result
+++ b/mysql-test/suite/storage_engine/trx/level_read_uncommitted.result
@@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
connection con1;
CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
START TRANSACTION;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
BEGIN;
@@ -14,7 +14,7 @@ INSERT INTO t1 (a) VALUES(1);
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
connection con2;
@@ -22,35 +22,35 @@ INSERT INTO t1 (a) VALUES (2);
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
INSERT INTO t1 (a) SELECT a+100 FROM t1;
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
101
102
2
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
101
102
2
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
101
102
2
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
101
@@ -59,7 +59,7 @@ a
INSERT INTO t1 (a) SELECT a+200 FROM t1;
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
101
@@ -70,7 +70,7 @@ a
301
302
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
101
@@ -81,7 +81,7 @@ a
301
302
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
101
@@ -106,7 +106,7 @@ connection con2;
INSERT INTO t1 (a) VALUES (1);
connection con1;
# If consistent read works on this isolation level (READ UNCOMMITTED), the following SELECT should not return the value we inserted (1)
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
COMMIT;
diff --git a/mysql-test/suite/storage_engine/trx/level_repeatable_read.result b/mysql-test/suite/storage_engine/trx/level_repeatable_read.result
index 82324c16801..c828b18dba0 100644
--- a/mysql-test/suite/storage_engine/trx/level_repeatable_read.result
+++ b/mysql-test/suite/storage_engine/trx/level_repeatable_read.result
@@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection con1;
CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
START TRANSACTION;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
BEGIN;
@@ -14,50 +14,50 @@ INSERT INTO t1 (a) VALUES(1);
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
INSERT INTO t1 (a) VALUES (2);
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
INSERT INTO t1 (a) SELECT a+100 FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
INSERT INTO t1 (a) SELECT a+200 FROM t1;
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
201
202
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
201
202
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
diff --git a/mysql-test/suite/storage_engine/trx/level_serializable.result b/mysql-test/suite/storage_engine/trx/level_serializable.result
index 0f990dfbf77..3f57395fa37 100644
--- a/mysql-test/suite/storage_engine/trx/level_serializable.result
+++ b/mysql-test/suite/storage_engine/trx/level_serializable.result
@@ -6,7 +6,7 @@ SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
connection con1;
CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
START TRANSACTION;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
BEGIN;
@@ -15,7 +15,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
INSERT INTO t1 (a) VALUES (2);
@@ -23,32 +23,32 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
# If it differs from the result file, it might indicate a problem.
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
INSERT INTO t1 (a) SELECT a+100 FROM t1;
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
INSERT INTO t1 (a) SELECT a+200 FROM t1;
# WARNING: Statement ended with errno 0, errname ''.
# If it differs from the result file, it might indicate a problem.
-SELECT * FROM t1;
+SELECT a FROM t1;
a
COMMIT;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection default;
disconnect con1;
diff --git a/mysql-test/suite/storage_engine/trx/select_for_update.result b/mysql-test/suite/storage_engine/trx/select_for_update.result
index 8b0de87de05..f5954489d91 100644
--- a/mysql-test/suite/storage_engine/trx/select_for_update.result
+++ b/mysql-test/suite/storage_engine/trx/select_for_update.result
@@ -3,23 +3,23 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
connect con1,localhost,root,,;
BEGIN;
-SELECT * FROM t1 WHERE b='a' FOR UPDATE;
+SELECT a,b FROM t1 WHERE b='a' FOR UPDATE;
a b
1 a
3 a
connection default;
SET lock_wait_timeout = 1;
-SELECT * FROM t1 WHERE b='a';
+SELECT a,b FROM t1 WHERE b='a';
a b
1 a
3 a
-SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t1 SET b='c' WHERE b='a';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
@@ -27,7 +27,7 @@ a b
disconnect con1;
connection default;
UPDATE t1 SET b='c' WHERE b='a';
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 c
2 b
diff --git a/mysql-test/suite/storage_engine/trx/select_for_update.test b/mysql-test/suite/storage_engine/trx/select_for_update.test
index 93ccc1915df..2a7dee2d3f4 100644
--- a/mysql-test/suite/storage_engine/trx/select_for_update.test
+++ b/mysql-test/suite/storage_engine/trx/select_for_update.test
@@ -22,7 +22,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
--connect (con1,localhost,root,,)
BEGIN;
--sorted_result
-SELECT * FROM t1 WHERE b='a' FOR UPDATE;
+SELECT a,b FROM t1 WHERE b='a' FOR UPDATE;
if ($mysql_errname)
{
--let $functionality = SELECT .. FOR UPDATE
@@ -35,7 +35,7 @@ SET lock_wait_timeout = 1;
# Should still be able to select
--sorted_result
-SELECT * FROM t1 WHERE b='a';
+SELECT a,b FROM t1 WHERE b='a';
if ($mysql_errname)
{
--let $functionality = SELECT .. FOR UPDATE or locking
@@ -46,7 +46,7 @@ if ($mysql_errname)
--sorted_result
--let $error_codes = ER_LOCK_WAIT_TIMEOUT
-SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
--source ../check_errors.inc
if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
{
@@ -66,7 +66,7 @@ if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
--connection con1
COMMIT;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--disconnect con1
--connection default
@@ -78,7 +78,7 @@ if ($mysql_errname)
--source ../unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result
index 00610a03bd8..3d668d721ae 100644
--- a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result
+++ b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.result
@@ -3,17 +3,17 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
connect con1,localhost,root,,;
BEGIN;
-SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
a b
1 a
3 a
connection default;
SET lock_wait_timeout = 1;
-SELECT * FROM t1 WHERE b='a';
+SELECT a,b FROM t1 WHERE b='a';
a b
1 a
3 a
-SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
a b
1 a
3 a
@@ -21,7 +21,7 @@ UPDATE t1 SET b='c' WHERE b='a';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection con1;
COMMIT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
2 b
@@ -29,7 +29,7 @@ a b
disconnect con1;
connection default;
UPDATE t1 SET b='c' WHERE b='a';
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 c
2 b
diff --git a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test
index a50c86403e9..4c03b44640b 100644
--- a/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test
+++ b/mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test
@@ -22,7 +22,7 @@ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
--connect (con1,localhost,root,,)
BEGIN;
--sorted_result
-SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
if ($mysql_errname)
{
--let $functionality = LOCK IN SHARE MODE
@@ -35,14 +35,14 @@ SET lock_wait_timeout = 1;
# Should still be able to select
--sorted_result
-SELECT * FROM t1 WHERE b='a';
+SELECT a,b FROM t1 WHERE b='a';
if ($mysql_errname)
{
--let $functionality = LOCK IN SHARE MODE
--source ../unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
if ($mysql_errname)
{
--let $functionality = LOCK IN SHARE MODE
@@ -61,7 +61,7 @@ if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
--connection con1
COMMIT;
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--disconnect con1
--connection default
@@ -73,7 +73,7 @@ if ($mysql_errname)
--source ../unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/transaction_isolation.inc b/mysql-test/suite/storage_engine/trx/transaction_isolation.inc
index c81071d99b6..9e07ff1b857 100644
--- a/mysql-test/suite/storage_engine/trx/transaction_isolation.inc
+++ b/mysql-test/suite/storage_engine/trx/transaction_isolation.inc
@@ -31,7 +31,7 @@ let $create_definition = a $int_col;
START TRANSACTION;
--sorted_result
-SELECT * FROM t1; # First snapshot
+SELECT a FROM t1; # First snapshot
connection con2;
@@ -42,7 +42,7 @@ INSERT INTO t1 (a) VALUES(1);
connection con1;
--sorted_result
-SELECT * FROM t1; # Second snapshot
+SELECT a FROM t1; # Second snapshot
connection con2;
--let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT
@@ -51,25 +51,25 @@ INSERT INTO t1 (a) VALUES (2);
connection con1;
--sorted_result
-SELECT * FROM t1; # Third snapshot
+SELECT a FROM t1; # Third snapshot
--let $error_codes = 0,ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (a) SELECT a+100 FROM t1;
--source ../strict_check_errors.inc
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
connection con2;
--sorted_result
-SELECT * FROM t1; # Inside the transaction
+SELECT a FROM t1; # Inside the transaction
COMMIT;
--sorted_result
-SELECT * FROM t1; # Outside the transaction
+SELECT a FROM t1; # Outside the transaction
connection con1;
--sorted_result
-SELECT * FROM t1; # Inside the transaction
+SELECT a FROM t1; # Inside the transaction
# Note: INSERT .. SELECT might be tricky, for example for InnoDB
# even with REPEATABLE-READ it works as if it is executed with READ COMMITTED.
@@ -81,14 +81,14 @@ INSERT INTO t1 (a) SELECT a+200 FROM t1;
--source ../strict_check_errors.inc
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
COMMIT;
--sorted_result
-SELECT * FROM t1; # Outside the transaction
+SELECT a FROM t1; # Outside the transaction
connection con2;
--sorted_result
-SELECT * FROM t1; # After both transactions have committed
+SELECT a FROM t1; # After both transactions have committed
connection default;
disconnect con1;
diff --git a/mysql-test/suite/storage_engine/trx/update.result b/mysql-test/suite/storage_engine/trx/update.result
index e609bfcbc23..968674619bd 100644
--- a/mysql-test/suite/storage_engine/trx/update.result
+++ b/mysql-test/suite/storage_engine/trx/update.result
@@ -6,7 +6,7 @@ BEGIN;
UPDATE t1 SET a=a+100;
UPDATE t1 SET a=a-50, b=DEFAULT WHERE a>100;
COMMIT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
10050 NULL
10050 NULL
@@ -31,7 +31,7 @@ UPDATE t1 SET b = '';
ROLLBACK TO SAVEPOINT spt1;
UPDATE t1 SET b = 'upd' WHERE a = 10050;
COMMIT;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
10050 upd
10050 upd
diff --git a/mysql-test/suite/storage_engine/trx/update.test b/mysql-test/suite/storage_engine/trx/update.test
index df65e244528..245b7554477 100644
--- a/mysql-test/suite/storage_engine/trx/update.test
+++ b/mysql-test/suite/storage_engine/trx/update.test
@@ -26,7 +26,7 @@ if (!$mysql_errname)
UPDATE t1 SET a=a-50, b=DEFAULT WHERE a>100;
COMMIT;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
BEGIN;
UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3;
@@ -41,7 +41,7 @@ if (!$mysql_errname)
UPDATE t1 SET b = 'upd' WHERE a = 10050;
COMMIT;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
}
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/xa.result b/mysql-test/suite/storage_engine/trx/xa.result
index 3e2cb43a11c..72017018e2a 100644
--- a/mysql-test/suite/storage_engine/trx/xa.result
+++ b/mysql-test/suite/storage_engine/trx/xa.result
@@ -7,18 +7,18 @@ connection con2;
XA START 'xa1';
INSERT INTO t1 (a) VALUES (1);
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
INSERT INTO t1 (a) VALUES (2);
XA END 'xa1';
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
XA PREPARE 'xa1';
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
connection con2;
XA RECOVER;
@@ -26,7 +26,7 @@ formatID gtrid_length bqual_length data
1 3 0 xa1
XA COMMIT 'xa1';
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
@@ -34,7 +34,7 @@ connection con2;
XA START 'xa2';
INSERT INTO t1 (a) VALUES (3);
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
@@ -42,14 +42,14 @@ connection con2;
INSERT INTO t1 (a) VALUES (4);
XA END 'xa2';
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
connection con2;
XA COMMIT 'xa2' ONE PHASE;
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
@@ -59,7 +59,7 @@ connection con2;
XA START 'xa3';
INSERT INTO t1 (a) VALUES (5);
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
@@ -69,7 +69,7 @@ connection con2;
INSERT INTO t1 (a) VALUES (6);
XA END 'xa3';
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
@@ -78,7 +78,7 @@ a
connection con2;
XA PREPARE 'xa3';
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
@@ -87,7 +87,7 @@ a
connection con2;
XA ROLLBACK 'xa3';
connection con1;
-SELECT * FROM t1;
+SELECT a FROM t1;
a
1
2
diff --git a/mysql-test/suite/storage_engine/trx/xa.test b/mysql-test/suite/storage_engine/trx/xa.test
index c64ba7cd27b..17cae7eae76 100644
--- a/mysql-test/suite/storage_engine/trx/xa.test
+++ b/mysql-test/suite/storage_engine/trx/xa.test
@@ -30,7 +30,7 @@ INSERT INTO t1 (a) VALUES (1);
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
INSERT INTO t1 (a) VALUES (2);
@@ -38,14 +38,14 @@ XA END 'xa1';
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
XA PREPARE 'xa1';
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
XA RECOVER;
@@ -53,7 +53,7 @@ XA COMMIT 'xa1';
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
# One-phase COMMIT
@@ -63,7 +63,7 @@ INSERT INTO t1 (a) VALUES (3);
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
INSERT INTO t1 (a) VALUES (4);
@@ -71,14 +71,14 @@ XA END 'xa2';
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
XA COMMIT 'xa2' ONE PHASE;
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
# Rollback
@@ -88,7 +88,7 @@ INSERT INTO t1 (a) VALUES (5);
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
INSERT INTO t1 (a) VALUES (6);
@@ -96,21 +96,21 @@ XA END 'xa3';
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
XA PREPARE 'xa3';
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
--connection con2
XA ROLLBACK 'xa3';
--connection con1
--sorted_result
-SELECT * FROM t1;
+SELECT a FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.result b/mysql-test/suite/storage_engine/trx/xa_recovery.result
index e14e9a0bf1a..a9208a6e9d3 100644
--- a/mysql-test/suite/storage_engine/trx/xa_recovery.result
+++ b/mysql-test/suite/storage_engine/trx/xa_recovery.result
@@ -22,7 +22,7 @@ formatID gtrid_length bqual_length data
1 3 0 xa2
XA ROLLBACK 'xa1';
XA COMMIT 'xa2';
-SELECT * FROM t1;
+SELECT a FROM t1;
a
3
4
diff --git a/mysql-test/suite/storage_engine/trx/xa_recovery.test b/mysql-test/suite/storage_engine/trx/xa_recovery.test
index d7ac2e782d1..4dab66b77dd 100644
--- a/mysql-test/suite/storage_engine/trx/xa_recovery.test
+++ b/mysql-test/suite/storage_engine/trx/xa_recovery.test
@@ -64,7 +64,7 @@ EOF
XA RECOVER;
XA ROLLBACK 'xa1';
XA COMMIT 'xa2';
-SELECT * FROM t1;
+SELECT a FROM t1;
DROP TABLE t1;
--source ../cleanup_engine.inc
diff --git a/mysql-test/suite/storage_engine/type_binary.inc b/mysql-test/suite/storage_engine/type_binary.inc
index 812a1cc9527..dbee1d57274 100644
--- a/mysql-test/suite/storage_engine/type_binary.inc
+++ b/mysql-test/suite/storage_engine/type_binary.inc
@@ -27,16 +27,16 @@ if (!$mysql_errname)
# Valid values
- INSERT INTO t1 VALUES ('','','','','');
- INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+ INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','','');
+ INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
--sorted_result
SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
# Invalid values
- INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
- INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+ INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+ INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
--sorted_result
SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
diff --git a/mysql-test/suite/storage_engine/type_binary.result b/mysql-test/suite/storage_engine/type_binary.result
index 455dbb57a7e..8da8b04095b 100644
--- a/mysql-test/suite/storage_engine/type_binary.result
+++ b/mysql-test/suite/storage_engine/type_binary.result
@@ -12,20 +12,20 @@ b0 binary(0) # # # #
b1 binary(1) # # # #
b20 binary(20) # # # #
b255 binary(255) # # # #
-INSERT INTO t1 VALUES ('','','','','');
-INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('','','','','');
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
SELECT HEX(b), HEX(b0), HEX(b1), HEX(b20), HEX(b255) FROM t1;
HEX(b) HEX(b0) HEX(b1) HEX(b20) HEX(b255)
00 00 0000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
61 62 616263646566676869206B6C6D6E6F7071727374 4372656174696E6720616E2061727469636C6520666F7220746865204B6E6F776C65646765626173652069732073696D696C617220746F2061736B696E67207175657374696F6E732E2046697273742C206E6176696761746520746F207468652063617465676F727920776865726520796F75206665656C207468652061727469636C652073686F756C642062652E204F6E63652074686572652C20646F75626C6520636865636B207468617420616E2061727469636C6520646F65736E277420616C726561647920657869737420776869636820776F756C6420776F726B2E00000000000000000000000000000000000000000000000000000000000000
-INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+INSERT INTO t1 (b,b0,b1,b20,b255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b0' at row 1
Warning 1265 Data truncated for column 'b1' at row 1
Warning 1265 Data truncated for column 'b20' at row 1
Warning 1265 Data truncated for column 'b255' at row 1
-INSERT INTO t1 SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
+INSERT INTO t1 (b,b0,b1,b20,b255) SELECT b255, b255, b255, b255, CONCAT(b255,b255) FROM t1;
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b0' at row 1
diff --git a/mysql-test/suite/storage_engine/type_binary_indexes.result b/mysql-test/suite/storage_engine/type_binary_indexes.result
index 6f828aed100..96e0d6d601a 100644
--- a/mysql-test/suite/storage_engine/type_binary_indexes.result
+++ b/mysql-test/suite/storage_engine/type_binary_indexes.result
@@ -88,7 +88,7 @@ SHOW INDEX IN t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 v16 1 v16 # # 10 NULL # #
INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b'),('d','char5','varchar4a','varchar3b'),('e','char6','varchar2a','varchar3b');
-INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 (b,b20,v16,v128) SELECT b,b20,v16,v128 FROM t1;
EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%';
id select_type table type possible_keys key key_len ref rows Extra
# # # # # NULL # # # #
diff --git a/mysql-test/suite/storage_engine/type_binary_indexes.test b/mysql-test/suite/storage_engine/type_binary_indexes.test
index 24b16aa5175..943593027f8 100644
--- a/mysql-test/suite/storage_engine/type_binary_indexes.test
+++ b/mysql-test/suite/storage_engine/type_binary_indexes.test
@@ -130,7 +130,7 @@ if (!$mysql_errname)
SHOW INDEX IN t1;
INSERT INTO t1 (b,b20,v16,v128) VALUES ('a','char1','varchar1a','varchar1b'),('a','char2','varchar2a','varchar2b'),('b','char3','varchar1a','varchar1b'),('c','char4','varchar3a','varchar3b'),('d','char5','varchar4a','varchar3b'),('e','char6','varchar2a','varchar3b');
- INSERT INTO t1 SELECT * FROM t1;
+ INSERT INTO t1 (b,b20,v16,v128) SELECT b,b20,v16,v128 FROM t1;
--replace_column 1 # 2 # 3 # 4 # 5 # 7 # 8 # 9 # 10 #
EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%';
diff --git a/mysql-test/suite/storage_engine/type_bit.inc b/mysql-test/suite/storage_engine/type_bit.inc
index 1a232305e1c..eb7920f8d83 100644
--- a/mysql-test/suite/storage_engine/type_bit.inc
+++ b/mysql-test/suite/storage_engine/type_bit.inc
@@ -43,28 +43,28 @@ if (!$mysql_errname)
SHOW COLUMNS IN t1;
}
- INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+ INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
--sorted_result
SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
- INSERT INTO t1 VALUES (1,0,-1,0);
+ INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0);
--sorted_result
SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
- INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+ INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0);
--sorted_result
SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
# Out of range values
# (should produce warnings)
- INSERT INTO t1 VALUES (0x10,0,0,1);
+ INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c,d FROM t1;
- INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+ INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c,d FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_bit.result b/mysql-test/suite/storage_engine/type_bit.result
index 69b9ac53d76..3c88b297d8a 100644
--- a/mysql-test/suite/storage_engine/type_bit.result
+++ b/mysql-test/suite/storage_engine/type_bit.result
@@ -18,29 +18,29 @@ a bit(1) # # #
b bit(20) # # #
c bit(64) # # #
d bit(1) # # #
-INSERT INTO t1 VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
+INSERT INTO t1 (a,b,c,d) VALUES (0,POW(2,20)-1,b'1111111111111111111111111111111111111111111111111111111111111111',1);
SELECT BIN(a), HEX(b), c+0 FROM t1 WHERE d>0;
BIN(a) HEX(b) c+0
0 FFFFF 18446744073709551615
-INSERT INTO t1 VALUES (1,0,-1,0);
+INSERT INTO t1 (a,b,c,d) VALUES (1,0,-1,0);
SELECT a+0, b+0, c+0 FROM t1 WHERE d<100;
a+0 b+0 c+0
0 1048575 18446744073709551615
1 0 18446744073709551615
-INSERT INTO t1 VALUES (b'1', 'f', 0xFF, 0x0);
+INSERT INTO t1 (a,b,c,d) VALUES (b'1', 'f', 0xFF, 0x0);
SELECT a+0, b+0, c+0 FROM t1 WHERE d IN (0, 2);
a+0 b+0 c+0
1 0 18446744073709551615
1 102 255
-INSERT INTO t1 VALUES (0x10,0,0,1);
+INSERT INTO t1 (a,b,c,d) VALUES (0x10,0,0,1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-SELECT * FROM t1;
+SELECT a,b,c,d FROM t1;
a b c d
-INSERT INTO t1 VALUES (0x01,0,0x10000000000000000,0);
+INSERT INTO t1 (a,b,c,d) VALUES (0x01,0,0x10000000000000000,0);
Warnings:
Warning 1264 Out of range value for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c,d FROM t1;
a b c d
DROP TABLE t1;
CREATE TABLE t1 (a BIT(65) <CUSTOM_COL_OPTIONS>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
diff --git a/mysql-test/suite/storage_engine/type_blob.inc b/mysql-test/suite/storage_engine/type_blob.inc
index 93a52fc9971..626c556102e 100644
--- a/mysql-test/suite/storage_engine/type_blob.inc
+++ b/mysql-test/suite/storage_engine/type_blob.inc
@@ -33,7 +33,7 @@ if (!$mysql_errname)
# Valid values
# (cannot get MAX for all columns due to max_allowed_packet limitations)
- INSERT INTO t1 VALUES
+ INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -44,7 +44,7 @@ if (!$mysql_errname)
# Invalid values (produce warnings, except for mediumblob and longblob columns for which the values are within limits)
- INSERT INTO t1 VALUES
+ INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
--sorted_result
diff --git a/mysql-test/suite/storage_engine/type_blob.result b/mysql-test/suite/storage_engine/type_blob.result
index a93391f749a..9a9e14709e5 100644
--- a/mysql-test/suite/storage_engine/type_blob.result
+++ b/mysql-test/suite/storage_engine/type_blob.result
@@ -22,7 +22,7 @@ b17m longblob # # #
t tinyblob # # #
m mediumblob # # #
l longblob # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -33,7 +33,7 @@ LENGTH(b) LENGTH(b0) LENGTH(b1) LENGTH(b300) LENGTH(bm) LENGTH(b70k) LENGTH(b17m
1 1 1 1 1 1 1 1 1 1
5 5 5 5 5 5 5 5 5 6
65535 65535 255 65535 65535 1048576 2097152 255 1048576 2097152
-INSERT INTO t1 VALUES
+INSERT INTO t1 (b,b0,b1,b300,bm,b70k,b17m,t,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
diff --git a/mysql-test/suite/storage_engine/type_bool.inc b/mysql-test/suite/storage_engine/type_bool.inc
index ae7d0043c49..b14f658c973 100644
--- a/mysql-test/suite/storage_engine/type_bool.inc
+++ b/mysql-test/suite/storage_engine/type_bool.inc
@@ -25,40 +25,40 @@ if (!$mysql_errname)
# Valid values
- INSERT INTO t1 VALUES (1,TRUE);
+ INSERT INTO t1 (b1,b2) VALUES (1,TRUE);
--sorted_result
- SELECT * FROM t1;
+ SELECT b1,b2 FROM t1;
- INSERT INTO t1 VALUES (FALSE,0);
+ INSERT INTO t1 (b1,b2) VALUES (FALSE,0);
--sorted_result
- SELECT * FROM t1;
+ SELECT b1,b2 FROM t1;
- INSERT INTO t1 VALUES (2,3);
+ INSERT INTO t1 (b1,b2) VALUES (2,3);
--sorted_result
- SELECT * FROM t1;
+ SELECT b1,b2 FROM t1;
- INSERT INTO t1 VALUES (-1,-2);
+ INSERT INTO t1 (b1,b2) VALUES (-1,-2);
--sorted_result
- SELECT * FROM t1;
+ SELECT b1,b2 FROM t1;
--sorted_result
SELECT IF(b1,'true','false') AS a, IF(b2,'true','false') AS b FROM t1;
--sorted_result
- SELECT * FROM t1 WHERE b1 = TRUE;
+ SELECT b1,b2 FROM t1 WHERE b1 = TRUE;
--sorted_result
- SELECT * FROM t1 WHERE b2 = FALSE;
+ SELECT b1,b2 FROM t1 WHERE b2 = FALSE;
# Invalid values
- INSERT INTO t1 VALUES ('a','b');
+ INSERT INTO t1 (b1,b2) VALUES ('a','b');
--sorted_result
- SELECT * FROM t1;
+ SELECT b1,b2 FROM t1;
- INSERT INTO t1 VALUES (128,-129);
+ INSERT INTO t1 (b1,b2) VALUES (128,-129);
--sorted_result
- SELECT * FROM t1;
+ SELECT b1,b2 FROM t1;
# This is why we don't have zerofill and unsigned tests
# for boolean columns:
diff --git a/mysql-test/suite/storage_engine/type_bool.result b/mysql-test/suite/storage_engine/type_bool.result
index 89beaa11a16..87308ed63fc 100644
--- a/mysql-test/suite/storage_engine/type_bool.result
+++ b/mysql-test/suite/storage_engine/type_bool.result
@@ -6,23 +6,23 @@ SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
b1 tinyint(1) # # #
b2 tinyint(1) # # #
-INSERT INTO t1 VALUES (1,TRUE);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (1,TRUE);
+SELECT b1,b2 FROM t1;
b1 b2
1 1
-INSERT INTO t1 VALUES (FALSE,0);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (FALSE,0);
+SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
-INSERT INTO t1 VALUES (2,3);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (2,3);
+SELECT b1,b2 FROM t1;
b1 b2
0 0
1 1
2 3
-INSERT INTO t1 VALUES (-1,-2);
-SELECT * FROM t1;
+INSERT INTO t1 (b1,b2) VALUES (-1,-2);
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
@@ -34,28 +34,28 @@ false false
true true
true true
true true
-SELECT * FROM t1 WHERE b1 = TRUE;
+SELECT b1,b2 FROM t1 WHERE b1 = TRUE;
b1 b2
1 1
-SELECT * FROM t1 WHERE b2 = FALSE;
+SELECT b1,b2 FROM t1 WHERE b2 = FALSE;
b1 b2
0 0
-INSERT INTO t1 VALUES ('a','b');
+INSERT INTO t1 (b1,b2) VALUES ('a','b');
Warnings:
Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1
Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1
-SELECT * FROM t1;
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
0 0
1 1
2 3
-INSERT INTO t1 VALUES (128,-129);
+INSERT INTO t1 (b1,b2) VALUES (128,-129);
Warnings:
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b2' at row 1
-SELECT * FROM t1;
+SELECT b1,b2 FROM t1;
b1 b2
-1 -2
0 0
diff --git a/mysql-test/suite/storage_engine/type_char.inc b/mysql-test/suite/storage_engine/type_char.inc
index 8484fc23b10..8e666299736 100644
--- a/mysql-test/suite/storage_engine/type_char.inc
+++ b/mysql-test/suite/storage_engine/type_char.inc
@@ -27,19 +27,19 @@ if (!$mysql_errname)
# Valid values
- INSERT INTO t1 VALUES ('','','','','');
- INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+ INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','','');
+ INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
--sorted_result
- SELECT * FROM t1;
+ SELECT c,c0,c1,c20,c255 FROM t1;
# Invalid values
- INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
- INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+ INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+ INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
--sorted_result
- SELECT * FROM t1;
+ SELECT c,c0,c1,c20,c255 FROM t1;
--sorted_result
SELECT DISTINCT c20, REPEAT('a',LENGTH(c20)), COUNT(*) FROM t1 GROUP BY c1, c20;
diff --git a/mysql-test/suite/storage_engine/type_char.result b/mysql-test/suite/storage_engine/type_char.result
index 61d3cf2419d..ce6d6f11b19 100644
--- a/mysql-test/suite/storage_engine/type_char.result
+++ b/mysql-test/suite/storage_engine/type_char.result
@@ -12,20 +12,20 @@ c0 char(0) # # #
c1 char(1) # # #
c20 char(20) # # #
c255 char(255) # # #
-INSERT INTO t1 VALUES ('','','','','');
-INSERT INTO t1 VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
-SELECT * FROM t1;
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('','','','','');
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('a','','b','abcdefghi klmnopqrst', 'Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn\'t already exist which would work.');
+SELECT c,c0,c1,c20,c255 FROM t1;
c c0 c1 c20 c255
a b abcdefghi klmnopqrst Creating an article for the Knowledgebase is similar to asking questions. First, navigate to the category where you feel the article should be. Once there, double check that an article doesn't already exist which would work.
-INSERT INTO t1 VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
+INSERT INTO t1 (c,c0,c1,c20,c255) VALUES ('abc', 'a', 'abc', REPEAT('a',21), REPEAT('x',256));
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'c0' at row 1
Warning 1265 Data truncated for column 'c1' at row 1
Warning 1265 Data truncated for column 'c20' at row 1
Warning 1265 Data truncated for column 'c255' at row 1
-INSERT INTO t1 SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
+INSERT INTO t1 (c,c0,c1,c20,c255) SELECT c255, c255, c255, c255, CONCAT(c255,c1) FROM t1;
Warnings:
Warning 1265 Data truncated for column 'c' at row 2
Warning 1265 Data truncated for column 'c0' at row 2
@@ -36,7 +36,7 @@ Warning 1265 Data truncated for column 'c0' at row 3
Warning 1265 Data truncated for column 'c1' at row 3
Warning 1265 Data truncated for column 'c20' at row 3
Warning 1265 Data truncated for column 'c255' at row 3
-SELECT * FROM t1;
+SELECT c,c0,c1,c20,c255 FROM t1;
c c0 c1 c20 c255
diff --git a/mysql-test/suite/storage_engine/type_char_indexes.result b/mysql-test/suite/storage_engine/type_char_indexes.result
index f02fcef3ef0..33594e2581f 100644
--- a/mysql-test/suite/storage_engine/type_char_indexes.result
+++ b/mysql-test/suite/storage_engine/type_char_indexes.result
@@ -96,10 +96,10 @@ varchar1b 2
varchar2b 1
varchar3b 1
SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
-EXPLAIN SELECT * FROM t1 WHERE c > 'a';
+EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
id select_type table type possible_keys key key_len ref rows Extra
# # # range c_v c_v # # # Using index condition
-SELECT * FROM t1 WHERE c > 'a';
+SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
c c20 v16 v128
b char3 varchar1a varchar1b
c char4 varchar3a varchar3b
@@ -133,10 +133,10 @@ r1a
r1a
r2a
r3a
-EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
id select_type table type possible_keys key key_len ref rows Extra
# # # range # v16 # # # #
-SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
c c20 v16 v128
a char1 varchar1a varchar1b
b char3 varchar1a varchar1b
diff --git a/mysql-test/suite/storage_engine/type_char_indexes.test b/mysql-test/suite/storage_engine/type_char_indexes.test
index 582800eabba..6fff8a6f73e 100644
--- a/mysql-test/suite/storage_engine/type_char_indexes.test
+++ b/mysql-test/suite/storage_engine/type_char_indexes.test
@@ -135,9 +135,9 @@ if (!$mysql_errname)
SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
--replace_column 1 # 2 # 3 # 7 # 8 # 9 #
- EXPLAIN SELECT * FROM t1 WHERE c > 'a';
+ EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
--sorted_result
- SELECT * FROM t1 WHERE c > 'a';
+ SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
SET SESSION optimizer_switch = @@global.optimizer_switch;
DROP TABLE t1;
@@ -175,9 +175,9 @@ if (!$mysql_errname)
SELECT SUBSTRING(v16,7,3) FROM t1 IGNORE INDEX (v16) WHERE v16 LIKE 'varchar%';
--replace_column 1 # 2 # 3 # 5 # 7 # 8 # 9 # 10 #
- EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
--sorted_result
- SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/type_date_time.inc b/mysql-test/suite/storage_engine/type_date_time.inc
index d0b953984be..29bfcf630f0 100644
--- a/mysql-test/suite/storage_engine/type_date_time.inc
+++ b/mysql-test/suite/storage_engine/type_date_time.inc
@@ -32,22 +32,22 @@ if (!$mysql_errname)
# Valid values
# '1970-01-01 00:00:01'
- INSERT INTO t1 VALUES
+ INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
--sorted_result
- SELECT * FROM t1;
+ SELECT d,dt,ts,t,y,y4,y2 FROM t1;
# Invalid values
- INSERT INTO t1 VALUES
+ INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
--sorted_result
- SELECT * FROM t1;
+ SELECT d,dt,ts,t,y,y4,y2 FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/type_date_time.result b/mysql-test/suite/storage_engine/type_date_time.result
index 06b92d3149f..73c9a2ec7ed 100644
--- a/mysql-test/suite/storage_engine/type_date_time.result
+++ b/mysql-test/suite/storage_engine/type_date_time.result
@@ -19,18 +19,18 @@ y year(4) # # #
y4 year(4) # # #
y2 year(2) # # #
SET @tm = '2012-04-09 05:27:00';
-INSERT INTO t1 VALUES
+INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('1000-01-01', '1000-01-01 00:00:00', FROM_UNIXTIME(1), '-838:59:59', '1901', '1901', '00'),
('9999-12-31', '9999-12-31 23:59:59', FROM_UNIXTIME(2147483647), '838:59:59', '2155', '2155', '99'),
('0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '00:00:00', '0', '0', '0'),
(DATE(@tm),@tm,TIMESTAMP(@tm),TIME(@tm),YEAR(@tm),YEAR(@tm),YEAR(@tm));
-SELECT * FROM t1;
+SELECT d,dt,ts,t,y,y4,y2 FROM t1;
d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
1000-01-01 1000-01-01 00:00:00 1970-01-01 03:00:01 -838:59:59 1901 1901 00
2012-04-09 2012-04-09 05:27:00 2012-04-09 05:27:00 05:27:00 2012 2012 12
9999-12-31 9999-12-31 23:59:59 2038-01-19 07:14:07 838:59:59 2155 2155 99
-INSERT INTO t1 VALUES
+INSERT INTO t1 (d,dt,ts,t,y,y4,y2) VALUES
('999-13-32', '999-11-31 00:00:00', '0', '-839:00:00', '1900', '1900', '-1' );
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
@@ -40,7 +40,7 @@ Warning 1264 Out of range value for column 't' at row 1
Warning 1264 Out of range value for column 'y' at row 1
Warning 1264 Out of range value for column 'y4' at row 1
Warning 1264 Out of range value for column 'y2' at row 1
-SELECT * FROM t1;
+SELECT d,dt,ts,t,y,y4,y2 FROM t1;
d dt ts t y y4 y2
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 -838:59:59 0000 0000 00
0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 00:00:00 2000 2000 00
diff --git a/mysql-test/suite/storage_engine/type_enum.inc b/mysql-test/suite/storage_engine/type_enum.inc
index 6b9b83fc52e..2e747e50ef4 100644
--- a/mysql-test/suite/storage_engine/type_enum.inc
+++ b/mysql-test/suite/storage_engine/type_enum.inc
@@ -28,16 +28,16 @@ if (!$mysql_errname)
--replace_column 3 # 4 # 5 #
SHOW COLUMNS IN t1;
- INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
+ INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c FROM t1;
# Out of range values
# (should produce warnings)
- INSERT INTO t1 VALUES (0,'test6',-1);
+ INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c FROM t1;
# Non-unique values in enum
# (should produce a warning)
@@ -53,14 +53,14 @@ if (!$mysql_errname)
--replace_column 3 # 4 # 5 #
SHOW COLUMNS IN t1;
- INSERT INTO t1 VALUES ('','test3','75','A');
+ INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c,e FROM t1;
# Simple comparison
--sorted_result
- SELECT * FROM t1 WHERE b='test2' OR a != '';
+ SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != '';
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/type_enum.result b/mysql-test/suite/storage_engine/type_enum.result
index 920aa5c7807..c2efd87ffb7 100644
--- a/mysql-test/suite/storage_engine/type_enum.result
+++ b/mysql-test/suite/storage_engine/type_enum.result
@@ -8,17 +8,17 @@ Field Type Null Key Default Extra
a enum('') # # #
b enum('test1','test2','test3','test4','test5') # # #
c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
-INSERT INTO t1 VALUES ('','test2','4'),('',5,2);
-SELECT * FROM t1;
+INSERT INTO t1 (a,b,c) VALUES ('','test2','4'),('',5,2);
+SELECT a,b,c FROM t1;
a b c
test2 4
test5 2
-INSERT INTO t1 VALUES (0,'test6',-1);
+INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
test2 4
@@ -33,14 +33,14 @@ a enum('') # # #
b enum('test1','test2','test3','test4','test5') # # #
c enum('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i','3j','3k','3l','3m','3n','3o','3p','3q','3r','3s','3t','3u','3v','3w','3x','3y','3z','40','41','42','43','44','45','46','47','48','49','4a','4b','4c','4d','4e','4f','4g','4h','4i','4j','4k','4l','4m','4n','4o','4p','4q','4r','4s','4t','4u','4v','4w','4x','4y','4z','50','51','52','53','54','55','56','57','58','59','5a','5b','5c','5d','5e','5f','5g','5h','5i','5j','5k','5l','5m','5n','5o','5p','5q','5r','5s','5t','5u','5v','5w','5x','5y','5z','60','61','62','63','64','65','66','67','68','69','6a','6b','6c','6d','6e','6f','6g','6h','6i','6j','6k','6l','6m','6n','6o','6p','6q','6r','6s','6t','6u','6v','6w','6x','6y','6z','70','71','72','73','74','75') # # #
e enum('a','A') # # #
-INSERT INTO t1 VALUES ('','test3','75','A');
-SELECT * FROM t1;
+INSERT INTO t1 (a,b,c,e) VALUES ('','test3','75','A');
+SELECT a,b,c,e FROM t1;
a b c e
NULL
test2 4 NULL
test3 75 a
test5 2 NULL
-SELECT * FROM t1 WHERE b='test2' OR a != '';
+SELECT a,b,c,e FROM t1 WHERE b='test2' OR a != '';
a b c e
test2 4 NULL
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/type_fixed.inc b/mysql-test/suite/storage_engine/type_fixed.inc
index 6765fb575bc..3b4ade9ff6d 100644
--- a/mysql-test/suite/storage_engine/type_fixed.inc
+++ b/mysql-test/suite/storage_engine/type_fixed.inc
@@ -32,40 +32,40 @@ if (!$mysql_errname)
# Always valid values
- INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
- INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
- INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0);
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
--sorted_result
- SELECT * FROM t1;
+ SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
# Values which can be valid or not,
# depending on whether columns are SIGNED or UNSIGNED
# (if not valid should produce warnings)
- INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
- INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
--sorted_result
- SELECT * FROM t1;
+ SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
--sorted_result
- SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+ SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
# Invalid values
- INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
--sorted_result
- SELECT * FROM t1;
+ SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
- INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
--sorted_result
- SELECT * FROM t1;
+ SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
- INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+ INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
--sorted_result
- SELECT * FROM t1;
+ SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
--let $error_codes = ER_TOO_BIG_PRECISION
--let $alter_definition = ADD COLUMN n66 NUMERIC(66)
diff --git a/mysql-test/suite/storage_engine/type_fixed.result b/mysql-test/suite/storage_engine/type_fixed.result
index 2c1566538db..5eea911a323 100644
--- a/mysql-test/suite/storage_engine/type_fixed.result
+++ b/mysql-test/suite/storage_engine/type_fixed.result
@@ -22,30 +22,30 @@ n0_0 decimal(10,0) # # #
n1 decimal(1,0) # # #
n20_4 decimal(20,4) # # #
n65_4 decimal(65,4) # # #
-INSERT INTO t1 VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (100,123456,0.3,40000.25,123456789123456789.10001,1024,7000.0,8.0,999999.9,9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.0,9999999999.0,0.9,99999999.99,99999999999999999999999999999999999999999999999999.9999999999,9999999999.0,9999999999.0,9.0,9999999999999999.9999,9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
-INSERT INTO t1 VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
-SELECT * FROM t1;
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-100,-123456,-0.3,-40000.25,-123456789123456789.10001,-1024,-7000.0,-8.0,-999999.9,-9223372036854775807);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (-9999999999.0,-9999999999.0,-0.9,-99999999.99,-99999999999999999999999999999999999999999999999999.9999999999,-9999999999.0,-9999999999.0,-9.0,-9999999999999999.9999,-9999999999999999999999999999999999999999999999999999999999999.9999);
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-SELECT * FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1 WHERE n20_4 = 9999999999999999.9999 OR d < 100;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
0 0 0.0 0.00 0.0000000000 0 0 0 0.0000 0.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) SELECT n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4, n65_4 FROM t1 WHERE n65_4 = ( SELECT MAX(n65_4) FROM t1 );
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -56,7 +56,7 @@ Warning 1264 Out of range value for column 'n' at row 1
Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -64,7 +64,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
100 123456 0.3 40000.25 123456789123456789.1000100000 1024 7000 8 999999.9000 9223372036854775807.0000
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (10000000000.0,10000000000.0,1.1,100000000.99,100000000000000000000000000000000000000000000000000.0,10000000000.0,10000000000.0,10.0,10000000000000000.9999,10000000000000000000000000000000000000000000000000000000000000.9999);
Warnings:
Warning 1264 Out of range value for column 'd' at row 1
Warning 1264 Out of range value for column 'd0' at row 1
@@ -76,7 +76,7 @@ Warning 1264 Out of range value for column 'n0_0' at row 1
Warning 1264 Out of range value for column 'n1' at row 1
Warning 1264 Out of range value for column 'n20_4' at row 1
Warning 1264 Out of range value for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
@@ -85,7 +85,7 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
-INSERT INTO t1 VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
+INSERT INTO t1 (d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4) VALUES (9999999999.1,9999999999.1,1.9,99999999.001,99999999999999999999999999999999999999999999999999.99999999991,9999999999.1,9999999999.1,9.1,9999999999999999.00001,9999999999999999999999999999999999999999999999999999999999999.11111);
Warnings:
Note 1265 Data truncated for column 'd' at row 1
Note 1265 Data truncated for column 'd0' at row 1
@@ -97,7 +97,7 @@ Note 1265 Data truncated for column 'n0_0' at row 1
Note 1265 Data truncated for column 'n1' at row 1
Note 1265 Data truncated for column 'n20_4' at row 1
Note 1265 Data truncated for column 'n65_4' at row 1
-SELECT * FROM t1;
+SELECT d,d0,d1_1,d10_2,d60_10,n,n0_0,n1,n20_4,n65_4 FROM t1;
d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
-100 -123456 -0.3 -40000.25 -123456789123456789.1000100000 -1024 -7000 -8 -999999.9000 -9223372036854775807.0000
-9999999999 -9999999999 -0.9 -99999999.99 -99999999999999999999999999999999999999999999999999.9999999999 -9999999999 -9999999999 -9 -9999999999999999.9999 -9999999999999999999999999999999999999999999999999999999999999.9999
diff --git a/mysql-test/suite/storage_engine/type_float.inc b/mysql-test/suite/storage_engine/type_float.inc
index 7e355f01e0d..1b8f0102755 100644
--- a/mysql-test/suite/storage_engine/type_float.inc
+++ b/mysql-test/suite/storage_engine/type_float.inc
@@ -32,13 +32,13 @@ if (!$mysql_errname)
# Always valid values
- INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
--sorted_result
- --query_vertical SELECT * FROM t1
+ --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1
- INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
- INSERT INTO t1 VALUES (
+ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0);
+ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
99999999999999999999999999999999999999,
99999999999999999999999999999999999999.9999999999999999,
0.9,
@@ -52,28 +52,28 @@ if (!$mysql_errname)
);
--sorted_result
- --query_vertical SELECT * FROM t1
+ --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1
# Values which can be valid or not,
# depending on whether columns are SIGNED or UNSIGNED
# (if not valid should produce warnings)
- INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
--sorted_result
- --query_vertical SELECT * FROM t1
+ --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1
--sorted_result
--query_vertical SELECT MAX(f), MAX(f0), MAX(r1_1), MAX(f23_0), MAX(f20_3), MAX(d), MAX(d1_0), MAX(d10_10), MAX(d53), MAX(d53_10) FROM t1
# Invalid values
- INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
--sorted_result
- --query_vertical SELECT * FROM t1
+ --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1
- INSERT INTO t1 VALUES (
+ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
999999999999999999999999999999999999999,
999999999999999999999999999999999999999.9999999999999999,
1.9,
@@ -87,7 +87,7 @@ if (!$mysql_errname)
);
--sorted_result
- --query_vertical SELECT * FROM t1
+ --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1
--let $error_codes = ER_TOO_BIG_DISPLAYWIDTH
--let $alter_definition = ADD COLUMN d0_0 DOUBLE(0,0)
diff --git a/mysql-test/suite/storage_engine/type_float.result b/mysql-test/suite/storage_engine/type_float.result
index 1f863505430..5cd76673a3c 100644
--- a/mysql-test/suite/storage_engine/type_float.result
+++ b/mysql-test/suite/storage_engine/type_float.result
@@ -22,8 +22,8 @@ d1_0 double(1,0) # # #
d10_10 double(10,10) # # #
d53 double(53,0) # # #
d53_10 double(53,10) # # #
-INSERT INTO t1 VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (12345.12345,12345.12345,0.9,123456789.123,56789.987,11111111.111,8.0,0.0123456789,1234566789123456789,99999999999999999.99999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 11111111.111
d10_10 0.0123456789
@@ -34,8 +34,8 @@ f0 12345.1
f20_3 56789.988
f23_0 123457000
r1_1 0.9
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
99999999999999999999999999999999999999,
99999999999999999999999999999999999999.9999999999999999,
0.9,
@@ -50,7 +50,7 @@ INSERT INTO t1 VALUES (
Warnings:
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d 0
d 11111111.111
@@ -81,8 +81,8 @@ f23_0 1e38
r1_1 0.0
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
-SELECT * FROM t1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (-999999999999999999999999,-99999999999.999999999999,-0.9,-999.99999999999999999999,-99999999999999999.999,-999999999999999999999999999999999999999999999999999999999999-0.999,-9,-.9999999999,-999999999999999999999999999999.99999999999999999999999,-9999999999999999999999999999999999999999999.9999999999);
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -134,7 +134,7 @@ MAX(f0) 9.999999680285692e37
MAX(f20_3) 99999998430674940.000
MAX(f23_0) 9.999999680285692e37
MAX(r1_1) 0.9
-INSERT INTO t1 SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) SELECT d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10, d53_10 FROM t1 ORDER BY d53_10 DESC LIMIT 1;
Warnings:
Warning 1264 Out of range value for column 'f' at row 1
Warning 1264 Out of range value for column 'f0' at row 1
@@ -142,7 +142,7 @@ Warning 1264 Out of range value for column 'r1_1' at row 1
Warning 1264 Out of range value for column 'f23_0' at row 1
Warning 1264 Out of range value for column 'f20_3' at row 1
Warning 1264 Out of range value for column 'd1_0' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
@@ -193,7 +193,7 @@ r1_1 0.0
r1_1 0.9
r1_1 0.9
r1_1 0.9
-INSERT INTO t1 VALUES (
+INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10) VALUES (
999999999999999999999999999999999999999,
999999999999999999999999999999999999999.9999999999999999,
1.9,
@@ -216,7 +216,7 @@ Warning 1264 Out of range value for column 'd1_0' at row 1
Warning 1264 Out of range value for column 'd10_10' at row 1
Warning 1264 Out of range value for column 'd53' at row 1
Warning 1264 Out of range value for column 'd53_10' at row 1
-SELECT * FROM t1;
+SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1;
f 12345.1
d -1e60
d 0
diff --git a/mysql-test/suite/storage_engine/type_int.inc b/mysql-test/suite/storage_engine/type_int.inc
index 5aaea78fcd5..058b18a24d5 100644
--- a/mysql-test/suite/storage_engine/type_int.inc
+++ b/mysql-test/suite/storage_engine/type_int.inc
@@ -42,32 +42,32 @@ if (!$mysql_errname)
# Always valid values
- INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
- INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
- INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
--sorted_result
- SELECT * FROM t1;
+ SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
# Values which can be valid or not,
# depending on whether columns are SIGNED or UNSIGNED
# (if not valid should produce warnings)
- INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
- INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
--sorted_result
- SELECT * FROM t1;
+ SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
# Invalid values
- INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
- INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
- INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+ INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
--sorted_result
- SELECT * FROM t1;
+ SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
--let $error_codes = ER_TOO_BIG_DISPLAYWIDTH
--let $alter_definition = ADD COLUMN i257 INT(257)
diff --git a/mysql-test/suite/storage_engine/type_int.result b/mysql-test/suite/storage_engine/type_int.result
index 47f4ebad93a..8f462648a6a 100644
--- a/mysql-test/suite/storage_engine/type_int.result
+++ b/mysql-test/suite/storage_engine/type_int.result
@@ -42,16 +42,16 @@ b bigint(20) # # #
b0 bigint(20) # # #
b1 bigint(1) # # #
b20 bigint(20) # # #
-INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
-INSERT INTO t1 VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
-INSERT INTO t1 VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
-SELECT * FROM t1;
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (2147483647,2147483647,2147483647,2147483647,127,127,127,127,32767,32767,32767,32767,8388607,8388607,8388607,8388607,9223372036854775807,9223372036854775807,9223372036854775807,9223372036854775807);
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
-INSERT INTO t1 VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
-INSERT INTO t1 VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483648,-2147483648,-2147483648,-2147483648,-128,-128,-128,-128,-32768,-32768,-32768,-32768,-8388608,-8388608,-8388608,-8388608,-9223372036854775808,-9223372036854775808,-9223372036854775808,-9223372036854775808);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967295,4294967295,4294967295,4294967295,255,255,255,255,65535,65535,65535,65535,16777215,16777215,16777215,16777215,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -73,14 +73,14 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
2147483647 2147483647 2147483647 2147483647 127 127 127 127 32767 32767 32767 32767 8388607 8388607 8388607 8388607 9223372036854775807 9223372036854775807 9223372036854775807 9223372036854775807
-INSERT INTO t1 VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (-2147483649,-2147483649,-2147483649,-2147483649,-129,-129,-129,-129,-32769,-32769,-32769,-32769,-8388609,-8388609,-8388609,-8388609,-9223372036854775809,-9223372036854775809,-9223372036854775809,-9223372036854775809);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -102,7 +102,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) VALUES (4294967296,4294967296,4294967296,4294967296,256,256,256,256,65536,65536,65536,65536,16777216,16777216,16777216,16777216,18446744073709551616,18446744073709551616,18446744073709551616,18446744073709551616);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -124,7 +124,7 @@ Warning 1264 Out of range value for column 'b' at row 1
Warning 1264 Out of range value for column 'b0' at row 1
Warning 1264 Out of range value for column 'b1' at row 1
Warning 1264 Out of range value for column 'b20' at row 1
-INSERT INTO t1 SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
+INSERT INTO t1 (i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20) SELECT b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b FROM t1 WHERE b IN (-9223372036854775808,9223372036854775807,18446744073709551615);
Warnings:
Warning 1264 Out of range value for column 'i' at row 1
Warning 1264 Out of range value for column 'i0' at row 1
@@ -190,7 +190,7 @@ Warning 1264 Out of range value for column 'm' at row 4
Warning 1264 Out of range value for column 'm0' at row 4
Warning 1264 Out of range value for column 'm1' at row 4
Warning 1264 Out of range value for column 'm20' at row 4
-SELECT * FROM t1;
+SELECT i,i0,i1,i20,t,t0,t1,t20,s,s0,s1,s20,m,m0,m1,m20,b,b0,b1,b20 FROM t1;
i i0 i1 i20 t t0 t1 t20 s s0 s1 s20 m m0 m1 m20 b b0 b1 b20
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
-2147483648 -2147483648 -2147483648 -2147483648 -128 -128 -128 -128 -32768 -32768 -32768 -32768 -8388608 -8388608 -8388608 -8388608 -9223372036854775808 -9223372036854775808 -9223372036854775808 -9223372036854775808
diff --git a/mysql-test/suite/storage_engine/type_set.inc b/mysql-test/suite/storage_engine/type_set.inc
index b4844b00ec7..bc927cf8014 100644
--- a/mysql-test/suite/storage_engine/type_set.inc
+++ b/mysql-test/suite/storage_engine/type_set.inc
@@ -25,19 +25,19 @@ if (!$mysql_errname)
--replace_column 3 # 4 # 5 #
SHOW COLUMNS IN t1;
- INSERT INTO t1 VALUES
+ INSERT INTO t1 (a,b,c) VALUES
('','test2,test3','01,34,44,,23'),
('',5,2),
(',','test4,test2','');
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c FROM t1;
# Out of range values
# (should produce warnings)
- INSERT INTO t1 VALUES (0,'test6',-1);
+ INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b,c FROM t1;
# Non-unique values in set
# (should produce a warning)
@@ -62,7 +62,7 @@ if (!$mysql_errname)
# Simple comparison
--sorted_result
- SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+ SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
DROP TABLE t1;
}
diff --git a/mysql-test/suite/storage_engine/type_set.result b/mysql-test/suite/storage_engine/type_set.result
index 210b07748bc..2248ce9f7e0 100644
--- a/mysql-test/suite/storage_engine/type_set.result
+++ b/mysql-test/suite/storage_engine/type_set.result
@@ -8,22 +8,22 @@ Field Type Null Key Default Extra
a set('') # # #
b set('test1','test2','test3','test4','test5') # # #
c set('01','02','03','04','05','06','07','08','09','10','11','12','13','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','39','40','41','42','43','44','45','46','47','48','49','50''51','52','53','54','55','56','57','58','59','60','61','62','63','64') # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (a,b,c) VALUES
('','test2,test3','01,34,44,,23'),
('',5,2),
(',','test4,test2','');
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
test1,test3 02
test2,test3 01,23,34,44
test2,test4
-INSERT INTO t1 VALUES (0,'test6',-1);
+INSERT INTO t1 (a,b,c) VALUES (0,'test6',-1);
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'c' at row 1
-SELECT * FROM t1;
+SELECT a,b,c FROM t1;
a b c
01,02,03,04,05,06,07,08,09,10,11,12,13,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,39,40,41,42,43,44,45,46,47,48,49,50'51,52,53,54,55,56,57,58,59,60,61,62,63,64
test1,test3 02
@@ -41,7 +41,7 @@ c set('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15'
e set('a','A') # # #
ALTER TABLE t1 ADD COLUMN f SET('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','11','12','13','14','15','16','17','18','19','1a','1b','1c','1d','1e','1f','1g','1h','1i','1j','1k','1l','1m','1n','1o','1p','1q','1r','1s','1t','1u','1v','1w','1x','1y','1z','20','21','22','23','24','25','26','27','28','29','2a','2b','2c','2d','2e','2f','2g','2h','2i','2j','2k','2l','2m','2n','2o','2p','2q','2r','2s','2t','2u','2v','2w','2x','2y','2z','30','31','32','33','34','35','36','37','38','39','3a','3b','3c','3d','3e','3f','3g','3h','3i') <CUSTOM_COL_OPTIONS>;
ERROR HY000: Too many strings for column f and SET
-SELECT * FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
+SELECT a,b,c,e FROM t1 WHERE FIND_IN_SET('test2',b)>0 OR a != '';
a b c e
test2,test3 01,23,34,44 NULL
test2,test4 NULL
diff --git a/mysql-test/suite/storage_engine/type_spatial.inc b/mysql-test/suite/storage_engine/type_spatial.inc
index 5195f779bcc..212786d60bf 100644
--- a/mysql-test/suite/storage_engine/type_spatial.inc
+++ b/mysql-test/suite/storage_engine/type_spatial.inc
@@ -372,50 +372,50 @@ if (!$mysql_errname)
SHOW FIELDS FROM gis_geometrycollection;
SHOW FIELDS FROM gis_geometry;
- INSERT INTO gis_point VALUES
+ INSERT INTO gis_point (fid,g) VALUES
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
(103, PointFromText('POINT(20 20)')),
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
- INSERT INTO gis_line VALUES
+ INSERT INTO gis_line (fid,g) VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
- INSERT INTO gis_polygon VALUES
+ INSERT INTO gis_polygon (fid,g) VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
- INSERT INTO gis_multi_point VALUES
+ INSERT INTO gis_multi_point (fid,g) VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
- INSERT INTO gis_multi_line VALUES
+ INSERT INTO gis_multi_line (fid,g) VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
- INSERT INTO gis_multi_polygon VALUES
+ INSERT INTO gis_multi_polygon (fid,g) VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
- INSERT INTO gis_geometrycollection VALUES
+ INSERT INTO gis_geometrycollection (fid,g) VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
(122, GeomFromText('GeometryCollection()')),
(123, GeomFromText('GeometryCollection EMPTY'));
- INSERT into gis_geometry SELECT * FROM gis_point;
- INSERT into gis_geometry SELECT * FROM gis_line;
- INSERT into gis_geometry SELECT * FROM gis_polygon;
- INSERT into gis_geometry SELECT * FROM gis_multi_point;
- INSERT into gis_geometry SELECT * FROM gis_multi_line;
- INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
- INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+ INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+ INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+ INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+ INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+ INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+ INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+ INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
SELECT fid, AsText(g) FROM gis_point;
SELECT fid, AsText(g) FROM gis_line;
@@ -475,7 +475,7 @@ if (!$mysql_errname)
USE gis_ogs;
--echo # Lakes
- INSERT INTO lakes VALUES (
+ INSERT INTO lakes (fid,name,shore) VALUES (
101, 'BLUE LAKE',
PolyFromText(
'POLYGON(
@@ -486,37 +486,37 @@ if (!$mysql_errname)
--echo # Road Segments
- INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+ INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
- INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+ INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
LineFromText(
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
- INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+ INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 70 38, 72 48 )' ,101));
- INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+ INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
LineFromText(
'LINESTRING( 70 38, 84 42 )' ,101));
- INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+ INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
1,
LineFromText(
'LINESTRING( 28 26, 28 0 )',101));
--echo # DividedRoutes
- INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+ INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
MLineFromText(
'MULTILINESTRING((10 48,10 21,10 0),
(16 0,16 23,16 48))', 101));
--echo # Forests
- INSERT INTO forests VALUES(109, 'Green Forest',
+ INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
MPolyFromText(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
@@ -524,28 +524,28 @@ if (!$mysql_errname)
--echo # Bridges
- INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+ INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
'POINT( 44 31 )', 101));
--echo # Streams
- INSERT INTO streams VALUES(111, 'Cam Stream',
+ INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
LineFromText(
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
- INSERT INTO streams VALUES(112, NULL,
+ INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
LineFromText(
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
--echo # Buildings
- INSERT INTO buildings VALUES(113, '123 Main Street',
+ INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
PointFromText(
'POINT( 52 30 )', 101),
PolyFromText(
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
- INSERT INTO buildings VALUES(114, '215 Main Street',
+ INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
PointFromText(
'POINT( 64 33 )', 101),
PolyFromText(
@@ -554,24 +554,24 @@ if (!$mysql_errname)
--echo # Ponds
- INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+ INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
MPolyFromText(
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
--echo # Named Places
- INSERT INTO named_places VALUES(117, 'Ashton',
+ INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
PolyFromText(
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
- INSERT INTO named_places VALUES(118, 'Goose Island',
+ INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
PolyFromText(
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
--echo # Map Neatlines
- INSERT INTO map_neatlines VALUES(115,
+ INSERT INTO map_neatlines (fid,neatline) VALUES(115,
PolyFromText(
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
diff --git a/mysql-test/suite/storage_engine/type_spatial.result b/mysql-test/suite/storage_engine/type_spatial.result
index c6b856ab8b0..94e3b22fd3c 100644
--- a/mysql-test/suite/storage_engine/type_spatial.result
+++ b/mysql-test/suite/storage_engine/type_spatial.result
@@ -77,43 +77,43 @@ SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
fid int(11) YES NULL
g geometry YES NULL
-INSERT INTO gis_point VALUES
+INSERT INTO gis_point (fid,g) VALUES
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
(103, PointFromText('POINT(20 20)')),
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-INSERT INTO gis_line VALUES
+INSERT INTO gis_line (fid,g) VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
-INSERT INTO gis_polygon VALUES
+INSERT INTO gis_polygon (fid,g) VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
-INSERT INTO gis_multi_point VALUES
+INSERT INTO gis_multi_point (fid,g) VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
-INSERT INTO gis_multi_line VALUES
+INSERT INTO gis_multi_line (fid,g) VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
-INSERT INTO gis_multi_polygon VALUES
+INSERT INTO gis_multi_polygon (fid,g) VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-INSERT INTO gis_geometrycollection VALUES
+INSERT INTO gis_geometrycollection (fid,g) VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
(122, GeomFromText('GeometryCollection()')),
(123, GeomFromText('GeometryCollection EMPTY'));
-INSERT into gis_geometry SELECT * FROM gis_point;
-INSERT into gis_geometry SELECT * FROM gis_line;
-INSERT into gis_geometry SELECT * FROM gis_polygon;
-INSERT into gis_geometry SELECT * FROM gis_multi_point;
-INSERT into gis_geometry SELECT * FROM gis_multi_line;
-INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
-INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
SELECT fid, AsText(g) FROM gis_point;
fid AsText(g)
101 POINT(10 10)
@@ -431,7 +431,7 @@ first second w c o e d t i r
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
USE gis_ogs;
# Lakes
-INSERT INTO lakes VALUES (
+INSERT INTO lakes (fid,name,shore) VALUES (
101, 'BLUE LAKE',
PolyFromText(
'POLYGON(
@@ -440,68 +440,68 @@ PolyFromText(
)',
101));
# Road Segments
-INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
-INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
LineFromText(
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
-INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 70 38, 72 48 )' ,101));
-INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
LineFromText(
'LINESTRING( 70 38, 84 42 )' ,101));
-INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
1,
LineFromText(
'LINESTRING( 28 26, 28 0 )',101));
# DividedRoutes
-INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
MLineFromText(
'MULTILINESTRING((10 48,10 21,10 0),
(16 0,16 23,16 48))', 101));
# Forests
-INSERT INTO forests VALUES(109, 'Green Forest',
+INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
MPolyFromText(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
101));
# Bridges
-INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
'POINT( 44 31 )', 101));
# Streams
-INSERT INTO streams VALUES(111, 'Cam Stream',
+INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
LineFromText(
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
-INSERT INTO streams VALUES(112, NULL,
+INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
LineFromText(
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
# Buildings
-INSERT INTO buildings VALUES(113, '123 Main Street',
+INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
PointFromText(
'POINT( 52 30 )', 101),
PolyFromText(
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
-INSERT INTO buildings VALUES(114, '215 Main Street',
+INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
PointFromText(
'POINT( 64 33 )', 101),
PolyFromText(
'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
# Ponds
-INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
MPolyFromText(
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
# Named Places
-INSERT INTO named_places VALUES(117, 'Ashton',
+INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
PolyFromText(
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
-INSERT INTO named_places VALUES(118, 'Goose Island',
+INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
PolyFromText(
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
# Map Neatlines
-INSERT INTO map_neatlines VALUES(115,
+INSERT INTO map_neatlines (fid,neatline) VALUES(115,
PolyFromText(
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
SELECT Dimension(shore)
diff --git a/mysql-test/suite/storage_engine/type_spatial_indexes.result b/mysql-test/suite/storage_engine/type_spatial_indexes.result
index a3c2a4d4e75..cebcb80d14f 100644
--- a/mysql-test/suite/storage_engine/type_spatial_indexes.result
+++ b/mysql-test/suite/storage_engine/type_spatial_indexes.result
@@ -77,43 +77,43 @@ SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
fid int(11) YES NULL
g geometry YES NULL
-INSERT INTO gis_point VALUES
+INSERT INTO gis_point (fid,g) VALUES
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
(103, PointFromText('POINT(20 20)')),
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-INSERT INTO gis_line VALUES
+INSERT INTO gis_line (fid,g) VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
-INSERT INTO gis_polygon VALUES
+INSERT INTO gis_polygon (fid,g) VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
-INSERT INTO gis_multi_point VALUES
+INSERT INTO gis_multi_point (fid,g) VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
-INSERT INTO gis_multi_line VALUES
+INSERT INTO gis_multi_line (fid,g) VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
-INSERT INTO gis_multi_polygon VALUES
+INSERT INTO gis_multi_polygon (fid,g) VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-INSERT INTO gis_geometrycollection VALUES
+INSERT INTO gis_geometrycollection (fid,g) VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
(122, GeomFromText('GeometryCollection()')),
(123, GeomFromText('GeometryCollection EMPTY'));
-INSERT into gis_geometry SELECT * FROM gis_point;
-INSERT into gis_geometry SELECT * FROM gis_line;
-INSERT into gis_geometry SELECT * FROM gis_polygon;
-INSERT into gis_geometry SELECT * FROM gis_multi_point;
-INSERT into gis_geometry SELECT * FROM gis_multi_line;
-INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
-INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
SELECT fid, AsText(g) FROM gis_point;
fid AsText(g)
101 POINT(10 10)
@@ -431,7 +431,7 @@ first second w c o e d t i r
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
USE gis_ogs;
# Lakes
-INSERT INTO lakes VALUES (
+INSERT INTO lakes (fid,name,shore) VALUES (
101, 'BLUE LAKE',
PolyFromText(
'POLYGON(
@@ -440,68 +440,68 @@ PolyFromText(
)',
101));
# Road Segments
-INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
-INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
LineFromText(
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
-INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 70 38, 72 48 )' ,101));
-INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
LineFromText(
'LINESTRING( 70 38, 84 42 )' ,101));
-INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
1,
LineFromText(
'LINESTRING( 28 26, 28 0 )',101));
# DividedRoutes
-INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
MLineFromText(
'MULTILINESTRING((10 48,10 21,10 0),
(16 0,16 23,16 48))', 101));
# Forests
-INSERT INTO forests VALUES(109, 'Green Forest',
+INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
MPolyFromText(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
101));
# Bridges
-INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
'POINT( 44 31 )', 101));
# Streams
-INSERT INTO streams VALUES(111, 'Cam Stream',
+INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
LineFromText(
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
-INSERT INTO streams VALUES(112, NULL,
+INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
LineFromText(
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
# Buildings
-INSERT INTO buildings VALUES(113, '123 Main Street',
+INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
PointFromText(
'POINT( 52 30 )', 101),
PolyFromText(
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
-INSERT INTO buildings VALUES(114, '215 Main Street',
+INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
PointFromText(
'POINT( 64 33 )', 101),
PolyFromText(
'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
# Ponds
-INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
MPolyFromText(
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
# Named Places
-INSERT INTO named_places VALUES(117, 'Ashton',
+INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
PolyFromText(
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
-INSERT INTO named_places VALUES(118, 'Goose Island',
+INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
PolyFromText(
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
# Map Neatlines
-INSERT INTO map_neatlines VALUES(115,
+INSERT INTO map_neatlines (fid,neatline) VALUES(115,
PolyFromText(
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
SELECT Dimension(shore)
@@ -777,43 +777,43 @@ SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
fid int(11) YES NULL
g geometry NO NULL
-INSERT INTO gis_point VALUES
+INSERT INTO gis_point (fid,g) VALUES
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
(103, PointFromText('POINT(20 20)')),
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-INSERT INTO gis_line VALUES
+INSERT INTO gis_line (fid,g) VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
-INSERT INTO gis_polygon VALUES
+INSERT INTO gis_polygon (fid,g) VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
-INSERT INTO gis_multi_point VALUES
+INSERT INTO gis_multi_point (fid,g) VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
-INSERT INTO gis_multi_line VALUES
+INSERT INTO gis_multi_line (fid,g) VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
-INSERT INTO gis_multi_polygon VALUES
+INSERT INTO gis_multi_polygon (fid,g) VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-INSERT INTO gis_geometrycollection VALUES
+INSERT INTO gis_geometrycollection (fid,g) VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
(122, GeomFromText('GeometryCollection()')),
(123, GeomFromText('GeometryCollection EMPTY'));
-INSERT into gis_geometry SELECT * FROM gis_point;
-INSERT into gis_geometry SELECT * FROM gis_line;
-INSERT into gis_geometry SELECT * FROM gis_polygon;
-INSERT into gis_geometry SELECT * FROM gis_multi_point;
-INSERT into gis_geometry SELECT * FROM gis_multi_line;
-INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
-INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
SELECT fid, AsText(g) FROM gis_point;
fid AsText(g)
101 POINT(10 10)
@@ -1131,7 +1131,7 @@ first second w c o e d t i r
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
USE gis_ogs;
# Lakes
-INSERT INTO lakes VALUES (
+INSERT INTO lakes (fid,name,shore) VALUES (
101, 'BLUE LAKE',
PolyFromText(
'POLYGON(
@@ -1140,68 +1140,68 @@ PolyFromText(
)',
101));
# Road Segments
-INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
-INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
LineFromText(
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
-INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 70 38, 72 48 )' ,101));
-INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
LineFromText(
'LINESTRING( 70 38, 84 42 )' ,101));
-INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
1,
LineFromText(
'LINESTRING( 28 26, 28 0 )',101));
# DividedRoutes
-INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
MLineFromText(
'MULTILINESTRING((10 48,10 21,10 0),
(16 0,16 23,16 48))', 101));
# Forests
-INSERT INTO forests VALUES(109, 'Green Forest',
+INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
MPolyFromText(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
101));
# Bridges
-INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
'POINT( 44 31 )', 101));
# Streams
-INSERT INTO streams VALUES(111, 'Cam Stream',
+INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
LineFromText(
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
-INSERT INTO streams VALUES(112, NULL,
+INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
LineFromText(
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
# Buildings
-INSERT INTO buildings VALUES(113, '123 Main Street',
+INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
PointFromText(
'POINT( 52 30 )', 101),
PolyFromText(
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
-INSERT INTO buildings VALUES(114, '215 Main Street',
+INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
PointFromText(
'POINT( 64 33 )', 101),
PolyFromText(
'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
# Ponds
-INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
MPolyFromText(
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
# Named Places
-INSERT INTO named_places VALUES(117, 'Ashton',
+INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
PolyFromText(
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
-INSERT INTO named_places VALUES(118, 'Goose Island',
+INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
PolyFromText(
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
# Map Neatlines
-INSERT INTO map_neatlines VALUES(115,
+INSERT INTO map_neatlines (fid,neatline) VALUES(115,
PolyFromText(
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
SELECT Dimension(shore)
diff --git a/mysql-test/suite/storage_engine/type_text.inc b/mysql-test/suite/storage_engine/type_text.inc
index 0f31e91c776..86521e5fb1e 100644
--- a/mysql-test/suite/storage_engine/type_text.inc
+++ b/mysql-test/suite/storage_engine/type_text.inc
@@ -33,7 +33,7 @@ if (!$mysql_errname)
# Valid values
# (cannot get MAX for all columns due to max_allowed_packet limitations)
- INSERT INTO t1 VALUES
+ INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -44,7 +44,7 @@ if (!$mysql_errname)
# Invalid values (produce warnings, except for mediumtext and longtext columns for which the values are within limits)
- INSERT INTO t1 VALUES
+ INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
--sorted_result
diff --git a/mysql-test/suite/storage_engine/type_text.result b/mysql-test/suite/storage_engine/type_text.result
index b3ca7a8d9da..88204e2235e 100644
--- a/mysql-test/suite/storage_engine/type_text.result
+++ b/mysql-test/suite/storage_engine/type_text.result
@@ -22,7 +22,7 @@ t17m longtext # # #
tt tinytext # # #
m mediumtext # # #
l longtext # # #
-INSERT INTO t1 VALUES
+INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
('','','','','','','','','',''),
('a','b','c','d','e','f','g','h','i','j'),
('test1','test2','test3','test4','test5','test6','test7','test8','test9','test10'),
@@ -33,7 +33,7 @@ LENGTH(t) LENGTH(t0) LENGTH(t1) LENGTH(t300) LENGTH(tm) LENGTH(t70k) LENGTH(t17m
1 1 1 1 1 1 1 1 1 1
5 5 5 5 5 5 5 5 5 6
65535 65535 255 65535 65535 1048576 1048576 255 1048576 1048576
-INSERT INTO t1 VALUES
+INSERT INTO t1 (t,t0,t1,t300,tm,t70k,t17m,tt,m,l) VALUES
( REPEAT('a',65536), REPEAT('b',65536), REPEAT('c',256), REPEAT('d',65536), REPEAT('e',65536), REPEAT('f',1048576), REPEAT('g',1048576), REPEAT('h',256), REPEAT('i',1048576), REPEAT('j',1048576) );
Warnings:
Warning 1265 Data truncated for column 't' at row 1
diff --git a/mysql-test/suite/storage_engine/type_varchar.inc b/mysql-test/suite/storage_engine/type_varchar.inc
index 472f74e0dd1..e2da3deba39 100644
--- a/mysql-test/suite/storage_engine/type_varchar.inc
+++ b/mysql-test/suite/storage_engine/type_varchar.inc
@@ -72,7 +72,7 @@ if (!$mysql_errname)
o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
--sorted_result
- SELECT * FROM t1;
+ SELECT v0,v1,v64,v65000 FROM t1;
# Invalid values
diff --git a/mysql-test/suite/storage_engine/type_varchar.result b/mysql-test/suite/storage_engine/type_varchar.result
index 055c8dcd7ca..f5e9bb416fe 100644
--- a/mysql-test/suite/storage_engine/type_varchar.result
+++ b/mysql-test/suite/storage_engine/type_varchar.result
@@ -51,7 +51,7 @@ INSERT INTO t1 (v0,v1,v64,v65000) VALUES ('','y','Once there, double check that
* MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ');
-SELECT * FROM t1;
+SELECT v0,v1,v64,v65000 FROM t1;
v0 v1 v64 v65000
diff --git a/mysql-test/suite/storage_engine/update.result b/mysql-test/suite/storage_engine/update.result
index 3b96558c7c5..a07a1b57a5c 100644
--- a/mysql-test/suite/storage_engine/update.result
+++ b/mysql-test/suite/storage_engine/update.result
@@ -3,7 +3,7 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTO
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
INSERT INTO t1 (a,b) SELECT a, b FROM t1;
UPDATE t1 SET a=a+100;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
101 a
101 a
@@ -18,7 +18,7 @@ a b
105 e
105 e
UPDATE t1 SET a=a-100, b=DEFAULT WHERE a>100;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 NULL
1 NULL
@@ -33,7 +33,7 @@ a b
5 NULL
5 NULL
UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY b DESC, a ASC LIMIT 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 NULL
1 update
diff --git a/mysql-test/suite/storage_engine/update.test b/mysql-test/suite/storage_engine/update.test
index 4f892fa547d..ad36382f8be 100644
--- a/mysql-test/suite/storage_engine/update.test
+++ b/mysql-test/suite/storage_engine/update.test
@@ -24,16 +24,16 @@ if ($mysql_errname)
if (!$mysql_errname)
{
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
UPDATE t1 SET a=a-100, b=DEFAULT WHERE a>100;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
# ORDER BY and LIMIT
UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY b DESC, a ASC LIMIT 1;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
}
# Cleanup
diff --git a/mysql-test/suite/storage_engine/update_ignore.result b/mysql-test/suite/storage_engine/update_ignore.result
index 26b7168196a..27e62c4f966 100644
--- a/mysql-test/suite/storage_engine/update_ignore.result
+++ b/mysql-test/suite/storage_engine/update_ignore.result
@@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) SELECT a, b FROM t1;
CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t2 (c,d) SELECT b, a FROM t1;
UPDATE IGNORE t1 SET b = 'upd1' WHERE b IS NOT NULL ORDER BY a LIMIT 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
1 upd1
@@ -23,7 +23,7 @@ UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b'
WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
Warnings:
Warning 1242 Subquery returns more than 1 row
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
1 upd2a
@@ -37,7 +37,7 @@ a b
4 upd2a
5 upd2a
5 upd2a
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
upd2b 1
upd2b 1
diff --git a/mysql-test/suite/storage_engine/update_ignore.test b/mysql-test/suite/storage_engine/update_ignore.test
index ddd4f7405a3..98f817b0e77 100644
--- a/mysql-test/suite/storage_engine/update_ignore.test
+++ b/mysql-test/suite/storage_engine/update_ignore.test
@@ -26,14 +26,14 @@ if ($mysql_errname)
if (!$mysql_errname)
{
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
UPDATE IGNORE t1, t2 SET b = 'upd2a', c = 'upd2b'
WHERE c < b OR a != ( SELECT 1 UNION SELECT 2 );
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--sorted_result
- SELECT * FROM t2;
+ SELECT c,d FROM t2;
}
# Cleanup
diff --git a/mysql-test/suite/storage_engine/update_low_prio.result b/mysql-test/suite/storage_engine/update_low_prio.result
index 31a31b6be62..1e038103870 100644
--- a/mysql-test/suite/storage_engine/update_low_prio.result
+++ b/mysql-test/suite/storage_engine/update_low_prio.result
@@ -19,7 +19,7 @@ a+SLEEP(1)
11
12
connection default;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
21 foobar
22 b
@@ -37,7 +37,7 @@ a+SLEEP(1)
21
22
connection default;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
41 foobar
42 b
@@ -56,7 +56,7 @@ a+SLEEP(1)
41
42
connection default;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
71 foobar
72 b
diff --git a/mysql-test/suite/storage_engine/update_low_prio.test b/mysql-test/suite/storage_engine/update_low_prio.test
index 6c089c7172f..8cc1ad07d5c 100644
--- a/mysql-test/suite/storage_engine/update_low_prio.test
+++ b/mysql-test/suite/storage_engine/update_low_prio.test
@@ -76,7 +76,7 @@ if ($mysql_errname)
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
# UPDATE LOW_PRIORITY
@@ -107,7 +107,7 @@ SELECT a+SLEEP(1) FROM t1;
--connection default
--reap
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
SET LOW_PRIORITY_UPDATES = 1;
@@ -152,7 +152,7 @@ if ($mysql_errname)
--source unexpected_result.inc
}
--sorted_result
-SELECT * FROM t1;
+SELECT a,b FROM t1;
--disconnect con1
--disconnect con2
diff --git a/mysql-test/suite/storage_engine/update_multi.result b/mysql-test/suite/storage_engine/update_multi.result
index 42b2f239dd2..909cce8213d 100644
--- a/mysql-test/suite/storage_engine/update_multi.result
+++ b/mysql-test/suite/storage_engine/update_multi.result
@@ -5,7 +5,7 @@ INSERT INTO t1 (a,b) SELECT a, b FROM t1;
CREATE TABLE t2 (c <CHAR_COLUMN>, d <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t2 (c,d) SELECT b, a FROM t1;
UPDATE t1, t2 SET t1.a = t2.d+100, t2.c = 'multi' WHERE c < b AND a + d != 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
1 a
@@ -19,7 +19,7 @@ a b
101 e
101 foobar
101 foobar
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
foobar 10000
foobar 10000
@@ -34,7 +34,7 @@ multi 4
multi 5
multi 5
UPDATE t2, t1 SET t2.d = DEFAULT WHERE c = 'foobar' and b = c;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 a
1 a
@@ -48,7 +48,7 @@ a b
101 e
101 foobar
101 foobar
-SELECT * FROM t2;
+SELECT c,d FROM t2;
c d
foobar NULL
foobar NULL
diff --git a/mysql-test/suite/storage_engine/update_multi.test b/mysql-test/suite/storage_engine/update_multi.test
index 589a8319382..4820eb5df46 100644
--- a/mysql-test/suite/storage_engine/update_multi.test
+++ b/mysql-test/suite/storage_engine/update_multi.test
@@ -26,15 +26,15 @@ if ($mysql_errname)
if (!$mysql_errname)
{
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--sorted_result
- SELECT * FROM t2;
+ SELECT c,d FROM t2;
UPDATE t2, t1 SET t2.d = DEFAULT WHERE c = 'foobar' and b = c;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--sorted_result
- SELECT * FROM t2;
+ SELECT c,d FROM t2;
}
# Cleanup
diff --git a/mysql-test/suite/storage_engine/update_with_keys.result b/mysql-test/suite/storage_engine/update_with_keys.result
index 8250f31a19e..ed62c96a5e6 100644
--- a/mysql-test/suite/storage_engine/update_with_keys.result
+++ b/mysql-test/suite/storage_engine/update_with_keys.result
@@ -5,7 +5,7 @@ UPDATE t1 SET a=100, b='f' WHERE b IN ('b','c');
UPDATE t1 SET b='m' WHERE b = 'f';
UPDATE t1 SET b='z' WHERE a < 2;
UPDATE t1 SET b='';
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1
100
@@ -25,7 +25,7 @@ ERROR 23000: Duplicate entry '205' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
12345 a
200 f
@@ -51,7 +51,7 @@ ERROR 23000: Duplicate entry '4-d' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
UPDATE t1 SET a=a+1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
101 a
2 a
@@ -74,7 +74,7 @@ ERROR 23000: Duplicate entry '205' for key 'PRIMARY'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
# If you got a difference in error message, just add it to rdiff file
UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1;
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
0 a
12345 e
diff --git a/mysql-test/suite/storage_engine/update_with_keys.test b/mysql-test/suite/storage_engine/update_with_keys.test
index 578ee3b3294..77843365cef 100644
--- a/mysql-test/suite/storage_engine/update_with_keys.test
+++ b/mysql-test/suite/storage_engine/update_with_keys.test
@@ -32,7 +32,7 @@ if (!$mysql_errname)
UPDATE t1 SET b='z' WHERE a < 2;
UPDATE t1 SET b='';
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
}
DROP TABLE t1;
}
@@ -62,7 +62,7 @@ if (!$mysql_errname)
--source check_errors.inc
UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
# We'll check that the next update causes an error,
# but won't check the result because it might be different depending
@@ -101,7 +101,7 @@ if (!$mysql_errname)
--source check_errors.inc
UPDATE t1 SET a=a+1;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
--let $error_codes = ER_DUP_ENTRY,ER_DUP_KEY
UPDATE t1 SET b='z';
--source check_errors.inc
@@ -135,7 +135,7 @@ if (!$mysql_errname)
UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1;
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
# We'll check that the next update causes an error,
# but won't check the result because it might be different depending
diff --git a/mysql-test/suite/storage_engine/vcol.result b/mysql-test/suite/storage_engine/vcol.result
index bae7636f6cb..d51ab038576 100644
--- a/mysql-test/suite/storage_engine/vcol.result
+++ b/mysql-test/suite/storage_engine/vcol.result
@@ -9,7 +9,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 2
2 3
@@ -26,7 +26,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 2
2 3
@@ -43,7 +43,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 2
2 3
@@ -60,7 +60,7 @@ INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-SELECT * FROM t1;
+SELECT a,b FROM t1;
a b
1 2
2 3
diff --git a/mysql-test/suite/storage_engine/vcol.test b/mysql-test/suite/storage_engine/vcol.test
index 90819ffbd47..e6257ab324b 100644
--- a/mysql-test/suite/storage_engine/vcol.test
+++ b/mysql-test/suite/storage_engine/vcol.test
@@ -24,7 +24,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
@@ -37,7 +37,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
@@ -50,7 +50,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
@@ -63,7 +63,7 @@ if (!$mysql_errname)
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
--sorted_result
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
DROP TABLE t1;
}
diff --git a/mysql-test/suite/sys_vars/disabled.def b/mysql-test/suite/sys_vars/disabled.def
index 1ae495e4863..596191d09b6 100644
--- a/mysql-test/suite/sys_vars/disabled.def
+++ b/mysql-test/suite/sys_vars/disabled.def
@@ -10,6 +10,5 @@
#
##############################################################################
-innodb_trx_rseg_n_slots_debug_basic: variable innodb_trx_rseg_n_slots_debug is removed in MariaDB
innodb_flush_checkpoint_debug_basic: removed from XtraDB-26.0
diff --git a/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result
index 55e6f747a19..937a3b164fa 100644
--- a/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result
+++ b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result
@@ -9,7 +9,7 @@ SELECT @global_start_value;
select @old_session_opt_switch:=@@session.optimizer_switch,
@old_global_opt_switch:=@@global.optimizer_switch;
@old_session_opt_switch:=@@session.optimizer_switch @old_global_opt_switch:=@@global.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
'#--------------------FN_DYNVARS_028_01------------------------#'
SET @@session.engine_condition_pushdown = 0;
Warnings:
@@ -212,7 +212,7 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@session.engine_condition_pushdown = TRUE;
Warnings:
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
@@ -220,7 +220,7 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@session.engine_condition_pushdown = FALSE;
Warnings:
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
@@ -228,7 +228,7 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@global.engine_condition_pushdown = TRUE;
Warnings:
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
@@ -236,7 +236,7 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@global.engine_condition_pushdown = FALSE;
Warnings:
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
@@ -244,31 +244,31 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@session.optimizer_switch = "engine_condition_pushdown=on";
select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+1 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@session.optimizer_switch = "engine_condition_pushdown=off";
select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@global.optimizer_switch = "engine_condition_pushdown=on";
select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set @@global.optimizer_switch = "engine_condition_pushdown=off";
select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
SET @@session.engine_condition_pushdown = @session_start_value;
Warnings:
Warning 1287 '@@engine_condition_pushdown' is deprecated and will be removed in a future release. Please use '@@optimizer_switch' instead
@@ -287,4 +287,4 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
diff --git a/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result b/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result
index 55d61800a39..5802c71d280 100644
--- a/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result
+++ b/mysql-test/suite/sys_vars/r/ignore_db_dirs_basic.result
@@ -6,8 +6,8 @@ e,lost+found,.mysqlgui,ignored_db
# with '.'
SHOW DATABASES;
Database
-information_schema
#mysql50#.otherdir
+information_schema
mtr
mysql
performance_schema
@@ -33,8 +33,8 @@ id
2
SHOW DATABASES;
Database
-information_schema
#mysql50#.otherdir
+information_schema
lost+found
mtr
mysql
diff --git a/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result
new file mode 100644
index 00000000000..3d4f401aad1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_limit_optimistic_insert_debug_basic.result
@@ -0,0 +1,58 @@
+SET @start_global_value = @@global.innodb_limit_optimistic_insert_debug;
+SELECT @start_global_value;
+@start_global_value
+0
+select @@global.innodb_limit_optimistic_insert_debug;
+@@global.innodb_limit_optimistic_insert_debug
+0
+select @@session.innodb_limit_optimistic_insert_debug;
+ERROR HY000: Variable 'innodb_limit_optimistic_insert_debug' is a GLOBAL variable
+show global variables like 'innodb_limit_optimistic_insert_debug';
+Variable_name Value
+innodb_limit_optimistic_insert_debug 0
+show session variables like 'innodb_limit_optimistic_insert_debug';
+Variable_name Value
+innodb_limit_optimistic_insert_debug 0
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0
+set global innodb_limit_optimistic_insert_debug=1;
+select @@global.innodb_limit_optimistic_insert_debug;
+@@global.innodb_limit_optimistic_insert_debug
+1
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 1
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 1
+set @@global.innodb_limit_optimistic_insert_debug=0;
+select @@global.innodb_limit_optimistic_insert_debug;
+@@global.innodb_limit_optimistic_insert_debug
+0
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG 0
+set session innodb_limit_optimistic_insert_debug='some';
+ERROR HY000: Variable 'innodb_limit_optimistic_insert_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set @@session.innodb_limit_optimistic_insert_debug='some';
+ERROR HY000: Variable 'innodb_limit_optimistic_insert_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_limit_optimistic_insert_debug=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug'
+set global innodb_limit_optimistic_insert_debug='foo';
+ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug'
+set global innodb_limit_optimistic_insert_debug=-2;
+Warnings:
+Warning 1292 Truncated incorrect innodb_limit_optimistic_insert_d value: '-2'
+set global innodb_limit_optimistic_insert_debug=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_limit_optimistic_insert_debug'
+SET @@global.innodb_limit_optimistic_insert_debug = @start_global_value;
+SELECT @@global.innodb_limit_optimistic_insert_debug;
+@@global.innodb_limit_optimistic_insert_debug
+0
diff --git a/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result
index d9d067c2cf9..d9d067c2cf9 100644
--- a/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result
diff --git a/mysql-test/suite/sys_vars/r/innodb_trx_purge_view_update_only_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_trx_purge_view_update_only_debug_basic.result
new file mode 100644
index 00000000000..1779cbb48df
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_trx_purge_view_update_only_debug_basic.result
@@ -0,0 +1,62 @@
+SET @start_global_value = @@global.innodb_trx_purge_view_update_only_debug;
+SELECT @start_global_value;
+@start_global_value
+0
+select @@global.innodb_trx_purge_view_update_only_debug in (0, 1);
+@@global.innodb_trx_purge_view_update_only_debug in (0, 1)
+1
+select @@global.innodb_trx_purge_view_update_only_debug;
+@@global.innodb_trx_purge_view_update_only_debug
+0
+select @@session.innodb_trx_purge_view_update_only_debug;
+ERROR HY000: Variable 'innodb_trx_purge_view_update_only_debug' is a GLOBAL variable
+show global variables like 'innodb_trx_purge_view_update_only_debug';
+Variable_name Value
+innodb_trx_purge_view_update_only_debug OFF
+show session variables like 'innodb_trx_purge_view_update_only_debug';
+Variable_name Value
+innodb_trx_purge_view_update_only_debug OFF
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF
+set global innodb_trx_purge_view_update_only_debug=1;
+select @@global.innodb_trx_purge_view_update_only_debug;
+@@global.innodb_trx_purge_view_update_only_debug
+1
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG ON
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG ON
+set @@global.innodb_trx_purge_view_update_only_debug=0;
+select @@global.innodb_trx_purge_view_update_only_debug;
+@@global.innodb_trx_purge_view_update_only_debug
+0
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG OFF
+set session innodb_trx_purge_view_update_only_debug='some';
+ERROR HY000: Variable 'innodb_trx_purge_view_update_only_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set @@session.innodb_trx_purge_view_update_only_debug='some';
+ERROR HY000: Variable 'innodb_trx_purge_view_update_only_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_trx_purge_view_update_only_debug=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_trx_purge_view_update_only_debug'
+set global innodb_trx_purge_view_update_only_debug='foo';
+ERROR 42000: Variable 'innodb_trx_purge_view_update_only_debug' can't be set to the value of 'foo'
+set global innodb_trx_purge_view_update_only_debug=-2;
+ERROR 42000: Variable 'innodb_trx_purge_view_update_only_debug' can't be set to the value of '-2'
+set global innodb_trx_purge_view_update_only_debug=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_trx_purge_view_update_only_debug'
+set global innodb_trx_purge_view_update_only_debug=2;
+ERROR 42000: Variable 'innodb_trx_purge_view_update_only_debug' can't be set to the value of '2'
+SET @@global.innodb_trx_purge_view_update_only_debug = @start_global_value;
+SELECT @@global.innodb_trx_purge_view_update_only_debug;
+@@global.innodb_trx_purge_view_update_only_debug
+0
diff --git a/mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result
new file mode 100644
index 00000000000..fa6379fbe1c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result
@@ -0,0 +1,21 @@
+select @@global.innodb_use_atomic_writes;
+@@global.innodb_use_atomic_writes
+0
+select @@session.innodb_use_atomic_writes;
+ERROR HY000: Variable 'innodb_use_atomic_writes' is a GLOBAL variable
+show global variables like 'innodb_use_atomic_writes';
+Variable_name Value
+innodb_use_atomic_writes OFF
+show session variables like 'innodb_use_atomic_writes';
+Variable_name Value
+innodb_use_atomic_writes OFF
+select * from information_schema.global_variables where variable_name='innodb_use_atomic_writes';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_ATOMIC_WRITES OFF
+select * from information_schema.session_variables where variable_name='innodb_use_atomic_writes';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_ATOMIC_WRITES OFF
+set global innodb_use_atomic_writes=1;
+ERROR HY000: Variable 'innodb_use_atomic_writes' is a read only variable
+set session innodb_use_atomic_writes=1;
+ERROR HY000: Variable 'innodb_use_atomic_writes' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result
new file mode 100644
index 00000000000..7ea55fba0a4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result
@@ -0,0 +1,21 @@
+select @@global.innodb_use_fallocate;
+@@global.innodb_use_fallocate
+1
+select @@session.innodb_use_fallocate;
+ERROR HY000: Variable 'innodb_use_fallocate' is a GLOBAL variable
+show global variables like 'innodb_use_fallocate';
+Variable_name Value
+innodb_use_fallocate ON
+show session variables like 'innodb_use_fallocate';
+Variable_name Value
+innodb_use_fallocate ON
+select * from information_schema.global_variables where variable_name='innodb_use_fallocate';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_FALLOCATE ON
+select * from information_schema.session_variables where variable_name='innodb_use_fallocate';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_FALLOCATE ON
+set global innodb_use_fallocate=1;
+ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable
+set session innodb_use_fallocate=1;
+ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
index 9f630e8bb00..bb7492ee7ef 100644
--- a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
@@ -1,7 +1,7 @@
SET @start_value = @@global.max_binlog_cache_size;
SELECT @start_value;
@start_value
-4294963200
+18446744073709547520
'#--------------------FN_DYNVARS_072_01------------------------#'
SET @@global.max_binlog_cache_size = 5000;
Warnings:
@@ -9,7 +9,7 @@ Warning 1292 Truncated incorrect max_binlog_cache_size value: '5000'
SET @@global.max_binlog_cache_size = DEFAULT;
SELECT @@global.max_binlog_cache_size;
@@global.max_binlog_cache_size
-4294963200
+18446744073709547520
'#---------------------FN_DYNVARS_072_02-------------------------#'
SET @@global.max_binlog_cache_size = @start_value;
SELECT @@global.max_binlog_cache_size = 4294967295;
@@ -149,4 +149,4 @@ ERROR 42S22: Unknown column 'max_binlog_cache_size' in 'field list'
SET @@global.max_binlog_cache_size = @start_value;
SELECT @@global.max_binlog_cache_size;
@@global.max_binlog_cache_size
-4294963200
+18446744073709547520
diff --git a/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result b/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
index 14407672aa3..0b2db8eef69 100644
--- a/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
@@ -1,7 +1,7 @@
SET @start_value = @@global.max_binlog_stmt_cache_size;
SELECT @start_value;
@start_value
-4294963200
+18446744073709547520
'#--------------------FN_DYNVARS_072_01------------------------#'
SET @@global.max_binlog_stmt_cache_size = 5000;
Warnings:
@@ -9,7 +9,7 @@ Warning 1292 Truncated incorrect max_binlog_stmt_cache_size value: '5000'
SET @@global.max_binlog_stmt_cache_size = DEFAULT;
SELECT @@global.max_binlog_stmt_cache_size;
@@global.max_binlog_stmt_cache_size
-4294963200
+18446744073709547520
'#---------------------FN_DYNVARS_072_02-------------------------#'
SET @@global.max_binlog_stmt_cache_size = @start_value;
SELECT @@global.max_binlog_stmt_cache_size = 4294967295;
@@ -149,4 +149,4 @@ ERROR 42S22: Unknown column 'max_binlog_stmt_cache_size' in 'field list'
SET @@global.max_binlog_stmt_cache_size = @start_value;
SELECT @@global.max_binlog_stmt_cache_size;
@@global.max_binlog_stmt_cache_size
-4294963200
+18446744073709547520
diff --git a/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result b/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result
deleted file mode 100644
index 6353fba2b7c..00000000000
--- a/mysql-test/suite/sys_vars/r/ndb_log_update_as_write_basic.result
+++ /dev/null
@@ -1,14 +0,0 @@
-SET @global_start_value = @@global.ndb_log_update_as_write;
-ERROR HY000: Unknown system variable 'ndb_log_update_as_write'
-SELECT @@global.ndb_log_update_as_write;
-ERROR HY000: Unknown system variable 'ndb_log_update_as_write'
-'Bug: The value is not a system variable or atleast not supported in version 5.1.22'
-'#--------------------FN_DYNVARS_102_01------------------------#'
-'#---------------------FN_DYNVARS_102_02-------------------------#'
-'#--------------------FN_DYNVARS_102_03------------------------#'
-'#--------------------FN_DYNVARS_102_04-------------------------#'
-'#-------------------FN_DYNVARS_102_05----------------------------#'
-'#----------------------FN_DYNVARS_102_06------------------------#'
-'#----------------------FN_DYNVARS_102_07------------------------#'
-'#---------------------FN_DYNVARS_102_08-------------------------#'
-'#---------------------FN_DYNVARS_102_09----------------------#'
diff --git a/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result b/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result
deleted file mode 100644
index 38abb7cc263..00000000000
--- a/mysql-test/suite/sys_vars/r/ndb_log_updated_only_basic.result
+++ /dev/null
@@ -1,14 +0,0 @@
-SET @global_start_value = @@global.ndb_log_updated_only;
-ERROR HY000: Unknown system variable 'ndb_log_updated_only'
-SELECT @@global.ndb_log_updated_only;
-ERROR HY000: Unknown system variable 'ndb_log_updated_only'
-'Bug: The value is not a system variable or atleast not supported in version 5.1.22'
-'#--------------------FN_DYNVARS_103_01------------------------#'
-'#---------------------FN_DYNVARS_103_02-------------------------#'
-'#--------------------FN_DYNVARS_103_03------------------------#'
-'#--------------------FN_DYNVARS_103_04-------------------------#'
-'#-------------------FN_DYNVARS_103_05----------------------------#'
-'#----------------------FN_DYNVARS_103_06------------------------#'
-'#----------------------FN_DYNVARS_103_07------------------------#'
-'#---------------------FN_DYNVARS_103_08-------------------------#'
-'#---------------------FN_DYNVARS_103_09----------------------#'
diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
index 509c0706ca3..8a9c49def85 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
@@ -1,61 +1,61 @@
SET @start_global_value = @@global.optimizer_switch;
SELECT @start_global_value;
@start_global_value
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
show global variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
show session variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
select * from information_schema.global_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
set global optimizer_switch=10;
set session optimizer_switch=5;
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
set global optimizer_switch="index_merge_sort_union=on";
set session optimizer_switch="index_merge=off";
select @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
show global variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
show session variables like 'optimizer_switch';
Variable_name Value
-optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
select * from information_schema.global_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
select * from information_schema.session_variables where variable_name='optimizer_switch';
VARIABLE_NAME VARIABLE_VALUE
-OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
set session optimizer_switch="default";
select @@session.optimizer_switch;
@@session.optimizer_switch
-index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off
+index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off
set optimizer_switch = replace(@@optimizer_switch, '=off', '=on');
select @@optimizer_switch;
@@optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on
set global optimizer_switch=1.1;
ERROR 42000: Incorrect argument type to variable 'optimizer_switch'
set global optimizer_switch=1e1;
@@ -67,4 +67,4 @@ ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'foobar'
SET @@global.optimizer_switch = @start_global_value;
SELECT @@global.optimizer_switch;
@@global.optimizer_switch
-index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown1.result b/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown1.result
index 7fb9e0aaaae..be4da117c2b 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown1.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown1.result
@@ -2,4 +2,4 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-1 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+1 1 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown2.result b/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown2.result
index 9eb3a8f942d..d1c5516d9ed 100644
--- a/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown2.result
+++ b/mysql-test/suite/sys_vars/r/optimizer_switch_eng_cond_pushdown2.result
@@ -2,4 +2,4 @@ select @@session.engine_condition_pushdown,
@@global.engine_condition_pushdown,
@@session.optimizer_switch, @@global.optimizer_switch;
@@session.engine_condition_pushdown @@global.engine_condition_pushdown @@session.optimizer_switch @@global.optimizer_switch
-0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off
+0 0 index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=off
diff --git a/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result
new file mode 100644
index 00000000000..c98dd338909
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/pseudo_slave_mode_basic.result
@@ -0,0 +1,119 @@
+SET @session_start_value = @@session.pseudo_slave_mode;
+SELECT @session_start_value;
+@session_start_value
+0
+'#--------------------FN_DYNVARS_156_01------------------------#'
+SET @@session.pseudo_slave_mode = 0;
+Warnings:
+Warning 1231 'pseudo_slave_mode' change was ineffective.
+SET @@session.pseudo_slave_mode = DEFAULT;
+Warnings:
+Warning 1231 'pseudo_slave_mode' change was ineffective.
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+0
+SET @@session.pseudo_slave_mode = 1;
+SET @@session.pseudo_slave_mode = DEFAULT;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+0
+'#---------------------FN_DYNVARS_156_02-------------------------#'
+SET pseudo_slave_mode = 1;
+SELECT @@pseudo_slave_mode;
+@@pseudo_slave_mode
+1
+SELECT session.pseudo_slave_mode;
+ERROR 42S02: Unknown table 'session' in field list
+SELECT local.pseudo_slave_mode;
+ERROR 42S02: Unknown table 'local' in field list
+SET session pseudo_slave_mode = 0;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+0
+'#--------------------FN_DYNVARS_156_03------------------------#'
+SET @@session.pseudo_slave_mode = 0;
+Warnings:
+Warning 1231 'pseudo_slave_mode' change was ineffective.
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+0
+SET @@session.pseudo_slave_mode = 1;
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+1
+'#--------------------FN_DYNVARS_156_04-------------------------#'
+SET @@session.pseudo_slave_mode = -1;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '-1'
+SET @@session.pseudo_slave_mode = 2;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '2'
+SET @@session.pseudo_slave_mode = "T";
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'T'
+SET @@session.pseudo_slave_mode = "Y";
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'Y'
+SET @@session.pseudo_slave_mode = TRÜE;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'TRÜE'
+SET @@session.pseudo_slave_mode = ÕN;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'ÕN'
+SET @@session.pseudo_slave_mode = OF;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'OF'
+SET @@session.pseudo_slave_mode = ÓFF;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'ÓFF'
+SET @@session.pseudo_slave_mode = '¹';
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of '¹'
+SET @@session.pseudo_slave_mode = NO;
+ERROR 42000: Variable 'pseudo_slave_mode' can't be set to the value of 'NO'
+'#-------------------FN_DYNVARS_156_05----------------------------#'
+SET @@global.pseudo_slave_mode = 0;
+ERROR HY000: Variable 'pseudo_slave_mode' is a SESSION variable and can't be used with SET GLOBAL
+SELECT @@global.pseudo_slave_mode;
+ERROR HY000: Variable 'pseudo_slave_mode' is a SESSION variable
+'#----------------------FN_DYNVARS_156_06------------------------#'
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode';
+count(VARIABLE_VALUE)
+1
+'#----------------------FN_DYNVARS_156_07------------------------#'
+SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='pseudo_slave_mode';
+IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
+1
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+1
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='pseudo_slave_mode';
+VARIABLE_VALUE
+ON
+'#---------------------FN_DYNVARS_156_08-------------------------#'
+SET @@session.pseudo_slave_mode = OFF;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+0
+SET @@session.pseudo_slave_mode = ON;
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+1
+'#---------------------FN_DYNVARS_156_09----------------------#'
+SET @@session.pseudo_slave_mode = TRUE;
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+1
+SET @@session.pseudo_slave_mode = FALSE;
+Warnings:
+Warning 1231 Slave applier execution mode not active, statement ineffective.
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+0
+SET @@session.pseudo_slave_mode = @session_start_value;
+Warnings:
+Warning 1231 'pseudo_slave_mode' change was ineffective.
+SELECT @@session.pseudo_slave_mode;
+@@session.pseudo_slave_mode
+0
diff --git a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_enabled_basic.result b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_enabled_basic.result
index 3e444519441..7454f0b0089 100644
--- a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_enabled_basic.result
+++ b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_enabled_basic.result
@@ -1,4 +1,3 @@
-INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_enabled;
@@global.rpl_semi_sync_master_enabled
0
@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_master_enabled = @start_global_value;
select @@global.rpl_semi_sync_master_enabled;
@@global.rpl_semi_sync_master_enabled
0
-UNINSTALL PLUGIN rpl_semi_sync_master;
diff --git a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_timeout_basic.result b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_timeout_basic.result
index e77bcc1c12a..78fee2a91dc 100644
--- a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_timeout_basic.result
+++ b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_timeout_basic.result
@@ -1,4 +1,3 @@
-INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_timeout;
@@global.rpl_semi_sync_master_timeout
10000
@@ -51,4 +50,3 @@ SET @@global.rpl_semi_sync_master_timeout = @start_global_value;
select @@global.rpl_semi_sync_master_timeout;
@@global.rpl_semi_sync_master_timeout
10000
-UNINSTALL PLUGIN rpl_semi_sync_master;
diff --git a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_trace_level_basic.result b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_trace_level_basic.result
index 55df5f57d9e..1096fa995e7 100644
--- a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_trace_level_basic.result
+++ b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_trace_level_basic.result
@@ -1,4 +1,3 @@
-INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_trace_level;
@@global.rpl_semi_sync_master_trace_level
32
@@ -69,4 +68,3 @@ SET @@global.rpl_semi_sync_master_trace_level = @start_global_value;
select @@global.rpl_semi_sync_master_trace_level;
@@global.rpl_semi_sync_master_trace_level
32
-UNINSTALL PLUGIN rpl_semi_sync_master;
diff --git a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_wait_no_slave_basic.result b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_wait_no_slave_basic.result
index 3d951b499ed..535f777eff7 100644
--- a/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_wait_no_slave_basic.result
+++ b/mysql-test/suite/sys_vars/r/rpl_semi_sync_master_wait_no_slave_basic.result
@@ -1,4 +1,3 @@
-INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';
select @@global.rpl_semi_sync_master_wait_no_slave;
@@global.rpl_semi_sync_master_wait_no_slave
1
@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_master_wait_no_slave = @start_global_value;
select @@global.rpl_semi_sync_master_wait_no_slave;
@@global.rpl_semi_sync_master_wait_no_slave
1
-UNINSTALL PLUGIN rpl_semi_sync_master;
diff --git a/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_enabled_basic.result b/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_enabled_basic.result
index a23b160e6f2..f52e8e80127 100644
--- a/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_enabled_basic.result
+++ b/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_enabled_basic.result
@@ -1,4 +1,3 @@
-INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
select @@global.rpl_semi_sync_slave_enabled;
@@global.rpl_semi_sync_slave_enabled
0
@@ -70,4 +69,3 @@ SET @@global.rpl_semi_sync_slave_enabled = @start_global_value;
select @@global.rpl_semi_sync_slave_enabled;
@@global.rpl_semi_sync_slave_enabled
0
-UNINSTALL PLUGIN rpl_semi_sync_slave;
diff --git a/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_trace_level_basic.result b/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_trace_level_basic.result
index f7796309aea..9917ec6fce5 100644
--- a/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_trace_level_basic.result
+++ b/mysql-test/suite/sys_vars/r/rpl_semi_sync_slave_trace_level_basic.result
@@ -1,4 +1,3 @@
-INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';
select @@global.rpl_semi_sync_slave_trace_level;
@@global.rpl_semi_sync_slave_trace_level
32
@@ -69,4 +68,3 @@ SET @@global.rpl_semi_sync_slave_trace_level = @start_global_value;
select @@global.rpl_semi_sync_slave_trace_level;
@@global.rpl_semi_sync_slave_trace_level
32
-UNINSTALL PLUGIN rpl_semi_sync_slave;
diff --git a/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test
new file mode 100644
index 00000000000..7998297c69e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_limit_optimistic_insert_debug_basic.test
@@ -0,0 +1,50 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_limit_optimistic_insert_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_limit_optimistic_insert_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_limit_optimistic_insert_debug;
+show global variables like 'innodb_limit_optimistic_insert_debug';
+show session variables like 'innodb_limit_optimistic_insert_debug';
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+
+#
+# show that it's writable
+#
+set global innodb_limit_optimistic_insert_debug=1;
+select @@global.innodb_limit_optimistic_insert_debug;
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+set @@global.innodb_limit_optimistic_insert_debug=0;
+select @@global.innodb_limit_optimistic_insert_debug;
+select * from information_schema.global_variables where variable_name='innodb_limit_optimistic_insert_debug';
+select * from information_schema.session_variables where variable_name='innodb_limit_optimistic_insert_debug';
+--error ER_GLOBAL_VARIABLE
+set session innodb_limit_optimistic_insert_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_limit_optimistic_insert_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_limit_optimistic_insert_debug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_limit_optimistic_insert_debug='foo';
+set global innodb_limit_optimistic_insert_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_limit_optimistic_insert_debug=1e1;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_limit_optimistic_insert_debug = @start_global_value;
+SELECT @@global.innodb_limit_optimistic_insert_debug;
diff --git a/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test
index 00aa476e8d2..00aa476e8d2 100644
--- a/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test
diff --git a/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test
new file mode 100644
index 00000000000..d7207515fe1
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_trx_purge_view_update_only_debug_basic.test
@@ -0,0 +1,54 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_trx_purge_view_update_only_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_trx_purge_view_update_only_debug in (0, 1);
+select @@global.innodb_trx_purge_view_update_only_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_trx_purge_view_update_only_debug;
+show global variables like 'innodb_trx_purge_view_update_only_debug';
+show session variables like 'innodb_trx_purge_view_update_only_debug';
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+
+#
+# show that it's writable
+#
+set global innodb_trx_purge_view_update_only_debug=1;
+select @@global.innodb_trx_purge_view_update_only_debug;
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+set @@global.innodb_trx_purge_view_update_only_debug=0;
+select @@global.innodb_trx_purge_view_update_only_debug;
+select * from information_schema.global_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_purge_view_update_only_debug';
+--error ER_GLOBAL_VARIABLE
+set session innodb_trx_purge_view_update_only_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_trx_purge_view_update_only_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=1.1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug='foo';
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=1e1;
+--error ER_WRONG_VALUE_FOR_VAR
+set global innodb_trx_purge_view_update_only_debug=2;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_trx_purge_view_update_only_debug = @start_global_value;
+SELECT @@global.innodb_trx_purge_view_update_only_debug;
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test
new file mode 100644
index 00000000000..e14f618ee6b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+# bool readonly
+
+#
+# show values;
+#
+select @@global.innodb_use_atomic_writes;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_use_atomic_writes;
+show global variables like 'innodb_use_atomic_writes';
+show session variables like 'innodb_use_atomic_writes';
+select * from information_schema.global_variables where variable_name='innodb_use_atomic_writes';
+select * from information_schema.session_variables where variable_name='innodb_use_atomic_writes';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_use_atomic_writes=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_use_atomic_writes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test
new file mode 100644
index 00000000000..655893be98e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+# bool readonly
+
+#
+# show values;
+#
+select @@global.innodb_use_fallocate;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_use_fallocate;
+show global variables like 'innodb_use_fallocate';
+show session variables like 'innodb_use_fallocate';
+select * from information_schema.global_variables where variable_name='innodb_use_fallocate';
+select * from information_schema.session_variables where variable_name='innodb_use_fallocate';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_use_fallocate=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_use_fallocate=1;
+
diff --git a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test
deleted file mode 100644
index e616a807a38..00000000000
--- a/mysql-test/suite/sys_vars/t/ndb_log_update_as_write_basic.test
+++ /dev/null
@@ -1,216 +0,0 @@
-############## mysql-test\t\ndb_log_update_as_write_basic.test ###############
-# #
-# Variable Name: ndb_log_update_as_write #
-# Scope: GLOBAL #
-# Access Type: Dynamic #
-# Data Type: boolean #
-# Default Value: #
-# Range: #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Rizwan #
-# #
-# Description: Test Cases of Dynamic System Variable ndb_log_update_as_write #
-# that checks the behavior of this variable in the following ways#
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-###############################################################################
-############## mysql-test\t\ndb_log_update_as_write_basic.test ################
-# #
-# Variable Name: ndb_log_update_as_write #
-# Scope: GLOBAL & SESSION #
-# Access Type: Dynamic #
-# Data Type: Numeric #
-# Default Value: 1 #
-# Range: 1 - 65536 #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Rizwan Maredia #
-# #
-# Description: Test Cases of Dynamic System Variable ndb_log_update_as_write #
-# that checks the behavior of this variable in the following ways #
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-################################################################################
-################# mysql-test\t\ndb_log_update_as_write_basic.test ######
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Rizwan Maredia #
-# #
-# Description: Test Cases of Dynamic System Variable #
-# ndb_log_update_as_write that check behavior of this #
-# variable with valid values, invalid values, #
-# accessing variable with scope that is #
-# allowed and with scope that is now allowed. #
-# Scope: Global #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system #
-# -variables.html #
-# #
-########################################################################
-
---source include/load_sysvars.inc
-
-########################################################################
-# START OF ndb_log_update_as_write TESTS #
-########################################################################
-
-
-################################################################################
-# Saving initial value of ndb_log_update_as_write in a temporary variable #
-################################################################################
-
-
---Error ER_UNKNOWN_SYSTEM_VARIABLE
-SET @global_start_value = @@global.ndb_log_update_as_write;
---Error ER_UNKNOWN_SYSTEM_VARIABLE
-SELECT @@global.ndb_log_update_as_write;
-
---echo 'Bug: The value is not a system variable or atleast not supported in version 5.1.22'
-
-
---echo '#--------------------FN_DYNVARS_102_01------------------------#'
-########################################################################
-# Display the DEFAULT value of ndb_log_update_as_write #
-########################################################################
-
-#SET @@ndb_log_update_as_write = 0;
-#SET @@ndb_log_update_as_write = DEFAULT;
-#SELECT @@ndb_log_update_as_write;
-#
-#SET @@ndb_log_update_as_write = 1;
-#SET @@ndb_log_update_as_write = DEFAULT;
-#SELECT @@ndb_log_update_as_write;
-
-
---echo '#---------------------FN_DYNVARS_102_02-------------------------#'
-#############################################################################
-# Check if ndb_log_update_as_write can be accessed with and without @@ sign #
-#############################################################################
-
-#SET ndb_log_update_as_write = 1;
-#SELECT @@ndb_log_update_as_write;
-#--Error ER_UNKNOWN_TABLE
-#SELECT global.ndb_log_update_as_write;
-#
-#SET global ndb_log_update_as_write = 1;
-#SELECT @@global.ndb_log_update_as_write;
-
-
---echo '#--------------------FN_DYNVARS_102_03------------------------#'
-########################################################################
-# Change the value of ndb_log_update_as_write to a valid value #
-########################################################################
-
-#SET @@global.ndb_log_update_as_write = 0;
-#SELECT @@global.ndb_log_update_as_write;
-#SET @@global.ndb_log_update_as_write = 1;
-#SELECT @@global.ndb_log_update_as_write;
-## a value of 2 is used to just flush logs and then shutdown cold.
-#SET @@global.ndb_log_update_as_write = 2;
-#SELECT @@global.ndb_log_update_as_write;
-
---echo '#--------------------FN_DYNVARS_102_04-------------------------#'
-###########################################################################
-# Change the value of ndb_log_update_as_write to invalid value #
-###########################################################################
-
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = -1;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = TRU;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = TRUE_F;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = FALS;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = OON;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = ONN;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = OOFF;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = 0FF;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = ' 1';
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_update_as_write = "0 ";
-
-
-
---echo '#-------------------FN_DYNVARS_102_05----------------------------#'
-###########################################################################
-# Test if accessing session ndb_log_update_as_write gives error #
-###########################################################################
-
-#--Error ER_LOCAL_VARIABLE
-#SET @@session.ndb_log_update_as_write = 0;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SET @@ndb_log_update_as_write = 0;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SET @@local.ndb_log_update_as_write = 0;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SELECT @@session.ndb_log_update_as_write;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SELECT @@local.ndb_log_update_as_write;
-
---echo '#----------------------FN_DYNVARS_102_06------------------------#'
-#########################################################################
-# Check if the value in SESSION Table contains variable value #
-#########################################################################
-
-#SELECT count(VARIABLE_VALUE) AS res_is_0 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='ndb_log_update_as_write';
-
-
---echo '#----------------------FN_DYNVARS_102_07------------------------#'
-#########################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-#########################################################################
-
-#SELECT @@global.ndb_log_update_as_write = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='ndb_log_update_as_write';
-
-
---echo '#---------------------FN_DYNVARS_102_08-------------------------#'
-###################################################################
-# Check if ON and OFF values can be used on variable #
-###################################################################
-
-#SET @@ndb_log_update_as_write = OFF;
-#SELECT @@ndb_log_update_as_write;
-#SET @@ndb_log_update_as_write = ON;
-#SELECT @@ndb_log_update_as_write;
-
---echo '#---------------------FN_DYNVARS_102_09----------------------#'
-###################################################################
-# Check if TRUE and FALSE values can be used on variable #
-###################################################################
-
-#SET @@ndb_log_update_as_write = TRUE;
-#SELECT @@ndb_log_update_as_write;
-#SET @@ndb_log_update_as_write = 'FALSE';
-#SELECT @@ndb_log_update_as_write;
-
-##############################
-# Restore initial value #
-##############################
-
-#SET @@ndb_log_update_as_write = @global_start_value;
-#SELECT @@ndb_log_update_as_write;
-
-########################################################################
-# END OF ndb_log_update_as_write TESTS #
-########################################################################
diff --git a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test b/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test
deleted file mode 100644
index c00ecf2e2fa..00000000000
--- a/mysql-test/suite/sys_vars/t/ndb_log_updated_only_basic.test
+++ /dev/null
@@ -1,216 +0,0 @@
-############## mysql-test\t\ndb_log_updated_only_basic.test ###############
-# #
-# Variable Name: ndb_log_updated_only #
-# Scope: GLOBAL #
-# Access Type: Dynamic #
-# Data Type: boolean #
-# Default Value: #
-# Range: #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Rizwan #
-# #
-# Description: Test Cases of Dynamic System Variable ndb_log_updated_only #
-# that checks the behavior of this variable in the following ways#
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-###############################################################################
-############## mysql-test\t\ndb_log_updated_only_basic.test ################
-# #
-# Variable Name: ndb_log_updated_only #
-# Scope: GLOBAL & SESSION #
-# Access Type: Dynamic #
-# Data Type: Numeric #
-# Default Value: 1 #
-# Range: 1 - 65536 #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Rizwan Maredia #
-# #
-# Description: Test Cases of Dynamic System Variable ndb_log_updated_only #
-# that checks the behavior of this variable in the following ways #
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-################################################################################
-################# mysql-test\t\ndb_log_updated_only_basic.test #########
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Rizwan Maredia #
-# #
-# Description: Test Cases of Dynamic System Variable #
-# ndb_log_updated_only that check behavior of this #
-# variable with valid values, invalid values, #
-# accessing variable with scope that is #
-# allowed and with scope that is now allowed. #
-# Scope: Global #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system #
-# -variables.html #
-# #
-########################################################################
-
---source include/load_sysvars.inc
-
-########################################################################
-# START OF ndb_log_updated_only TESTS #
-########################################################################
-
-
-################################################################################
-# Saving initial value of ndb_log_updated_only in a temporary variable #
-################################################################################
-
-
---Error ER_UNKNOWN_SYSTEM_VARIABLE
-SET @global_start_value = @@global.ndb_log_updated_only;
---Error ER_UNKNOWN_SYSTEM_VARIABLE
-SELECT @@global.ndb_log_updated_only;
-
---echo 'Bug: The value is not a system variable or atleast not supported in version 5.1.22'
-
-
---echo '#--------------------FN_DYNVARS_103_01------------------------#'
-########################################################################
-# Display the DEFAULT value of ndb_log_updated_only #
-########################################################################
-
-#SET @@ndb_log_updated_only = 0;
-#SET @@ndb_log_updated_only = DEFAULT;
-#SELECT @@ndb_log_updated_only;
-#
-#SET @@ndb_log_updated_only = 1;
-#SET @@ndb_log_updated_only = DEFAULT;
-#SELECT @@ndb_log_updated_only;
-
-
---echo '#---------------------FN_DYNVARS_103_02-------------------------#'
-#############################################################################
-# Check if ndb_log_updated_only can be accessed with and without @@ sign #
-#############################################################################
-
-#SET ndb_log_updated_only = 1;
-#SELECT @@ndb_log_updated_only;
-#--Error ER_UNKNOWN_TABLE
-#SELECT global.ndb_log_updated_only;
-#
-#SET global ndb_log_updated_only = 1;
-#SELECT @@global.ndb_log_updated_only;
-
-
---echo '#--------------------FN_DYNVARS_103_03------------------------#'
-########################################################################
-# Change the value of ndb_log_updated_only to a valid value #
-########################################################################
-
-#SET @@global.ndb_log_updated_only = 0;
-#SELECT @@global.ndb_log_updated_only;
-#SET @@global.ndb_log_updated_only = 1;
-#SELECT @@global.ndb_log_updated_only;
-## a value of 2 is used to just flush logs and then shutdown cold.
-#SET @@global.ndb_log_updated_only = 2;
-#SELECT @@global.ndb_log_updated_only;
-
---echo '#--------------------FN_DYNVARS_103_04-------------------------#'
-###########################################################################
-# Change the value of ndb_log_updated_only to invalid value #
-###########################################################################
-
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = -1;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = TRU;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = TRUE_F;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = FALS;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = OON;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = ONN;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = OOFF;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = 0FF;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = ' 1';
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.ndb_log_updated_only = "0 ";
-
-
-
---echo '#-------------------FN_DYNVARS_103_05----------------------------#'
-###########################################################################
-# Test if accessing session ndb_log_updated_only gives error #
-###########################################################################
-
-#--Error ER_LOCAL_VARIABLE
-#SET @@session.ndb_log_updated_only = 0;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SET @@ndb_log_updated_only = 0;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SET @@local.ndb_log_updated_only = 0;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SELECT @@session.ndb_log_updated_only;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SELECT @@local.ndb_log_updated_only;
-
---echo '#----------------------FN_DYNVARS_103_06------------------------#'
-#########################################################################
-# Check if the value in SESSION Table contains variable value #
-#########################################################################
-
-#SELECT count(VARIABLE_VALUE) AS res_is_0 FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='ndb_log_updated_only';
-
-
---echo '#----------------------FN_DYNVARS_103_07------------------------#'
-#########################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-#########################################################################
-
-#SELECT @@global.ndb_log_updated_only = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='ndb_log_updated_only';
-
-
---echo '#---------------------FN_DYNVARS_103_08-------------------------#'
-###################################################################
-# Check if ON and OFF values can be used on variable #
-###################################################################
-
-#SET @@ndb_log_updated_only = OFF;
-#SELECT @@ndb_log_updated_only;
-#SET @@ndb_log_updated_only = ON;
-#SELECT @@ndb_log_updated_only;
-
---echo '#---------------------FN_DYNVARS_103_09----------------------#'
-###################################################################
-# Check if TRUE and FALSE values can be used on variable #
-###################################################################
-
-#SET @@ndb_log_updated_only = TRUE;
-#SELECT @@ndb_log_updated_only;
-#SET @@ndb_log_updated_only = 'FALSE';
-#SELECT @@ndb_log_updated_only;
-
-##############################
-# Restore initial value #
-##############################
-
-#SET @@ndb_log_updated_only = @global_start_value;
-#SELECT @@ndb_log_updated_only;
-
-########################################################################
-# END OF ndb_log_updated_only TESTS #
-########################################################################
diff --git a/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test
new file mode 100644
index 00000000000..3ef39bb8667
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/pseudo_slave_mode_basic.test
@@ -0,0 +1,168 @@
+####################### mysql-test\t\pseudo_slave_mode_basic.test ###################
+# #
+# Variable Name: pseudo_slave_mode #
+# Scope: SESSION #
+# Access Type: Dynamic #
+# Data Type: boolean #
+# Default Value: #
+# Valid Values: 0,1 #
+# #
+# #
+# Creation Date: 2012-11-16 #
+# #
+# Description: Test Cases of Dynamic System Variable pseudo_slave_mode #
+# that checks the behavior of this variable in the following ways#
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.5/en/ #
+# server-system-variables.html #
+# #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+########################################################################
+# START OF pseudo_slave_mode TESTS #
+########################################################################
+
+
+##############################################################################
+# Saving initial value of pseudo_slave_mode in a temporary variable #
+##############################################################################
+
+SET @session_start_value = @@session.pseudo_slave_mode;
+SELECT @session_start_value;
+
+--echo '#--------------------FN_DYNVARS_156_01------------------------#'
+########################################################################
+# Display the DEFAULT value of pseudo_slave_mode #
+########################################################################
+
+SET @@session.pseudo_slave_mode = 0;
+SET @@session.pseudo_slave_mode = DEFAULT;
+SELECT @@session.pseudo_slave_mode;
+
+SET @@session.pseudo_slave_mode = 1;
+SET @@session.pseudo_slave_mode = DEFAULT;
+SELECT @@session.pseudo_slave_mode;
+
+
+--echo '#---------------------FN_DYNVARS_156_02-------------------------#'
+#############################################################################
+# Check if pseudo_slave_mode can be accessed with and without @@ sign #
+#############################################################################
+
+SET pseudo_slave_mode = 1;
+SELECT @@pseudo_slave_mode;
+
+--Error ER_UNKNOWN_TABLE
+SELECT session.pseudo_slave_mode;
+
+--Error ER_UNKNOWN_TABLE
+SELECT local.pseudo_slave_mode;
+
+SET session pseudo_slave_mode = 0;
+SELECT @@session.pseudo_slave_mode;
+
+
+--echo '#--------------------FN_DYNVARS_156_03------------------------#'
+########################################################################
+# change the value of pseudo_slave_mode to a valid value #
+########################################################################
+
+SET @@session.pseudo_slave_mode = 0;
+SELECT @@session.pseudo_slave_mode;
+SET @@session.pseudo_slave_mode = 1;
+SELECT @@session.pseudo_slave_mode;
+
+
+--echo '#--------------------FN_DYNVARS_156_04-------------------------#'
+###########################################################################
+# Change the value of pseudo_slave_mode to invalid value #
+###########################################################################
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = TRÜE;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = ÕN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = OF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = ÓFF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = '¹';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@session.pseudo_slave_mode = NO;
+
+
+--echo '#-------------------FN_DYNVARS_156_05----------------------------#'
+###########################################################################
+# Test if accessing global pseudo_slave_mode gives error #
+###########################################################################
+
+--error ER_LOCAL_VARIABLE
+SET @@global.pseudo_slave_mode = 0;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@global.pseudo_slave_mode;
+
+--echo '#----------------------FN_DYNVARS_156_06------------------------#'
+#########################################################################
+# Check if the value in SESSION Table contains variable value #
+#########################################################################
+
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='pseudo_slave_mode';
+
+--echo '#----------------------FN_DYNVARS_156_07------------------------#'
+#########################################################################
+# Check if the value in SESSION Table matches value in variable #
+#########################################################################
+
+SELECT IF(@@session.pseudo_slave_mode, "ON", "OFF") = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='pseudo_slave_mode';
+SELECT @@session.pseudo_slave_mode;
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+WHERE VARIABLE_NAME='pseudo_slave_mode';
+
+--echo '#---------------------FN_DYNVARS_156_08-------------------------#'
+###################################################################
+# Check if ON and OFF values can be used on variable #
+###################################################################
+
+SET @@session.pseudo_slave_mode = OFF;
+SELECT @@session.pseudo_slave_mode;
+SET @@session.pseudo_slave_mode = ON;
+SELECT @@session.pseudo_slave_mode;
+
+--echo '#---------------------FN_DYNVARS_156_09----------------------#'
+###################################################################
+# Check if TRUE and FALSE values can be used on variable #
+###################################################################
+
+SET @@session.pseudo_slave_mode = TRUE;
+SELECT @@session.pseudo_slave_mode;
+SET @@session.pseudo_slave_mode = FALSE;
+SELECT @@session.pseudo_slave_mode;
+
+##############################
+# Restore initial value #
+##############################
+
+SET @@session.pseudo_slave_mode = @session_start_value;
+SELECT @@session.pseudo_slave_mode;
+
+###############################################################
+# END OF pseudo_slave_mode TESTS #
+###############################################################
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test
index ded489f36ff..2ff03a53c42 100644
--- a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_enabled_basic.test
@@ -6,10 +6,7 @@
#
#
source include/not_embedded.inc;
-source include/have_semisync_plugin.inc;
-# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
+source include/have_semisync.inc;
select @@global.rpl_semi_sync_master_enabled;
SET @start_global_value = @@global.rpl_semi_sync_master_enabled;
@@ -61,5 +58,3 @@ set global rpl_semi_sync_master_enabled="some text";
#
SET @@global.rpl_semi_sync_master_enabled = @start_global_value;
select @@global.rpl_semi_sync_master_enabled;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test
index 5258894150d..74d3c41150b 100644
--- a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_timeout_basic.test
@@ -5,10 +5,7 @@
# 2010-01-21 OBN - Added
#
source include/not_embedded.inc;
-source include/have_semisync_plugin.inc;
-# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
+source include/have_semisync.inc;
select @@global.rpl_semi_sync_master_timeout;
SET @start_global_value = @@global.rpl_semi_sync_master_timeout;
@@ -51,5 +48,3 @@ set global rpl_semi_sync_master_timeout="some text";
#
SET @@global.rpl_semi_sync_master_timeout = @start_global_value;
select @@global.rpl_semi_sync_master_timeout;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test
index d9b1d860b35..c41b53fe5e6 100644
--- a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_trace_level_basic.test
@@ -5,10 +5,7 @@
# 2010-01-21 OBN - Added
#
source include/not_embedded.inc;
-source include/have_semisync_plugin.inc;
-# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
+source include/have_semisync.inc;
select @@global.rpl_semi_sync_master_trace_level;
SET @start_global_value = @@global.rpl_semi_sync_master_trace_level;
@@ -59,5 +56,3 @@ set global rpl_semi_sync_master_trace_level="some text";
#
SET @@global.rpl_semi_sync_master_trace_level = @start_global_value;
select @@global.rpl_semi_sync_master_trace_level;
-UNINSTALL PLUGIN rpl_semi_sync_master;
-
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test
index 896bd50d156..d4a46a08140 100644
--- a/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_master_wait_no_slave_basic.test
@@ -6,10 +6,7 @@
#
#
source include/not_embedded.inc;
-source include/have_semisync_plugin.inc;
-# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN rpl_semi_sync_master SONAME '$SEMISYNC_MASTER_SO';
+source include/have_semisync.inc;
select @@global.rpl_semi_sync_master_wait_no_slave;
SET @start_global_value = @@global.rpl_semi_sync_master_wait_no_slave;
@@ -61,5 +58,4 @@ set global rpl_semi_sync_master_wait_no_slave="some text";
#
SET @@global.rpl_semi_sync_master_wait_no_slave = @start_global_value;
select @@global.rpl_semi_sync_master_wait_no_slave;
-UNINSTALL PLUGIN rpl_semi_sync_master;
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test
index 030b0827a11..c7ce371970d 100644
--- a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_enabled_basic.test
@@ -6,10 +6,7 @@
#
#
source include/not_embedded.inc;
-source include/have_semisync_plugin.inc;
-# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
+source include/have_semisync.inc;
select @@global.rpl_semi_sync_slave_enabled;
SET @start_global_value = @@global.rpl_semi_sync_slave_enabled;
@@ -62,5 +59,3 @@ set global rpl_semi_sync_slave_enabled="some text";
#
SET @@global.rpl_semi_sync_slave_enabled = @start_global_value;
select @@global.rpl_semi_sync_slave_enabled;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-
diff --git a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test
index 64c935ee957..d7e001b7322 100644
--- a/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test
+++ b/mysql-test/suite/sys_vars/t/rpl_semi_sync_slave_trace_level_basic.test
@@ -5,10 +5,7 @@
# 2010-01-21 OBN - Added
#
source include/not_embedded.inc;
-source include/have_semisync_plugin.inc;
-# The following is to prevent a mis-match on windows that has the name of of the lib ending with 'dll'
---replace_regex /\.dll/.so/
-eval INSTALL PLUGIN rpl_semi_sync_slave SONAME '$SEMISYNC_SLAVE_SO';
+source include/have_semisync.inc;
select @@global.rpl_semi_sync_slave_trace_level;
SET @start_global_value = @@global.rpl_semi_sync_slave_trace_level;
@@ -59,5 +56,3 @@ set global rpl_semi_sync_slave_trace_level="some text";
#
SET @@global.rpl_semi_sync_slave_trace_level = @start_global_value;
select @@global.rpl_semi_sync_slave_trace_level;
-UNINSTALL PLUGIN rpl_semi_sync_slave;
-
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index eade7ba721e..d48b1687fa0 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1231,3 +1231,30 @@ execute stmt1;
deallocate prepare stmt1;
drop table t2;
+#
+# Test of ALTER TABLE IF [NOT] EXISTS
+#
+
+CREATE TABLE t1 (
+ id INT(11) NOT NULL,
+ x_param INT(11) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
+
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS id INT,
+ ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+ALTER TABLE t1 ADD COLUMN IF NOT EXISTS lol INT AFTER id;
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
+ALTER TABLE t1 DROP COLUMN IF EXISTS lol;
+
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+ALTER TABLE t1 ADD KEY IF NOT EXISTS x_param(x_param);
+ALTER TABLE t1 MODIFY IF EXISTS lol INT;
+
+DROP INDEX IF EXISTS x_param ON t1;
+DROP INDEX IF EXISTS x_param ON t1;
+CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
+CREATE INDEX IF NOT EXISTS x_param1 ON t1(x_param);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
diff --git a/mysql-test/t/bug13633383.test b/mysql-test/t/bug13633383.test
index 72eb2f81c98..e31d4a8c9f6 100644
--- a/mysql-test/t/bug13633383.test
+++ b/mysql-test/t/bug13633383.test
@@ -5,19 +5,19 @@
CREATE TABLE t1 (
`a` int(11) DEFAULT NULL,
`col432` bit(8) DEFAULT NULL,
- `col433` multipoint DEFAULT NULL,
- `col434` polygon DEFAULT NULL,
+ `col433` geometry DEFAULT NULL,
+ `col434` geometry DEFAULT NULL,
`col435` decimal(50,17) unsigned DEFAULT NULL,
`col436` geometry NOT NULL,
`col437` tinyblob NOT NULL,
- `col438` multipolygon DEFAULT NULL,
+ `col438` geometry DEFAULT NULL,
`col439` mediumblob NOT NULL,
`col440` tinyblob NOT NULL,
`col441` double unsigned DEFAULT NULL
);
CREATE TABLE t2 (
- `a` multipoint DEFAULT NULL,
+ `a` geometry DEFAULT NULL,
`col460` date DEFAULT NULL,
`col461` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`col462` date NOT NULL,
@@ -34,7 +34,7 @@ CREATE TABLE t3 (
`col579` bit(38) NOT NULL,
`col580` varchar(93) NOT NULL,
`col581` datetime DEFAULT NULL,
- `col583` multipolygon DEFAULT NULL,
+ `col583` geometry DEFAULT NULL,
`col584` bit(47) NOT NULL
);
diff --git a/mysql-test/t/cache_temporal_4265.test b/mysql-test/t/cache_temporal_4265.test
new file mode 100644
index 00000000000..6135438f023
--- /dev/null
+++ b/mysql-test/t/cache_temporal_4265.test
@@ -0,0 +1,11 @@
+#
+# MDEV-4265 5.5 is slower than 5.3 because of many str_to_datetime calls
+#
+--source include/have_debug.inc
+
+create table t1 (a date);
+insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
+set debug_dbug='d,str_to_datetime_warn';
+select * from t1 where a > date_add('2000-01-01', interval 5 day);
+drop table t1;
+
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index a61f89539cb..f82d859243a 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1559,29 +1559,26 @@ drop table t1,t2,t3;
--echo # -- End of Bug#45829
#
---echo # new table creation/renaming blocked if old encoded table present
+# new table creation/renaming is NOT blocked if old encoded table present
#
let $MYSQLD_DATADIR= `select @@datadir`;
-create table `t-1` (a int) engine=myisam;
-insert into `t-1` values (1);
+create table `#mysql50#t-1` (a int) engine=myisam;
+insert into `#mysql50#t-1` values (1);
show tables;
-flush tables;
---echo convert table files in mysql 5.0 file name encoding
---copy_file $MYSQLD_DATADIR/test/t@002d1.MYD $MYSQLD_DATADIR/test/t-1.MYD
---copy_file $MYSQLD_DATADIR/test/t@002d1.MYI $MYSQLD_DATADIR/test/t-1.MYI
---copy_file $MYSQLD_DATADIR/test/t@002d1.frm $MYSQLD_DATADIR/test/t-1.frm
---remove_file $MYSQLD_DATADIR/test/t@002d1.MYD
---remove_file $MYSQLD_DATADIR/test/t@002d1.MYI
---remove_file $MYSQLD_DATADIR/test/t@002d1.frm
-show tables;
---error ER_TABLE_EXISTS_ERROR
create table `t-1` (a int);
+show tables;
+# selects can distinguish between the two tables
+select * from `t-1`;
+select * from `#mysql50#t-1`;
+drop table `t-1`;
create table t1 (a int);
---error ER_TABLE_EXISTS_ERROR
alter table t1 rename `t-1`;
---error ER_TABLE_EXISTS_ERROR
+show tables;
+drop table `t-1`;
+create table t1 (a int);
rename table t1 to `t-1`;
-drop table `#mysql50#t-1`, t1;
+show tables;
+drop table `#mysql50#t-1`, `t-1`;
--echo
--echo End of 5.1 tests
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 4cf5cccc254..381c87c635c 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -343,3 +343,18 @@ SELECT 1 FROM t1 JOIN v1 ON 1 > (SELECT 1 FROM v2);
DROP TABLE t1, t2;
DROP VIEW v1, v2;
set optimizer_switch=@save_derived_optimizer_switch;
+
+#
+# MDEV-614 lp:1050806 - different result for a query using subquery between 5.5.25 and 5.5.27
+# MySQL Bug#66845 Wrong result (extra row) on a FROM subquery with a variable and ORDER BY
+#
+create table t1 (n bigint(20) unsigned, d1 datetime, d2 datetime, key (d1));
+insert t1 values (2085,'2012-01-01 00:00:00','2013-01-01 00:00:00');
+insert t1 values (2084,'2012-02-01 00:00:00','2013-01-01 00:00:00');
+insert t1 values (2088,'2012-03-01 00:00:00','2013-01-01 00:00:00');
+select * from (
+ select n, d1, d2, @result := 0 as result
+ from t1
+ where d1 < '2012-12-12 12:12:12' and n in (2085, 2084) order by d2 asc
+) as calculated_result;
+drop table t1;
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index c7705294ef2..4b7e76e11ca 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1512,6 +1512,40 @@ set optimizer_switch=@save3912_optimizer_switch;
drop table t1, t2, t3;
--echo #
+--echo # MDEV-4209: equi-join on BLOB column from materialized view
+--echo # or derived table
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='derived_with_keys=on';
+
+CREATE TABLE t1 (c1 text, c2 int);
+INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3);
+CREATE TABLE t2 (c1 text, c2 int);
+INSERT INTO t2 VALUES ('b',2), ('c',3);
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+
+EXPLAIN EXTENDED
+SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
+SELECT v1.c1, v1.c2 FROM v1, t2 WHERE v1.c1=t2.c1 AND v1.c2=t2.c2;
+
+EXPLAIN EXTENDED
+SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
+ WHERE t.g=t2.c1 AND t.m=t2.c2;
+SELECT t2.c1, t2.c2 FROM (SELECT c1 g, MAX(c2) m FROM t1 GROUP BY c1) t, t2
+ WHERE t.g=t2.c1 AND t.m=t2.c2;
+
+EXPLAIN EXTENDED
+SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
+SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+set optimizer_switch=@save_optimizer_switch;
+
+
+--echo #
--echo # end of 5.3 tests
--echo #
diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test
index de30cac610a..c817e7209f6 100644
--- a/mysql-test/t/dyncol.test
+++ b/mysql-test/t/dyncol.test
@@ -552,6 +552,62 @@ select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as de
select hex(COLUMN_CREATE(0, 0.0 as decimal));
--echo #
+--echo # MDEV-4292: parse error when selecting on views using dynamic column
+--echo #
+create table t1 (i int, d blob);
+
+create view v1 as select i, column_get(d, 1 as binary) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as int) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as date) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as time) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as datetime) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as decimal) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as double) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as char) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+drop table t1;
+
+--echo #
+--echo # end of 5.3 tests
+--echo #
+
+--echo #
--echo # test of symbolic names
--echo #
--echo # creation test (names)
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index b4b09413896..6e44b4c1578 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -646,3 +646,14 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo End of 5.1 tests
+
+CREATE TABLE t1 (
+ id int(11) auto_increment,
+ title varchar(100) default '',
+ PRIMARY KEY (id),
+ KEY ind5 (title)
+) ENGINE=MyISAM;
+
+CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
+CREATE FULLTEXT INDEX IF NOT EXISTS ft1 ON t1(title);
+DROP TABLE t1;
diff --git a/mysql-test/t/fulltext_derived_4316.test b/mysql-test/t/fulltext_derived_4316.test
new file mode 100644
index 00000000000..ecf4a0e7722
--- /dev/null
+++ b/mysql-test/t/fulltext_derived_4316.test
@@ -0,0 +1,14 @@
+#
+# MATCH on the derived tables
+#
+
+#
+# MDEV-4316 MariaDB server crash with signal 11
+#
+
+create table t1 (ft text) engine=myisam;
+insert into t1 values ('test1'),('test2');
+select distinct match(ft) against("test1" in boolean mode) from
+ (select distinct ft from t1) as t;
+drop table t1;
+
diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test
index fc5a5cb2823..5f27978347c 100644
--- a/mysql-test/t/func_date_add.test
+++ b/mysql-test/t/func_date_add.test
@@ -88,3 +88,15 @@ select b + interval a day from t1;
drop table t1;
--echo End of 5.0 tests
+
+#
+# MDEV-4284 Assertion `cmp_items[(uint)cmp_type]' fails in sql/item_cmpfunc.cc
+#
+
+create table t1 (a varchar(10));
+insert t1 values ('2000-12-03'),('2008-05-03');
+select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end;
+drop table t1;
+
+--echo End of 5.5 tests
+
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 89c6c0fe534..97766fefa91 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1372,7 +1372,16 @@ set @@optimizer_switch=@save_optimizer_switch;
--echo #
DROP TABLE IF EXISTS t1,t2,t3,empty1;
-###
+#
+# MDEV-4286 Server crashes in Protocol_text::store, stack smashing detected
+#
+create table t1 (i int, d date);
+insert into t1 values (1, '2008-10-02'), (2, '2010-12-12');
+select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i;
+drop table t1;
+
+#### End of 5.3 tests
+
--echo #
--echo # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
--echo # file .\item_sum.cc, line 587
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
index 6706792d162..06405808d79 100644
--- a/mysql-test/t/func_group_innodb.test
+++ b/mysql-test/t/func_group_innodb.test
@@ -159,7 +159,20 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
DROP TABLE t1;
---echo # End of test BUG#12713907
+--echo #
+--echo # MDEV-4269: crash when grouping by values()
+--echo #
+
+SELECT @@storage_engine INTO @old_engine;
+set storage_engine=innodb;
+
+create table y select 1 b;
+select 1 from y group by b;
+select 1 from y group by values(b);
+drop table y;
+SET storage_engine=@old_engine;
+
+### End of 5.1 tests
--echo #
--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 292db69a6e3..22ebb6248e2 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -369,6 +369,183 @@ drop table t1,tv;
--echo #
+--echo # GET_LOCK, RELEASE_LOCK, IS_USED_LOCK functions test
+--echo #
+
+--echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is not acquired
+--echo # Note: IS_USED_LOCK returns NULL if the lock is unused
+select is_used_lock('test');
+select is_free_lock('test');
+
+--echo # GET_LOCK returns 1 if it manages to acquire a lock
+select get_lock('test', 0);
+
+--echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired
+select is_free_lock('test');
+select is_used_lock('test') = connection_id();
+
+connect (con1,localhost,root,,);
+--echo # -> Switching to connection 'con1'
+connection con1;
+--echo # IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired in another
+--echo # connection
+select is_used_lock('test') = connection_id();
+select is_free_lock('test');
+
+--echo # GET_LOCK returns 0 if it can't acquire a lock (wait timeout)
+select get_lock('test', 0);
+
+--echo # RELEASE_LOCK returns 0 if the lock belongs to another connection
+select release_lock('test');
+
+--echo # -> Switching to connection 'default'
+connection default;
+
+--echo # RELEASE_LOCK returns 1 if it successfully releases a lock
+select release_lock('test');
+--echo # RELEASE_LOCK returns NULL if it doesn't release a lock and there is no such lock
+select release_lock('test');
+
+--echo # Test that get_lock() returns NULL if error.
+select get_lock('test', 0);
+--echo # -> Switching to connection 'con1'
+connection con1;
+create table t1 select connection_id() as id;
+send select get_lock('test', 7200);
+
+--echo # -> Switching to connection 'default'
+connection default;
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state='User lock';
+source include/wait_condition.inc;
+select (@id := id) - id from t1;
+kill query @id;
+
+--echo # -> Switching to connection 'con1'
+connection con1;
+reap;
+
+--echo # -> Switching to connection 'default'
+connection default;
+
+--echo # GET_LOCK() works recursively
+select get_lock('test', 0);
+select get_lock('test', 0);
+select get_lock('test', 0);
+
+--echo # RELEASE_LOCK() needs to be called recursively then, too
+select release_lock('test');
+select release_lock('test');
+select release_lock('test');
+
+--echo # Once the last instance of the lock is released,
+--echo # the next call returns NULL
+select release_lock('test');
+
+
+--echo # Multiple locks in the same session are OK
+select get_lock('test1', 0);
+select get_lock('test2', 0);
+select get_lock('test3', 0);
+
+select release_lock('test1');
+select release_lock('test2');
+select release_lock('test3');
+
+--echo # Deadlocks are detected e.g. in case of a mutual wait
+select get_lock('test1', 0);
+
+--echo # -> Switching to connection 'con1'
+connection con1;
+select get_lock('test2', 0);
+send select get_lock('test1', 7200);
+
+--echo # -> Switching to connection 'default'
+connection default;
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state='User lock';
+source include/wait_condition.inc;
+--error ER_LOCK_DEADLOCK
+select get_lock('test2', 7200);
+
+select release_lock('test1');
+
+--echo # -> Switching to connection 'con1'
+connection con1;
+reap;
+select release_lock('test2');
+select release_lock('test1');
+
+--echo # -> Switching to connection 'default'
+connection default;
+
+--echo # LOCK/UNLOCK TABLES works fine with a user lock.
+lock table t1 write;
+select get_lock('test', 0);
+unlock tables;
+commit;
+select release_lock('test');
+
+--echo # GLOBAL READ LOCK works with fine with user locks
+select get_lock('test1', 0);
+flush tables with read lock;
+select get_lock('test2', 0);
+unlock tables;
+commit;
+select release_lock('test1');
+select release_lock('test2');
+
+--echo # BEGIN/COMMIT/ROLLBACK don't unlock user locks.
+begin;
+select get_lock('test1', 0);
+select get_lock('test2', 0);
+select count(*) from t1;
+rollback;
+select release_lock('test1');
+select release_lock('test2');
+
+--echo # Deadlocks between user locks and LOCK TABLES locks
+--echo # are detected OK.
+select get_lock('test', 0);
+
+--echo # -> Switching to connection 'con1'
+connection con1;
+lock table t1 write;
+send select get_lock('test', 7200);
+
+--echo # -> Switching to connection 'default'
+connection default;
+let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE info LIKE 'select%' AND state = 'User lock';
+source include/wait_condition.inc;
+--error ER_LOCK_DEADLOCK
+lock table t1 read;
+
+select release_lock('test');
+
+--echo # -> Switching to connection 'con1'
+connection con1;
+reap;
+select release_lock('test');
+unlock tables;
+
+--echo # cleanup
+disconnect con1;
+connection default;
+drop table t1;
+
+--echo # check too long identifier names
+select get_lock(repeat('a', 192), 0);
+select is_used_lock(repeat('a', 192)) = connection_id();
+select is_free_lock(repeat('a', 192));
+select release_lock(repeat('a', 192));
+--error ER_TOO_LONG_IDENT
+select get_lock(repeat('a', 193), 0);
+--error ER_TOO_LONG_IDENT
+select is_used_lock(repeat('a', 193));
+--error ER_TOO_LONG_IDENT
+select is_free_lock(repeat('a', 193));
+--error ER_TOO_LONG_IDENT
+select release_lock(repeat('a', 193));
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index d8d8f4538e1..f245b4f9f78 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1385,6 +1385,24 @@ LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+#
+# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1))
+#
+SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
+SELECT LEFT('1', DAY(FROM_UNIXTIME(-1)));
+SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1)));
+SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1)));
+SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+
+#
+# MDEV-4289 Assertion `0' fails in make_sortkey with GROUP_CONCAT, MAKE_SET, GROUP BY
+#
+create table t1 (i int);
+insert into t1 values (null),(8);
+select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field;
+drop table t1;
+
--echo End of 5.1 tests
--echo Start of 5.4 tests
@@ -1502,11 +1520,6 @@ round(
--connection default
SET @@global.max_allowed_packet:= @tmp_max;
--disconnect newconn
-
---echo #
---echo # End of 5.5 tests
---echo #
-
#
# Bug#11765562 58545:
# EXPORT_SET() CAN BE USED TO MAKE ENTIRE SERVER COMPLETELY UNRESPONSIVE
@@ -1517,3 +1530,16 @@ SELECT @@global.max_allowed_packet;
SELECT CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000)));
SET @@global.max_allowed_packet:= @tmp_max;
+--echo #
+--echo # MDEV-4272: DIV operator crashes in Item_func_int_div::val_int
+--echo # (incorrect NULL value handling by convert)
+--echo #
+create table t1(a int) select null;
+select 1 div convert(a using utf8) from t1;
+drop table t1;
+
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 57ef68595bf..7a72c21d0ff 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -883,7 +883,9 @@ SELECT STR_TO_DATE(SPACE(2),'1');
--echo #
SET GLOBAL SQL_MODE='';
+--disable_warnings
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
+--enable_warnings
SET GLOBAL SQL_MODE=DEFAULT;
--echo #
@@ -1174,3 +1176,13 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010')
--error ER_TOO_BIG_PRECISION
select now(258);
+
+#
+# MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument in WHERE
+#
+SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index e7e6fa59df0..731efe5648e 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -120,7 +120,7 @@ INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('
drop table t1;
CREATE TABLE t1 (
- line LINESTRING NOT NULL,
+ line GEOMETRY NOT NULL,
kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
name VARCHAR(32),
@@ -935,7 +935,7 @@ DROP TABLE t1;
--echo # and invalid spatial data
--echo #
-CREATE TABLE t1(a LINESTRING NOT NULL, b GEOMETRY NOT NULL,
+CREATE TABLE t1(a POINT NOT NULL, b GEOMETRY NOT NULL,
SPATIAL KEY(a), SPATIAL KEY(b)) ENGINE=MyISAM;
INSERT INTO t1 VALUES(GEOMFROMTEXT("point (0 0)"), GEOMFROMTEXT("point (1 1)"));
--error ER_CANT_CREATE_GEOMETRY_OBJECT
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index b0ad8329cfb..cff93fc13ee 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -741,7 +741,7 @@ SET @a=POLYFROMWKB(@a);
# Bug #57321 crashes and valgrind errors from spatial types
#
-create table t1(a polygon NOT NULL)engine=myisam;
+create table t1(a geometry NOT NULL)engine=myisam;
insert into t1 values (geomfromtext("point(0 1)"));
insert into t1 values (geomfromtext("point(1 0)"));
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
@@ -759,6 +759,87 @@ create spatial index i on t1 (a);
drop table t1;
+#
+# Bug#11767480 - SPATIAL INDEXES ON NON-SPATIAL COLUMNS CAUSE CRASHES.
+#
+CREATE TABLE t0 (a BINARY(32) NOT NULL);
+--error ER_WRONG_ARGUMENTS
+CREATE SPATIAL INDEX i on t0 (a);
+INSERT INTO t0 VALUES (1);
+
+--error ER_WRONG_ARGUMENTS
+CREATE TABLE t1(
+ col0 BINARY NOT NULL,
+ col2 TIMESTAMP,
+ SPATIAL INDEX i1 (col0)
+) ENGINE=MyISAM;
+
+# Test other ways to add indices
+CREATE TABLE t1 (
+ col0 BINARY NOT NULL,
+ col2 TIMESTAMP
+) ENGINE=MyISAM;
+
+--error ER_WRONG_ARGUMENTS
+CREATE SPATIAL INDEX idx0 ON t1(col0);
+
+--error ER_WRONG_ARGUMENTS
+ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
+
+CREATE TABLE t2 (
+ col0 INTEGER NOT NULL,
+ col1 POINT,
+ col2 POINT
+);
+
+--error ER_WRONG_ARGUMENTS
+CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
+
+--error ER_WRONG_ARGUMENTS
+CREATE TABLE t3 (
+ col0 INTEGER NOT NULL,
+ col1 POINT,
+ col2 LINESTRING,
+ SPATIAL INDEX i1 (col1, col2)
+);
+
+# cleanup
+DROP TABLE t0, t1, t2;
+
+
+--echo #
+--echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
+--echo #
+SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
+
+--echo #
+--echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
+--echo # GEOMETRY FUNCTION ARGUMENTS
+--echo #
+--replace_regex /non geometric .* value/non geometric '' value/
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
+
+--echo #
+--echo # MDEV-4252 geometry query crashes server
+--echo #
+select astext(0x0100000000030000000100000000000010);
+select astext(st_centroid(0x0100000000030000000100000000000010));
+select astext(st_exteriorring(0x0100000000030000000100000000000010));
+select envelope(0x0100000000030000000100000000000010);
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
+
+--echo #
+--echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
+--echo #
+
+SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
+
+--echo #
+--echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
+--echo #
+SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
--echo End of 5.1 tests
#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
@@ -1293,6 +1374,7 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
#WHERE lakes.name = 'Blue Lake';
DROP DATABASE gis_ogs;
+USE test;
--echo #
--echo # BUG #1043845 st_distance() results are incorrect depending on variable order
@@ -1308,25 +1390,18 @@ select st_distance(geomfromtext('point(-95.96269500000000000000 36.1418183333333
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
-USE test;
-
--echo #
---echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
+--echo # MDEV-4310 geometry function equals hangs forever.
--echo #
-SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
-
---echo #
---echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
---echo # GEOMETRY FUNCTION ARGUMENTS
---echo #
---replace_regex /non geometric .* value/non geometric '' value/
---error ER_ILLEGAL_VALUE_FOR_TYPE
-SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
-
-
---echo End of 5.1 tests
+create table t1(a geometry not null)engine=myisam;
+insert into t1 values(geomfromtext("POINT(0 0)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+select equals(`a`,convert(`a` using utf8)) from `t1`;
+drop table t1;
+--echo End of 5.3 tests
--echo #
--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
@@ -1358,4 +1433,13 @@ SELECT 1 FROM g1 WHERE a >= ANY
DROP TABLE g1;
+--echo #
+--echo # MDEV-3819 missing constraints for spatial column types
+--echo #
+
+create table t1 (pt point);
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
+drop table t1;
+
--echo End of 5.5 tests
diff --git a/mysql-test/t/grant4.test b/mysql-test/t/grant4.test
index f3e551cd623..c30e0c28f31 100644
--- a/mysql-test/t/grant4.test
+++ b/mysql-test/t/grant4.test
@@ -104,9 +104,7 @@ connection con1;
use mysqltest_db1;
--echo ** Connect as restricted user mysqltest_u1.
--echo ** SELECT FROM INFORMATION_SCHEMA.STATISTICS will succeed because any privileges will do (authentication is enough).
-#
-# this result is wrong. reported as bug#34104
-#
+--echo ** but will return no rows
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name='t5';
#
# Bug27145 EXTRA_ACL trouble
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index b2dd84f63c7..b606d413608 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1322,6 +1322,80 @@ SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
DROP TABLE t1;
SET BIG_TABLES=0;
+--echo #
+--echo # MDEV-641 LP:1002108 - Wrong result (or crash) from a query with duplicated field in the group list and a limit clause
+--echo # Bug#11761078: 53534: INCORRECT 'SELECT SQL_BIG_RESULT...'
+--echo # WITH GROUP BY ON DUPLICATED FIELDS
+--echo #
+
+CREATE TABLE t1(
+ col1 int,
+ UNIQUE INDEX idx (col1));
+
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
+ (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+
+let $query0=SELECT col1 AS field1, col1 AS field2
+ FROM t1 GROUP BY field1, field2;
+
+# Needs to be range to exercise bug
+--eval EXPLAIN $query0;
+FLUSH STATUS;
+--eval $query0;
+SHOW SESSION STATUS LIKE 'Sort_scan%';
+
+let $query=SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
+ FROM t1 GROUP BY field1, field2;
+
+# Needs to be range to exercise bug
+--eval EXPLAIN $query;
+FLUSH STATUS;
+--eval $query;
+SHOW SESSION STATUS LIKE 'Sort_scan%';
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2
+FROM v1
+GROUP BY field1, field2;
+
+SELECT SQL_BIG_RESULT tbl1.col1 AS field1, tbl2.col1 AS field2
+FROM t1 as tbl1, t1 as tbl2
+GROUP BY field1, field2
+LIMIT 3;
+
+explain
+select col1 f1, col1 f2 from t1 order by f2, f1;
+select col1 f1, col1 f2 from t1 order by f2, f1;
+
+explain
+select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
+select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
+
+explain
+select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
+select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1;
+
+CREATE TABLE t2(
+ col1 int,
+ col2 int,
+ UNIQUE INDEX idx (col1, col2));
+
+INSERT INTO t2(col1, col2) VALUES
+ (1,20),(2,19),(3,18),(4,17),(5,16),(6,15),(7,14),(8,13),(9,12),(10,11),
+ (11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
+
+explain
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
+
+explain
+select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
+select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
+
+DROP VIEW v1;
+DROP TABLE t1, t2;
+
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 19f7cbe40a1..82097c53fe0 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1204,6 +1204,64 @@ drop table t1;
--echo End of 5.1 tests
+--echo #
+--echo # MDEV-765 lp:825075 - Wrong result with GROUP BY + multipart key + MIN/MAX loose scan
+--echo #
+
+CREATE TABLE t1 (a varchar(1), b varchar(1), KEY (b,a));
+INSERT INTO t1 VALUES
+('0',NULL),('9',NULL),('8','c'),('4','d'),('7','d'),(NULL,'f'),
+('7','f'),('8','g'),(NULL,'j');
+
+explain
+SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
+SELECT max(a) , b FROM t1 WHERE a IS NULL OR b = 'z' GROUP BY b;
+
+explain
+SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
+SELECT b, min(a) FROM t1 WHERE a = '7' OR b = 'z' GROUP BY b;
+
+explain
+SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
+SELECT b, min(a) FROM t1 WHERE (a = b OR b = 'd' OR b is NULL) GROUP BY b;
+
+explain
+SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
+SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
+
+explain
+SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
+SELECT b, min(a) FROM t1 WHERE a > '0' AND (b < (a = '7')) GROUP BY b;
+
+explain
+SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
+SELECT b, min(a) FROM t1 WHERE (a > '0' AND (a > '1' OR b = 'd')) GROUP BY b;
+
+drop table t1;
+
+--echo #
+--echo # MDEV-4140 Wrong result with GROUP BY + multipart key + MIN/MAX loose scan and a subquery
+--echo #
+
+CREATE TABLE t1 (a int, b int, KEY (b, a)) ;
+INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0);
+CREATE TABLE t2 (c int) ;
+INSERT INTO t2 VALUES (0),(1);
+
+EXPLAIN
+SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
+SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b;
+EXPLAIN
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT c FROM t2 WHERE c = 0 ) GROUP BY b;
+# this test is for 5.5 to ensure that the subquery is expensive
+EXPLAIN
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
+SELECT MIN(a), b FROM t1 WHERE a > ( SELECT min(c) FROM t2, t1 t1a, t1 t1b WHERE c = 0 ) GROUP BY b;
+
+drop table t1, t2;
+
+--echo End of 5.3 tests
--echo #
--echo # WL#3220 (Loose index scan for COUNT DISTINCT)
@@ -1342,4 +1400,3 @@ explain SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
drop table t1;
--echo # End of test#50539.
-
diff --git a/mysql-test/t/information_schema_all_engines-master.opt b/mysql-test/t/information_schema_all_engines-master.opt
index 085c81d34bb..0a9fa574e49 100644
--- a/mysql-test/t/information_schema_all_engines-master.opt
+++ b/mysql-test/t/information_schema_all_engines-master.opt
@@ -2,9 +2,10 @@
--loose-innodb-buffer-pool-pages
--loose-innodb-buffer-pool-pages-blob
--loose-innodb-buffer-pool-pages-index
+--loose-innodb-changed-pages
--loose-innodb-cmp
---loose-innodb-cmpmem-reset
--loose-innodb-cmp-reset
+--loose-innodb-cmpmem-reset
--loose-innodb-index-stats
--loose-innodb-lock-waits
--loose-innodb-rseg
diff --git a/mysql-test/t/information_schema_all_engines.test b/mysql-test/t/information_schema_all_engines.test
index 553367d2b9a..73ed00376ab 100644
--- a/mysql-test/t/information_schema_all_engines.test
+++ b/mysql-test/t/information_schema_all_engines.test
@@ -49,7 +49,7 @@ SELECT t.table_name, c1.column_name
#
# Bug#24630 Subselect query crashes mysqld
#
-select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
+select 1 as f1 from information_schema.tables where "ALL_PLUGINS"=
(select cast(table_name as char) from information_schema.tables
order by table_name limit 1) limit 1;
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index 3e82403ddb5..31c6fca2b95 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -414,6 +414,7 @@ INSERT INTO t1 (a) VALUES (4), (6);
INSERT INTO t2 (b) VALUES (0), (8);
set @save_optimizer_switch=@@optimizer_switch;
+set @save_join_cache_level=@@join_cache_level;
SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on';
@@ -424,6 +425,7 @@ EXPLAIN
SELECT * FROM t1, t2 WHERE b=a;
SELECT * FROM t1, t2 WHERE b=a;
+set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
@@ -466,6 +468,78 @@ set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1;
+--echo #
+--echo # Bug mdev-4220: using ref instead of eq_ref
+--echo # with extended_keys=on
+--echo # (performance regression introduced in the patch for mdev-3851)
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+create table t1 (a int not null) engine=innodb;
+
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 (
+ pk int primary key, a int not null, b int, unique(a)
+)engine=innodb;
+
+insert into t2
+select
+ A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a
+from t1 A, t1 B;
+
+set optimizer_switch='extended_keys=off';
+explain
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+flush status;
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+show status like 'handler_read%';
+
+set optimizer_switch='extended_keys=on';
+explain
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+flush status;
+select * from t1, t2 where t2.a=t1.a and t2.b < 2;
+show status like 'handler_read%';
+
+drop table t1,t2;
+
+# this test case did not demonstrate any regression
+# it is added for better testing
+
+create table t1(a int) engine=myisam;
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2(a int) engine=myisam;
+insert into t2 select A.a + 10*B.a + 100*C.a from t1 A, t1 B, t1 C;
+
+create table t3 (
+ pk1 int not null, pk2 int not null, col1 int not null, col2 int not null)
+engine=innodb;
+insert into t3 select a,a,a,a from t2;
+alter table t3 add primary key (pk1, pk2);
+alter table t3 add key (col1, col2);
+
+set optimizer_switch='extended_keys=off';
+--replace_column 9 #
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
+--replace_column 9 #
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
+
+set optimizer_switch='extended_keys=on';
+--replace_column 9 #
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
+--replace_column 9 #
+explain
+select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
+
+drop table t1,t2,t3;
+
+set optimizer_switch=@save_optimizer_switch;
+
set optimizer_switch=@save_ext_key_optimizer_switch;
SET SESSION STORAGE_ENGINE=DEFAULT;
-
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 907d39e95fe..33289f77c13 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -1136,3 +1136,29 @@ SET optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2,t3,t4,t5;
SET optimizer_switch=@save_optimizer_switch;
+
+--echo #
+--echo # Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
+--echo #
+
+CREATE TABLE t1 (a int);
+
+INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+
+CREATE TABLE t2 (a int);
+
+INSERT INTO t2 (a) VALUES (1),(2),(3),(4);
+
+EXPLAIN
+SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;
+SELECT t1.a FROM t1 NATURAL INNER JOIN t2 ORDER BY t1.a;
+
+EXPLAIN
+SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;
+SELECT t1.a FROM t1 STRAIGHT_JOIN t2 USING(a) ORDER BY t1.a;
+
+EXPLAIN
+SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
+SELECT t1.a FROM t1 NATURAL STRAIGHT_JOIN t2 ORDER BY t1.a;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/join_cache.test b/mysql-test/t/join_cache.test
index 9b04c264faf..2d06c3e2a30 100644
--- a/mysql-test/t/join_cache.test
+++ b/mysql-test/t/join_cache.test
@@ -3594,7 +3594,7 @@ DROP TABLE t1,t2,t3;
CREATE TABLE t1 (
col269 decimal(31,10) unsigned DEFAULT NULL,
- col280 multipoint DEFAULT NULL,
+ col280 geometry DEFAULT NULL,
col281 tinyint(1) DEFAULT NULL,
col282 time NOT NULL,
col284 datetime DEFAULT NULL,
diff --git a/mysql-test/t/join_outer_innodb.test b/mysql-test/t/join_outer_innodb.test
index cca1dde481d..adb555d5f85 100644
--- a/mysql-test/t/join_outer_innodb.test
+++ b/mysql-test/t/join_outer_innodb.test
@@ -143,3 +143,210 @@ eval SELECT $rest_of_query;
eval EXPLAIN SELECT $rest_of_query;
drop table t1,t2,t3,t4,t5,t6;
+
+--echo #
+--echo Bug mdev-4318: view over a complex query with outer joins
+--echo #
+
+CREATE TABLE t1 (
+ a1 int NOT NULL, a2 int NOT NULL, a3 int DEFAULT NULL, a4 tinyint NOT NULL,
+ a5 int NOT NULL, a6 tinyint NOT NULL, a7 tinyint(4) DEFAULT NULL,
+ a8 smallint(6) DEFAULT NULL, a9 smallint(6) DEFAULT NULL, a10 tinyint NOT NULL,
+ PRIMARY KEY (a1), KEY a2 (a2), KEY a3 (a3), KEY a4 (a4), KEY a6 (a6),
+ KEY a5 (a5), KEY a7 (a7), KEY a8 (a8), KEY a9 (a9)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+ (3360,5684,2219,1,316832,1,0,NULL,NULL,NULL),
+ (3362,2754,597,2,316844,1,0,NULL,NULL,NULL),
+ (3363,369,NULL,1,317295,1,0,NULL,NULL,NULL);
+
+CREATE TABLE t2 (
+ b1 int NOT NULL, b2 int NOT NULL, PRIMARY KEY (b1,b2), KEY b2 (b2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE t3 (
+ c1 int NOT NULL, PRIMARY KEY (c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES
+ (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),
+ (1000),(1001),(1002),(1003),(9999);
+
+CREATE TABLE t4 (
+ d1 int NOT NULL, PRIMARY KEY (d1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t4 VALUES (5674),(5676),(5680),(5684),(5685);
+
+CREATE TABLE t5 (
+ e1 int NOT NULL, e2 varchar(64) NOT NULL, PRIMARY KEY (e1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t5 VALUES
+ (5684,'51a5de7a9f56314e082094d78f58be082c3cf0c1'),
+ (5685,'754dc8292cb9f5eb9ade126fe7e961c62412a349'),
+ (5686,'75eeb33f1c819bac21f6d023b4c5b24185eeda5c');
+
+CREATE TABLE t6 (
+ f1 int NOT NULL, PRIMARY KEY (f1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t6 VALUES (5542),(5620),(5686);
+
+CREATE TABLE t7 (
+ g1 tinyint NOT NULL DEFAULT '0', g2 varchar(20) NOT NULL, PRIMARY KEY (g1)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t7 VALUES
+ (1,'60feec2b20ed19f55ad0'),(3,'9ddb18bff7fcbd1e3133'),
+ (5,'a05599df9222bb160d11'),(7,'e31bae372f7d01df0589'),
+ (9,'8f8372dd7fc8eb46c8a3'),(11,'f8d0e28529e990a09309');
+
+CREATE TABLE t8 (
+ h1 tinyint NOT NULL, h2 varchar(128) DEFAULT NULL, PRIMARY KEY (h1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t8 VALUES (1,'b'),(2,'c'),(3,'d'),(4,'e');
+
+CREATE TABLE t9 (
+ i1 tinyint NOT NULL, i2 varchar(7) NOT NULL, i3 varchar(128) NOT NULL,
+ PRIMARY KEY (i1,i2), KEY i2 (i2), KEY i3 (i3)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t9 VALUES
+ (2,'a','07630d223c7e5f7b1feb19b3caafb0833fd028eb'),
+ (3,'b','1ca53dcc50b68af86f4b1b4676dbed917b543c30'),
+ (1,'b','2c01ac36c1ce9a7de66be89f85d8aa5f0052e2e8'),
+ (4,'a','496c486b3a9edc439477fef7d34cbefdebba86df'),
+ (3,'a','98bf72d8d467201058a5f69bd7709bfc74a8637e'),
+ (2,'b','9a45425f6160fb59d7f8a02c721498d4ce945302'),
+ (4,'b','9c9a7300f3e708f8e430f9f3376d966f5951f583'),
+ (1,'a','c0af3f076b905f31cbb51af304b9c7ad539e0861');
+
+CREATE TABLE t10 (
+ j1 tinyint NOT NULL, j2 varchar(20) NOT NULL, PRIMARY KEY (j1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t10 VALUES (1,'b'),(2,'c'),(3,'d');
+
+CREATE TABLE t11 (
+ k1 int NOT NULL, k2 datetime DEFAULT NULL, k3 int DEFAULT NULL,
+ k4 int DEFAULT NULL, PRIMARY KEY (k1), KEY k3 (k3), KEY k4 (k4)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t11 VALUES
+ (317422,'2013-03-18 11:43:03',1,NULL),(317423,'2013-03-18 11:43:11',1,NULL),
+ (317424,'2013-03-18 11:52:01',1,1),(317425,'2013-03-18 11:52:01',1,1),
+ (317426,'2013-03-18 11:56:38',1,1),(317427,'2013-03-18 12:18:25',1,NULL),
+ (317428,'2013-03-18 12:46:28',1,NULL),(317429,'2013-03-18 12:46:28',1,NULL),
+ (317430,'2013-03-18 12:46:28',1,NULL),(317431,'2013-03-18 12:46:28',1,NULL),
+ (317432,'2013-03-18 12:46:28',1,NULL),(317433,'2013-03-18 12:46:28',1,NULL),
+ (317434,'2013-03-18 12:46:28',1,NULL),(317435,'2013-03-18 12:46:28',1,NULL),
+ (317436,'2013-03-18 12:46:28',1,NULL),(317437,'2013-03-18 12:46:28',1,NULL),
+ (317438,'2013-03-18 12:46:28',1,NULL),(317439,'2013-03-18 12:46:28',1,NULL),
+ (317440,'2013-03-18 12:55:20',1,NULL),(317441,'2013-03-18 12:58:29',1,NULL),
+ (317442,'2013-03-18 13:06:02',1,NULL),(317443,'2013-03-18 15:23:18',21,NULL);
+
+CREATE TABLE t12 (
+ l1 int NOT NULL, l2 varchar(64) NOT NULL, PRIMARY KEY (l1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t12 VALUES
+ (552,'59a498252ef59f96fbdc13a414abe244d8e8bc30'),
+ (554,'c6025c7cb2d9dfb1be7ce4a61f35b45bb9e61ba3'),
+ (555,'b245bcc672082bb6d10794b2b4ac972dd14b1cf5');
+
+CREATE TABLE t13 (
+ m1 int NOT NULL, m2 int NOT NULL, m3 int NOT NULL,
+ PRIMARY KEY (m1,m2,m3), KEY m3 (m3), KEY m2 (m2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t13 VALUES (3324,43,4),(3332,263,1),(3348,27,3);
+
+CREATE TABLE t14 (
+ n1 smallint NOT NULL, n2 varchar(64) NOT NULL, PRIMARY KEY (n1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t14 VALUES
+ (21,'685bf7ca576af964c7cff564d5e4473b81499b8b'),
+ (23,'b8e42dab1ab952406b3accfb47089c61478138a8'),
+ (25,'3fea441e411db8c70bf039b50c8f18f59515be53'),
+ (27,'998aecc30fd0e0b8a1cac6590e5eccc2d7822223');
+
+CREATE TABLE t15 (
+ o1 smallint NOT NULL, PRIMARY KEY (o1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t15 VALUES (1),(3);
+
+CREATE TABLE t16 (
+ p1 smallint NOT NULL, p2 varchar(7) NOT NULL, p3 varchar(64) NOT NULL,
+ PRIMARY KEY (p1,p2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t16 VALUES
+ (1,'a','66bdbb389456f3ae97206da115a7b397c31400e8'),
+ (1,'b','66bdbb389456f3ae97206da115a7b397c31400e8'),
+ (3,'a','386c10e454278c6e27feb16258089166422f79b4'),
+ (3,'b','386c10e454278c6e27feb16258089166422f79b4');
+
+let $Q=
+select t3.c1,t5.e2,t1.a1,t14.n2,t16.p3,t10.j2,t7.g2,t11.k2,l3.l2,
+ t9.i3,t12.l2 AS l_l2,l2.l2 AS l2_l2,l4.l1 AS l4_l1,t6.f1
+from
+(
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ t1
+ left join t2 on t1.a1 = t2.b1
+ )
+ left join t3 on t2.b2 = t3.c1
+ )
+ left join t4 on t1.a2 = t4.d1
+ )
+ left join t5 on t4.d1 = t5.e1
+ )
+ left join t6 on t1.a3 = t6.f1
+ )
+ left join t5 e2 on t6.f1 = e2.e1
+ )
+ join t7 on t1.a7 = t7.g1
+ )
+ join t8 on t1.a4 = t8.h1
+ )
+ join t9 on t8.h1 = t9.i1
+ )
+ join t10 on t1.a6 = t10.j1
+ )
+ join t11 on t1.a5 = t11.k1
+ )
+ left join t12 on t11.k3 = t12.l1
+ )
+ left join t12 l2 on t11.k4 = l2.l1
+ )
+ left join t13 on t1.a1 = t13.m1 and t13.m3 = 4
+ )
+ left join t12 l4 on l4.l1 = t13.m2
+ )
+ left join t13 m2 on t1.a1 = m2.m1 and m2.m3 = 3
+ )
+ left join t12 l3 on l3.l1 = m2.m2
+ )
+ left join t14 on t1.a8 = t14.n1
+ )
+ left join t15 on t1.a9 = t15.o1
+)
+left join t16 on t15.o1 = t16.p1
+where t1.a10 = 1;
+
+eval create view v1 as $Q;
+
+eval explain $Q;
+
+explain select * from v1;
+
+drop view v1;
+
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
index 08016313ca7..54052e65014 100644
--- a/mysql-test/t/keywords.test
+++ b/mysql-test/t/keywords.test
@@ -162,3 +162,14 @@ call p2();
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE t1;
+
+#
+# OPTION is not anymore a keyword
+#
+
+create table option (option int not null);
+drop table option;
+--error 1193
+set option=1;
+--error 1193
+set option option=1;
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test
index 197cad536e4..fef8a9848ca 100644
--- a/mysql-test/t/mdl_sync.test
+++ b/mysql-test/t/mdl_sync.test
@@ -4382,7 +4382,7 @@ connection default;
--echo # Connection con2
connection con2;
--echo # Reaping: RENAME TABLE db1.t1 TO test.t1
---error ER_FILE_NOT_FOUND, ER_FILE_NOT_FOUND
+--error ER_NO_SUCH_TABLE
--reap
--echo # Connection default
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 4066fcb264b..7e198275730 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -226,19 +226,19 @@ drop table t3,t1,t2;
#
# temporary merge tables
#
-CREATE TABLE t1 (c1 INT NOT NULL);
-CREATE TABLE t2 (c1 INT NOT NULL);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2);
-SELECT * FROM t3;
-CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL);
-CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL);
-INSERT INTO t4 VALUES (4);
-INSERT INTO t5 VALUES (5);
-CREATE TEMPORARY TABLE t6 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t4,t5);
-SELECT * FROM t6;
-DROP TABLE t6, t3, t1, t2, t4, t5;
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t2 values (2);
+create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
+select * from t3;
+create temporary table t4 (a int not null);
+create temporary table t5 (a int not null);
+insert into t4 values (1);
+insert into t5 values (2);
+create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5);
+select * from t6;
+drop table t6, t3, t1, t2, t4, t5;
#
# Bug#19627 - temporary merge table locking
# MERGE table and its children must match in temporary type.
@@ -622,14 +622,6 @@ SHOW CREATE TABLE m1;
DROP TABLE t1, m1;
#
-# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
-# key accessed
-#
-CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
-SELECT MAX(a) FROM t1;
-DROP TABLE t1;
-
-#
# BUG#32047 - 'Spurious' errors while opening MERGE tables
#
CREATE TABLE t1(a INT);
@@ -1306,9 +1298,9 @@ DROP TABLE t1, t2, t3;
# Truncate failed with error message when table was in use by MERGE.
#
# Show that truncate of child table after use of parent table works.
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
+CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t3;
@@ -1840,6 +1832,51 @@ DROP TABLE m1, t1;
--echo End of 5.1 tests
+--echo #
+--echo # MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
+--echo #
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 ( i int ) engine=myisam;
+insert into t2 values (1),(2);
+
+create table t3 (a int, b int, filler char(100), key(a), key(b)) engine=myisam;
+create table t4 like t3;
+insert into t3
+ select A.a+10*B.a+100*C.a,
+ A.a+10*B.a+100*C.a,
+ 'filler-data-FILLER-DATA-qqq'
+ from t1 A, t1 B, t1 C where C.a < 5;
+insert into t4
+ select A.a+10*B.a+100*C.a,
+ A.a+10*B.a+100*C.a,
+ 'filler-data-FILLER-DATA-qqq'
+ from t1 A, t1 B, t1 C where C.a >= 5;
+
+create table t5 like t3;
+alter table t5 engine=merge;
+alter table t5 union(t3, t4);
+
+update t5 set b=999, a=999 where b>950;
+
+explain
+select * from t2, t5 where t5.a=999 and t5.b=999;
+select * from t2, t5 where t5.a=999 and t5.b=999;
+
+drop table t5;
+drop table t1,t2,t3,t4;
+
+--echo End of 5.3 tests
+
+#
+# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
+# key accessed
+#
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+DROP TABLE t1;
+
--echo #
--echo # An additional test case for Bug#27430 Crash in subquery code
--echo # when in PS and table DDL changed after PREPARE
@@ -2845,3 +2882,4 @@ eval set global storage_engine=$default;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index 48735304aad..e0a35ca2bb9 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -696,6 +696,55 @@ DROP FUNCTION f1;
DROP TABLE t1;
--echo #
+--echo # MDEV-4123: Incorrect results after multi-table update or
+--echo # assertion `!table || (!table->read_set ||
+--echo # bitmap_is_set(table->read_set, field_index))' failure
+--echo #
+
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+ id int(10) unsigned NOT NULL,
+ level tinyint(3) unsigned NOT NULL,
+ PRIMARY KEY (id)
+);
+INSERT INTO t1 VALUES (2519583,1);
+
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t2 (
+ club_id int(11) NOT NULL DEFAULT '0',
+ profile_id int(11) NOT NULL DEFAULT '0',
+ member_level_id int(11) NOT NULL DEFAULT '0',
+ PRIMARY KEY (profile_id,club_id)
+);
+INSERT INTO t2 VALUES (2,2519583,12);
+
+DROP TABLE IF EXISTS t3;
+CREATE TABLE t3 (
+ member_level_id int(11) unsigned NOT NULL DEFAULT '0',
+ map_level int(11) unsigned NOT NULL DEFAULT '0',
+ map_status int(11) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (member_level_id)
+);
+INSERT INTO t3 VALUES (12,12,1);
+
+CREATE
+ VIEW v1 AS
+ select club_id,profile_id,
+ map_level AS member_level_id,map_status AS member_status
+ from (t2 tc join t3 map
+ on(((tc.member_level_id = map.member_level_id) and
+ (club_id = 2))));
+
+select level, count(*) as cnt from t1 group by level;
+UPDATE t1 c LEFT JOIN v1 t ON (c.id = t.profile_id AND t.club_id = 2)
+ SET c.level = IF (t.member_status IS NULL, 1, IF (t.member_status = 1, 2,3));
+select level, count(*) as cnt from t1 group by level;
+drop view v1;
+drop table t1,t2,t3;
+
+--echo end of tests
+
+--echo #
--echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a
--echo # table is updated twice
--echo #
@@ -759,6 +808,5 @@ SELECT * FROM t2;
DROP TABLE t1,t2;
-
-
+--echo end of 5.5 tests
diff --git a/mysql-test/t/myisam-metadata.test b/mysql-test/t/myisam-metadata.test
new file mode 100644
index 00000000000..c5327aa3a71
--- /dev/null
+++ b/mysql-test/t/myisam-metadata.test
@@ -0,0 +1,49 @@
+#
+# Test bugs in MyISAM that may cause problems for metadata
+#
+
+--source include/big_test.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+#
+# LP:989055 - Querying myisam table metadata may corrupt the table
+#
+
+CREATE TABLE t1 (
+ id INT PRIMARY KEY,
+ a VARCHAR(100),
+ INDEX(a)
+) ENGINE=MyISAM;
+ALTER TABLE t1 DISABLE KEYS;
+
+let $1=100000;
+--disable_query_log
+while ($1)
+{
+ eval insert into t1 values($1, "line number $1");
+ dec $1;
+}
+--enable_query_log
+
+--connect(con1,localhost,root,,)
+--send
+ ALTER TABLE t1 ENABLE KEYS;
+
+--connection default
+--let $wait_timeout=10
+--let $show_statement= SHOW PROCESSLIST
+--let $field= State
+--let $condition= = 'Repair by sorting'
+--source include/wait_show_condition.inc
+
+--replace_column 7 # 8 # 9 # 12 # 13 # 14 #
+SHOW TABLE STATUS LIKE 't1';
+
+--connection con1
+--reap
+--connection default
+--disconnect con1
+DROP TABLE t1;
diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test
index d908e639a4e..cece33bb00b 100644
--- a/mysql-test/t/myisam-system.test
+++ b/mysql-test/t/myisam-system.test
@@ -9,14 +9,21 @@ drop table if exists t1,t2;
create table t1 (a int) engine=myisam;
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/test/t1.MYI
+--replace_result $MYSQLD_DATADIR ./
drop table if exists t1;
create table t1 (a int) engine=myisam;
--remove_file $MYSQLD_DATADIR/test/t1.MYI
---error ER_BAD_TABLE_ERROR,6
+--replace_result $MYSQLD_DATADIR ./
+--error ER_FILE_NOT_FOUND
+select * from t1;
+--replace_result $MYSQLD_DATADIR ./
drop table t1;
create table t1 (a int) engine=myisam;
--remove_file $MYSQLD_DATADIR/test/t1.MYD
---error ER_BAD_TABLE_ERROR,6,29
+--replace_result $MYSQLD_DATADIR ./
+--error 29
+select * from t1;
+--replace_result $MYSQLD_DATADIR ./
drop table t1;
--error ER_BAD_TABLE_ERROR
drop table t1;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 4199d98073c..8323890b028 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1536,10 +1536,10 @@ drop table t1;
#
CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t1 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t1;
CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
+INSERT INTO t2 VALUES (GeomFromText("LINESTRING(0 0)"));
checksum table t2;
CREATE TABLE t3 select * from t1;
checksum table t3;
@@ -1582,22 +1582,6 @@ SELECT h+0, d + 0, e, g + 0 FROM t1;
DROP TABLE t1;
---echo #
---echo # Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field
---echo # (same content / differen checksum)
---echo #
-
-CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)"));
-checksum table t1;
-CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam;
-INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)"));
-checksum table t2;
-CREATE TABLE t3 select * from t1;
-checksum table t3;
-drop table t1,t2,t3;
-
-
#
# BUG#47073 - valgrind errs, corruption,failed repair of partition,
# low myisam_sort_buffer_size
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 71a985654ef..662cd4c7c0c 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -593,6 +593,15 @@ create database `aa``bb````cc`;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql
drop database `aa``bb````cc`;
+#
+# MySQL Bug#13639125 DELIMITER STRIPS THE NEXT NEW LINE IN A SQL STATEMENT
+#
+--write_file $MYSQLTEST_VARDIR/tmp/13639125.sql
+select ">>
+delimiter
+<<" as a;
+EOF
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/13639125.sql
--echo
--echo End of tests
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
index 90da022fb38..bf5331ca4f9 100644
--- a/mysql-test/t/mysql_client_test.test
+++ b/mysql-test/t/mysql_client_test.test
@@ -6,6 +6,8 @@
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
+call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
+
# We run with different binaries for normal and --embedded-server
#
# If this test fails with "command "$MYSQL_CLIENT_TEST" failed",
diff --git a/mysql-test/t/mysql_client_test_nonblock.test b/mysql-test/t/mysql_client_test_nonblock.test
index fc2e0b1d01b..51263854e58 100644
--- a/mysql-test/t/mysql_client_test_nonblock.test
+++ b/mysql-test/t/mysql_client_test_nonblock.test
@@ -5,6 +5,7 @@
SET @old_general_log= @@global.general_log;
SET @old_slow_query_log= @@global.slow_query_log;
+call mtr.add_suppression(" Error reading file './client_test_db/test_frm_bug.frm'");
# We run with different binaries for normal and --embedded-server
#
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index c0025f9e742..06d702495c2 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -93,6 +93,7 @@ drop view v1;
# Bug#37527: mysqlcheck fails to report entire database
# when frm file corruption
#
+call mtr.add_suppression("Error reading file './test/t1.frm'");
CREATE TABLE t1(a INT) engine=myisam;
CREATE TABLE t2(a INT) engine=myisam;
# backup then null t1.frm
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index 806e6f7f8d1..0f3df10ea70 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -20,11 +20,14 @@ perl;
# their paths may vary:
@skipvars=qw/basedir open-files-limit general-log-file log plugin-dir
log-slow-queries pid-file slow-query-log-file log-basename
- datadir slave-load-tmpdir tmpdir socket/;
+ datadir slave-load-tmpdir tmpdir socket thread-pool-size/;
# Plugins which may or may not be there:
- @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster feedback debug temp-pool ssl des-key-file
- xtradb thread-concurrency super-large-pages mutex-deadlock-detector null-audit maria aria pbxt oqgraph sphinx thread-handling thread-pool/;
+ @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster
+ feedback debug temp-pool ssl des-key-file xtradb sequence
+ thread-concurrency super-large-pages mutex-deadlock-detector
+ null-audit aria pbxt oqgraph sphinx thread-handling
+ test-sql-discovery rpl-semi-sync query-cache-info/;
# And substitute the content some environment variables with their
# names:
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 038907702d5..bad59ff09c3 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2494,3 +2494,31 @@ INSERT INTO t1 VALUES (1),(2),(2),(3),(4);
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
SELECT * from t1 order by i;
DROP TABLE t1;
+
+#
+# Test ALTER TABLE ADD/DROP PARTITION IF EXISTS
+#
+
+CREATE TABLE t1 ( d DATE NOT NULL)
+PARTITION BY RANGE( YEAR(d) ) (
+ PARTITION p0 VALUES LESS THAN (1960),
+ PARTITION p1 VALUES LESS THAN (1970),
+ PARTITION p2 VALUES LESS THAN (1980),
+ PARTITION p3 VALUES LESS THAN (1990)
+);
+
+ALTER TABLE t1 ADD PARTITION IF NOT EXISTS(
+PARTITION `p5` VALUES LESS THAN (2010)
+COMMENT 'APSTART \' APEND'
+);
+
+ALTER TABLE t1 ADD PARTITION IF NOT EXISTS(
+PARTITION `p5` VALUES LESS THAN (2010)
+COMMENT 'APSTART \' APEND'
+);
+
+alter table t1 drop partition if exists p5;
+alter table t1 drop partition if exists p5;
+
+DROP TABLE t1;
+
diff --git a/mysql-test/t/partition_debug_sync.test b/mysql-test/t/partition_debug_sync.test
index 027a4bd19a7..f8c00abafab 100644
--- a/mysql-test/t/partition_debug_sync.test
+++ b/mysql-test/t/partition_debug_sync.test
@@ -60,22 +60,19 @@ CREATE TABLE t2
b INTEGER NOT NULL,
KEY (b))
ENGINE = MYISAM
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (2),
- PARTITION p1 VALUES LESS THAN (20),
- PARTITION p2 VALUES LESS THAN (100),
- PARTITION p3 VALUES LESS THAN MAXVALUE ) */;
+PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (2),
+ PARTITION p1 VALUES LESS THAN (20),
+ PARTITION p2 VALUES LESS THAN (100),
+ PARTITION p3 VALUES LESS THAN MAXVALUE);
SET DEBUG_SYNC= 'alter_table_before_open_tables SIGNAL removing_partitions WAIT_FOR waiting_for_alter';
SET DEBUG_SYNC= 'alter_table_before_rename_result_table WAIT_FOR delete_done';
--send ALTER TABLE t2 REMOVE PARTITIONING
connection default;
--echo # Con default
-SET SESSION debug_dbug= "+d,sleep_before_no_locks_delete_table";
SET DEBUG_SYNC= 'now WAIT_FOR removing_partitions';
SET DEBUG_SYNC= 'rm_table_no_locks_before_delete_table SIGNAL waiting_for_alter';
SET DEBUG_SYNC= 'rm_table_no_locks_before_binlog SIGNAL delete_done';
DROP TABLE IF EXISTS t2;
-SET SESSION debug_dbug= "-d,sleep_before_no_locks_delete_table";
--echo # Con 1
connection con1;
--error ER_NO_SUCH_TABLE
diff --git a/mysql-test/t/partition_disabled.test b/mysql-test/t/partition_disabled.test
index 320d6238502..798fb0aa59e 100644
--- a/mysql-test/t/partition_disabled.test
+++ b/mysql-test/t/partition_disabled.test
@@ -29,7 +29,9 @@ ALTER TABLE t1 ANALYZE PARTITION ALL;
ALTER TABLE t1 REBUILD PARTITION ALL;
ALTER TABLE t1 ENGINE Memory;
ALTER TABLE t1 ADD (new INT);
+--disable_warnings
DROP TABLE t1;
+--enable_warnings
--error ER_OPTION_PREVENTS_STATEMENT
CREATE TABLE t1 (
diff --git a/mysql-test/t/partition_not_windows.test b/mysql-test/t/partition_not_windows.test
index 333e12e2b16..429329c79bb 100644
--- a/mysql-test/t/partition_not_windows.test
+++ b/mysql-test/t/partition_not_windows.test
@@ -199,7 +199,7 @@ DROP TABLE example;
--rmdir $MYSQLTEST_VARDIR/p2Index
--rmdir $MYSQLTEST_VARDIR/p3Index
---error ER_CANT_CREATE_TABLE,1
+--error 1
CREATE TABLE `example` (
`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT,
`DESCRIPTION` varchar(30) NOT NULL,
diff --git a/mysql-test/t/partition_rename_longfilename.test b/mysql-test/t/partition_rename_longfilename.test
index 5e454f01da7..51d9c583f56 100644
--- a/mysql-test/t/partition_rename_longfilename.test
+++ b/mysql-test/t/partition_rename_longfilename.test
@@ -1,4 +1,5 @@
-- source include/not_windows.inc
+-- source include/support_long_file_names.inc
-- source include/have_partition.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index 4412383f837..602b2e3c5c9 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -16,12 +16,13 @@ INSTALL SONAME 'ha_example';
--replace_regex /\.dll/.so/
--query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
-CREATE TABLE t1(a int) ENGINE=EXAMPLE;
+CREATE TABLE t1 (a int) ENGINE=EXAMPLE;
+CREATE TABLE t2 (a int) ENGINE=EXAMPLE;
+FLUSH TABLES;
# Let's do some advanced ops with the example engine :)
SELECT * FROM t1;
-
# a couple of tests for variables
set global example_ulong_var=500;
set global example_enum_var= e1;
@@ -29,12 +30,26 @@ show status like 'example%';
show variables like 'example%';
UNINSTALL SONAME 'ha_example';
+
+# the engine is NOT uninstalled yet,
+# because the table `t1` is open, sitting in the table defintion cache
+
--replace_column 5 #
--replace_regex /\.dll/.so/
--query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
-
DROP TABLE t1;
+# now the engine IS unloaded
+# and the table `t2` belongs to an unknown engine
+
+--replace_column 5 #
+--replace_regex /\.dll/.so/
+--query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
+--error ER_UNKNOWN_STORAGE_ENGINE
+SELECT * FROM t2;
+DROP TABLE t2;
+
+
--error 1305
UNINSTALL PLUGIN EXAMPLE;
@@ -129,6 +144,7 @@ CREATE TABLE t1 (a int) ENGINE=example ULL=1e2;
CREATE TABLE t1 (a int) ENGINE=example ULL=0x1234;
SHOW CREATE TABLE t1;
+SET example_varopt_default=33; # does not affect varopt of t1
select create_options from information_schema.tables where table_schema='test' and table_name='t1';
@@ -137,6 +153,16 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
+create table t1 (a int) engine=example; # varopt is 10
+show create table t1;
+drop table t1;
+
+create table t1 (a int) engine=example varopt=15;
+show create table t1;
+alter table t1 varopt=default;
+show create table t1;
+drop table t1;
+
SET @@SQL_MODE=@OLD_SQL_MODE;
#
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 812b1b5ff94..22cad56a8e4 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -582,10 +582,7 @@ drop table t2;
# cases derived from client_test.c: test_rename()
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
-# rename must fail, t7 does not exist
-# Clean up the filename here because embedded server reports whole path
---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' t7.frm t7
---error ER_FILE_NOT_FOUND
+--error ER_NO_SUCH_TABLE
execute stmt1 ;
create table t7 (a int) ;
# rename, t5 -> t6 and t7 -> t8
diff --git a/mysql-test/t/quick_select_4161.test b/mysql-test/t/quick_select_4161.test
new file mode 100644
index 00000000000..1e746754b41
--- /dev/null
+++ b/mysql-test/t/quick_select_4161.test
@@ -0,0 +1,53 @@
+#
+# MDEV-4161 Assertion `status_var.memory_used == 0' fails in virtual THD::~THD()
+#
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (
+ event_date date DEFAULT '0000-00-00' NOT NULL,
+ type int(11) DEFAULT '0' NOT NULL,
+ event_id int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (event_date,type,event_id)
+);
+
+INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
+('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
+('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
+('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
+('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
+('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
+('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
+('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
+('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
+('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
+('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
+('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
+('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
+('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
+('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
+('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
+('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
+('1999-09-19',100100,37), ('2000-12-18',100700,38);
+
+connect (killee, localhost, root);
+
+let $id=`select connection_id()`;
+
+set debug_sync='inside_make_join_statistics signal killme wait_for done';
+send select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
+
+connection default;
+set debug_sync='now wait_for killme';
+--replace_result $id %connection%
+eval kill $id;
+set debug_sync='now signal done';
+
+connection killee;
+--error 1053,1927,2006,2013
+reap;
+
+connection default;
+disconnect killee;
+
+drop table t1;
+
diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test
index bb90cbafd74..a55bc845acc 100644
--- a/mysql-test/t/rename.test
+++ b/mysql-test/t/rename.test
@@ -21,16 +21,16 @@ rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
select * from t1;
# The following should give errors
---error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
+--error ER_TABLE_EXISTS_ERROR
rename table t1 to t2;
---error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
+--error ER_TABLE_EXISTS_ERROR
rename table t1 to t1;
---error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
+--error ER_TABLE_EXISTS_ERROR
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
show tables like "t_";
---error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
+--error ER_TABLE_EXISTS_ERROR
rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
---error ER_FILE_NOT_FOUND,ER_FILE_NOT_FOUND
+--error ER_NO_SUCH_TABLE
rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
select * from t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 44eaf7130a7..af507b1f7ef 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -4460,5 +4460,24 @@ INSERT INTO t2 VALUES (3),(4);
SELECT * FROM t1, t2 WHERE a=3 AND a=b;
drop table t1,t2;
+--echo #
+--echo # Bug mdev-4250: wrong transformation of WHERE condition with OR
+--echo #
+
+CREATE TABLE t1 (pk int PRIMARY KEY, a int);
+INSERT INTO t1 VALUES (3,0), (2,0), (4,1), (5,0), (1,0);
+
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE (1=2 OR t1.pk=2) AND t1.a <> 0;
+
+DROP TABLE t1;
+
+SELECT * FROM mysql.time_zone
+WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
+ AND Time_zone_id = Time_zone_id
+ OR Time_zone_id <> Time_zone_id )
+ AND Use_leap_seconds <> 'N';
+
--echo End of 5.3 tests
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index c2edef87d41..32bf5417a0a 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -429,7 +429,9 @@ system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
SHOW TABLE STATUS like 't1';
--error ER_NOT_FORM_FILE
show create table t1;
+--disable_warnings
drop table if exists t1;
+--enable_warnings
--error 1,0
--remove_file $MYSQLD_DATADIR/test/t1.frm
diff --git a/mysql-test/t/show_explain.test b/mysql-test/t/show_explain.test
index 051d4b8b5fc..41091d7f5b9 100644
--- a/mysql-test/t/show_explain.test
+++ b/mysql-test/t/show_explain.test
@@ -466,7 +466,7 @@ explain SELECT * FROM t2 WHERE a =
WHERE pk= (SELECT MAX(pk) FROM t2 WHERE pk = 3)
);
-set @show_explain_probe_select_id=2;
+set @show_explain_probe_select_id=1;
set debug_dbug='+d,show_explain_probe_do_select';
send SELECT * FROM t2 WHERE a =
(SELECT MAX(a) FROM t2
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 12b0f903c26..e109f88e3f9 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -7,9 +7,6 @@
# In the case of trouble you might want to skip this.
#
-# embedded server returns different paths in error messages
-# in lines like 'call bug14233();'
-# mysqltest should be fixed to allow REPLACE_RESULT in error message
-- source include/not_embedded.inc
# Supress warnings written to the log file
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 37f660d6682..e427253f65f 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -1865,5 +1865,18 @@ ORDER BY alias1.b;
drop table t1, t2, t3;
+--echo #
+--echo # MDEV-4144 simple subquery causes full scan instead of range scan
+--echo #
+
+CREATE TABLE t1 (id int not null auto_increment, x int not null, primary key(id));
+INSERT INTO t1 (x) VALUES (0),(0),(0);
+
+EXPLAIN
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+
+drop table t1;
+
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
diff --git a/mysql-test/t/subselect_exists2in.test b/mysql-test/t/subselect_exists2in.test
new file mode 100644
index 00000000000..94e7109e9d2
--- /dev/null
+++ b/mysql-test/t/subselect_exists2in.test
@@ -0,0 +1,739 @@
+
+--disable_warnings
+drop table if exists t1,t2,t3;
+--enable_warnings
+
+set optimizer_switch='exists_to_in=on';
+--echo #
+--echo # LP BUG#884644 exists2in broke name resolution
+--echo #
+
+CREATE TABLE t1 (f1 integer);
+
+--error ER_BAD_FIELD_ERROR
+SELECT * FROM t1 WHERE EXISTS (SELECT NO_SUCH_TABLE.NO_SUCH_FIELD FROM t1);
+
+drop table t1;
+
+--echo #
+--echo # LP BUG#884657 Wrong result with exists2in , correlated subquery
+--echo #
+
+CREATE TABLE t1 ( a varchar(1)) ;
+INSERT INTO t1 VALUES ('c'),('b');
+
+CREATE TABLE t2 ( b varchar(1)) ;
+INSERT INTO t2 VALUES ('v'),('v'),('c'),(NULL),('x'),('i'),('e'),('p'),('s'),('j'),('z'),('c'),('a'),('q'),('y'),(NULL),('r'),('v'),(NULL),('r');
+
+CREATE TABLE t3 ( a int NOT NULL , b varchar(1)) ;
+INSERT INTO t3 VALUES (29,'c');
+
+SELECT *
+FROM t1, t2
+WHERE EXISTS (
+ SELECT a
+ FROM t3
+ WHERE t3.b = t1.a
+ AND t3.b <> t2.b
+);
+
+
+INSERT INTO t3 VALUES (2,'c');
+alter table t1 add index aa (a);
+alter table t3 add index bb (b);
+--echo -- EXIST to IN then semijoin (has priority over IN to EXISTS)
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+--echo -- EXIST to IN then IN to EXISTS
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+--echo -- EXIST2IN then MATERIALIZATION
+set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+--echo -- NO EXIST2IN
+set optimizer_switch='exists_to_in=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t3 WHERE t3.b = t1.a);
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+drop table t1,t2,t3;
+
+--echo #
+--echo # From group_min_max.test
+--echo #
+create table t1 (
+ a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' '
+);
+
+insert into t1 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),
+('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),
+('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),
+('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),
+('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');
+
+create index idx_t1_0 on t1 (a1);
+create index idx_t1_1 on t1 (a1,a2,b,c);
+create index idx_t1_2 on t1 (a1,a2,b);
+analyze table t1;
+
+# t2 is the same as t1, but with some NULLs in the MIN/MAX column, and
+# one more nullable attribute
+
+create table t2 (
+ a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' '
+);
+insert into t2 select * from t1;
+# add few rows with NULL's in the MIN/MAX column
+insert into t2 (a1, a2, b, c, d) values
+('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
+('a','a','a',NULL,'xyz'),
+('a','a','b',NULL,'xyz'),
+('a','b','a',NULL,'xyz'),
+('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
+('d','b','b',NULL,'xyz'),
+('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
+('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),
+('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),
+('a','a','a',NULL,'xyz'),
+('a','a','b',NULL,'xyz'),
+('a','b','a',NULL,'xyz'),
+('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),
+('d','b','b',NULL,'xyz'),
+('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),
+('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz');
+
+create index idx_t2_0 on t2 (a1);
+create index idx_t2_1 on t2 (a1,a2,b,c);
+create index idx_t2_2 on t2 (a1,a2,b);
+analyze table t2;
+
+# Table t3 is the same as t1, but with smaller column lenghts.
+# This allows to test different branches of the cost computation procedure
+# when the number of keys per block are less than the number of keys in the
+# sub-groups formed by predicates over non-group attributes.
+
+create table t3 (
+ a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' '
+);
+
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+insert into t3 (a1, a2, b, c, d) values
+('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),
+('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),
+('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),
+('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),
+('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),
+('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),
+('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),
+('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),
+('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),
+('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),
+('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),
+('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');
+
+create index idx_t3_0 on t3 (a1);
+create index idx_t3_1 on t3 (a1,a2,b,c);
+create index idx_t3_2 on t3 (a1,a2,b);
+analyze table t3;
+
+
+explain select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+ where t2.c in (select c from t3 where t3.c > t1.b) and
+ t2.c > 'b1' )
+group by a1,a2,b;
+
+select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+ where t2.c in (select c from t3 where t3.c > t1.b) and
+ t2.c > 'b1' )
+group by a1,a2,b;
+
+explain select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+ where t2.c in (select c from t3 where t3.c > t1.c) and
+ t2.c > 'b1' )
+group by a1,a2,b;
+
+select a1,a2,b,c,min(c), max(c) from t1
+where exists ( select * from t2
+ where t2.c in (select c from t3 where t3.c > t1.c) and
+ t2.c > 'b1' )
+group by a1,a2,b;
+
+drop table t1, t2, t3;
+
+#
+# LP BUG#901835 - incorrect semi-join conversion after exists2in
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (7),(0);
+CREATE TABLE t2 ( b INT );
+INSERT INTO t2 VALUES (0),(8);
+
+SELECT * FROM t1 WHERE
+ EXISTS ( SELECT * FROM t2 WHERE b = a )
+ OR a > 0;
+
+explain extended
+SELECT * FROM t1 WHERE
+ EXISTS ( SELECT * FROM t2 WHERE b = a )
+ OR a > 0;
+
+drop tables t1,t2;
+
+#
+# NOT EXISTS test
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1),(5);
+CREATE TABLE t2 ( b INT ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1);
+
+CREATE TABLE t3 ( c INT );
+INSERT INTO t3 VALUES (4),(5);
+
+SET optimizer_switch='exists_to_in=on,subquery_cache=off,materialization=on,in_to_exists=off,semijoin=off';
+
+explain extended
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+
+SET optimizer_switch='exists_to_in=on,subquery_cache=off';
+
+
+explain extended
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+
+SET optimizer_switch='exists_to_in=off,subquery_cache=off';
+
+explain extended
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
+
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+drop table t1,t2,t3;
+
+--echo # multi condition test
+CREATE TABLE t1 ( a varchar(1), a1 varchar(1)) ;
+INSERT INTO t1 VALUES ('c', 'c'), ('b', 'b');
+
+CREATE TABLE t3 ( a int NOT NULL , b varchar(1), b1 varchar(1)) ;
+INSERT INTO t3 VALUES (29,'c','c');
+INSERT INTO t3 VALUES (2,'c','c');
+alter table t1 add index aa (a,a1);
+alter table t3 add index bb (b,b1);
+--echo -- EXIST to IN then semijoin (has priority over IN to EXISTS)
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=on,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+--echo -- EXIST to IN then IN to EXISTS
+set optimizer_switch='exists_to_in=on,in_to_exists=on,semijoin=off,materialization=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+--echo -- EXIST2IN then MATERIALIZATION
+set optimizer_switch='exists_to_in=on,in_to_exists=off,semijoin=off,materialization=on,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+--echo -- NO EXIST2IN
+set optimizer_switch='exists_to_in=off,subquery_cache=off';
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+explain extended
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t3 WHERE t3.b = t1.a and t3.b1 = t1.a1);
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+drop table t1,t3;
+
+--echo #
+--echo # MDEV-159 Assertion about not marked for read failed in
+--echo # String* Field_varstring::val_str(String*, String*)
+--echo #
+
+SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
+SET optimizer_switch='in_to_exists=on,exists_to_in=on';
+
+CREATE TABLE t1 ( a VARCHAR(1) );
+INSERT INTO t1 VALUES ('k'),('m');
+
+CREATE TABLE t2 ( b INT,
+ c VARCHAR(1),
+ d VARCHAR(1) NOT NULL );
+
+INSERT INTO t2 VALUES
+ (4,'j','j'),(6,'v','v');
+
+CREATE ALGORITHM=MERGE VIEW v AS SELECT * FROM t2 WHERE b < 1;
+
+SELECT c FROM v
+WHERE EXISTS (
+ SELECT * FROM t1, t2
+ WHERE a <= v.d AND b = v.b
+);
+
+explain extended
+SELECT c FROM v
+WHERE EXISTS (
+ SELECT * FROM t1, t2
+ WHERE a <= v.d AND b = v.b
+);
+
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+drop view v;
+drop table t1,t2;
+
+
+--echo #
+--echo # MDEV-160 Exists2In: Crash in in hp_movelink with subquery_cache=ON
+--echo #
+
+SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
+
+CREATE TABLE t1 (
+ a VARCHAR(3) NOT NULL,
+ b VARCHAR(50)
+);
+INSERT INTO t1 VALUES
+ ('USA','Chinese'),('USA','English'),
+ ('FRA','French'),('ITA','Italian');
+
+CREATE TABLE t2 ( c VARCHAR(3) );
+INSERT INTO t2 VALUES ('USA'),('FRA');
+
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+ SELECT * FROM t1, t2
+ WHERE a <= alias2.a AND c = alias1.b
+) OR alias1 .a = 'foo';
+
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+ SELECT * FROM t1, t2
+ WHERE a <= alias2.a AND c = alias1.a
+) OR alias1 .a = 'foo';
+
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+--echo #
+--echo # MDEV-160 Exists2In: Crash in in hp_movelink with subquery_cache=ON
+--echo #
+SET optimizer_switch = 'in_to_exists=on,subquery_cache=on,exists_to_in=on';
+
+CREATE TABLE t1 (
+ a VARCHAR(3) NOT NULL,
+ b VARCHAR(50)
+);
+INSERT INTO t1 VALUES
+ ('USA','Chinese'),('USA','English'),
+ ('FRA','French'),('ITA','Italian');
+
+CREATE TABLE t2 ( c VARCHAR(3) );
+INSERT INTO t2 VALUES ('USA'),('FRA');
+
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+ SELECT * FROM t1, t2
+ WHERE a <= alias2.a AND c = alias1.b
+) OR alias1 .a = 'foo';
+
+explain extended
+SELECT * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS (
+ SELECT * FROM t1, t2
+ WHERE a <= alias2.a AND c = alias1.b
+) OR alias1 .a = 'foo';
+
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+--echo #
+--echo # MDEV-245 Exists2In: Wrong result (extra rows) with
+--echo # exists_to_in=ON, materialization=OFF, NOT EXISTS subquery
+--echo #
+SET optimizer_switch='materialization=off,exists_to_in=on';
+
+CREATE TABLE t1 ( a INT ) ;
+INSERT INTO t1 VALUES (0),(8),(1);
+
+CREATE TABLE t2 ( b INT ) ;
+INSERT INTO t2 VALUES (1),(2),(3);
+
+SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b = a );
+explain extended
+SELECT * FROM t1 WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b = a );
+
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+--echo #
+--echo # MDEV-243 Wrong result (extra or missing rows) with
+--echo # exists_to_in + materialization, EXISTS subquery
+--echo #
+
+SET optimizer_switch='index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=off,exists_to_in=on';
+
+CREATE TABLE t1 ( a VARCHAR(1), b VARCHAR(1) );
+INSERT INTO t1 VALUES ('v','v'),('s','v');
+
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+explain extended
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+
+SET optimizer_switch = REPLACE( @@optimizer_switch, '=on', '=off' );
+SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=off';
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+explain extended
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+SET optimizer_switch = 'exists_to_in=on,materialization=on,semijoin=on';
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+explain extended
+SELECT * FROM t1 AS alias
+WHERE EXISTS ( SELECT * FROM t1 WHERE a > alias.a AND a = alias.b );
+
+drop table t1;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+--echo #
+--echo # MDEV-403 Wrong result (missing rows) with subquery in
+--echo # EXISTS and an OR condition outside
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (2),(3);
+
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(3);
+SET optimizer_switch = 'exists_to_in=off,in_to_exists=on';
+SELECT * FROM t1 AS alias1, t2 AS alias2
+WHERE EXISTS (
+ SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
+) OR a = 5;
+
+SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
+
+SELECT * FROM t1 AS alias1, t2 AS alias2
+WHERE EXISTS (
+ SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
+) OR a = 5;
+
+explain extended
+SELECT * FROM t1 AS alias1, t2 AS alias2
+WHERE EXISTS (
+ SELECT 1 FROM t2 WHERE b = alias1.a AND b > alias2.b
+) OR a = 5;
+
+drop table t1, t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+--echo #
+--echo # MDEV-404: Wrong result (extra rows) with STRAIGHT_JOIN,
+--echo # EXISTS subquery, NOT NULL column
+--echo # (same as above)
+--echo #
+SET optimizer_switch = 'exists_to_in=on,in_to_exists=on';
+
+CREATE TABLE t1 (a INT, b VARCHAR(1) NOT NULL);
+INSERT INTO t1 VALUES (1,'s'),(2,'e');
+
+SELECT STRAIGHT_JOIN * FROM t1 AS alias1, t1 AS alias2
+WHERE EXISTS ( SELECT 1 FROM t1 WHERE b < alias2.b AND a = alias1.a );
+
+drop table t1;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+
+--echo #
+--echo # MDEV-3800: ORDER BY doesn't work with exists_to_in=ON on
+--echo # a query with EXISTS subquery and OR condition
+--echo #
+SET optimizer_switch = 'in_to_exists=on,exists_to_in=on';
+CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'j'),(6,'v'),(3,'c');
+
+CREATE TABLE t2 (c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('b'),('y');
+
+SELECT a FROM t1
+WHERE EXISTS (
+ SELECT 1 FROM t2 WHERE c = b
+) OR b NOT IN ('U')
+ORDER BY a;
+
+select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`b` in (select `test`.`t2`.`c` from `test`.`t2` where 1 ) or (`test`.`t1`.`b` <> 'U') order by `test`.`t1`.`a`;
+
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+
+--echo #
+--echo # correct calculation of reserved items (postreview-fix)
+--echo #
+create table t1 (col1 int, col2 int, col3 int);
+insert into t1 values (1,2,3),(2,3,4),(4,5,6);
+create table t2 as select * from t1;
+explain extended
+select * from t1 where exists (select col2 from t2 where t2.col1=t1.col1 and t2.col2=t1.col2);
+select * from t1 where exists (select col2 from t2 where t2.col1=t1.col1 and t2.col2=t1.col2);
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-3879: Exists2In: Wrong result (extra row) and unexpected
+--echo # warning with exists_to_in=on and a NOT EXISTS subquery
+--echo #
+SET optimizer_switch = 'exists_to_in=on';
+
+CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (3,'y'),(6,'w');
+
+CREATE TABLE t2 (a2 INT, b2 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3,'y'),(6,'d');
+
+SELECT * FROM t1
+WHERE NOT EXISTS ( SELECT * FROM t2 WHERE b2 = b1 AND a2 = a1 );
+
+drop table t1, t2;
+
+--echo #
+--echo # MDEV-3880: Wrong result (missing rows) with exists_to_in=on,
+--echo # LEFT JOIN and NOT EXISTS subquery.
+--echo # (Duplicate of above MDEV-3879).
+--echo #
+
+SET optimizer_switch = 'exists_to_in=on';
+CREATE TABLE t1 (a1 INT, b1 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'b'),(5,'y');
+
+CREATE TABLE t2 (b2 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('z'),('b');
+
+CREATE TABLE t3 (a3 INT, b3 CHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4,'j'),(6,'v');
+
+SELECT * FROM t1 LEFT JOIN t2 ON ( b2 = b1 )
+WHERE NOT EXISTS ( SELECT * FROM t3 WHERE b3 = b2 AND a3 = a1 ) ;
+
+drop table t1, t2, t3;
+
+
+
+--echo #
+--echo # MDEV-3881: Endless loop and crash in Item_ref::real_item with
+--echo # exists_to_in=on, NOT EXISTS subquery, merge view or from subquery,
+--echo # constant table
+--echo #
+SET optimizer_switch = 'exists_to_in=on';
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(7);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8);
+CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2;
+
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4),(6);
+
+SELECT * FROM t1, v1 WHERE NOT EXISTS ( SELECT * FROM t3 WHERE c = b ) AND a = b;
+
+drop view v1;
+drop table t1, t2, t3;
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(7);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8);
+
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4),(6);
+
+SELECT * FROM t1, ( SELECT * FROM t2 ) alias WHERE NOT EXISTS ( SELECT * FROM t3 WHERE c = b ) AND a = b;
+
+drop table t1, t2, t3;
+
+--echo #
+--echo # MDEV-3906: Server crashes in Dependency_marker::visit_field
+--echo # on 2nd execution of PS with exists_to_in and NOT EXISTS subquery
+--echo #
+SET optimizer_switch='exists_to_in=on';
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(7);
+
+PREPARE stmt FROM '
+SELECT * FROM t1 AS alias
+WHERE NOT EXISTS ( SELECT * FROM t1 WHERE t1.a = alias.a )
+';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+drop table t1;
+
+--echo #
+--echo # MDEV-3904: Assertion `in_subs->has_strategy()' failed in
+--echo # JOIN::choose_subquery_plan on 2nd execution of PS with
+--echo # exists_to_in+semijoin, EXISTS subquery, MERGE view or FROM subquery
+--echo #
+SET optimizer_switch='in_to_exists=on,semijoin=on,exists_to_in=on';
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4),(6);
+
+CREATE ALGORITHM=MERGE VIEW v AS
+SELECT * FROM t1 WHERE EXISTS ( SELECT * FROM t2 WHERE b = a );
+
+PREPARE stmt FROM ' SELECT * FROM v ';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+drop view v;
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+--echo #
+--echo # MDEV-3903: Server crashes in Item_cond::fix_fields on 2nd execution
+--echo # of a prepared stmt with exists_to_in+materialization+semijoin,
+--echo # EXISTS subquery, STRAIGHT_JOIN
+--echo #
+
+SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+
+PREPARE stmt FROM
+'SELECT STRAIGHT_JOIN * FROM t1
+WHERE EXISTS ( SELECT * FROM t2 WHERE b = a )';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+drop table t1,t2;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+--echo #
+--echo # MDEV-4152: Wrong result (missing rows) with exists_to_in=on,
+--echo # inner joins
+--echo #
+SET optimizer_switch='materialization=on,semijoin=on,exists_to_in=on';
+
+CREATE TABLE t1 (i INT, c1 CHAR(5), c2 CHAR(5), t1_field VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,'test1','test2','f'), (2,'test3','test4','d');
+
+CREATE TABLE t2 (t2_field VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('m'), ('b');
+
+CREATE TABLE t3 (t3_field VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('b'),('c');
+
+SELECT * FROM t1, t2 outer_t2
+WHERE EXISTS ( SELECT 1 FROM t2, t3 WHERE t3_field = outer_t2.t2_field AND t2_field <= t1_field );
+
+drop table t1,t2,t3;
+set optimizer_switch=default;
+set optimizer_switch='exists_to_in=on';
+
+#restore defaults
+set optimizer_switch=default;
diff --git a/mysql-test/t/subselect_exists2in_costmat.test b/mysql-test/t/subselect_exists2in_costmat.test
new file mode 100644
index 00000000000..5d5eeaee268
--- /dev/null
+++ b/mysql-test/t/subselect_exists2in_costmat.test
@@ -0,0 +1,83 @@
+#
+# Tests of cost-based choice between the materialization and in-to-exists
+# subquery execution strategies (MWL#89)
+#
+# The test file is divided into two groups of tests:
+# A. Typical cases when either of the two strategies is selected:
+# 1. Subquery in disjunctive WHERE clause of the outer query.
+# 2. NOT IN subqueries
+# 3. Subqueries with GROUP BY, HAVING, and aggregate functions
+# 4. Subqueries in the SELECT and HAVING clauses
+# 5. Subqueries with UNION
+# B. Reasonably exhaustive tests of the various combinations of optimizer
+# switches, data distribution, available indexes, and typical queries.
+#
+
+set @subselect_mat_cost=@@optimizer_switch;
+set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
+#
+# Test logging to slow log (there was some errors in the log files about
+# the slow log when running under valgrind, so better to get this tested)
+#
+set long_query_time=0.1;
+
+
+--disable_warnings
+drop database if exists world;
+--enable_warnings
+
+set names utf8;
+
+create database world;
+use world;
+
+--source include/world_schema.inc
+--disable_query_log
+--disable_result_log
+--disable_warnings
+--source include/world.inc
+--enable_warnings
+--enable_result_log
+--enable_query_log
+
+-- echo Make the schema and data more diverse by adding more indexes, nullable
+-- echo columns, and NULL data.
+create index SurfaceArea on Country(SurfaceArea);
+create index Language on CountryLanguage(Language);
+create index CityName on City(Name);
+alter table City change population population int(11) null default 0;
+
+select max(id) from City into @max_city_id;
+insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL);
+
+
+SELECT COUNT(*) FROM Country;
+SELECT COUNT(*) FROM City;
+SELECT COUNT(*) FROM CountryLanguage;
+
+set @@optimizer_switch = 'exists_to_in=on,in_to_exists=on,semijoin=on,materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on';
+
+-- echo
+-- echo 1. Subquery in a disjunctive WHERE clause of the outer query.
+-- echo
+
+-- echo
+-- echo Q1.1m:
+-- echo MATERIALIZATION: there are too many rows in the outer query
+-- echo to be looked up in the inner table.
+EXPLAIN
+SELECT Name FROM Country
+WHERE (EXISTS (select 1 from City where City.Population > 100000 and
+Code = Country) OR
+ Name LIKE 'L%') AND
+ surfacearea > 1000000;
+
+SELECT Name FROM Country
+WHERE (EXISTS (select 1 from City where City.Population > 100000 and
+Code = Country) OR
+ Name LIKE 'L%') AND
+ surfacearea > 1000000;
+
+drop database world;
+
+set optimizer_switch=@subselect_mat_cost;
diff --git a/mysql-test/t/subselect_exists_to_in.test b/mysql-test/t/subselect_exists_to_in.test
new file mode 100644
index 00000000000..1b97aa13955
--- /dev/null
+++ b/mysql-test/t/subselect_exists_to_in.test
@@ -0,0 +1,11 @@
+#
+# Run subselect.test with exists to in transformation
+#
+select @@optimizer_switch like '%exists_to_in=on%';
+set optimizer_switch='exists_to_in=on';
+
+--source t/subselect.test
+
+set optimizer_switch=default;
+select @@optimizer_switch like '%exists_to_in=on%';
+
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index efbd2b00f24..e2abb8040b3 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2482,6 +2482,15 @@ deallocate prepare stmt;
drop table t1,t2;
--echo #
+--echo # MDEV-4335: Unexpected results when selecting on information_schema
+--echo #
+CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
+INSERT INTO t1 VALUES ('mysql'),('information_schema');
+SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
+DROP TABLE t1;
+
+
+--echo #
--echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null
--echo #
diff --git a/mysql-test/t/subselect_sj2_mat.test b/mysql-test/t/subselect_sj2_mat.test
index 7c3b37b517a..61d9b09edff 100644
--- a/mysql-test/t/subselect_sj2_mat.test
+++ b/mysql-test/t/subselect_sj2_mat.test
@@ -36,4 +36,230 @@ WHERE a IN
DROP TABLE t1, t2;
set max_join_size= @tmp_906385;
+--echo #
+--echo # mdev-3995: Wrong result for semijoin with materialization
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+CREATE TABLE t1 (
+ cat_id int(10) unsigned NOT NULL,
+ PRIMARY KEY (cat_id)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES
+(709411),(709412),(709413),(709414),(709416),(709417),(709418),(709419),(709421),(709422),
+(709424),(709425),(709427),(709428),(709429),(709431),(709432),(709433),(709434),(709435),
+(709438),(709439),(709441),(709442),(709443),(709444),(709445),(709446),(709447),(709450),
+(709451),(709454),(709455),(709456),(709457),(709459),(709460),(709461),(709462),(709463),
+(709464),(709465),(709467),(709469),(709470),(709471),(709472),(709473),(709474),(709475),
+(709476),(709477),(709478),(709479),(709480),(709481),(709483),(709484),(709485),(709487),
+(709490),(709491),(709492),(709493),(709494),(709495),(709496),(709497),(709498),(709499),
+(709500),(709501),(709502),(709503),(709504),(709505),(709506),(709507),(709509),(709510),
+(709511),(709512),(709513),(709514),(709515),(709516),(709517),(709518),(709519),(709520),
+(709521),(709522),(709523),(709524),(709525),(709526),(709527),(709528),(709529),(709530),
+(709531),(709532),(709533),(709534),(709535),(709536),(709537),(709538),(709539),(709540),
+(709541),(709542),(709543),(709544),(709545),(709546),(709548),(709549),(709551),(709552),
+(709553),(709555),(709556),(709557),(709558),(709559),(709560),(709561),(709562),(709563),
+(709564),(709565),(709566),(709567),(709568),(709569),(709570),(709571),(709572),(709573),
+(709574),(709575),(709576),(709577),(709578),(709579),(709580),(709581),(709582),(709583),
+(709584),(709585),(709586),(709587),(709588),(709590),(709591),(709592),(709593),(709594),
+(709595),(709596),(709597),(709598),(709600),(709601),(709602),(709603),(709604),(709605),
+(709606),(709608),(709609),(709610),(709611),(709612),(709613),(709614),(709615),(709616),
+(709617),(709618),(709619),(709620),(709621),(709622),(709623),(709624),(709625),(709626),
+(709627),(709628),(709629),(709630),(709631),(709632),(709633),(709634),(709635),(709637),
+(709638),(709639),(709640),(709641),(709642),(709643),(709644),(709645),(709646),(709649),
+(709650),(709651),(709652),(709653),(709654),(709655),(709656),(709657),(709658),(709659);
+
+CREATE TABLE t2 (
+ cat_id int(10) NOT NULL,
+ KEY cat_id (cat_id)
+) ENGINE=MyISAM;
+
+INSERT INTO t2 VALUES
+(708742),(708755),(708759),(708761),(708766),(708769),(708796),(708798),(708824),(708825),
+(708838),(708844),(708861),(708882),(708887),(708889),(708890),(709586),(709626);
+
+CREATE TABLE t3 (
+ sack_id int(10) unsigned NOT NULL,
+ kit_id tinyint(3) unsigned NOT NULL DEFAULT '0',
+ cat_id int(10) unsigned NOT NULL,
+ PRIMARY KEY (sack_id,kit_id,cat_id)
+) ENGINE=MyISAM;
+
+INSERT INTO t3 VALUES
+(33479,6,708523),(33479,6,708632),(33479,6,709085),(33479,6,709586),(33479,6,709626);
+
+CREATE TABLE t4 (
+ cat_id int(10) unsigned NOT NULL,
+ KEY cat_id (cat_id)
+) ENGINE=MyISAM;
+
+INSERT INTO t4 (cat_id) SELECT cat_id from t2;
+
+set optimizer_switch='materialization=off';
+
+EXPLAIN
+SELECT count(*) FROM t1, t3
+ WHERE t1.cat_id = t3.cat_id AND
+ t3.cat_id IN (SELECT cat_id FROM t2) AND
+ t3.sack_id = 33479 AND t3.kit_id = 6;
+
+SELECT count(*) FROM t1, t3
+ WHERE t1.cat_id = t3.cat_id AND
+ t3.cat_id IN (SELECT cat_id FROM t2) AND
+ t3.sack_id = 33479 AND t3.kit_id = 6;
+
+set optimizer_switch='materialization=on';
+
+EXPLAIN
+SELECT count(*) FROM t1, t3
+ WHERE t1.cat_id = t3.cat_id AND
+ t3.cat_id IN (SELECT cat_id FROM t4) AND
+ t3.sack_id = 33479 AND t3.kit_id = 6;
+
+SELECT count(*) FROM t1, t3
+ WHERE t1.cat_id = t3.cat_id AND
+ t3.cat_id IN (SELECT cat_id FROM t4) AND
+ t3.sack_id = 33479 AND t3.kit_id = 6;
+
+EXPLAIN
+SELECT count(*) FROM t1, t3
+ WHERE t1.cat_id = t3.cat_id AND
+ t3.cat_id IN (SELECT cat_id FROM t2) AND
+ t3.sack_id = 33479 AND t3.kit_id = 6;
+
+SELECT count(*) FROM t1, t3
+ WHERE t1.cat_id = t3.cat_id AND
+ t3.cat_id IN (SELECT cat_id FROM t2) AND
+ t3.sack_id = 33479 AND t3.kit_id = 6;
+
+
+DROP TABLE t1,t2,t3,t4;
+
+set optimizer_switch=@save_optimizer_switch;
+
+--echo #
+--echo # mdev-3913: LEFT JOIN with materialized multi-table IN subquery in WHERE
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+CREATE TABLE t1 (a1 char(1), b1 char(1), index idx(b1,a1));
+INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y');
+INSERT INTO t1 VALUES ('f','c'),('d','m'),('g','y');
+
+CREATE TABLE t2 (a2 char(1), b2 char(1));
+INSERT INTO t2 VALUES ('y','y'),('y','y'),('w','w');
+
+CREATE TABLE t3 (a3 int);
+INSERT INTO t3 VALUES (8),(6);
+
+CREATE TABLE t4 (a4 char(1), b4 char(1));
+INSERT INTO t4 VALUES ('y','y'),('y','y'),('w','w');
+
+set optimizer_switch='materialization=off';
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+ WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+ WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+
+set optimizer_switch='materialization=on';
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+ WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+SELECT * FROM t1 LEFT JOIN t2 ON ( b1 = a2 )
+ WHERE ( b1, b1 ) IN ( SELECT a4, b4 FROM t3, t4);
+
+DROP TABLE t1,t2,t3,t4;
+
+set optimizer_switch=@save_optimizer_switch;
+
+--echo #
+--echo # mdev-4172: LEFT JOIN with materialized multi-table IN subquery in WHERE
+--echo # and OR in ON condition
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+CREATE TABLE t1 (a1 int, c1 varchar(1));
+INSERT t1 VALUES (7,'v'), (3,'y');
+
+CREATE TABLE t2 (c2 varchar(1));
+INSERT INTO t2 VALUES ('y'), ('y');
+
+CREATE TABLE t3 (c3 varchar(1));
+INSERT INTO t3 VALUES
+ ('j'), ('v'), ('c'), ('m'), ('d'),
+ ('d'), ('y'), ('t'), ('d'), ('s');
+
+CREATE TABLE t4 (a4 int, c4 varchar(1));
+INSERT INTO t4 SELECT * FROM t1;
+
+set optimizer_switch='materialization=off';
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+ WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+ WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+
+set optimizer_switch='materialization=on';
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+ WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z')
+ WHERE c1 IN ( SELECT c4 FROM t3,t4 WHERE c3 = c4);
+
+DROP TABLE t1,t2,t3,t4;
+
+set optimizer_switch=@save_optimizer_switch;
+
+--echo #
+--echo # mdev-4177: materialization of a subquery whose WHERE condition is OR
+--echo # formula with two disjucts such that the second one is always false
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+set @save_join_cache_level=@@join_cache_level;
+
+CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1), (7), (4), (8), (4);
+
+CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7), (5);
+
+CREATE TABLE t3 (i3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (7), (2), (9);
+
+set join_cache_level=3;
+
+set optimizer_switch='materialization=off,semijoin=off';
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+
+set optimizer_switch='materialization=on,semijoin=on';
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+SELECT * FROM t1 WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 = i2 OR 1=2);
+
+EXPLAIN EXTENDED
+SELECT * FROM t1
+ WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
+SELECT * FROM t1
+ WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
+SELECT * FROM t1
+ WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 7 AND i3 = i2 OR 1=2);
+
+DROP TABLE t1,t2,t3;
+
+set join_cache_level= @save_join_cache_level;
+set optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test
index d3710056c9a..fee406ee46d 100644
--- a/mysql-test/t/sum_distinct-big.test
+++ b/mysql-test/t/sum_distinct-big.test
@@ -3,15 +3,23 @@
#
--source include/big_test.inc
+--source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
+set @save_tmp_table_size=@@tmp_table_size;
+set @save_max_heap_table_size=@@max_heap_table_size;
+
+set @save_storage_engine=@@storage_engine;
+
#
# Test the case when distinct values doesn't fit in memory and
# filesort is used (see uniques.cc:merge_walk)
#
+set storage_engine=MYISAM;
+
CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER);
@@ -82,3 +90,64 @@ SELECT SUM(DISTINCT id) sm FROM t2;
DROP TABLE t1;
DROP TABLE t2;
+
+SET @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=@save_max_heap_table_size;
+
+--echo #
+--echo # Bug mdev-4311: COUNT(DISTINCT...) requiring a file for Unique
+--echo # (bug #68749)
+--echo #
+
+set @save_storage_engine=@@storage_engine;
+set storage_engine=INNODB;
+
+CREATE TABLE t1 (id INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (id INTEGER) ENGINE=InnoDB;
+
+INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 SELECT id+1 FROM t1;
+INSERT INTO t1 SELECT id+2 FROM t1;
+INSERT INTO t1 SELECT id+4 FROM t1;
+INSERT INTO t1 SELECT id+8 FROM t1;
+INSERT INTO t1 SELECT id+16 FROM t1;
+INSERT INTO t1 SELECT id+32 FROM t1;
+INSERT INTO t1 SELECT id+64 FROM t1;
+INSERT INTO t1 SELECT id+128 FROM t1;
+INSERT INTO t1 SELECT id+256 FROM t1;
+INSERT INTO t1 SELECT id+512 FROM t1;
+INSERT INTO t1 SELECT id+1024 FROM t1;
+INSERT INTO t1 SELECT id+2048 FROM t1;
+INSERT INTO t1 SELECT id+4096 FROM t1;
+INSERT INTO t1 SELECT id+8192 FROM t1;
+
+INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t2 VALUE(NULL);
+
+--echo # With default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+set @@tmp_table_size=1024*256;
+
+--echo # With reduced tmp_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+set @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=1024*256;
+
+--echo # With reduced max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+SET @@max_heap_table_size=@save_max_heap_table_size;
+
+--echo # Back to default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+DROP TABLE t1,t2;
+
+set storage_engine=@save_storage_engine;
diff --git a/mysql-test/t/temporal_scale_4283.test b/mysql-test/t/temporal_scale_4283.test
new file mode 100644
index 00000000000..d79ca7caa54
--- /dev/null
+++ b/mysql-test/t/temporal_scale_4283.test
@@ -0,0 +1,13 @@
+#
+# MDEV-4283 Assertion `scale <= precision' fails in strings/decimal.c
+#
+create table t1 (a int);
+insert into t1 values (4),(8);
+select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1;
+drop table t1;
+
+create table t1 (i int);
+insert into t1 values (2),(4);
+select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1;
+drop table t1;
+
diff --git a/mysql-test/t/truncate_badse.test b/mysql-test/t/truncate_badse.test
new file mode 100644
index 00000000000..71545cab11a
--- /dev/null
+++ b/mysql-test/t/truncate_badse.test
@@ -0,0 +1,15 @@
+#
+# test what TRUNCATE TABLE does, if the table was created in
+# now-unknown storage engine.
+#
+--source include/have_example_plugin.inc
+install plugin example soname 'ha_example';
+create table t1 (a int) engine=example;
+select 1;
+uninstall plugin example;
+flush tables;
+select count(*) from information_schema.plugins where plugin_name='example';
+--error ER_UNKNOWN_STORAGE_ENGINE
+truncate table t1;
+drop table t1;
+
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 989e0d29210..d1648254fb2 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -463,6 +463,16 @@ DROP TABLE t1;
--echo End of 5.1 tests
+#
+# MDEV-4281 Assertion `maybe_null && item->null_value' fails in make_sortkey on CASE with different return types, GROUP_CONCAT, GROUP BY
+#
+create table t1 (d date, t time) engine=myisam;
+insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31');
+select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond;
+drop table t1;
+
+--echo End of 5.3 tests
+
--echo #
--echo # Start of 5.5 tests
--echo #
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 2043342e2c8..5b0b70631a5 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -221,3 +221,18 @@ SELECT a FROM t1 WHERE a=0;
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # MDEV-4241: Assertion failure: scale >= 0 && precision > 0 &&
+--echo # scale <= precision in decimal_bin_size
+--echo #
+CREATE TABLE t1 (
+ f1 enum('1','2','3','4','5')
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+--enable_metadata
+SELECT AVG(f1) FROM t1;
+--disable_metadata
+drop table t1;
+
+--echo End of 5.3 tests
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
index a8c875ef764..c6d01a16f49 100644
--- a/mysql-test/t/upgrade.test
+++ b/mysql-test/t/upgrade.test
@@ -33,18 +33,15 @@ drop database `mysqltest-1`;
#
# Bug#17142: Crash if create with encoded name
#
---disable_warnings
-drop table if exists `txu@0023p@0023p1`;
-drop table if exists `txu#p#p1`;
---enable_warnings
create table `txu#p#p1` (s1 int);
insert into `txu#p#p1` values (1);
--error 1146
select * from `txu@0023p@0023p1`;
---error ER_TABLE_EXISTS_ERROR
create table `txu@0023p@0023p1` (s1 int);
+show tables;
select * from `txu#p#p1`;
drop table `txu#p#p1`;
+drop table `txu@0023p@0023p1`;
--echo #
--echo # Bug#37631 Incorrect key file for table after upgrading from 5.0 to 5.1
diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test
index c6930a7e468..2c889c2cc0c 100644
--- a/mysql-test/t/user_var.test
+++ b/mysql-test/t/user_var.test
@@ -364,7 +364,7 @@ SELECT (@v:=a) <> (@v:=1) FROM t1;
DROP TABLE t1;
#
-# LP BUG#1001506 Crash on a query with GROUP BY and user variables
+# lp:1001506 Crash on a query with GROUP BY and user variables
# MySQL Bug #11764372 57197: EVEN MORE USER VARIABLE CRASHING FUN
#
@@ -374,15 +374,49 @@ SELECT DISTINCT @a:=MIN(t1.a) FROM t1, t1 AS t2
GROUP BY @b:=(SELECT COUNT(*) > t2.a);
DROP TABLE t1;
+#
+#
+# Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT
+# SAME USER VARIABLE = CRASH
+#
+SET @bug12408412=1;
+SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412;
+
--echo End of 5.1 tests
#
-# Bug#50511: Sometimes wrong handling of user variables containing NULL.
+# MDEV-616 lp:1002126
+# Bug #11764371 57196: MORE FUN WITH ASSERTION: !TABLE->FILE ||
+# TABLE->FILE->INITED == HANDLER::
#
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0);
+SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
+AS b FROM t1 GROUP BY a;
+SELECT @a;
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT, f2 INT);
+INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (1);
+SET @var=NULL;
+SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
+LIMIT 1;
+SELECT @var;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(1),(3);
+SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a limit 1)) AS b FROM t1 GROUP BY a;
+SELECT @a;
+DROP TABLE t1;
+
+--echo End of 5.2 tests
+
+#
+# Bug#50511: Sometimes wrong handling of user variables containing NULL.
+#
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
@@ -415,7 +449,6 @@ SELECT f1, f2 FROM t1 ORDER BY f2;
DROP TRIGGER trg1;
DROP TABLE t1;
-
--echo #
--echo # Bug #12408412: GROUP_CONCAT + ORDER BY + INPUT/OUTPUT
--echo # SAME USER VARIABLE = CRASH
@@ -452,6 +485,8 @@ SELECT DISTINCT POW(COUNT(distinct a), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2
SELECT @a;
DROP TABLE t1;
+--echo End of 5.5 tests
+
--echo #
--echo # Check that used memory extends if we set a variable
--echo #
@@ -466,4 +501,3 @@ eval select $tmp < $tmp2;
--enable_column_names
--enable_query_log
---echo End of 5.5 tests
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 792859386e9..08e7e68c225 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1206,22 +1206,6 @@ SET GLOBAL server_id = -1;
SELECT @@GLOBAL.server_id;
SET GLOBAL server_id = @old_server_id;
-#
-# Bug #42778: delete order by null global variable causes
-# assertion .\filesort.cc, line 797
-#
-
-SELECT @@GLOBAL.INIT_CONNECT, @@GLOBAL.INIT_CONNECT IS NULL;
-
-CREATE TABLE t1 (a INT);
-INSERT INTO t1 VALUES ();
-SET @bug42778= @@sql_safe_updates;
-SET @@sql_safe_updates= 0;
-DELETE FROM t1 ORDER BY (@@GLOBAL.INIT_CONNECT) ASC LIMIT 10;
-SET @@sql_safe_updates= @bug42778;
-
-DROP TABLE t1;
-
--echo #
--echo # BUG#10206 - InnoDB: Transaction requiring Max_BinLog_Cache_size > 4GB always rollsback
--echo #
diff --git a/mysys/default.c b/mysys/default.c
index a90f428eca5..70738e11d4b 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -814,7 +814,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
continue;
/* Configuration File Directives */
- if ((*ptr == '!'))
+ if (*ptr == '!')
{
if (recursion_level >= max_recursion_level)
{
@@ -846,7 +846,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
if (!(search_dir= my_dir(ptr, MYF(MY_WME))))
goto err;
- for (i= 0; i < (uint) search_dir->number_off_files; i++)
+ for (i= 0; i < (uint) search_dir->number_of_files; i++)
{
search_file= search_dir->dir_entry + i;
ext= fn_ext(search_file->name);
diff --git a/mysys/errors.c b/mysys/errors.c
index 6cc0f083922..ebbdc410901 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -54,7 +54,7 @@ const char *globerrs[GLOBERRS]=
"File '%s' (fileno: %d) was not closed",
"Can't change ownership of the file '%s' (Errcode: %M)",
"Can't change permissions of the file '%s' (Errcode: %M)",
- "Can't seek in file '%s' (Errcode: %M)"
+ "Can't seek in file '%s' (Errcode: %M)",
"Can't change mode for file '%s' to 0x%lx (Errcode: %M)",
"Warning: Can't copy ownership for file '%s' (Errcode: %M)"
};
@@ -108,12 +108,12 @@ void init_glob_errs()
void wait_for_free_space(const char *filename, int errors)
{
if (errors == 0)
- my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
+ my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH | ME_JUST_WARNING),
filename,my_errno,MY_WAIT_FOR_USER_TO_FIX_PANIC);
if (!(errors % MY_WAIT_GIVE_USER_A_MESSAGE))
my_printf_error(EE_DISK_FULL,
"Retry in %d secs. Message reprinted in %d secs",
- MYF(ME_BELL | ME_NOREFRESH),
+ MYF(ME_BELL | ME_NOREFRESH | ME_JUST_WARNING),
MY_WAIT_FOR_USER_TO_FIX_PANIC,
MY_WAIT_GIVE_USER_A_MESSAGE * MY_WAIT_FOR_USER_TO_FIX_PANIC );
(void) sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
diff --git a/mysys/hash.c b/mysys/hash.c
index 0a830d8e3f4..aca6be4eb80 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -1,4 +1,5 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2013, Monty Program Ab.
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
@@ -59,6 +60,7 @@ static my_hash_value_type calc_hash(const HASH *hash,
as required during insertion.
@param[in,out] hash The hash that is initialized
+ @param[in[ growth_size size incrememnt for the underlying dynarray
@param[in] charset The charater set information
@param[in] size The hash size
@param[in] key_offest The key offset for the hash
@@ -72,7 +74,7 @@ static my_hash_value_type calc_hash(const HASH *hash,
@retval 1 failure
*/
my_bool
-_my_hash_init(HASH *hash, uint growth_size, CHARSET_INFO *charset,
+my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset,
ulong size, size_t key_offset, size_t key_length,
my_hash_get_key get_key,
void (*free_element)(void*), uint flags)
diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c
index 8a224f1c5e8..71ceceaf162 100644
--- a/mysys/ma_dyncol.c
+++ b/mysys/ma_dyncol.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011,2012 Monty Program Ab;
+/* Copyright (c) 2011,2013 Monty Program Ab;
Copyright (c) 2011,2012 Oleksandr Byelkin
Redistribution and use in source and binary forms, with or without
@@ -866,7 +866,7 @@ dynamic_column_uint_read(DYNAMIC_COLUMN_VALUE *store_it_here,
static size_t dynamic_column_sint_bytes(longlong val)
{
return dynamic_column_uint_bytes((val << 1) ^
- (val < 0 ? ULL(0xffffffffffffffff) : 0));
+ (val < 0 ? 0xffffffffffffffffull : 0));
}
@@ -884,7 +884,7 @@ dynamic_column_sint_store(DYNAMIC_COLUMN *str, longlong val)
{
return dynamic_column_uint_store(str,
(val << 1) ^
- (val < 0 ? ULL(0xffffffffffffffff) : 0));
+ (val < 0 ? 0xffffffffffffffffULL : 0));
}
@@ -906,7 +906,7 @@ dynamic_column_sint_read(DYNAMIC_COLUMN_VALUE *store_it_here,
dynamic_column_uint_read(store_it_here, data, length);
val= store_it_here->x.ulong_value;
if (val & 1)
- val= (val >> 1) ^ ULL(0xffffffffffffffff);
+ val= (val >> 1) ^ 0xffffffffffffffffULL;
else
val>>= 1;
store_it_here->x.long_value= (longlong) val;
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index a51d94f8e73..d684be238e6 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2012, Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2013, Monty Program Ab.
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
@@ -12,7 +12,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
#include "mysys_priv.h"
#include <m_string.h>
@@ -452,10 +453,10 @@ char *intern_filename(char *to, const char *from)
char buff[FN_REFLEN + 1];
if (from == to)
{ /* Dirname may destroy from */
- strmov(buff,from);
+ (void) strnmov(buff, from, FN_REFLEN);
from=buff;
}
length= dirname_part(to, from, &to_length); /* Copy dirname & fix chars */
- (void) strmov(to + to_length,from+length);
+ (void) strnmov(to + to_length, from + length, FN_REFLEN - to_length);
return (to);
} /* intern_filename */
diff --git a/mysys/my_compress.c b/mysys/my_compress.c
index ea56900db05..10c1903c163 100644
--- a/mysys/my_compress.c
+++ b/mysys/my_compress.c
@@ -234,7 +234,7 @@ my_bool my_uncompress(uchar *packet, size_t len, size_t *complen)
>0 Failure
*/
-int packfrm(uchar *data, size_t len,
+int packfrm(const uchar *data, size_t len,
uchar **pack_data, size_t *pack_len)
{
int error;
diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c
index 74dae29f235..aa63138b48c 100644
--- a/mysys/my_gethwaddr.c
+++ b/mysys/my_gethwaddr.c
@@ -87,13 +87,17 @@ my_bool my_gethwaddr(uchar *to)
int fd, res= 1;
struct ifreq ifr[32];
struct ifconf ifc;
+ DBUG_ENTER("my_gethwaddr");
ifc.ifc_req= ifr;
ifc.ifc_len= sizeof(ifr);
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
+ {
+ DBUG_PRINT("error", ("socket() call failed with %d", errno));
goto err;
+ }
if (ioctl(fd, SIOCGIFCONF, (char*)&ifc) >= 0)
{
@@ -106,8 +110,8 @@ my_bool my_gethwaddr(uchar *to)
ETHER_ADDR_LEN);
#else
/*
- A bug in OpenSolaris used to prevent non-root from getting a mac address:
- {no url. Oracle killed the old OpenSolaris bug database}
+ A bug in OpenSolaris used to prevent non-root from getting a mac
+ address: {no url. Oracle killed the old OpenSolaris bug database}
Thus, we'll use an alternative method and extract the address from the
arp table.
@@ -124,7 +128,7 @@ my_bool my_gethwaddr(uchar *to)
close(fd);
err:
- return res;
+ DBUG_RETURN(res);
}
#elif defined(_WIN32)
diff --git a/mysys/my_lib.c b/mysys/my_lib.c
index 9c8655338c1..e8a81b19e22 100644
--- a/mysys/my_lib.c
+++ b/mysys/my_lib.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, 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
@@ -11,7 +11,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
/* TODO: check for overun of memory for names. */
@@ -21,10 +22,8 @@
#include "mysys_err.h"
#if defined(HAVE_DIRENT_H)
# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
# if defined(HAVE_SYS_NDIR_H)
# include <sys/ndir.h>
# endif
@@ -59,25 +58,29 @@
static int comp_names(struct fileinfo *a,struct fileinfo *b);
+typedef struct {
+ MY_DIR dir;
+ DYNAMIC_ARRAY array;
+ MEM_ROOT root;
+} MY_DIR_HANDLE;
- /* We need this because program don't know with malloc we used */
+/* We need this because the caller doesn't know which malloc we've used */
-void my_dirend(MY_DIR *buffer)
+void my_dirend(MY_DIR *dir)
{
+ MY_DIR_HANDLE *dirh= (MY_DIR_HANDLE*) dir;
DBUG_ENTER("my_dirend");
- if (buffer)
+ if (dirh)
{
- delete_dynamic((DYNAMIC_ARRAY*)((char*)buffer +
- ALIGN_SIZE(sizeof(MY_DIR))));
- free_root((MEM_ROOT*)((char*)buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
- ALIGN_SIZE(sizeof(DYNAMIC_ARRAY))), MYF(0));
- my_free(buffer);
+ delete_dynamic(&dirh->array);
+ free_root(&dirh->root, MYF(0));
+ my_free(dirh);
}
DBUG_VOID_RETURN;
} /* my_dirend */
- /* Compare in sort of filenames */
+ /* Compare in sort of filenames */
static int comp_names(struct fileinfo *a, struct fileinfo *b)
{
@@ -87,16 +90,30 @@ static int comp_names(struct fileinfo *a, struct fileinfo *b)
#if !defined(_WIN32)
+static char *directory_file_name (char * dst, const char *src)
+{
+ /* Process as Unix format: just remove test the final slash. */
+ char *end;
+ DBUG_ASSERT(strlen(src) < (FN_REFLEN + 1));
+
+ if (src[0] == 0)
+ src= (char*) "."; /* Use empty as current */
+ end=strmov(dst, src);
+ if (end[-1] != FN_LIBCHAR + 1)
+ {
+ *end++= FN_LIBCHAR; /* Add last '/' */
+ *end='\0';
+ }
+ return end;
+}
+
MY_DIR *my_dir(const char *path, myf MyFlags)
{
- char *buffer;
- MY_DIR *result= 0;
+ MY_DIR_HANDLE *dirh= 0;
FILEINFO finfo;
- DYNAMIC_ARRAY *dir_entries_storage;
- MEM_ROOT *names_storage;
DIR *dirp;
struct dirent *dp;
- char tmp_path[FN_REFLEN+1],*tmp_file;
+ char tmp_path[FN_REFLEN + 2], *tmp_file;
char dirent_tmp[sizeof(struct dirent)+_POSIX_PATH_MAX+1];
DBUG_ENTER("my_dir");
@@ -106,59 +123,53 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
mysql_mutex_lock(&THR_LOCK_open);
#endif
- dirp = opendir(directory_file_name(tmp_path,(char *) path));
-#if defined(__amiga__)
- if ((dirp->dd_fd) < 0) /* Directory doesn't exists */
- goto error;
-#endif
- if (dirp == NULL ||
- ! (buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) +
- ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) +
- sizeof(MEM_ROOT), MyFlags)))
+ tmp_file= directory_file_name(tmp_path, path);
+
+ if (!(dirp= opendir(tmp_path)))
goto error;
- dir_entries_storage= (DYNAMIC_ARRAY*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)));
- names_storage= (MEM_ROOT*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
- ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)));
+ if (!(dirh= my_malloc(sizeof(*dirh), MyFlags | MY_ZEROFILL)))
+ goto error;
- if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
+ if (my_init_dynamic_array(&dirh->array, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT,
MYF(MyFlags)))
- {
- my_free(buffer);
goto error;
- }
- init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE,
- MYF(MyFlags));
- /* MY_DIR structure is allocated and completly initialized at this point */
- result= (MY_DIR*)buffer;
-
- tmp_file=strend(tmp_path);
+ init_alloc_root(&dirh->root, NAMES_START_SIZE, NAMES_START_SIZE,
+ MYF(MyFlags));
dp= (struct dirent*) dirent_tmp;
while (!(READDIR(dirp,(struct dirent*) dirent_tmp,dp)))
{
- if (!(finfo.name= strdup_root(names_storage, dp->d_name)))
- goto error;
+ MY_STAT statbuf, *mystat= 0;
+ if (dp->d_name[0] == '.' &&
+ (dp->d_name[1] == '\0' ||
+ (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
+ continue; /* . or .. */
+
if (MyFlags & MY_WANT_STAT)
{
- if (!(finfo.mystat= (MY_STAT*)alloc_root(names_storage,
- sizeof(MY_STAT))))
- goto error;
-
- bzero(finfo.mystat, sizeof(MY_STAT));
- (void) strmov(tmp_file,dp->d_name);
- (void) my_stat(tmp_path, finfo.mystat, MyFlags);
- if (!(finfo.mystat->st_mode & MY_S_IREAD))
+ mystat= &statbuf;
+ bzero(mystat, sizeof(*mystat));
+ (void) strmov(tmp_file, dp->d_name);
+ (void) my_stat(tmp_path, mystat, MyFlags);
+ if (!(mystat->st_mode & MY_S_IREAD))
continue;
}
- else
- finfo.mystat= NULL;
- if (push_dynamic(dir_entries_storage, (uchar*)&finfo))
+ if (!(finfo.name= strdup_root(&dirh->root, dp->d_name)))
+ goto error;
+
+ if (mystat &&
+ !((mystat= memdup_root(&dirh->root, mystat, sizeof(*mystat)))))
+ goto error;
+
+ finfo.mystat= mystat;
+
+ if (push_dynamic(&dirh->array, (uchar*)&finfo))
goto error;
}
@@ -166,13 +177,14 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
#if !defined(HAVE_READDIR_R)
mysql_mutex_unlock(&THR_LOCK_open);
#endif
- result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
- result->number_off_files= dir_entries_storage->elements;
- if (!(MyFlags & MY_DONT_SORT))
- my_qsort((void *) result->dir_entry, result->number_off_files,
- sizeof(FILEINFO), (qsort_cmp) comp_names);
- DBUG_RETURN(result);
+ if (MyFlags & MY_WANT_SORT)
+ sort_dynamic(&dirh->array, (qsort_cmp) comp_names);
+
+ dirh->dir.dir_entry= dynamic_element(&dirh->array, 0, FILEINFO *);
+ dirh->dir.number_of_files= dirh->array.elements;
+
+ DBUG_RETURN(&dirh->dir);
error:
#if !defined(HAVE_READDIR_R)
@@ -181,36 +193,13 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
my_errno=errno;
if (dirp)
(void) closedir(dirp);
- my_dirend(result);
+ my_dirend(&dirh->dir);
if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,my_errno);
- DBUG_RETURN((MY_DIR *) NULL);
+ my_error(EE_DIR, MYF(ME_BELL | ME_WAITTANG), path, my_errno);
+ DBUG_RETURN(NULL);
} /* my_dir */
-/*
- * Convert from directory name to filename.
- * On UNIX, it's simple: just make sure there is a terminating /
-
- * Returns pointer to dst;
- */
-
-char * directory_file_name (char * dst, const char *src)
-{
- /* Process as Unix format: just remove test the final slash. */
- char *end;
-
- if (src[0] == 0)
- src= (char*) "."; /* Use empty as current */
- end=strmov(dst, src);
- if (end[-1] != FN_LIBCHAR)
- {
- end[0]=FN_LIBCHAR; /* Add last '/' */
- end[1]='\0';
- }
- return dst;
-}
-
#else
/*
@@ -221,18 +210,11 @@ char * directory_file_name (char * dst, const char *src)
MY_DIR *my_dir(const char *path, myf MyFlags)
{
- char *buffer;
- MY_DIR *result= 0;
+ MY_DIR_HANDLE *dirh= 0;
FILEINFO finfo;
- DYNAMIC_ARRAY *dir_entries_storage;
- MEM_ROOT *names_storage;
-#ifdef __BORLANDC__
- struct ffblk find;
-#else
struct _finddata_t find;
-#endif
ushort mode;
- char tmp_path[FN_REFLEN],*tmp_file,attrib;
+ char tmp_path[FN_REFLEN], *tmp_file,attrib;
#ifdef _WIN64
__int64 handle;
#else
@@ -255,32 +237,18 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
tmp_file[2]='*';
tmp_file[3]='\0';
- if (!(buffer= my_malloc(ALIGN_SIZE(sizeof(MY_DIR)) +
- ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)) +
- sizeof(MEM_ROOT), MyFlags)))
+ if (!(dirh= my_malloc(sizeof(*dirh), MyFlags | MY_ZEROFILL)))
goto error;
-
- dir_entries_storage= (DYNAMIC_ARRAY*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)));
- names_storage= (MEM_ROOT*)(buffer + ALIGN_SIZE(sizeof(MY_DIR)) +
- ALIGN_SIZE(sizeof(DYNAMIC_ARRAY)));
- if (my_init_dynamic_array(dir_entries_storage, sizeof(FILEINFO),
+ if (my_init_dynamic_array(&dirh->array, sizeof(FILEINFO),
ENTRIES_START_SIZE, ENTRIES_INCREMENT,
MYF(MyFlags)))
- {
- my_free(buffer);
goto error;
- }
- init_alloc_root(names_storage, NAMES_START_SIZE, NAMES_START_SIZE, MYF(MyFlags));
-
- /* MY_DIR structure is allocated and completly initialized at this point */
- result= (MY_DIR*)buffer;
-#ifdef __BORLANDC__
- if ((handle= findfirst(tmp_path,&find,0)) == -1L)
-#else
+ init_alloc_root(&dirh->root, NAMES_START_SIZE, NAMES_START_SIZE,
+ MYF(MyFlags));
+
if ((handle=_findfirst(tmp_path,&find)) == -1L)
-#endif
{
DBUG_PRINT("info", ("findfirst returned error, errno: %d", errno));
if (errno != EINVAL)
@@ -293,12 +261,8 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
}
else
{
-
do
{
-#ifdef __BORLANDC__
- attrib= find.ff_attrib;
-#else
attrib= find.attrib;
/*
Do not show hidden and system files which Windows sometimes create.
@@ -307,71 +271,55 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
*/
if (attrib & (_A_HIDDEN | _A_SYSTEM))
continue;
-#endif
-#ifdef __BORLANDC__
- if (!(finfo.name= strdup_root(names_storage, find.ff_name)))
- goto error;
-#else
- if (!(finfo.name= strdup_root(names_storage, find.name)))
+
+ if (find.name[0] == '.' &&
+ (find.name[1] == '\0' ||
+ (find.name[1] == '.' && find.name[2] == '\0')))
+ continue; /* . or .. */
+
+ if (!(finfo.name= strdup_root(&dirh->root, find.name)))
goto error;
-#endif
if (MyFlags & MY_WANT_STAT)
{
- if (!(finfo.mystat= (MY_STAT*)alloc_root(names_storage,
- sizeof(MY_STAT))))
+ if (!(finfo.mystat= (MY_STAT*)alloc_root(&dirh->root, sizeof(MY_STAT))))
goto error;
bzero(finfo.mystat, sizeof(MY_STAT));
-#ifdef __BORLANDC__
- finfo.mystat->st_size=find.ff_fsize;
-#else
finfo.mystat->st_size=find.size;
-#endif
mode= MY_S_IREAD;
if (!(attrib & _A_RDONLY))
mode|= MY_S_IWRITE;
if (attrib & _A_SUBDIR)
mode|= MY_S_IFDIR;
finfo.mystat->st_mode= mode;
-#ifdef __BORLANDC__
- finfo.mystat->st_mtime= ((uint32) find.ff_ftime);
-#else
finfo.mystat->st_mtime= ((uint32) find.time_write);
-#endif
}
else
finfo.mystat= NULL;
- if (push_dynamic(dir_entries_storage, (uchar*)&finfo))
+ if (push_dynamic(&dirh->array, (uchar*)&finfo))
goto error;
}
-#ifdef __BORLANDC__
- while (findnext(&find) == 0);
-#else
while (_findnext(handle,&find) == 0);
-
_findclose(handle);
-#endif
}
- result->dir_entry= (FILEINFO *)dir_entries_storage->buffer;
- result->number_off_files= dir_entries_storage->elements;
+ if (MyFlags & MY_WANT_SORT)
+ sort_dynamic(&dirh->array, (qsort_cmp) comp_names);
+
+ dirh->dir.dir_entry= dynamic_element(&dirh->array, 0, FILEINFO *);
+ dirh->dir.number_of_files= dirh->array.elements;
- if (!(MyFlags & MY_DONT_SORT))
- my_qsort((void *) result->dir_entry, result->number_off_files,
- sizeof(FILEINFO), (qsort_cmp) comp_names);
- DBUG_PRINT("exit", ("found %d files", result->number_off_files));
- DBUG_RETURN(result);
+ DBUG_PRINT("exit", ("found %d files", dirh->dir.number_of_files));
+ DBUG_RETURN(&dirh->dir);
error:
my_errno=errno;
-#ifndef __BORLANDC__
if (handle != -1)
_findclose(handle);
-#endif
- my_dirend(result);
- if (MyFlags & MY_FAE+MY_WME)
- my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
- DBUG_RETURN((MY_DIR *) NULL);
+ my_dirend(&dirh->dir);
+ if (MyFlags & (MY_FAE | MY_WME))
+ my_error(EE_DIR,MYF(ME_BELL | ME_WAITTANG), path, errno);
+ DBUG_RETURN(NULL);
} /* my_dir */
#endif /* _WIN32 */
diff --git a/mysys/my_rnd.c b/mysys/my_rnd.c
index 178bcd9c539..d043c8529ad 100644
--- a/mysys/my_rnd.c
+++ b/mysys/my_rnd.c
@@ -45,11 +45,20 @@ void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2)
RETURN VALUE
generated pseudo random number
+
+ NOTE:
+ This is codes so that it can be called by two threads at the same time
+ with minimum impact.
+ (As the number is supposed to be random, it doesn't matter much if
+ rand->seed1 or rand->seed2 are updated with slightly wrong numbers or
+ if two threads gets the same number.
*/
double my_rnd(struct my_rnd_struct *rand_st)
{
- rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
- rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value;
- return (((double) rand_st->seed1)/rand_st->max_value_dbl);
+ unsigned long seed1;
+ seed1= (rand_st->seed1*3+rand_st->seed2) % rand_st->max_value;
+ rand_st->seed2=(seed1+rand_st->seed2+33) % rand_st->max_value;
+ rand_st->seed1= seed1;
+ return (((double) seed1)/rand_st->max_value_dbl);
}
diff --git a/mysys/my_uuid.c b/mysys/my_uuid.c
index ab1b259ae0f..01c59e42f2e 100644
--- a/mysys/my_uuid.c
+++ b/mysys/my_uuid.c
@@ -123,7 +123,7 @@ void my_uuid_init(ulong seed1, ulong seed2)
Create a global unique identifier (uuid)
@func my_uuid()
- @param to Store uuid here. Must be of size MY_uuid_SIZE (16)
+ @param to Store uuid here. Must be of size MY_UUID_SIZE (16)
*/
void my_uuid(uchar *to)
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 204e2e1488d..3c94fab2ec7 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -47,11 +47,17 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
#else
writtenbytes= write(Filedes, Buffer, Count);
#endif
- DBUG_EXECUTE_IF("simulate_file_write_error",
- {
- errno= ENOSPC;
- writtenbytes= (size_t) -1;
- });
+
+ /**
+ To simulate the write error set the errno = error code
+ and the number pf written bytes to -1.
+ */
+ DBUG_EXECUTE_IF ("simulate_file_write_error",
+ if (!errors) {
+ errno= ENOSPC;
+ writtenbytes= (size_t) -1;
+ });
+
if (writtenbytes == Count)
break;
if (writtenbytes != (size_t) -1)
diff --git a/mysys/thr_rwlock.c b/mysys/thr_rwlock.c
index 17fafecd8fd..dd6c625a286 100644
--- a/mysys/thr_rwlock.c
+++ b/mysys/thr_rwlock.c
@@ -24,7 +24,7 @@
static BOOL have_srwlock= FALSE;
/* Prototypes and function pointers for windows functions */
typedef VOID (WINAPI* srw_func) (PSRWLOCK SRWLock);
-typedef BOOL (WINAPI* srw_bool_func) (PSRWLOCK SRWLock);
+typedef BOOLEAN (WINAPI* srw_bool_func) (PSRWLOCK SRWLock);
static srw_func my_InitializeSRWLock;
static srw_func my_AcquireSRWLockExclusive;
diff --git a/mysys/typelib.c b/mysys/typelib.c
index 402d108e51c..a332adf6af5 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -218,7 +219,7 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err)
x++;
if ((find= find_type(i, lib, FIND_TYPE_COMMA_TERM) - 1) < 0)
DBUG_RETURN(0);
- result|= (ULL(1) << find);
+ result|= (1ULL << find);
}
*err= 0;
DBUG_RETURN(result);
diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c
index 21b2a9ac78a..caeba9cfa12 100644
--- a/mysys/waiting_threads.c
+++ b/mysys/waiting_threads.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
+ Copyright (c) 2011, 2013, Monty Program Ab.
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
@@ -1068,7 +1069,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, mysql_mutex_t *mutex)
ret= WT_OK;
rc_unlock(rc);
- end_wait_time= starttime.val *1000 + (*thd->timeout_short)*ULL(1000000);
+ end_wait_time= starttime.val *1000 + (*thd->timeout_short)*1000000ULL;
set_timespec_time_nsec(timeout, end_wait_time);
if (ret == WT_TIMEOUT && !thd->killed)
ret= mysql_cond_timedwait(&rc->cond, mutex, &timeout);
@@ -1081,7 +1082,7 @@ int wt_thd_cond_timedwait(WT_THD *thd, mysql_mutex_t *mutex)
ret= WT_DEADLOCK;
else if (*thd->timeout_long > *thd->timeout_short)
{
- end_wait_time= starttime.val *1000 + (*thd->timeout_long)*ULL(1000000);
+ end_wait_time= starttime.val *1000 + (*thd->timeout_long)*1000000ULL;
set_timespec_time_nsec(timeout, end_wait_time);
if (!thd->killed)
ret= mysql_cond_timedwait(&rc->cond, mutex, &timeout);
diff --git a/packaging/WiX/custom_ui.wxs b/packaging/WiX/custom_ui.wxs
index 568053f4cf5..6e243832e12 100644
--- a/packaging/WiX/custom_ui.wxs
+++ b/packaging/WiX/custom_ui.wxs
@@ -2,7 +2,7 @@
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<!--
- Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2010, 2013, 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, 2012, 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, 2013, 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>
diff --git a/packaging/rpm-uln/mysql.spec.sh b/packaging/rpm-uln/mysql.spec.sh
index 8b25b160be1..3e2c5c3f11c 100644
--- a/packaging/rpm-uln/mysql.spec.sh
+++ b/packaging/rpm-uln/mysql.spec.sh
@@ -508,21 +508,28 @@ mkdir release
# TODO / FIXME: Do we need "scriptstub"?
gcc $CFLAGS $LDFLAGS -o scriptstub "-DLIBDIR=\"%{_libdir}/mysql\"" %{SOURCE4}
-# TODO / FIXME: "libmysqld.so" should have been produced above - WORK in PROGRESS
+# TODO / FIXME: "libmysqld.so" should have been produced above
# regular build will make libmysqld.a but not libmysqld.so :-(
cd release
mkdir libmysqld/work
cd libmysqld/work
-ar -x ../libmysqld.a
-rm rpl_utility.cc.o sql_binlog.cc.o # Try-and-Error: These modules cause unresolved references
-gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.0 -o libmysqld.so.0.0.1 \
- *.o \
+# "libmysqld" provides the same ABI as "libmysqlclient", but it implements the server:
+# The shared object is identified by the full version,
+# for linkage selection the first two levels are sufficient so that upgrades are possible
+# (see "man ld", option "-soname").
+SO_FULL='%{mysql_version}'
+SO_USE=`echo $SO_FULL | sed -e 's/\([0-9]\.[0-9]\)\.[0-9]*/\1/'`
+# These two modules should pull everything else which is needed:
+ar -x ../libmysqld.a client.c.o signal_handler.cc.o
+gcc $CFLAGS $LDFLAGS -shared -Wl,-soname,libmysqld.so.$SO_USE -o libmysqld.so.$SO_FULL \
+ *.o ../libmysqld.a \
-lpthread -lcrypt -laio -lnsl -lssl -lcrypto -lz -lrt -lstdc++ -lm -lc
# this is to check that we built a complete library
cp %{SOURCE9} .
-ln -s libmysqld.so.0.0.1 libmysqld.so.0
-gcc -I../../include -I../../../%{src_dir}/include $CFLAGS mysql-embedded-check.c libmysqld.so.0
-LD_LIBRARY_PATH=. ldd ./a.out
+PROGNAME=`basename %{SOURCE9} .c`
+ln -s libmysqld.so.$SO_FULL libmysqld.so.$SO_USE
+gcc -I../../include -I../../../%{src_dir}/include $CFLAGS -o $PROGNAME %{SOURCE9} libmysqld.so.$SO_USE
+LD_LIBRARY_PATH=. ldd $PROGNAME
cd ../..
cd ..
@@ -618,9 +625,11 @@ mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/my
install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysql_config
rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.a
-install -m 0755 release/libmysqld/work/libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0.0.1
-ln -s libmysqld.so.0.0.1 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.0
-ln -s libmysqld.so.0 ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so
+SO_FULL='%{mysql_version}'
+SO_USE=`echo $SO_FULL | sed -e 's/\([0-9]\.[0-9]\)\.[0-9]*/\1/'`
+install -m 0755 release/libmysqld/work/libmysqld.so.$SO_FULL ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.$SO_FULL
+ln -s libmysqld.so.$SO_FULL ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so.$SO_USE
+ln -s libmysqld.so.$SO_USE ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqld.so
rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err
rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1*
@@ -964,6 +973,12 @@ fi
%{_mandir}/man1/mysql_client_test.1*
%changelog
+* Thu Dec 7 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
+- Change the way in which "libmysqld.so" is created: Using all object modules
+ was wrong, gcc / ld can resolve the dependencies from "libmysqld.a".
+ Also, identify the ".so" version from the MySQL version, "0.0.1" was wrong.
+ Bug#15972480
+
* Tue Sep 18 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
- Restrict the vendor check to Oracle: There is no history here
which we have to allow for.
diff --git a/plugin/audit_null/audit_null.c b/plugin/audit_null/audit_null.c
index be0c70fbd35..0616f192f20 100644
--- a/plugin/audit_null/audit_null.c
+++ b/plugin/audit_null/audit_null.c
@@ -127,12 +127,10 @@ static struct st_mysql_audit audit_null_descriptor=
static struct st_mysql_show_var simple_status[]=
{
- { "Audit_null_called", (char *) &number_of_calls, SHOW_INT },
- { "Audit_null_general_log", (char *) &number_of_calls_general_log, SHOW_INT },
- { "Audit_null_general_error", (char *) &number_of_calls_general_error,
- SHOW_INT },
- { "Audit_null_general_result", (char *) &number_of_calls_general_result,
- SHOW_INT },
+ { "called", (char *) &number_of_calls, SHOW_INT },
+ { "general_log", (char *) &number_of_calls_general_log, SHOW_INT },
+ { "general_error", (char *) &number_of_calls_general_error, SHOW_INT },
+ { "general_result", (char *) &number_of_calls_general_result, SHOW_INT },
{ 0, 0, 0}
};
diff --git a/plugin/auth_examples/CMakeLists.txt b/plugin/auth_examples/CMakeLists.txt
index fb27289770f..f6c2b637067 100644
--- a/plugin/auth_examples/CMakeLists.txt
+++ b/plugin/auth_examples/CMakeLists.txt
@@ -27,5 +27,7 @@ MYSQL_ADD_PLUGIN(qa_auth_server qa_auth_server.c
MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c
MODULE_ONLY COMPONENT Test)
+MYSQL_ADD_PLUGIN(auth_0x0100 auth_0x0100.c MODULE_ONLY COMPONENT Test)
+
MYSQL_ADD_PLUGIN(mysql_clear_password clear_password_client.c
MODULE_ONLY COMPONENT SharedLibraries)
diff --git a/plugin/auth_examples/auth_0x0100.c b/plugin/auth_examples/auth_0x0100.c
new file mode 100644
index 00000000000..d1373b8a0b4
--- /dev/null
+++ b/plugin/auth_examples/auth_0x0100.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 2013 Sergei Golubchik and Monty Program Ab
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; version 2 of the
+ License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file
+
+ auth plugin that uses old structures as of
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100
+
+ To test the old version support.
+ It intentionally uses no constants like CR_OK ok PASSWORD_USED_YES.
+*/
+
+#include <mysql/plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#if 0
+#include <mysql/plugin_auth.h>
+#else
+#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100
+typedef void MYSQL_PLUGIN_VIO; /* we don't use it here */
+
+typedef struct st_mysql_server_auth_info
+{
+ char *user_name;
+ unsigned int user_name_length;
+ const char *auth_string;
+ unsigned long auth_string_length;
+ char authenticated_as[49];
+ char external_user[512];
+ int password_used;
+ const char *host_or_ip;
+ unsigned int host_or_ip_length;
+} MYSQL_SERVER_AUTH_INFO;
+
+struct st_mysql_auth
+{
+ int interface_version;
+ const char *client_auth_plugin;
+ int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info);
+};
+#endif
+
+static int do_auth_0x0100(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+ info->password_used= 1;
+ strcpy(info->authenticated_as, "zzzzzzzzzzzzzzzz");
+ memset(info->external_user, 'o', 510);
+ info->external_user[510]='.';
+ info->external_user[511]=0;
+ return vio ? -1 : 0; /* use vio to avoid the 'unused' warning */
+}
+
+static struct st_mysql_auth auth_0x0100_struct=
+{
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION, 0, do_auth_0x0100
+};
+
+maria_declare_plugin(auth_0x0100)
+{
+ MYSQL_AUTHENTICATION_PLUGIN,
+ &auth_0x0100_struct,
+ "auth_0x0100",
+ "Sergei Golubchik",
+ "Test for API 0x0100 support",
+ PLUGIN_LICENSE_GPL,
+ NULL,
+ NULL,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL,
+}
+maria_declare_plugin_end;
+
diff --git a/plugin/auth_socket/CMakeLists.txt b/plugin/auth_socket/CMakeLists.txt
index 731f7d01f9a..ae7dbffe2ae 100644
--- a/plugin/auth_socket/CMakeLists.txt
+++ b/plugin/auth_socket/CMakeLists.txt
@@ -21,7 +21,19 @@ int main() {
struct ucred cred;
getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, 0);
}" HAVE_PEERCRED)
+
+IF (NOT HAVE_PEERCRED)
+ # Hi, OpenBSD!
+ CHECK_CXX_SOURCE_COMPILES(
+ "#include <sys/types.h>
+ #include <sys/socket.h>
+ int main() {
+ struct sockpeercred cred;
+ getsockopt(0, SOL_SOCKET, SO_PEERCRED, &cred, 0);
+ }" HAVE_SOCKPEERCRED)
+ ADD_DEFINITIONS(-Ducred=sockpeercred)
+ENDIF()
-IF(HAVE_PEERCRED)
+IF(HAVE_PEERCRED OR HAVE_SOCKPEERCRED)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c MODULE_ONLY)
ENDIF()
diff --git a/plugin/auth_socket/auth_socket.c b/plugin/auth_socket/auth_socket.c
index 41cb1039fd2..78d7e769f7b 100644
--- a/plugin/auth_socket/auth_socket.c
+++ b/plugin/auth_socket/auth_socket.c
@@ -85,23 +85,6 @@ static struct st_mysql_auth socket_auth_handler=
socket_auth
};
-mysql_declare_plugin(socket_auth)
-{
- MYSQL_AUTHENTICATION_PLUGIN,
- &socket_auth_handler,
- "unix_socket",
- "Sergei Golubchik",
- "Unix Socket based authentication",
- PLUGIN_LICENSE_GPL,
- NULL,
- NULL,
- 0x0100,
- NULL,
- NULL,
- NULL,
- 0,
-}
-mysql_declare_plugin_end;
maria_declare_plugin(socket_auth)
{
MYSQL_AUTHENTICATION_PLUGIN,
diff --git a/plugin/daemon_example/daemon_example.cc b/plugin/daemon_example/daemon_example.cc
index ec2979de3c3..7d047b2eaf7 100644
--- a/plugin/daemon_example/daemon_example.cc
+++ b/plugin/daemon_example/daemon_example.cc
@@ -188,23 +188,6 @@ struct st_mysql_daemon daemon_example_plugin=
Plugin library descriptor
*/
-mysql_declare_plugin(daemon_example)
-{
- MYSQL_DAEMON_PLUGIN,
- &daemon_example_plugin,
- "daemon_example",
- "Brian Aker",
- "Daemon example, creates a heartbeat beat file in mysql-heartbeat.log",
- PLUGIN_LICENSE_GPL,
- daemon_example_plugin_init, /* Plugin Init */
- daemon_example_plugin_deinit, /* Plugin Deinit */
- 0x0100 /* 1.0 */,
- NULL, /* status variables */
- NULL, /* system variables */
- NULL, /* config options */
- 0, /* flags */
-}
-mysql_declare_plugin_end;
maria_declare_plugin(daemon_example)
{
MYSQL_DAEMON_PLUGIN,
diff --git a/plugin/fulltext/plugin_example.c b/plugin/fulltext/plugin_example.c
index 981335bddd6..2af3555393c 100644
--- a/plugin/fulltext/plugin_example.c
+++ b/plugin/fulltext/plugin_example.c
@@ -254,24 +254,6 @@ static struct st_mysql_sys_var* simple_system_variables[]= {
Plugin library descriptor
*/
-mysql_declare_plugin(ftexample)
-{
- MYSQL_FTPARSER_PLUGIN, /* type */
- &simple_parser_descriptor, /* descriptor */
- "simple_parser", /* name */
- "Sergei Golubchik", /* author */
- "Simple Full-Text Parser", /* description */
- PLUGIN_LICENSE_GPL,
- simple_parser_plugin_init, /* init function (when loaded) */
- simple_parser_plugin_deinit,/* deinit function (when unloaded) */
- 0x0001, /* version */
- simple_status, /* status variables */
- simple_system_variables, /* system variables */
- NULL,
- 0,
-}
-mysql_declare_plugin_end;
-
maria_declare_plugin(ftexample)
{
MYSQL_FTPARSER_PLUGIN, /* type */
diff --git a/plugin/qc_info/CMakeLists.txt b/plugin/qc_info/CMakeLists.txt
new file mode 100644
index 00000000000..f9c58f77466
--- /dev/null
+++ b/plugin/qc_info/CMakeLists.txt
@@ -0,0 +1,4 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include)
+
+MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc)
diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc
new file mode 100644
index 00000000000..af13b6edf93
--- /dev/null
+++ b/plugin/qc_info/qc_info.cc
@@ -0,0 +1,213 @@
+/*
+ Copyright (c) 2008, Roland Bouman
+ http://rpbouman.blogspot.com/
+ roland.bouman@gmail.com
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Roland Bouman nor the
+ names of the contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/*
+ * TODO: report query cache flags
+ */
+#ifndef MYSQL_SERVER
+#define MYSQL_SERVER
+#endif
+
+#include <sql_cache.h>
+#include <sql_parse.h> // check_global_access
+#include <sql_acl.h> // PROCESS_ACL
+#include <sql_class.h> // THD
+#include <table.h> // ST_SCHEMA_TABLE
+#include <mysql/plugin.h>
+
+class Accessible_Query_Cache : public Query_cache {
+public:
+ HASH *get_queries()
+ {
+ return &this->queries;
+ }
+} *qc;
+
+bool schema_table_store_record(THD *thd, TABLE *table);
+
+#define MAX_STATEMENT_TEXT_LENGTH 32767
+#define COLUMN_STATEMENT_SCHEMA 0
+#define COLUMN_STATEMENT_TEXT 1
+#define COLUMN_RESULT_BLOCKS_COUNT 2
+#define COLUMN_RESULT_BLOCKS_SIZE 3
+#define COLUMN_RESULT_BLOCKS_SIZE_USED 4
+
+/* ST_FIELD_INFO is defined in table.h */
+static ST_FIELD_INFO qc_info_fields[]=
+{
+ {"STATEMENT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
+ {"STATEMENT_TEXT", MAX_STATEMENT_TEXT_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, 0},
+ {"RESULT_BLOCKS_COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0},
+ {"RESULT_BLOCKS_SIZE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
+ {"RESULT_BLOCKS_SIZE_USED", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+};
+
+static int qc_info_fill_table(THD *thd, TABLE_LIST *tables,
+ COND *cond)
+{
+ int status= 1;
+ CHARSET_INFO *scs= system_charset_info;
+ TABLE *table= tables->table;
+ HASH *queries = qc->get_queries();
+
+ /* one must have PROCESS privilege to see others' queries */
+ if (check_global_access(thd, PROCESS_ACL, true))
+ return 0;
+
+ if (qc->try_lock(thd))
+ return status;
+
+ /* loop through all queries in the query cache */
+ for (uint i= 0; i < queries->records; i++)
+ {
+ const uchar *query_cache_block_raw;
+ Query_cache_block* query_cache_block;
+ Query_cache_query* query_cache_query;
+ uint result_blocks_count;
+ ulonglong result_blocks_size;
+ ulonglong result_blocks_size_used;
+ Query_cache_block *first_result_block;
+ Query_cache_block *result_block;
+ const char *statement_text;
+ size_t statement_text_length;
+ const char *key, *db;
+ size_t key_length, db_length;
+
+ query_cache_block_raw = my_hash_element(queries, i);
+ query_cache_block = (Query_cache_block*)query_cache_block_raw;
+ if (query_cache_block->type != Query_cache_block::QUERY)
+ continue;
+
+ query_cache_query = query_cache_block->query();
+
+ /* Get the actual SQL statement for this query cache query */
+ statement_text = (const char*)query_cache_query->query();
+ statement_text_length = strlen(statement_text);
+ /* We truncate SQL statements up to MAX_STATEMENT_TEXT_LENGTH in our I_S table */
+ table->field[COLUMN_STATEMENT_TEXT]->store((char*)statement_text,
+ min(statement_text_length, MAX_STATEMENT_TEXT_LENGTH), scs);
+
+ /* get the entire key that identifies this query cache query */
+ key = (const char*)query_cache_query_get_key(query_cache_block_raw,
+ &key_length, 0);
+ /* The database against which the statement is executed is part of the
+ query cache query key
+ */
+ compile_time_assert(QUERY_CACHE_DB_LENGTH_SIZE == 2);
+ db= key + statement_text_length + 1 + QUERY_CACHE_DB_LENGTH_SIZE;
+ db_length= uint2korr(db - QUERY_CACHE_DB_LENGTH_SIZE);
+
+ table->field[COLUMN_STATEMENT_SCHEMA]->store(db, db_length, scs);
+
+ /* If we have result blocks, process them */
+ first_result_block= query_cache_query->result();
+ if(first_result_block)
+ {
+ /* initialize so we can loop over the result blocks*/
+ result_block= first_result_block;
+ result_blocks_count = 1;
+ result_blocks_size = result_block->length;
+ result_blocks_size_used = result_block->used;
+
+ /* loop over the result blocks*/
+ while((result_block= result_block->next)!=first_result_block)
+ {
+ /* calculate total number of result blocks */
+ result_blocks_count++;
+ /* calculate total size of result blocks */
+ result_blocks_size += result_block->length;
+ /* calculate total of used size of result blocks */
+ result_blocks_size_used += result_block->used;
+ }
+ }
+ else
+ {
+ result_blocks_count = 0;
+ result_blocks_size = 0;
+ result_blocks_size_used = 0;
+ }
+ table->field[COLUMN_RESULT_BLOCKS_COUNT]->store(result_blocks_count, 0);
+ table->field[COLUMN_RESULT_BLOCKS_SIZE]->store(result_blocks_size, 0);
+ table->field[COLUMN_RESULT_BLOCKS_SIZE_USED]->store(result_blocks_size_used, 0);
+
+ if (schema_table_store_record(thd, table))
+ goto cleanup;
+ }
+ status = 0;
+
+cleanup:
+ qc->unlock();
+ return status;
+}
+
+static int qc_info_plugin_init(void *p)
+{
+ ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
+
+ schema->fields_info= qc_info_fields;
+ schema->fill_table= qc_info_fill_table;
+
+#ifdef _WIN32
+ qc = (Accessible_Query_Cache *)
+ GetProcAddress(GetModuleHandle(NULL), "?query_cache@@3VQuery_cache@@A");
+#else
+ qc = (Accessible_Query_Cache *)&query_cache;
+#endif
+
+ return qc == 0;
+}
+
+
+static struct st_mysql_information_schema qc_info_plugin=
+{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+/*
+ Plugin library descriptor
+*/
+
+maria_declare_plugin(query_cache_info)
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &qc_info_plugin,
+ "QUERY_CACHE_INFO",
+ "Roland Bouman",
+ "Lists all queries in the query cache.",
+ PLUGIN_LICENSE_BSD,
+ qc_info_plugin_init, /* Plugin Init */
+ 0, /* Plugin Deinit */
+ 0x0100, /* version, hex */
+ NULL, /* status variables */
+ NULL, /* system variables */
+ "1.0", /* version as a string */
+ MariaDB_PLUGIN_MATURITY_ALPHA
+}
+maria_declare_plugin_end;
+
diff --git a/plugin/semisync/CMakeLists.txt b/plugin/semisync/CMakeLists.txt
index f1ada507f4f..33c0895e5e1 100644
--- a/plugin/semisync/CMakeLists.txt
+++ b/plugin/semisync/CMakeLists.txt
@@ -17,11 +17,10 @@ SET(SEMISYNC_MASTER_SOURCES
semisync.cc semisync_master.cc semisync_master_plugin.cc
semisync.h semisync_master.h)
-MYSQL_ADD_PLUGIN(semisync_master ${SEMISYNC_MASTER_SOURCES}
- MODULE_ONLY MODULE_OUTPUT_NAME "semisync_master")
+MYSQL_ADD_PLUGIN(semisync_master ${SEMISYNC_MASTER_SOURCES})
SET(SEMISYNC_SLAVE_SOURCES semisync.cc semisync_slave.cc
semisync_slave_plugin.cc semisync.h semisync_slave.h )
-MYSQL_ADD_PLUGIN(semisync_slave ${SEMISYNC_SLAVE_SOURCES}
- MODULE_ONLY MODULE_OUTPUT_NAME "semisync_slave")
+
+MYSQL_ADD_PLUGIN(semisync_slave ${SEMISYNC_SLAVE_SOURCES})
diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc
index 88ffdd8ee73..ca25c74c8fa 100644
--- a/plugin/semisync/semisync_master.cc
+++ b/plugin/semisync/semisync_master.cc
@@ -429,12 +429,13 @@ int ReplSemiSyncMaster::disableMaster()
return 0;
}
-ReplSemiSyncMaster::~ReplSemiSyncMaster()
+void ReplSemiSyncMaster::cleanup()
{
if (init_done_)
{
mysql_mutex_destroy(&LOCK_binlog_);
mysql_cond_destroy(&COND_binlog_send_);
+ init_done_= 0;
}
delete active_tranxs_;
diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h
index 18143241e7c..66fa176624b 100644
--- a/plugin/semisync/semisync_master.h
+++ b/plugin/semisync/semisync_master.h
@@ -455,7 +455,9 @@ class ReplSemiSyncMaster
public:
ReplSemiSyncMaster();
- ~ReplSemiSyncMaster();
+ ~ReplSemiSyncMaster() {}
+
+ void cleanup();
bool getMasterEnabled() {
return master_enabled_;
diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc
index 70aa744604e..b8240c80ef3 100644
--- a/plugin/semisync/semisync_master_plugin.cc
+++ b/plugin/semisync/semisync_master_plugin.cc
@@ -19,7 +19,7 @@
#include "semisync_master.h"
#include "sql_class.h" // THD
-ReplSemiSyncMaster repl_semisync;
+static ReplSemiSyncMaster repl_semisync;
C_MODE_START
@@ -415,6 +415,7 @@ static int semi_sync_master_plugin_deinit(void *p)
sql_print_error("unregister_binlog_transmit_observer failed");
return 1;
}
+ repl_semisync.cleanup();
sql_print_information("unregister_replicator OK");
return 0;
}
@@ -426,7 +427,7 @@ struct Mysql_replication semi_sync_master_plugin= {
/*
Plugin library descriptor
*/
-mysql_declare_plugin(semi_sync_master)
+maria_declare_plugin(semisync_master)
{
MYSQL_REPLICATION_PLUGIN,
&semi_sync_master_plugin,
@@ -439,7 +440,8 @@ mysql_declare_plugin(semi_sync_master)
0x0100 /* 1.0 */,
semi_sync_master_status_vars, /* status variables */
semi_sync_master_system_vars, /* system variables */
- NULL, /* config options */
- 0, /* flags */
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_UNKNOWN
}
-mysql_declare_plugin_end;
+maria_declare_plugin_end;
+
diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc
index 5d373fa0862..96e614b845e 100644
--- a/plugin/semisync/semisync_slave_plugin.cc
+++ b/plugin/semisync/semisync_slave_plugin.cc
@@ -18,7 +18,7 @@
#include "semisync_slave.h"
#include <mysql.h>
-ReplSemiSyncSlave repl_semisync;
+static ReplSemiSyncSlave repl_semisync;
/*
indicate whether or not the slave should send a reply to the master.
@@ -212,7 +212,7 @@ struct Mysql_replication semi_sync_slave_plugin= {
/*
Plugin library descriptor
*/
-mysql_declare_plugin(semi_sync_slave)
+maria_declare_plugin(semisync_slave)
{
MYSQL_REPLICATION_PLUGIN,
&semi_sync_slave_plugin,
@@ -225,7 +225,8 @@ mysql_declare_plugin(semi_sync_slave)
0x0100 /* 1.0 */,
semi_sync_slave_status_vars, /* status variables */
semi_sync_slave_system_vars, /* system variables */
- NULL, /* config options */
- 0, /* flags */
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_UNKNOWN
}
-mysql_declare_plugin_end;
+maria_declare_plugin_end;
+
diff --git a/plugin/sql_errlog/sql_errlog.c b/plugin/sql_errlog/sql_errlog.c
index ce383916621..f84af963aca 100644
--- a/plugin/sql_errlog/sql_errlog.c
+++ b/plugin/sql_errlog/sql_errlog.c
@@ -144,24 +144,6 @@ static struct st_mysql_audit descriptor =
{ MYSQL_AUDIT_GENERAL_CLASSMASK }
};
-mysql_declare_plugin(sql_errlog)
-{
- MYSQL_AUDIT_PLUGIN,
- &descriptor,
- "SQL_ERROR_LOG",
- "Alexey Botchkov",
- "Log SQL level errors to a file with rotation",
- PLUGIN_LICENSE_GPL,
- sql_error_log_init,
- sql_error_log_deinit,
- 0x0100,
- NULL,
- vars,
- NULL,
- 0
-}
-mysql_declare_plugin_end;
-
maria_declare_plugin(sql_errlog)
{
MYSQL_AUDIT_PLUGIN,
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 639b2209b5b..6e490b20211 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -257,7 +257,7 @@ fi
# Now we can get arguments from the groups [mysqld] and [mysql_install_db]
# in the my.cfg file, then re-run to merge with command line arguments.
-parse_arguments `"$print_defaults" $defaults mysqld mariadb mysql_install_db client-server`
+parse_arguments `"$print_defaults" $defaults --mysqld mysql_install_db`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 81015746ae9..cd1b6fc18b7 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -237,7 +237,7 @@ sub defaults_for_group
sub init_log
{
- foreach my $opt (defaults_for_group('mysqld mariadb'))
+ foreach my $opt (defaults_for_group('--mysqld'))
{
if ($opt =~ m/^--datadir=(.*)/ && -d "$1" && -w "$1")
{
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index f49f885bf5a..572a08781c8 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -71,6 +71,7 @@ Usage: $0 [OPTIONS]
--defaults-extra-file=FILE Also use defaults from the specified file
--ledir=DIRECTORY Look for mysqld in the specified directory
--open-files-limit=LIMIT Limit the number of open files
+ --crash-script=FILE Script to call when mysqld crashes
--timezone=TZ Set the system timezone
--malloc-lib=LIB Preload shared library LIB if available
--mysqld=FILE Use the specified file as mysqld
@@ -202,6 +203,7 @@ parse_arguments() {
optname_subst=`echo "$optname" | sed 's/_/-/g'`
arg=`echo $arg | sed "s/^$optname/$optname_subst/"`
case "$arg" in
+ --crash-script=*) CRASH_SCRIPT="$val" ;;
# these get passed explicitly to mysqld
--basedir=*) MY_BASEDIR_VERSION="$val" ;;
--datadir=*|--data=*) DATADIR="$val" ;;
@@ -501,7 +503,7 @@ append_arg_to_args () {
args=
SET_USER=2
-parse_arguments `$print_defaults $defaults --loose-verbose mysqld mariadb server client-server`
+parse_arguments `$print_defaults $defaults --loose-verbose --mysqld`
if test $SET_USER -eq 2
then
SET_USER=0
@@ -585,7 +587,7 @@ then
log_notice "Logging to '$err_log'."
logging=file
- if [ ! -e "$err_log" ]; then # if error log already exists,
+ if [ ! -f "$err_log" ]; then # if error log already exists,
touch "$err_log" # we just append. otherwise,
chmod "$fmode" "$err_log" # fix the permissions here!
fi
@@ -799,13 +801,13 @@ have_sleep=1
while true
do
- rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety
+ rm -f "$pid_file" # Some extra safety
start_time=`date +%M%S`
eval_log_error "$cmd"
- if [ $want_syslog -eq 0 -a ! -e "$err_log" ]; then
+ if [ $want_syslog -eq 0 -a ! -f "$err_log" ]; then
touch "$err_log" # hypothetical: log was renamed but not
chown $user "$err_log" # flushed yet. we'd recreate it with
chmod "$fmode" "$err_log" # wrong owner next time we log, so set
@@ -874,6 +876,11 @@ do
done
fi
log_notice "mysqld restarted"
+ if test -n "$CRASH_SCRIPT"
+ then
+ crash_script_output=`$CRASH_SCRIPT 2>&1`
+ log_error "$crash_script_output"
+ fi
done
log_notice "mysqld from pid file $pid_file ended"
diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh
index 0de4fe159f0..c04ffad7457 100644
--- a/scripts/mysqldumpslow.sh
+++ b/scripts/mysqldumpslow.sh
@@ -53,7 +53,7 @@ GetOptions(\%opt,
$opt{'help'} and usage();
unless (@ARGV) {
- my $defaults = `my_print_defaults mysqld mariadb`;
+ my $defaults = `my_print_defaults --mysqld`;
my $datadir = ($defaults =~ m/--datadir=(.*)/g)[-1];
if (!$datadir or $opt{i}) {
diff --git a/sql-common/client.c b/sql-common/client.c
index e03f5236fef..a19bae35b78 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2239,7 +2239,10 @@ mysql_autodetect_character_set(MYSQL *mysql)
#ifdef __WIN__
char cpbuf[64];
{
- my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int) GetConsoleCP());
+ UINT cp= GetConsoleCP();
+ if (cp == 0)
+ cp= GetACP();
+ my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp);
csname= my_os_charset_to_mysql_charset(cpbuf);
}
#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO)
@@ -2617,8 +2620,6 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
mysql->server_version, mysql->server_capabilities,
mysql->server_status, mysql->client_flag));
- compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH);
-
/* This needs to be changed as it's not useful with big packets */
if (mysql->user[0])
strmake(end, mysql->user, USERNAME_LENGTH);
@@ -3463,6 +3464,12 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
strmov(mysql->server_version,(char*) net->read_pos+1);
mysql->port=port;
+ /* remove the rpl hack from the version string, see RPL_VERSION_HACK comment */
+ if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH &&
+ strncmp(mysql->server_version, RPL_VERSION_HACK,
+ sizeof(RPL_VERSION_HACK) - 1) == 0)
+ mysql->server_version+= sizeof(RPL_VERSION_HACK) - 1;
+
if (pkt_end >= end + SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323 + 1)
{
/*
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index fbcf52dbf19..d4093bb4df9 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -1,5 +1,6 @@
/*
Copyright (c) 2004, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2013, Monty Program Ab.
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
@@ -24,10 +25,10 @@
ulonglong log_10_int[20]=
{
1, 10, 100, 1000, 10000UL, 100000UL, 1000000UL, 10000000UL,
- ULL(100000000), ULL(1000000000), ULL(10000000000), ULL(100000000000),
- ULL(1000000000000), ULL(10000000000000), ULL(100000000000000),
- ULL(1000000000000000), ULL(10000000000000000), ULL(100000000000000000),
- ULL(1000000000000000000), ULL(10000000000000000000)
+ 100000000ULL, 1000000000ULL, 10000000000ULL, 100000000000ULL,
+ 1000000000000ULL, 10000000000000ULL, 100000000000000ULL,
+ 1000000000000000ULL, 10000000000000000ULL, 100000000000000000ULL,
+ 1000000000000000000ULL, 10000000000000000000ULL
};
@@ -1170,19 +1171,19 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
time_res->time_type=MYSQL_TIMESTAMP_DATETIME;
- if (nr <= (YY_PART_YEAR-1)*LL(10000000000)+LL(1231235959))
+ if (nr <= (YY_PART_YEAR-1)*10000000000LL+1231235959LL)
{
- nr= nr+LL(20000000000000); /* YYMMDDHHMMSS, 2000-2069 */
+ nr= nr+20000000000000LL; /* YYMMDDHHMMSS, 2000-2069 */
goto ok;
}
- if (nr < YY_PART_YEAR*LL(10000000000)+ LL(101000000))
+ if (nr < YY_PART_YEAR*10000000000LL+ 101000000LL)
goto err;
- if (nr <= LL(991231235959))
- nr= nr+LL(19000000000000); /* YYMMDDHHMMSS, 1970-1999 */
+ if (nr <= 991231235959LL)
+ nr= nr+19000000000000LL; /* YYMMDDHHMMSS, 1970-1999 */
ok:
- part1=(long) (nr/LL(1000000));
- part2=(long) (nr - (longlong) part1*LL(1000000));
+ part1=(long) (nr/1000000LL);
+ part2=(long) (nr - (longlong) part1*1000000LL);
time_res->year= (int) (part1/10000L); part1%=10000L;
time_res->month= (int) part1 / 100;
time_res->day= (int) part1 % 100;
@@ -1202,7 +1203,7 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
/* Don't want to have was_cut get set if NO_ZERO_DATE was violated. */
if (nr || !(flags & TIME_NO_ZERO_DATE))
*was_cut= 1;
- return LL(-1);
+ return -1;
err:
{
@@ -1212,7 +1213,7 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
time_res->time_type= save; /* Restore range */
*was_cut= 1; /* Found invalid date */
}
- return LL(-1);
+ return -1;
}
/*
@@ -1277,7 +1278,7 @@ ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *my_time)
{
return ((ulonglong) (my_time->year * 10000UL +
my_time->month * 100UL +
- my_time->day) * ULL(1000000) +
+ my_time->day) * 1000000ULL +
(ulonglong) (my_time->hour * 10000UL +
my_time->minute * 100UL +
my_time->second));
@@ -1338,7 +1339,7 @@ ulonglong TIME_to_ulonglong(const MYSQL_TIME *my_time)
return TIME_to_ulonglong_time(my_time);
case MYSQL_TIMESTAMP_NONE:
case MYSQL_TIMESTAMP_ERROR:
- return ULL(0);
+ return 0;
default:
DBUG_ASSERT(0);
}
diff --git a/sql-common/pack.c b/sql-common/pack.c
index 7ff89471b45..69ab7ac9e17 100644
--- a/sql-common/pack.c
+++ b/sql-common/pack.c
@@ -96,19 +96,19 @@ my_ulonglong net_field_length_ll(uchar **packet)
uchar *net_store_length(uchar *packet, ulonglong length)
{
- if (length < (ulonglong) LL(251))
+ if (length < (ulonglong) 251LL)
{
*packet=(uchar) length;
return packet+1;
}
/* 251 is reserved for NULL */
- if (length < (ulonglong) LL(65536))
+ if (length < (ulonglong) 65536LL)
{
*packet++=252;
int2store(packet,(uint) length);
return packet+2;
}
- if (length < (ulonglong) LL(16777216))
+ if (length < (ulonglong) 16777216LL)
{
*packet++=253;
int3store(packet,(ulong) length);
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 8c2b6c81755..aa916a3725a 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -189,9 +189,12 @@ INSTALL_DEBUG_TARGET(mysqld
PDB_DESTINATION ${INSTALL_SBINDIR}/debug
RENAME mysqld-debug)
+INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake)
+
# Handle out-of-source build from source package with possibly broken
# bison. Copy bison output to from source to build directory, if not already
# there
+IF (NOT BISON_USABLE)
IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc)
IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc)
@@ -202,9 +205,8 @@ IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
ENDIF()
ENDIF()
+ENDIF()
-
-INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake)
RUN_BISON(
${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
diff --git a/sql/create_options.cc b/sql/create_options.cc
index 5cedfa03a63..f12120bd0a1 100644
--- a/sql/create_options.cc
+++ b/sql/create_options.cc
@@ -21,6 +21,7 @@
#include "create_options.h"
#include <my_getopt.h>
+#include "set_var.h"
#define FRM_QUOTED_VALUE 0x8000
@@ -74,7 +75,7 @@ void engine_option_value::link(engine_option_value **start,
}
static bool report_wrong_value(THD *thd, const char *name, const char *val,
- my_bool suppress_warning)
+ bool suppress_warning)
{
if (suppress_warning)
return 0;
@@ -92,7 +93,7 @@ static bool report_wrong_value(THD *thd, const char *name, const char *val,
}
static bool report_unknown_option(THD *thd, engine_option_value *val,
- my_bool suppress_warning)
+ bool suppress_warning)
{
DBUG_ENTER("report_unknown_option");
@@ -115,8 +116,8 @@ static bool report_unknown_option(THD *thd, engine_option_value *val,
}
static bool set_one_value(ha_create_table_option *opt,
- THD *thd, LEX_STRING *value, void *base,
- my_bool suppress_warning,
+ THD *thd, const LEX_STRING *value, void *base,
+ bool suppress_warning,
MEM_ROOT *root)
{
DBUG_ENTER("set_one_value");
@@ -126,6 +127,8 @@ static bool set_one_value(ha_create_table_option *opt,
(value->str ? value->str : "<DEFAULT>")));
switch (opt->type)
{
+ case HA_OPTION_TYPE_SYSVAR:
+ DBUG_ASSERT(0); // HA_OPTION_TYPE_SYSVAR's are replaced in resolve_sysvars()
case HA_OPTION_TYPE_ULL:
{
ulonglong *val= (ulonglong*)((char*)base + opt->offset);
@@ -257,52 +260,92 @@ static const size_t ha_option_type_sizeof[]=
@retval FALSE OK
*/
-my_bool parse_option_list(THD* thd, void *option_struct_arg,
- engine_option_value *option_list,
- ha_create_table_option *rules,
- my_bool suppress_warning,
- MEM_ROOT *root)
+bool parse_option_list(THD* thd, handlerton *hton, void *option_struct_arg,
+ engine_option_value **option_list,
+ ha_create_table_option *rules,
+ bool suppress_warning, MEM_ROOT *root)
{
ha_create_table_option *opt;
size_t option_struct_size= 0;
- engine_option_value *val= option_list;
+ engine_option_value *val, *last;
void **option_struct= (void**)option_struct_arg;
DBUG_ENTER("parse_option_list");
DBUG_PRINT("enter",
- ("struct: 0x%lx list: 0x%lx rules: 0x%lx suppres %u root 0x%lx",
- (ulong) *option_struct, (ulong)option_list, (ulong)rules,
- (uint) suppress_warning, (ulong) root));
+ ("struct: %p list: %p rules: %p suppress_warning: %u root: %p",
+ *option_struct, *option_list, rules,
+ (uint) suppress_warning, root));
if (rules)
{
- LEX_STRING default_val= {NULL, 0};
for (opt= rules; opt->name; opt++)
set_if_bigger(option_struct_size, opt->offset +
ha_option_type_sizeof[opt->type]);
*option_struct= alloc_root(root, option_struct_size);
-
- /* set all values to default */
- for (opt= rules; opt->name; opt++)
- set_one_value(opt, thd, &default_val, *option_struct,
- suppress_warning, root);
}
- for (; val; val= val->next)
+ for (opt= rules; opt && opt->name; opt++)
{
- for (opt= rules; opt && opt->name; opt++)
+ bool seen=false;
+ for (val= *option_list; val; val= val->next)
{
+ last= val;
if (my_strnncoll(system_charset_info,
(uchar*)opt->name, opt->name_length,
(uchar*)val->name.str, val->name.length))
continue;
+ seen=true;
+
+ if (val->parsed && !val->value.str)
+ continue;
+
if (set_one_value(opt, thd, &val->value,
*option_struct, suppress_warning || val->parsed, root))
DBUG_RETURN(TRUE);
val->parsed= true;
break;
}
+ if (!seen)
+ {
+ LEX_STRING default_val= null_lex_str;
+
+ /*
+ If it's CREATE/ALTER TABLE parsing mode (options are created in the
+ transient thd->mem_root, not in the long living TABLE_SHARE::mem_root),
+ and variable-backed option was not explicitly set.
+
+ If it's not create, but opening of the existing frm (that was,
+ probably, created with the older version of the storage engine and
+ does not have this option stored), we take the *default* value of the
+ sysvar, not the *current* value. Because we don't want to have
+ different option values for the same table if it's opened many times.
+ */
+ if (root == thd->mem_root && opt->var)
+ {
+ // take a value from the variable and add it to the list
+ sys_var *sysvar= find_hton_sysvar(hton, opt->var);
+ DBUG_ASSERT(sysvar);
+
+ char buf[256];
+ String sbuf(buf, sizeof(buf), system_charset_info), *str;
+ if ((str= sysvar->val_str(&sbuf, thd, OPT_SESSION, 0)))
+ {
+ LEX_STRING name= { const_cast<char*>(opt->name), opt->name_length };
+ default_val.str= strmake_root(root, str->ptr(), str->length());
+ default_val.length= str->length();
+ val= new (root) engine_option_value(name, default_val, true,
+ option_list, &last);
+ val->parsed= true;
+ }
+ }
+ set_one_value(opt, thd, &default_val, *option_struct,
+ suppress_warning, root);
+ }
+ }
+
+ for (val= *option_list; val; val= val->next)
+ {
if (report_unknown_option(thd, val, suppress_warning))
DBUG_RETURN(TRUE);
val->parsed= true;
@@ -313,6 +356,102 @@ my_bool parse_option_list(THD* thd, void *option_struct_arg,
/**
+ Resolves all HA_OPTION_TYPE_SYSVAR elements.
+
+ This is done when an engine is loaded.
+*/
+static bool resolve_sysvars(handlerton *hton, ha_create_table_option *rules)
+{
+ for (ha_create_table_option *opt= rules; opt && opt->name; opt++)
+ {
+ if (opt->type == HA_OPTION_TYPE_SYSVAR)
+ {
+ struct my_option optp;
+ plugin_opt_set_limits(&optp, opt->var);
+ switch(optp.var_type) {
+ case GET_ULL:
+ case GET_ULONG:
+ case GET_UINT:
+ opt->type= HA_OPTION_TYPE_ULL;
+ opt->def_value= (ulonglong)optp.def_value;
+ opt->min_value= (ulonglong)optp.min_value;
+ opt->max_value= (ulonglong)optp.max_value;
+ opt->block_size= (ulonglong)optp.block_size;
+ break;
+ case GET_STR:
+ case GET_STR_ALLOC:
+ opt->type= HA_OPTION_TYPE_STRING;
+ break;
+ case GET_BOOL:
+ opt->type= HA_OPTION_TYPE_BOOL;
+ opt->def_value= optp.def_value;
+ break;
+ case GET_ENUM:
+ {
+ opt->type= HA_OPTION_TYPE_ENUM;
+ opt->def_value= optp.def_value;
+
+ char buf[256];
+ String str(buf, sizeof(buf), system_charset_info);
+ for (const char **s= optp.typelib->type_names; *s; s++)
+ {
+ if (str.append(*s) || str.append(','))
+ return 1;
+ }
+ DBUG_ASSERT(str.length());
+ opt->values= my_strndup(str.ptr(), str.length()-1, MYF(MY_WME));
+ if (!opt->values)
+ return 1;
+ break;
+ }
+ default:
+ DBUG_ASSERT(0);
+ }
+ }
+ }
+ return 0;
+}
+
+bool resolve_sysvar_table_options(handlerton *hton)
+{
+ return resolve_sysvars(hton, hton->table_options) ||
+ resolve_sysvars(hton, hton->field_options) ||
+ resolve_sysvars(hton, hton->index_options);
+}
+
+/*
+ Restore HA_OPTION_TYPE_SYSVAR options back as they were
+ before resolve_sysvars().
+
+ This is done when the engine is unloaded, so that we could
+ call resolve_sysvars() if the engine is installed again.
+*/
+static void free_sysvars(handlerton *hton, ha_create_table_option *rules)
+{
+ for (ha_create_table_option *opt= rules; opt && opt->name; opt++)
+ {
+ if (opt->var)
+ {
+ my_free(const_cast<char*>(opt->values));
+ opt->type= HA_OPTION_TYPE_SYSVAR;
+ opt->def_value= 0;
+ opt->min_value= 0;
+ opt->max_value= 0;
+ opt->block_size= 0;
+ opt->values= 0;
+ }
+ }
+}
+
+void free_sysvar_table_options(handlerton *hton)
+{
+ free_sysvars(hton, hton->table_options);
+ free_sysvars(hton, hton->field_options);
+ free_sysvars(hton, hton->index_options);
+}
+
+
+/**
Parses all table/fields/keys options
@param thd thread handler
@@ -323,27 +462,27 @@ my_bool parse_option_list(THD* thd, void *option_struct_arg,
@retval FALSE OK
*/
-my_bool parse_engine_table_options(THD *thd, handlerton *ht,
- TABLE_SHARE *share)
+bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share)
{
MEM_ROOT *root= &share->mem_root;
DBUG_ENTER("parse_engine_table_options");
- if (parse_option_list(thd, &share->option_struct, share->option_list,
+ if (parse_option_list(thd, ht, &share->option_struct, & share->option_list,
ht->table_options, TRUE, root))
DBUG_RETURN(TRUE);
for (Field **field= share->field; *field; field++)
{
- if (parse_option_list(thd, &(*field)->option_struct, (*field)->option_list,
+ if (parse_option_list(thd, ht, &(*field)->option_struct,
+ & (*field)->option_list,
ht->field_options, TRUE, root))
DBUG_RETURN(TRUE);
}
for (uint index= 0; index < share->keys; index ++)
{
- if (parse_option_list(thd, &share->key_info[index].option_struct,
- share->key_info[index].option_list,
+ if (parse_option_list(thd, ht, &share->key_info[index].option_struct,
+ & share->key_info[index].option_list,
ht->index_options, TRUE, root))
DBUG_RETURN(TRUE);
}
@@ -543,8 +682,8 @@ uchar *engine_option_value::frm_read(const uchar *buff, engine_option_value **st
@retval FALSE OK
*/
-my_bool engine_table_options_frm_read(const uchar *buff, uint length,
- TABLE_SHARE *share)
+bool engine_table_options_frm_read(const uchar *buff, uint length,
+ TABLE_SHARE *share)
{
const uchar *buff_end= buff + length;
engine_option_value *UNINIT_VAR(end);
diff --git a/sql/create_options.h b/sql/create_options.h
index ae918f6cea1..ea05bf75fac 100644
--- a/sql/create_options.h
+++ b/sql/create_options.h
@@ -69,16 +69,15 @@ class engine_option_value: public Sql_alloc
typedef struct st_key KEY;
class Create_field;
-my_bool parse_engine_table_options(THD *thd, handlerton *ht,
+bool resolve_sysvar_table_options(handlerton *hton);
+void free_sysvar_table_options(handlerton *hton);
+bool parse_engine_table_options(THD *thd, handlerton *ht, TABLE_SHARE *share);
+bool parse_option_list(THD* thd, handlerton *hton, void *option_struct,
+ engine_option_value **option_list,
+ ha_create_table_option *rules,
+ bool suppress_warning, MEM_ROOT *root);
+bool engine_table_options_frm_read(const uchar *buff, uint length,
TABLE_SHARE *share);
-my_bool parse_option_list(THD* thd, void *option_struct,
- engine_option_value *option_list,
- ha_create_table_option *rules,
- my_bool suppress_warning,
- MEM_ROOT *root);
-my_bool engine_table_options_frm_read(const uchar *buff,
- uint length,
- TABLE_SHARE *share);
engine_option_value *merge_engine_table_options(engine_option_value *source,
engine_option_value *changes,
MEM_ROOT *root);
diff --git a/sql/datadict.cc b/sql/datadict.cc
index e3f679cc7ec..4bc74af7bdb 100644
--- a/sql/datadict.cc
+++ b/sql/datadict.cc
@@ -55,11 +55,14 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
if the following test is true (arg #3). This should not have effect
on return value from this function (default FRMTYPE_TABLE)
*/
- if (header[0] != (uchar) 254 || header[1] != 1 ||
- (header[2] != FRM_VER && header[2] != FRM_VER+1 &&
- (header[2] < FRM_VER+3 || header[2] > FRM_VER+4)))
+ if (!is_binary_frm_header(header))
DBUG_RETURN(FRMTYPE_TABLE);
+ /*
+ XXX this is a bug.
+ if header[3] is > DB_TYPE_FIRST_DYNAMIC, then the complete
+ storage engine name must be read from the frm
+ */
*dbt= (enum legacy_db_type) (uint) *(header + 3);
/* Probably a table. */
@@ -67,117 +70,44 @@ frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt)
}
-/**
- Given a table name, check type of .frm and legacy table type.
-
- @param[in] thd The current session.
- @param[in] db Table schema.
- @param[in] table_name Table database.
- @param[out] table_type handlerton of the table if FRMTYPE_TABLE,
- otherwise undefined.
-
- @return FALSE if FRMTYPE_TABLE and storage engine found. TRUE otherwise.
-*/
-
-bool dd_frm_storage_engine(THD *thd, const char *db, const char *table_name,
- handlerton **table_type)
-{
- char path[FN_REFLEN + 1];
- enum legacy_db_type db_type;
- LEX_STRING db_name = {(char *) db, strlen(db)};
-
- /* There should be at least some lock on the table. */
- DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db,
- table_name, MDL_SHARED));
-
- if (check_db_name(&db_name))
- {
- my_error(ER_WRONG_DB_NAME, MYF(0), db_name.str);
- return TRUE;
- }
-
- if (check_table_name(table_name, strlen(table_name), FALSE))
- {
- my_error(ER_WRONG_TABLE_NAME, MYF(0), table_name);
- return TRUE;
- }
-
- (void) build_table_filename(path, sizeof(path) - 1, db,
- table_name, reg_ext, 0);
-
- dd_frm_type(thd, path, &db_type);
-
- /* Type is unknown if the object is not found or is not a table. */
- if (db_type == DB_TYPE_UNKNOWN ||
- !(*table_type= ha_resolve_by_legacy_type(thd, db_type)))
- {
- my_error(ER_NO_SUCH_TABLE, MYF(0), db, table_name);
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-/**
- Given a table name, check if the storage engine for the
- table referred by this name supports an option 'flag'.
- Return an error if the table does not exist or is not a
- base table.
-
- @pre Any metadata lock on the table.
-
- @param[in] thd The current session.
- @param[in] db Table schema.
- @param[in] table_name Table database.
- @param[in] flag The option to check.
- @param[out] yes_no The result. Undefined if error.
-*/
-
-bool dd_check_storage_engine_flag(THD *thd,
- const char *db, const char *table_name,
- uint32 flag, bool *yes_no)
-{
- handlerton *table_type;
-
- if (dd_frm_storage_engine(thd, db, table_name, &table_type))
- return TRUE;
-
- *yes_no= ha_check_storage_engine_flag(table_type, flag);
-
- return FALSE;
-}
-
-
/*
Regenerate a metadata locked table.
@param thd Thread context.
@param db Name of the database to which the table belongs to.
@param name Table name.
+ @param path For temporary tables only - path to table files.
+ Otherwise NULL (the path is calculated from db and table names).
@retval FALSE Success.
@retval TRUE Error.
*/
-bool dd_recreate_table(THD *thd, const char *db, const char *table_name)
+bool dd_recreate_table(THD *thd, const char *db, const char *table_name,
+ const char *path)
{
bool error= TRUE;
HA_CREATE_INFO create_info;
- char path[FN_REFLEN + 1];
+ char path_buf[FN_REFLEN + 1];
DBUG_ENTER("dd_recreate_table");
- /* There should be a exclusive metadata lock on the table. */
- DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
- MDL_EXCLUSIVE));
-
memset(&create_info, 0, sizeof(create_info));
- /* Create a path to the table, but without a extension. */
- build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0);
+ if (path)
+ create_info.options|= HA_LEX_CREATE_TMP_TABLE;
+ else
+ {
+ build_table_filename(path_buf, sizeof(path_buf) - 1,
+ db, table_name, "", 0);
+ path= path_buf;
+
+ /* There should be a exclusive metadata lock on the table. */
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
+ MDL_EXCLUSIVE));
+ }
/* Attempt to reconstruct the table. */
- error= ha_create_table(thd, path, db, table_name, &create_info, TRUE);
+ error= ha_create_table(thd, path, db, table_name, &create_info, NULL);
DBUG_RETURN(error);
}
diff --git a/sql/datadict.h b/sql/datadict.h
index f852b02f52c..dd80942daca 100644
--- a/sql/datadict.h
+++ b/sql/datadict.h
@@ -28,14 +28,22 @@ enum frm_type_enum
FRMTYPE_VIEW
};
+/*
+ Take extra care when using dd_frm_type() - it only checks the .frm file,
+ and it won't work for any engine that supports discovery.
+
+ Prefer to use ha_table_exists() instead.
+ To check whether it's an frm of a view, use dd_frm_is_view().
+*/
frm_type_enum dd_frm_type(THD *thd, char *path, enum legacy_db_type *dbt);
-bool dd_frm_storage_engine(THD *thd, const char *db, const char *table_name,
- handlerton **table_type);
-bool dd_check_storage_engine_flag(THD *thd,
- const char *db, const char *table_name,
- uint32 flag,
- bool *yes_no);
-bool dd_recreate_table(THD *thd, const char *db, const char *table_name);
+static inline bool dd_frm_is_view(THD *thd, char *path)
+{
+ enum legacy_db_type not_used;
+ return dd_frm_type(thd, path, &not_used) == FRMTYPE_VIEW;
+}
+
+bool dd_recreate_table(THD *thd, const char *db, const char *table_name,
+ const char *path = NULL);
#endif // DATADICT_INCLUDED
diff --git a/sql/discover.cc b/sql/discover.cc
index b9dba92a780..4224e8ce0b0 100644
--- a/sql/discover.cc
+++ b/sql/discover.cc
@@ -45,7 +45,7 @@
3 Could not allocate data for read. Could not read file
*/
-int readfrm(const char *name, uchar **frmdata, size_t *len)
+int readfrm(const char *name, const uchar **frmdata, size_t *len)
{
int error;
char index_file[FN_REFLEN];
@@ -70,13 +70,17 @@ int readfrm(const char *name, uchar **frmdata, size_t *len)
error= 2;
if (mysql_file_fstat(file, &state, MYF(0)))
goto err;
- read_len= (size_t)state.st_size;
+ read_len= (size_t)min(FRM_MAX_SIZE, state.st_size); // safety
// Read whole frm file
error= 3;
- read_data= 0; // Nothing to free
- if (read_string(file, &read_data, read_len))
+ if (!(read_data= (uchar*)my_malloc(read_len, MYF(MY_WME))))
goto err;
+ if (mysql_file_read(file, read_data, read_len, MYF(MY_NABP)))
+ {
+ my_free(read_data);
+ goto err;
+ }
// Setup return data
*frmdata= (uchar*) read_data;
@@ -96,7 +100,7 @@ int readfrm(const char *name, uchar **frmdata, size_t *len)
Write the content of a frm data pointer
to a frm file.
- @param name path to table-file "db/name"
+ @param path path to table-file "db/name"
@param frmdata frm data
@param len length of the frmdata
@@ -106,29 +110,167 @@ int readfrm(const char *name, uchar **frmdata, size_t *len)
2 Could not write file
*/
-int writefrm(const char *name, const uchar *frmdata, size_t len)
+int writefrm(const char *path, const char *db, const char *table,
+ bool tmp_table, const uchar *frmdata, size_t len)
{
- File file;
- char index_file[FN_REFLEN];
+ char file_name[FN_REFLEN+1];
int error;
+ int create_flags= O_RDWR | O_TRUNC;
DBUG_ENTER("writefrm");
- DBUG_PRINT("enter",("name: '%s' len: %lu ",name, (ulong) len));
+ DBUG_PRINT("enter",("name: '%s' len: %lu ",path, (ulong) len));
- error= 0;
- if ((file= mysql_file_create(key_file_frm,
- fn_format(index_file, name, "", reg_ext,
- MY_UNPACK_FILENAME | MY_APPEND_EXT),
- CREATE_MODE, O_RDWR | O_TRUNC,
- MYF(MY_WME))) >= 0)
+ if (tmp_table)
+ create_flags|= O_EXCL | O_NOFOLLOW;
+
+ strxnmov(file_name, sizeof(file_name)-1, path, reg_ext, NullS);
+
+ File file= mysql_file_create(key_file_frm, file_name,
+ CREATE_MODE, create_flags, MYF(0));
+
+ if ((error= file < 0))
{
- if (mysql_file_write(file, frmdata, len, MYF(MY_WME | MY_NABP)))
- error= 2;
- (void) mysql_file_close(file, MYF(0));
+ if (my_errno == ENOENT)
+ my_error(ER_BAD_DB_ERROR, MYF(0), db);
+ else
+ my_error(ER_CANT_CREATE_TABLE, MYF(0), db, table, my_errno);
+ }
+ else
+ {
+ error= mysql_file_write(file, frmdata, len, MYF(MY_WME | MY_NABP));
+
+ if (!error && !tmp_table && opt_sync_frm)
+ error= mysql_file_sync(file, MYF(MY_WME)) ||
+ my_sync_dir_by_file(file_name, MYF(MY_WME));
+
+ error|= mysql_file_close(file, MYF(MY_WME));
}
DBUG_RETURN(error);
} /* writefrm */
+static inline void advance(FILEINFO* &from, FILEINFO* &to,
+ FILEINFO* cur, bool &skip)
+{
+ if (skip) // if not copying
+ from= cur; // just advance the start pointer
+ else // if copying
+ if (to == from) // but to the same place (not shifting the data)
+ from= to= cur; // advance both pointers
+ else // otherwise
+ while (from < cur) // have to copy [from...cur) to [to...)
+ *to++ = *from++;
+ skip= false;
+}
+/**
+ Go through the directory listing looking for files with a specified
+ extension and add them to the result list
+
+ @details
+ This function may be called many times on the same directory listing
+ but with different extensions. To avoid discovering the same table twice,
+ whenever a table file is discovered, all files with the same name
+ (independently from the extensions) are removed from the list.
+ Example: the list contained
+ { "db.opt", "t1.MYD", "t1.MYI", "t1.frm", "t2.ARZ", "t3.ARZ", "t3.frm" }
+ on discovering all ".frm" files, tables "t1" and "t3" will be found,
+ and list will become
+ { "db.opt", "t2.ARZ" }
+ and now ".ARZ" discovery can discover the table "t2"
+ @note
+ This function assumes that the directory listing is sorted alphabetically.
+
+ @note Partitioning makes this more complicated. A partitioned table t1 might
+ have files, like t1.frm, t1#P#part1.ibd, t1#P#foo.ibd, etc.
+ That means we need to compare file names only up to the first '#' or '.'
+ whichever comes first.
+*/
+int extension_based_table_discovery(MY_DIR *dirp, const char *ext_meta,
+ handlerton::discovered_list *result)
+{
+ CHARSET_INFO *cs= character_set_filesystem;
+ size_t ext_meta_len= strlen(ext_meta);
+ FILEINFO *from, *to, *cur, *end;
+ bool skip= false;
+
+ from= to= cur= dirp->dir_entry;
+ end= cur + dirp->number_of_files;
+ while (cur < end)
+ {
+ char *octothorp= strrchr(cur->name, '#');
+ char *ext= strchr(octothorp ? octothorp : cur->name, FN_EXTCHAR);
+
+ if (ext && octothorp != cur->name)
+ {
+ size_t len= (octothorp ? octothorp : ext) - cur->name;
+ if (from != cur &&
+ (my_strnncoll(cs, (uchar*)from->name, len, (uchar*)cur->name, len) ||
+ (from->name[len] != FN_EXTCHAR && from->name[len] != '#')))
+ advance(from, to, cur, skip);
+
+ if (my_strnncoll(cs, (uchar*)ext, strlen(ext),
+ (uchar*)ext_meta, ext_meta_len) == 0)
+ {
+ *ext = 0;
+ if (result->add_file(cur->name))
+ return 1;
+ *ext = FN_EXTCHAR;
+ skip= true; // table discovered, skip all files with the same name
+ }
+ }
+ else
+ {
+ advance(from, to, cur, skip);
+ from++;
+ }
+
+ cur++;
+ }
+ advance(from, to, cur, skip);
+ dirp->number_of_files= to - dirp->dir_entry;
+ return 0;
+}
+
+/**
+ Simple, not reusable file-based table discovery
+
+ @details
+ simplified version of extension_based_table_discovery(), that does not
+ modify the list of files. It cannot be called many times for the same
+ directory listing, otherwise it'll produce duplicate results.
+
+ @note
+ For backward compatibility reasons, this will find tables with names,
+ starting from '#', as long as they don't start from '#sql-'.
+ These names are invalid since 5.0, and the compex discovery function
+ will ignore them. Anyone still having these files, should disable
+ discovering engines, and rename these invalid table files.
+*/
+int ext_table_discovery_simple(MY_DIR *dirp,
+ handlerton::discovered_list *result)
+{
+ CHARSET_INFO *cs= character_set_filesystem;
+ FILEINFO *cur, *end;
+
+ cur= dirp->dir_entry;
+ end= cur + dirp->number_of_files;
+ while (cur < end)
+ {
+ char *ext= strrchr(cur->name, FN_EXTCHAR);
+
+ if (ext && !is_prefix(cur->name, tmp_file_prefix))
+ {
+ if (my_strnncoll(cs, (uchar*)ext, strlen(ext),
+ (uchar*)reg_ext, reg_ext_length) == 0)
+ {
+ *ext = 0;
+ if (result->add_file(cur->name))
+ return 1;
+ }
+ }
+ cur++;
+ }
+ return 0;
+}
diff --git a/sql/discover.h b/sql/discover.h
index a663e44128d..fbf94891c74 100644
--- a/sql/discover.h
+++ b/sql/discover.h
@@ -18,7 +18,16 @@
#include "my_global.h" /* uchar */
-int readfrm(const char *name, uchar **data, size_t *length);
-int writefrm(const char* name, const uchar* data, size_t len);
+int extension_based_table_discovery(MY_DIR *dirp, const char *ext,
+ handlerton::discovered_list *tl);
+
+#ifdef MYSQL_SERVER
+int readfrm(const char *name, const uchar **data, size_t *length);
+int writefrm(const char *path, const char *db, const char *table,
+ bool tmp_table, const uchar *frmdata, size_t len);
+
+int ext_table_discovery_simple(MY_DIR *dirp,
+ handlerton::discovered_list *result);
+#endif
#endif /* DISCOVER_INCLUDED */
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index ec96ca45a0e..6317af1eac3 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -132,11 +132,11 @@ post_init_event_thread(THD *thd)
return TRUE;
}
+ thread_safe_increment32(&thread_count, &thread_count_lock);
mysql_mutex_lock(&LOCK_thread_count);
threads.append(thd);
- thread_count++;
- inc_thread_running();
mysql_mutex_unlock(&LOCK_thread_count);
+ inc_thread_running();
return FALSE;
}
@@ -154,12 +154,8 @@ deinit_event_thread(THD *thd)
{
thd->proc_info= "Clearing";
DBUG_PRINT("exit", ("Event thread finishing"));
- mysql_mutex_lock(&LOCK_thread_count);
- thread_count--;
- dec_thread_running();
- delete thd;
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
+
+ delete_running_thd(thd);
}
@@ -440,12 +436,7 @@ Event_scheduler::start()
ret= TRUE;
new_thd->proc_info= "Clearing";
- mysql_mutex_lock(&LOCK_thread_count);
- thread_count--;
- dec_thread_running();
- delete new_thd;
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
+ delete_running_thd(new_thd);
}
end:
UNLOCK_DATA();
@@ -574,12 +565,7 @@ error:
if (new_thd)
{
new_thd->proc_info= "Clearing";
- mysql_mutex_lock(&LOCK_thread_count);
- thread_count--;
- dec_thread_running();
- delete new_thd;
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
+ delete_running_thd(new_thd);
}
delete event_name;
DBUG_RETURN(TRUE);
diff --git a/sql/field.cc b/sql/field.cc
index 1769e4e55cb..460a3bd514b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2011, Monty Program Ab
+ Copyright (c) 2008, 2013, Monty Program Ab
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
@@ -68,7 +68,7 @@ const char field_separator=',';
#define LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE 128
#define DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE 128
#define BLOB_PACK_LENGTH_TO_MAX_LENGH(arg) \
-((ulong) ((LL(1) << min(arg, 4) * 8) - LL(1)))
+((ulong) ((1LL << min(arg, 4) * 8) - 1))
#define ASSERT_COLUMN_MARKED_FOR_READ DBUG_ASSERT(!table || (!table->read_set || bitmap_is_set(table->read_set, field_index)))
#define ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED DBUG_ASSERT(is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || bitmap_is_set(table->vcol_set, field_index)))
@@ -199,7 +199,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]=
//MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
MYSQL_TYPE_LONG, MYSQL_TYPE_VARCHAR,
//MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
- MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24,
+ MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONG,
//MYSQL_TYPE_DATE MYSQL_TYPE_TIME
MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR,
//MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
@@ -230,7 +230,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]=
//MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
MYSQL_TYPE_FLOAT, MYSQL_TYPE_VARCHAR,
//MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
- MYSQL_TYPE_FLOAT, MYSQL_TYPE_INT24,
+ MYSQL_TYPE_FLOAT, MYSQL_TYPE_FLOAT,
//MYSQL_TYPE_DATE MYSQL_TYPE_TIME
MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR,
//MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
@@ -261,7 +261,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]=
//MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
MYSQL_TYPE_DOUBLE, MYSQL_TYPE_VARCHAR,
//MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
- MYSQL_TYPE_DOUBLE, MYSQL_TYPE_INT24,
+ MYSQL_TYPE_DOUBLE, MYSQL_TYPE_DOUBLE,
//MYSQL_TYPE_DATE MYSQL_TYPE_TIME
MYSQL_TYPE_VARCHAR, MYSQL_TYPE_VARCHAR,
//MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
@@ -292,7 +292,7 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]=
//MYSQL_TYPE_NULL MYSQL_TYPE_TIMESTAMP
MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP,
//MYSQL_TYPE_LONGLONG MYSQL_TYPE_INT24
- MYSQL_TYPE_LONGLONG, MYSQL_TYPE_INT24,
+ MYSQL_TYPE_LONGLONG, MYSQL_TYPE_LONGLONG,
//MYSQL_TYPE_DATE MYSQL_TYPE_TIME
MYSQL_TYPE_NEWDATE, MYSQL_TYPE_TIME,
//MYSQL_TYPE_DATETIME MYSQL_TYPE_YEAR
@@ -3643,7 +3643,7 @@ int Field_long::store(longlong nr, bool unsigned_val)
res=0;
error= 1;
}
- else if ((ulonglong) nr >= (LL(1) << 32))
+ else if ((ulonglong) nr >= (1LL << 32))
{
res=(int32) (uint32) ~0L;
error= 1;
@@ -4577,7 +4577,7 @@ int Field_timestamp::store(longlong nr, bool unsigned_val)
longlong tmp= number_to_datetime(nr, 0, &l_time, (thd->variables.sql_mode &
MODE_NO_ZERO_DATE) |
MODE_NO_ZERO_IN_DATE, &error);
- return store_TIME_with_warning(thd, &l_time, &str, error, tmp != LL(-1));
+ return store_TIME_with_warning(thd, &l_time, &str, error, tmp != -1);
}
@@ -5793,8 +5793,8 @@ String *Field_datetime::val_str(String *val_buffer,
Avoid problem with slow longlong arithmetic and sprintf
*/
- part1=(long) (tmp/LL(1000000));
- part2=(long) (tmp - (ulonglong) part1*LL(1000000));
+ part1=(long) (tmp/1000000LL);
+ part2=(long) (tmp - (ulonglong) part1*1000000LL);
pos=(char*) val_buffer->ptr() + MAX_DATETIME_WIDTH;
*pos--=0;
@@ -5825,8 +5825,8 @@ bool Field_datetime::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
longlong tmp=Field_datetime::val_int();
uint32 part1,part2;
- part1=(uint32) (tmp/LL(1000000));
- part2=(uint32) (tmp - (ulonglong) part1*LL(1000000));
+ part1=(uint32) (tmp/1000000LL);
+ part2=(uint32) (tmp - (ulonglong) part1*1000000LL);
ltime->time_type= MYSQL_TIMESTAMP_DATETIME;
ltime->neg= 0;
@@ -7617,6 +7617,19 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
if (wkb_type < (uint32) Geometry::wkb_point ||
wkb_type > (uint32) Geometry::wkb_last)
goto err;
+
+ if (geom_type != Field::GEOM_GEOMETRY &&
+ geom_type != Field::GEOM_GEOMETRYCOLLECTION &&
+ (uint32) geom_type != wkb_type)
+ {
+ my_printf_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
+ ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), MYF(0),
+ Geometry::ci_collection[geom_type]->m_name.str,
+ Geometry::ci_collection[wkb_type]->m_name.str, field_name,
+ (ulong) table->in_use->warning_info->current_row_for_warning());
+ goto err_exit;
+ }
+
Field_blob::store_length(length);
if (table->copy_blobs || length <= MAX_FIELD_WIDTH)
{ // Must make a copy
@@ -7628,9 +7641,10 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
return 0;
err:
- bzero(ptr, Field_blob::pack_length());
my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+err_exit:
+ bzero(ptr, Field_blob::pack_length());
return -1;
}
@@ -7893,7 +7907,7 @@ int Field_set::store(longlong nr, bool unsigned_val)
if (sizeof(ulonglong)*8 <= typelib->count)
max_nr= ULONGLONG_MAX;
else
- max_nr= (ULL(1) << typelib->count) - 1;
+ max_nr= (1ULL << typelib->count) - 1;
if ((ulonglong) nr > max_nr)
{
@@ -8870,6 +8884,7 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
FLAGSTR(pack_flag, FIELDFLAG_DECIMAL),
f_packtype(pack_flag)));
vcol_info= 0;
+ create_if_not_exists= FALSE;
stored_in_db= TRUE;
DBUG_VOID_RETURN;
@@ -8907,7 +8922,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
char *fld_change, List<String> *fld_interval_list,
CHARSET_INFO *fld_charset, uint fld_geom_type,
Virtual_column_info *fld_vcol_info,
- engine_option_value *create_opt)
+ engine_option_value *create_opt, bool check_exists)
{
uint sign_len, allowed_type_modifier= 0;
ulong max_field_charlength= MAX_FIELD_CHARLENGTH;
@@ -8961,6 +8976,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
comment= *fld_comment;
vcol_info= fld_vcol_info;
+ create_if_not_exists= check_exists;
stored_in_db= TRUE;
/* Initialize data for a computed field */
@@ -9567,6 +9583,7 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
comment= old_field->comment;
decimals= old_field->decimals();
vcol_info= old_field->vcol_info;
+ create_if_not_exists= FALSE;
stored_in_db= old_field->stored_in_db;
option_list= old_field->option_list;
option_struct= old_field->option_struct;
diff --git a/sql/field.h b/sql/field.h
index e832928b114..d03479bbd06 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -2151,6 +2151,7 @@ public:
bool has_charset(void) const { return TRUE; }
/* enum and set are sorted as integers */
CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
+ uint decimals() const { return 0; }
virtual uchar *pack(uchar *to, const uchar *from, uint max_length);
virtual const uchar *unpack(uchar *to, const uchar *from,
@@ -2382,10 +2383,11 @@ public:
/** structure with parsed options (for comparing fields in ALTER TABLE) */
ha_field_option_struct *option_struct;
- uint8 row,col,sc_length,interval_id; // For rea_create_table
+ uint8 interval_id; // For rea_create_table
uint offset,pack_flag;
+ bool create_if_not_exists; // Used in ALTER TABLE IF NOT EXISTS
- /*
+ /*
This is additinal data provided for any computed(virtual) field.
In particular it includes a pointer to the item by which this field
can be computed from other fields.
@@ -2398,7 +2400,8 @@ public:
*/
bool stored_in_db;
- Create_field() :after(0), option_list(NULL), option_struct(NULL)
+ Create_field() :after(0), option_list(NULL), option_struct(NULL),
+ create_if_not_exists(FALSE)
{}
Create_field(Field *field, Field *orig_field);
/* Used to make a clone of this object for ALTER/CREATE TABLE */
@@ -2416,7 +2419,7 @@ public:
Item *on_update_value, LEX_STRING *comment, char *change,
List<String> *interval_list, CHARSET_INFO *cs,
uint uint_geom_type, Virtual_column_info *vcol_info,
- engine_option_value *option_list);
+ engine_option_value *option_list, bool check_exists);
bool field_flags_are_binary()
{
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 49aaa0af574..6f8867e8d64 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -952,7 +952,10 @@ static void make_sortkey(register Sort_param *param,
{
MYSQL_TIME buf;
if (item->get_date_result(&buf, TIME_FUZZY_DATE | TIME_INVALID_DATES))
- DBUG_ASSERT(maybe_null && item->null_value);
+ {
+ DBUG_ASSERT(maybe_null);
+ DBUG_ASSERT(item->null_value);
+ }
else
value= pack_time(&buf);
}
diff --git a/sql/frm_crypt.cc b/sql/frm_crypt.cc
deleted file mode 100644
index 5612908aea5..00000000000
--- a/sql/frm_crypt.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-
-/*
-** change the following to the output of password('our password')
-** split into 2 parts of 8 characters each.
-** This is done to make it impossible to search after a text string in the
-** mysql binary.
-*/
-
-#include "sql_priv.h"
-#include "frm_crypt.h"
-
-#ifdef HAVE_CRYPTED_FRM
-
-/* password('test') */
-ulong password_seed[2]={0x378b243e, 0x220ca493};
-
-SQL_CRYPT *get_crypt_for_frm(void)
-{
- return new SQL_CRYPT(password_seed);
-}
-
-#endif
diff --git a/sql/frm_crypt.h b/sql/frm_crypt.h
deleted file mode 100644
index 0605644b3e0..00000000000
--- a/sql/frm_crypt.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-#ifndef FRM_CRYPT_INCLUDED
-#define FRM_CRYPT_INCLUDED
-
-class SQL_CRYPT;
-
-SQL_CRYPT *get_crypt_for_frm(void);
-
-#endif /* FRM_CRYPT_INCLUDED */
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 148a2329660..bd08cd2dc32 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -78,6 +78,17 @@ static handler *partition_create_handler(handlerton *hton,
static uint partition_flags();
static uint alter_table_flags(uint flags);
+/*
+ If frm_error() is called then we will use this to to find out what file
+ extensions exist for the storage engine. This is also used by the default
+ rename_table and delete_table method in handler.cc.
+*/
+
+static const char *ha_partition_ext[]=
+{
+ ha_par_ext, NullS
+};
+
static int partition_initialize(void *p)
{
@@ -93,6 +104,7 @@ static int partition_initialize(void *p)
partition_hton->flags= HTON_NOT_USER_SELECTABLE |
HTON_HIDDEN |
HTON_TEMPORARY_NOT_SUPPORTED;
+ partition_hton->tablefile_extensions= ha_partition_ext;
return 0;
}
@@ -499,7 +511,7 @@ int ha_partition::rename_table(const char *from, const char *to)
Create the handler file (.par-file)
SYNOPSIS
- create_handler_files()
+ create_partitioning_metadata()
name Full path of table name
create_info Create info generated for CREATE TABLE
@@ -508,19 +520,18 @@ int ha_partition::rename_table(const char *from, const char *to)
0 Success
DESCRIPTION
- create_handler_files is called to create any handler specific files
+ create_partitioning_metadata is called to create any handler specific files
before opening the file with openfrm to later call ::create on the
file object.
In the partition handler this is used to store the names of partitions
and types of engines in the partitions.
*/
-int ha_partition::create_handler_files(const char *path,
+int ha_partition::create_partitioning_metadata(const char *path,
const char *old_path,
- int action_flag,
- HA_CREATE_INFO *create_info)
+ int action_flag)
{
- DBUG_ENTER("ha_partition::create_handler_files()");
+ DBUG_ENTER("ha_partition::create_partitioning_metadata()");
/*
We need to update total number of parts since we might write the handler
@@ -3830,6 +3841,7 @@ int ha_partition::truncate_partition(Alter_info *alter_info, bool *binlog_stmt)
part, sub_elem->partition_name));
if ((error= m_file[part]->ha_truncate()))
break;
+ sub_elem->part_state= PART_NORMAL;
} while (++j < num_subparts);
}
else
@@ -4428,6 +4440,7 @@ bool ha_partition::init_record_priority_queue()
{
if (bitmap_is_set(&m_part_info->used_partitions, i))
{
+ DBUG_PRINT("info", ("init rec-buf for part %u", i));
int2store(ptr, i);
ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
}
@@ -5322,11 +5335,27 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
m_top_entry= NO_CURRENT_PART_ID;
queue_remove_all(&m_queue);
- DBUG_PRINT("info", ("m_part_spec.start_part %d", m_part_spec.start_part));
- for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++)
+ /*
+ Position part_rec_buf_ptr to point to the first used partition >=
+ start_part. There may be partitions marked by used_partitions,
+ but is before start_part. These partitions has allocated record buffers
+ but is dynamically pruned, so those buffers must be skipped.
+ */
+ uint first_used_part= bitmap_get_first_set(&m_part_info->used_partitions);
+ for (; first_used_part < m_part_spec.start_part; first_used_part++)
+ {
+ if (bitmap_is_set(&(m_part_info->used_partitions), first_used_part))
+ part_rec_buf_ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
+ }
+ DBUG_PRINT("info", ("m_part_spec.start_part %u first_used_part %u",
+ m_part_spec.start_part, first_used_part));
+ for (i= first_used_part; i <= m_part_spec.end_part; i++)
{
if (!(bitmap_is_set(&(m_part_info->used_partitions), i)))
continue;
+ DBUG_PRINT("info", ("reading from part %u (scan_type: %u)",
+ i, m_index_scan_type));
+ DBUG_ASSERT(i == uint2korr(part_rec_buf_ptr));
uchar *rec_buf_ptr= part_rec_buf_ptr + PARTITION_BYTES_IN_POS;
int error;
handler *file= m_file[i];
@@ -7322,21 +7351,6 @@ int ha_partition::final_drop_index(TABLE *table_arg)
}
-/*
- If frm_error() is called then we will use this to to find out what file
- extensions exist for the storage engine. This is also used by the default
- rename_table and delete_table method in handler.cc.
-*/
-
-static const char *ha_partition_ext[]=
-{
- ha_par_ext, NullS
-};
-
-const char **ha_partition::bas_ext() const
-{ return ha_partition_ext; }
-
-
uint ha_partition::min_of_the_max_uint(
uint (handler::*operator_func)(void) const) const
{
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 96e47d3d676..55f199401f3 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -229,7 +229,7 @@ public:
chance for the handler to add any interesting comments to the table
comments not provided by the users comment.
- create_handler_files is called before opening a new handler object
+ create_partitioning_metadata is called before opening a new handler object
with openfrm to call create. It is used to create any local handler
object needed in opening the object in openfrm
-------------------------------------------------------------------------
@@ -238,9 +238,8 @@ public:
virtual int rename_table(const char *from, const char *to);
virtual int create(const char *name, TABLE *form,
HA_CREATE_INFO *create_info);
- virtual int create_handler_files(const char *name,
- const char *old_name, int action_flag,
- HA_CREATE_INFO *create_info);
+ virtual int create_partitioning_metadata(const char *name,
+ const char *old_name, int action_flag);
virtual void update_create_info(HA_CREATE_INFO *create_info);
virtual char *update_table_comment(const char *comment);
virtual int change_partitions(HA_CREATE_INFO *create_info,
@@ -885,10 +884,6 @@ public:
*/
virtual uint alter_table_flags(uint flags);
/*
- extensions of table handler files
- */
- virtual const char **bas_ext() const;
- /*
unireg.cc will call the following to make sure that the storage engine
can handle the data it is about to send.
diff --git a/sql/handler.cc b/sql/handler.cc
index 5297a8e8cfc..398b6b5c8b1 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -30,7 +30,7 @@
#include "sql_parse.h" // check_stack_overrun
#include "sql_acl.h" // SUPER_ACL
#include "sql_base.h" // free_io_cache
-#include "discover.h" // writefrm
+#include "discover.h" // extension_based_table_discovery, etc
#include "log_event.h" // *_rows_log_event
#include "create_options.h"
#include "rpl_filter.h"
@@ -229,13 +229,6 @@ handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type,
(void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
- switch (database_type) {
- case DB_TYPE_MRG_ISAM:
- return ha_resolve_by_legacy_type(thd, DB_TYPE_MRG_MYISAM);
- default:
- break;
- }
-
return ha_default_handlerton(thd);
} /* ha_checktype */
@@ -388,6 +381,34 @@ static int ha_finish_errors(void)
return 0;
}
+static volatile int32 need_full_discover_for_existence= 0;
+static volatile int32 engines_with_discover_table_names= 0;
+
+static int full_discover_for_existence(handlerton *, const char *, const char *)
+{ return 1; }
+
+static int ext_based_existence(handlerton *, const char *, const char *)
+{ return 1; }
+
+static int hton_ext_based_table_discovery(handlerton *hton, LEX_STRING *db,
+ MY_DIR *dir, handlerton::discovered_list *result)
+{
+ /*
+ tablefile_extensions[0] is the metadata file, see
+ the comment above tablefile_extensions declaration
+ */
+ return extension_based_table_discovery(dir, hton->tablefile_extensions[0],
+ result);
+}
+
+static void update_discovery_counters(handlerton *hton, int val)
+{
+ if (hton->discover_table_existence == full_discover_for_existence)
+ my_atomic_add32(&need_full_discover_for_existence, val);
+
+ if (hton->discover_table_names)
+ my_atomic_add32(&engines_with_discover_table_names, val);
+}
int ha_finalize_handlerton(st_plugin_int *plugin)
{
@@ -425,6 +446,9 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
}
}
+ free_sysvar_table_options(hton);
+ update_discovery_counters(hton, -1);
+
/*
In case a plugin is uninstalled and re-installed later, it should
reuse an array slot. Otherwise the number of uninstall/install
@@ -448,12 +472,12 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
int ha_initialize_handlerton(st_plugin_int *plugin)
{
handlerton *hton;
+ static const char *no_exts[]= { 0 };
DBUG_ENTER("ha_initialize_handlerton");
DBUG_PRINT("plugin", ("initialize plugin: '%s'", plugin->name.str));
hton= (handlerton *)my_malloc(sizeof(handlerton),
MYF(MY_WME | MY_ZEROFILL));
-
if (hton == NULL)
{
sql_print_error("Unable to allocate memory for plugin '%s' handlerton.",
@@ -461,6 +485,9 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
goto err_no_hton_memory;
}
+ hton->tablefile_extensions= no_exts;
+ hton->discover_table_names= hton_ext_based_table_discovery;
+
hton->slot= HA_SLOT_UNDEF;
/* Historical Requirement */
plugin->data= hton; // shortcut for the future
@@ -471,6 +498,21 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
goto err;
}
+ // hton_ext_based_table_discovery() works only when discovery
+ // is supported and the engine if file-based.
+ if (hton->discover_table_names == hton_ext_based_table_discovery &&
+ (!hton->discover_table || !hton->tablefile_extensions[0]))
+ hton->discover_table_names= NULL;
+
+ // default discover_table_existence implementation
+ if (!hton->discover_table_existence && hton->discover_table)
+ {
+ if (hton->tablefile_extensions[0])
+ hton->discover_table_existence= ext_based_existence;
+ else
+ hton->discover_table_existence= full_discover_for_existence;
+ }
+
/*
the switch below and hton->state should be removed when
command-line options for plugins will be implemented
@@ -560,6 +602,9 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
break;
};
+ resolve_sysvar_table_options(hton);
+ update_discovery_counters(hton, 1);
+
DBUG_RETURN(0);
err_deinit:
@@ -1096,7 +1141,8 @@ int ha_prepare(THD *thd)
else
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
+ ER_GET_ERRNO, ER(ER_GET_ERRNO),
+ HA_ERR_WRONG_COMMAND,
ha_resolve_storage_engine_name(ht));
}
}
@@ -1967,7 +2013,7 @@ int ha_savepoint(THD *thd, SAVEPOINT *sv)
}
if ((err= ht->savepoint_set(ht, thd, (uchar *)(sv+1)+ht->savepoint_offset)))
{ // cannot happen
- my_error(ER_GET_ERRNO, MYF(0), err);
+ my_error(ER_GET_ERRNO, MYF(0), err, hton_name(ht)->str);
error=1;
}
status_var_increment(thd->status_var.ha_savepoint_count);
@@ -1998,7 +2044,7 @@ int ha_release_savepoint(THD *thd, SAVEPOINT *sv)
if ((err= ht->savepoint_release(ht, thd,
(uchar *)(sv+1) + ht->savepoint_offset)))
{ // cannot happen
- my_error(ER_GET_ERRNO, MYF(0), err);
+ my_error(ER_GET_ERRNO, MYF(0), err, hton_name(ht)->str);
error=1;
}
}
@@ -2172,15 +2218,15 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
TABLE_SHARE dummy_share;
DBUG_ENTER("ha_delete_table");
+ /* table_type is NULL in ALTER TABLE when renaming only .frm files */
+ if (table_type == NULL || table_type == view_pseudo_hton ||
+ ! (file=get_new_handler((TABLE_SHARE*)0, thd->mem_root, table_type)))
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
+
bzero((char*) &dummy_table, sizeof(dummy_table));
bzero((char*) &dummy_share, sizeof(dummy_share));
dummy_table.s= &dummy_share;
- /* DB_TYPE_UNKNOWN is used in ALTER TABLE when renaming only .frm files */
- if (table_type == NULL ||
- ! (file=get_new_handler((TABLE_SHARE*)0, thd->mem_root, table_type)))
- DBUG_RETURN(ENOENT);
-
path= get_canonical_filename(file, path, tmp_path);
if ((error= file->ha_delete_table(path)) && generate_warning)
{
@@ -2195,6 +2241,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
/* Fill up strucutures that print_error may need */
dummy_share.path.str= (char*) path;
dummy_share.path.length= strlen(path);
+ dummy_share.normalized_path= dummy_share.path;
dummy_share.db.str= (char*) db;
dummy_share.db.length= strlen(db);
dummy_share.table_name.str= (char*) alias;
@@ -3122,7 +3169,7 @@ void handler::print_error(int error, myf errflag)
DBUG_ENTER("handler::print_error");
DBUG_PRINT("enter",("error: %d",error));
- int textno=ER_GET_ERRNO;
+ int textno= -1; // impossible value
switch (error) {
case EACCES:
textno=ER_OPEN_AS_READONLY;
@@ -3235,7 +3282,9 @@ void handler::print_error(int error, myf errflag)
textno=ER_OUT_OF_RESOURCES;
break;
case HA_ERR_WRONG_COMMAND:
- textno=ER_ILLEGAL_HA;
+ my_error(ER_ILLEGAL_HA, MYF(0), table_type(), table_share->db.str,
+ table_share->table_name.str);
+ DBUG_VOID_RETURN;
break;
case HA_ERR_OLD_FILE:
textno=ER_OLD_KEYFILE;
@@ -3354,10 +3403,11 @@ void handler::print_error(int error, myf errflag)
}
}
else
- my_error(ER_GET_ERRNO,errflag,error);
+ my_error(ER_GET_ERRNO, errflag, error, table_type());
DBUG_VOID_RETURN;
}
}
+ DBUG_ASSERT(textno > 0);
if (fatal_error)
{
/* Ensure this becomes a true error */
@@ -3371,7 +3421,17 @@ void handler::print_error(int error, myf errflag)
errflag|= ME_NOREFRESH;
}
}
- my_error(textno, errflag, table_share->table_name.str, error);
+
+ /* if we got an OS error from a file-based engine, specify a path of error */
+ if (error < HA_ERR_FIRST && bas_ext()[0])
+ {
+ char buff[FN_REFLEN];
+ strxnmov(buff, sizeof(buff),
+ table_share->normalized_path.str, bas_ext()[0], NULL);
+ my_error(textno, errflag, buff, error);
+ }
+ else
+ my_error(textno, errflag, table_share->table_name.str, error);
DBUG_VOID_RETURN;
}
@@ -3573,9 +3633,14 @@ int handler::delete_table(const char *name)
{
int saved_error= 0;
int error= 0;
- int enoent_or_zero= ENOENT; // Error if no file was deleted
+ int enoent_or_zero;
char buff[FN_REFLEN];
+ if (ht->discover_table)
+ enoent_or_zero= 0; // the table may not exist in the engine, it's ok
+ else
+ enoent_or_zero= ENOENT; // the first file of bas_ext() *must* exist
+
for (const char **ext=bas_ext(); *ext ; ext++)
{
fn_format(buff, name, "", *ext, MY_UNPACK_FILENAME|MY_APPEND_EXT);
@@ -3959,16 +4024,16 @@ handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info)
/**
Create handler files for CREATE TABLE: public interface.
- @sa handler::create_handler_files()
+ @sa handler::create_partitioning_metadata()
*/
int
-handler::ha_create_handler_files(const char *name, const char *old_name,
- int action_flag, HA_CREATE_INFO *info)
+handler::ha_create_partitioning_metadata(const char *name, const char *old_name,
+ int action_flag)
{
mark_trx_read_write();
- return create_handler_files(name, old_name, action_flag, info);
+ return create_partitioning_metadata(name, old_name, action_flag);
}
@@ -4256,154 +4321,69 @@ end:
*/
int ha_create_table(THD *thd, const char *path,
const char *db, const char *table_name,
- HA_CREATE_INFO *create_info,
- bool update_create_info)
+ HA_CREATE_INFO *create_info, LEX_CUSTRING *frm)
{
int error= 1;
TABLE table;
char name_buff[FN_REFLEN];
const char *name;
TABLE_SHARE share;
+ bool temp_table __attribute__((unused)) = create_info->tmp_table() ||
+ is_prefix(table_name, tmp_file_prefix);
DBUG_ENTER("ha_create_table");
-#ifdef HAVE_PSI_TABLE_INTERFACE
- my_bool temp_table= (my_bool)is_prefix(table_name, tmp_file_prefix) ||
- (create_info->options & HA_LEX_CREATE_TMP_TABLE ? TRUE : FALSE);
-#endif
init_tmp_table_share(thd, &share, db, 0, table_name, path);
- if (open_table_def(thd, &share, 0))
- goto err;
+
+ if (frm)
+ {
+ bool write_frm_now= !create_info->db_type->discover_table &&
+ !create_info->tmp_table();
+
+ share.frm_image= frm;
+
+ // open an frm image
+ if (share.init_from_binary_frm_image(thd, write_frm_now,
+ frm->str, frm->length))
+ goto err;
+ }
+ else
+ {
+ // open an frm file
+ share.db_plugin= ha_lock_engine(thd, create_info->db_type);
+
+ if (open_table_def(thd, &share))
+ goto err;
+ }
#ifdef HAVE_PSI_TABLE_INTERFACE
share.m_psi= PSI_CALL(get_table_share)(temp_table, &share);
#endif
- if (open_table_from_share(thd, &share, "", 0, (uint) READ_ALL, 0, &table,
- TRUE))
+
+ if (open_table_from_share(thd, &share, "", 0, READ_ALL, 0, &table, true))
goto err;
- if (update_create_info)
- update_create_info_from_table(create_info, &table);
+ update_create_info_from_table(create_info, &table);
name= get_canonical_filename(table.file, share.path.str, name_buff);
error= table.file->ha_create(name, &table, create_info);
+
(void) closefrm(&table, 0);
+
if (error)
{
- strxmov(name_buff, db, ".", table_name, NullS);
- my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error);
+ my_error(ER_CANT_CREATE_TABLE, MYF(0), db, table_name, error);
#ifdef HAVE_PSI_TABLE_INTERFACE
- PSI_CALL(drop_table_share)(temp_table, db, strlen(db), table_name,
- strlen(table_name));
+ PSI_CALL(drop_table_share)(temp_table, share.db.str, share.db.length,
+ share.table_name.str, share.table_name.length);
#endif
}
+
err:
free_table_share(&share);
DBUG_RETURN(error != 0);
}
-/**
- Try to discover table from engine.
-
- @note
- If found, write the frm file to disk.
-
- @retval
- -1 Table did not exists
- @retval
- 0 Table created ok
- @retval
- > 0 Error, table existed but could not be created
-*/
-int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
-{
- int error;
- uchar *frmblob;
- size_t frmlen;
- char path[FN_REFLEN + 1];
- HA_CREATE_INFO create_info;
- TABLE table;
- TABLE_SHARE share;
- DBUG_ENTER("ha_create_table_from_engine");
- DBUG_PRINT("enter", ("name '%s'.'%s'", db, name));
-
- bzero((uchar*) &create_info,sizeof(create_info));
- if ((error= ha_discover(thd, db, name, &frmblob, &frmlen)))
- {
- /* Table could not be discovered and thus not created */
- DBUG_RETURN(error);
- }
-
- /*
- Table exists in handler and could be discovered
- frmblob and frmlen are set, write the frm to disk
- */
-
- build_table_filename(path, sizeof(path) - 1, db, name, "", 0);
- // Save the frm file
- error= writefrm(path, frmblob, frmlen);
- my_free(frmblob);
- if (error)
- DBUG_RETURN(2);
-
- init_tmp_table_share(thd, &share, db, 0, name, path);
- if (open_table_def(thd, &share, 0))
- {
- DBUG_RETURN(3);
- }
-
-#ifdef HAVE_PSI_TABLE_INTERFACE
- /*
- Table discovery is not instrumented.
- Once discovered, the table will be opened normally,
- and instrumented normally.
- */
-#endif
-
- if (open_table_from_share(thd, &share, "" ,0, 0, 0, &table, FALSE))
- {
- free_table_share(&share);
- DBUG_RETURN(3);
- }
-
- update_create_info_from_table(&create_info, &table);
- create_info.table_options|= HA_OPTION_CREATE_FROM_ENGINE;
-
- get_canonical_filename(table.file, path, path);
- error=table.file->ha_create(path, &table, &create_info);
- (void) closefrm(&table, 1);
-
- DBUG_RETURN(error != 0);
-}
-
-
-/**
- Try to find a table in a storage engine.
-
- @param db Normalized table schema name
- @param name Normalized table name.
- @param[out] exists Only valid if the function succeeded.
-
- @retval TRUE An error is found
- @retval FALSE Success, check *exists
-*/
-
-bool
-ha_check_if_table_exists(THD* thd, const char *db, const char *name,
- bool *exists)
-{
- uchar *frmblob= NULL;
- size_t frmlen;
- DBUG_ENTER("ha_check_if_table_exists");
-
- *exists= ! ha_discover(thd, db, name, &frmblob, &frmlen);
- if (*exists)
- my_free(frmblob);
-
- DBUG_RETURN(FALSE);
-}
-
-
void st_ha_check_opt::init()
{
flags= sql_flags= 0;
@@ -4526,149 +4506,348 @@ int ha_change_key_cache(KEY_CACHE *old_key_cache,
}
-/**
- Try to discover one table from handler(s).
-
- @retval
- -1 Table did not exists
- @retval
- 0 OK. In this case *frmblob and *frmlen are set
- @retval
- >0 error. frmblob and frmlen may not be set
-*/
-struct st_discover_args
-{
- const char *db;
- const char *name;
- uchar **frmblob;
- size_t *frmlen;
-};
-
static my_bool discover_handlerton(THD *thd, plugin_ref plugin,
void *arg)
{
- st_discover_args *vargs= (st_discover_args *)arg;
+ TABLE_SHARE *share= (TABLE_SHARE *)arg;
handlerton *hton= plugin_data(plugin, handlerton *);
- if (hton->state == SHOW_OPTION_YES && hton->discover &&
- (!(hton->discover(hton, thd, vargs->db, vargs->name,
- vargs->frmblob,
- vargs->frmlen))))
- return TRUE;
+ if (hton->state == SHOW_OPTION_YES && hton->discover_table)
+ {
+ share->db_plugin= plugin;
+ int error= hton->discover_table(hton, thd, share);
+ if (error != HA_ERR_NO_SUCH_TABLE)
+ {
+ if (error)
+ {
+ DBUG_ASSERT(share->error); // MUST be always set for get_cached_table_share to work
+ my_error(ER_GET_ERRNO, MYF(0), error, plugin_name(plugin)->str);
+ share->db_plugin= 0;
+ }
+ else
+ share->error= OPEN_FRM_OK;
- return FALSE;
+ status_var_increment(thd->status_var.ha_discover_count);
+ return TRUE; // abort the search
+ }
+ share->db_plugin= 0;
+ }
+
+ DBUG_ASSERT(share->error == OPEN_FRM_OPEN_ERROR);
+ return FALSE; // continue with the next engine
}
-int ha_discover(THD *thd, const char *db, const char *name,
- uchar **frmblob, size_t *frmlen)
+int ha_discover_table(THD *thd, TABLE_SHARE *share)
{
- int error= -1; // Table does not exist in any handler
- DBUG_ENTER("ha_discover");
- DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
- st_discover_args args= {db, name, frmblob, frmlen};
+ DBUG_ENTER("ha_discover_table");
+ int found;
- if (is_prefix(name,tmp_file_prefix)) /* skip temporary tables */
- DBUG_RETURN(error);
+ DBUG_ASSERT(share->error == OPEN_FRM_OPEN_ERROR); // share is not OK yet
- if (plugin_foreach(thd, discover_handlerton,
- MYSQL_STORAGE_ENGINE_PLUGIN, &args))
- error= 0;
+ if (share->db_plugin)
+ found= discover_handlerton(thd, share->db_plugin, share);
+ else
+ found= plugin_foreach(thd, discover_handlerton,
+ MYSQL_STORAGE_ENGINE_PLUGIN, share);
+
+ if (!found)
+ open_table_error(share, OPEN_FRM_OPEN_ERROR, ENOENT); // not found
- if (!error)
- status_var_increment(thd->status_var.ha_discover_count);
- DBUG_RETURN(error);
+ DBUG_RETURN(share->error != OPEN_FRM_OK);
}
+static my_bool file_ext_exists(char *path, size_t path_len, const char *ext)
+{
+ strmake(path + path_len, ext, FN_REFLEN - path_len);
+ return !access(path, F_OK);
+}
-/**
- Call this function in order to give the handler the possiblity
- to ask engine if there are any new tables that should be written to disk
- or any dropped tables that need to be removed from disk
-*/
-struct st_find_files_args
+struct st_discover_existence_args
{
- const char *db;
- const char *path;
- const char *wild;
- bool dir;
- List<LEX_STRING> *files;
+ char *path;
+ size_t path_len;
+ const char *db, *table_name;
+ handlerton *hton;
};
-static my_bool find_files_handlerton(THD *thd, plugin_ref plugin,
- void *arg)
+static my_bool discover_existence(THD *thd, plugin_ref plugin,
+ void *arg)
{
- st_find_files_args *vargs= (st_find_files_args *)arg;
- handlerton *hton= plugin_data(plugin, handlerton *);
+ st_discover_existence_args *args= (st_discover_existence_args*)arg;
+ handlerton *ht= plugin_data(plugin, handlerton *);
+ if (ht->state != SHOW_OPTION_YES || !ht->discover_table_existence)
+ return FALSE;
+ args->hton= ht;
- if (hton->state == SHOW_OPTION_YES && hton->find_files)
- if (hton->find_files(hton, thd, vargs->db, vargs->path, vargs->wild,
- vargs->dir, vargs->files))
- return TRUE;
+ if (ht->discover_table_existence == ext_based_existence)
+ return file_ext_exists(args->path, args->path_len,
+ ht->tablefile_extensions[0]);
- return FALSE;
+ return ht->discover_table_existence(ht, args->db, args->table_name);
}
-int
-ha_find_files(THD *thd,const char *db,const char *path,
- const char *wild, bool dir, List<LEX_STRING> *files)
+class Table_exists_error_handler : public Internal_error_handler
{
- int error= 0;
- DBUG_ENTER("ha_find_files");
- DBUG_PRINT("enter", ("db: '%s' path: '%s' wild: '%s' dir: %d",
- db, path, wild, dir));
- st_find_files_args args= {db, path, wild, dir, files};
-
- plugin_foreach(thd, find_files_handlerton,
- MYSQL_STORAGE_ENGINE_PLUGIN, &args);
- /* The return value is not currently used */
- DBUG_RETURN(error);
+public:
+ Table_exists_error_handler()
+ : m_handled_errors(0), m_unhandled_errors(0)
+ {}
+
+ bool handle_condition(THD *thd,
+ uint sql_errno,
+ const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* msg,
+ MYSQL_ERROR ** cond_hdl)
+ {
+ *cond_hdl= NULL;
+ if (sql_errno == ER_NO_SUCH_TABLE ||
+ sql_errno == ER_NO_SUCH_TABLE_IN_ENGINE ||
+ sql_errno == ER_WRONG_OBJECT)
+ {
+ m_handled_errors++;
+ return TRUE;
+ }
+
+ if (level == MYSQL_ERROR::WARN_LEVEL_ERROR)
+ m_unhandled_errors++;
+ return FALSE;
+ }
+
+ bool safely_trapped_errors()
+ {
+ return ((m_handled_errors > 0) && (m_unhandled_errors == 0));
+ }
+
+private:
+ int m_handled_errors;
+ int m_unhandled_errors;
+};
+
+/**
+ Check if a given table exists, without doing a full discover, if possible
+
+ If the 'hton' is not NULL, it's set to the handlerton of the storage engine
+ of this table, or to view_pseudo_hton if the frm belongs to a view.
+
+
+ @retval true Table exists (even if the error occurred, like bad frm)
+ @retval false Table does not exist (one can do CREATE TABLE table_name)
+*/
+bool ha_table_exists(THD *thd, const char *db, const char *table_name,
+ handlerton **hton)
+{
+ DBUG_ENTER("ha_table_exists");
+
+ if (hton)
+ *hton= 0;
+
+ if (need_full_discover_for_existence)
+ {
+ TABLE_LIST table;
+ uint flags = GTS_TABLE | GTS_VIEW;
+
+ if (!hton)
+ flags|= GTS_NOLOCK;
+
+ Table_exists_error_handler no_such_table_handler;
+ thd->push_internal_handler(&no_such_table_handler);
+ TABLE_SHARE *share= get_table_share(thd, db, table_name, flags);
+ thd->pop_internal_handler();
+
+ if (hton && share)
+ {
+ *hton= share->db_type();
+ mysql_mutex_lock(&LOCK_open);
+ release_table_share(share);
+ mysql_mutex_unlock(&LOCK_open);
+ }
+
+ // the table doesn't exist if we've caught ER_NO_SUCH_TABLE and nothing else
+ DBUG_RETURN(!no_such_table_handler.safely_trapped_errors());
+ }
+
+ mysql_mutex_lock(&LOCK_open);
+ TABLE_SHARE *share= get_cached_table_share(db, table_name);
+ if (hton && share)
+ *hton= share->db_type();
+ mysql_mutex_unlock(&LOCK_open);
+
+ if (share)
+ DBUG_RETURN(TRUE);
+
+ char path[FN_REFLEN + 1];
+ size_t path_len = build_table_filename(path, sizeof(path) - 1,
+ db, table_name, "", 0);
+
+ if (file_ext_exists(path, path_len, reg_ext))
+ {
+ if (hton)
+ {
+ enum legacy_db_type db_type;
+ if (dd_frm_type(thd, path, &db_type) != FRMTYPE_VIEW)
+ *hton= ha_resolve_by_legacy_type(thd, db_type);
+ else
+ *hton= view_pseudo_hton;
+ }
+ DBUG_RETURN(TRUE);
+ }
+
+ st_discover_existence_args args= {path, path_len, db, table_name, 0};
+
+ if (plugin_foreach(thd, discover_existence, MYSQL_STORAGE_ENGINE_PLUGIN,
+ &args))
+ {
+ if (hton)
+ *hton= args.hton;
+ DBUG_RETURN(TRUE);
+ }
+
+ DBUG_RETURN(FALSE);
}
/**
- Ask handler if the table exists in engine.
- @retval
- HA_ERR_NO_SUCH_TABLE Table does not exist
- @retval
- HA_ERR_TABLE_EXIST Table exists
- @retval
- \# Error code
+ Discover all table names in a given database
*/
-struct st_table_exists_in_engine_args
+extern "C" {
+
+static int cmp_file_names(const void *a, const void *b)
{
- const char *db;
- const char *name;
- int err;
-};
+ CHARSET_INFO *cs= character_set_filesystem;
+ char *aa= ((FILEINFO *)a)->name;
+ char *bb= ((FILEINFO *)b)->name;
+ return my_strnncoll(cs, (uchar*)aa, strlen(aa), (uchar*)bb, strlen(bb));
+}
-static my_bool table_exists_in_engine_handlerton(THD *thd, plugin_ref plugin,
- void *arg)
+static int cmp_table_names(LEX_STRING * const *a, LEX_STRING * const *b)
{
- st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg;
- handlerton *hton= plugin_data(plugin, handlerton *);
+ return my_strnncoll(&my_charset_bin, (uchar*)((*a)->str), (*a)->length,
+ (uchar*)((*b)->str), (*b)->length);
+}
- int err= HA_ERR_NO_SUCH_TABLE;
+}
- if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine)
- err = hton->table_exists_in_engine(hton, thd, vargs->db, vargs->name);
+Discovered_table_list::Discovered_table_list(THD *thd_arg,
+ Dynamic_array<LEX_STRING*> *tables_arg,
+ const LEX_STRING *wild_arg)
+{
+ thd= thd_arg;
+ tables= tables_arg;
+ if (wild_arg->str && wild_arg->str[0])
+ {
+ wild= wild_arg->str;
+ wend= wild + wild_arg->length;
+ }
+ else
+ wild= 0;
+}
- vargs->err = err;
- if (vargs->err == HA_ERR_TABLE_EXIST)
- return TRUE;
+bool Discovered_table_list::add_table(const char *tname, size_t tlen)
+{
+ if (wild && my_wildcmp(files_charset_info, tname, tname + tlen, wild, wend,
+ wild_prefix, wild_one, wild_many))
+ return 0;
- return FALSE;
+ LEX_STRING *name= thd->make_lex_string(tname, tlen);
+ if (!name || tables->append(name))
+ return 1;
+ return 0;
+}
+
+bool Discovered_table_list::add_file(const char *fname)
+{
+ char tname[SAFE_NAME_LEN + 1];
+ size_t tlen= filename_to_tablename(fname, tname, sizeof(tname));
+ return add_table(tname, tlen);
+}
+
+
+void Discovered_table_list::sort()
+{
+ tables->sort(cmp_table_names);
+}
+
+void Discovered_table_list::remove_duplicates()
+{
+ LEX_STRING **src= tables->front();
+ LEX_STRING **dst= src;
+ while (++dst < tables->back())
+ {
+ LEX_STRING *s= *src, *d= *dst;
+ DBUG_ASSERT(strncmp(s->str, d->str, min(s->length, d->length)) <= 0);
+ if ((s->length != d->length || strncmp(s->str, d->str, d->length)))
+ {
+ src++;
+ if (src != dst)
+ *src= *dst;
+ }
+ }
+ tables->set_elements(src - tables->front() + 1);
+}
+
+struct st_discover_names_args
+{
+ LEX_STRING *db;
+ MY_DIR *dirp;
+ Discovered_table_list *result;
+ uint possible_duplicates;
+};
+
+static my_bool discover_names(THD *thd, plugin_ref plugin,
+ void *arg)
+{
+ st_discover_names_args *args= (st_discover_names_args *)arg;
+ handlerton *ht= plugin_data(plugin, handlerton *);
+
+ if (ht->state == SHOW_OPTION_YES && ht->discover_table_names)
+ {
+ uint old_elements= args->result->tables->elements();
+ if (ht->discover_table_names(ht, args->db, args->dirp, args->result))
+ return 1;
+
+ /*
+ hton_ext_based_table_discovery never discovers a table that has
+ a corresponding .frm file; but custom engine discover methods might
+ */
+ if (ht->discover_table_names != hton_ext_based_table_discovery)
+ args->possible_duplicates+= args->result->tables->elements() - old_elements;
+ }
+
+ return 0;
}
-int ha_table_exists_in_engine(THD* thd, const char* db, const char* name)
+int ha_discover_table_names(THD *thd, LEX_STRING *db, MY_DIR *dirp,
+ Discovered_table_list *result)
{
- DBUG_ENTER("ha_table_exists_in_engine");
- DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
- st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE};
- plugin_foreach(thd, table_exists_in_engine_handlerton,
- MYSQL_STORAGE_ENGINE_PLUGIN, &args);
- DBUG_PRINT("exit", ("error: %d", args.err));
- DBUG_RETURN(args.err);
+ int error;
+ DBUG_ENTER("ha_discover_table_names");
+
+ if (engines_with_discover_table_names == 0)
+ {
+ error= ext_table_discovery_simple(dirp, result);
+ result->sort();
+ }
+ else
+ {
+ st_discover_names_args args= {db, dirp, result, 0};
+
+ /* extension_based_table_discovery relies on dirp being sorted */
+ my_qsort(dirp->dir_entry, dirp->number_of_files,
+ sizeof(FILEINFO), cmp_file_names);
+
+ error= extension_based_table_discovery(dirp, reg_ext, result) ||
+ plugin_foreach(thd, discover_names,
+ MYSQL_STORAGE_ENGINE_PLUGIN, &args);
+ result->sort();
+
+ if (args.possible_duplicates > 0)
+ result->remove_duplicates();
+ }
+
+ DBUG_RETURN(error);
}
+
#ifdef HAVE_NDB_BINLOG
/*
TODO: change this into a dynamic struct
@@ -5017,26 +5196,20 @@ static my_bool exts_handlerton(THD *unused, plugin_ref plugin,
{
List<char> *found_exts= (List<char> *) arg;
handlerton *hton= plugin_data(plugin, handlerton *);
- handler *file;
- if (hton->state == SHOW_OPTION_YES && hton->create &&
- (file= hton->create(hton, (TABLE_SHARE*) 0, current_thd->mem_root)))
- {
- List_iterator_fast<char> it(*found_exts);
- const char **ext, *old_ext;
+ List_iterator_fast<char> it(*found_exts);
+ const char **ext, *old_ext;
- for (ext= file->bas_ext(); *ext; ext++)
+ for (ext= hton->tablefile_extensions; *ext; ext++)
+ {
+ while ((old_ext= it++))
{
- while ((old_ext= it++))
- {
- if (!strcmp(old_ext, *ext))
- break;
- }
- if (!old_ext)
- found_exts->push_back((char *) *ext);
-
- it.rewind();
+ if (!strcmp(old_ext, *ext))
+ break;
}
- delete file;
+ if (!old_ext)
+ found_exts->push_back((char *) *ext);
+
+ it.rewind();
}
return FALSE;
}
@@ -5137,7 +5310,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat)
if (!result && !thd->is_error())
my_eof(thd);
else if (!thd->is_error())
- my_error(ER_GET_ERRNO, MYF(0), errno);
+ my_error(ER_GET_ERRNO, MYF(0), errno, hton_name(db_type)->str);
return result;
}
diff --git a/sql/handler.h b/sql/handler.h
index 8ee1044f10c..44d86e5ec97 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -2,7 +2,7 @@
#define HANDLER_INCLUDED
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2011 Monty Program Ab
+ Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -31,6 +31,7 @@
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA */
#include "sql_cache.h"
#include "structs.h" /* SHOW_COMP_OPTION */
+#include "sql_array.h" /* Dynamic_array<> */
#include <my_compare.h>
#include <ft_global.h>
@@ -59,9 +60,9 @@
/* Bits in table_flags() to show what database can do */
-#define HA_NO_TRANSACTIONS (1 << 0) /* Doesn't support transactions */
-#define HA_PARTIAL_COLUMN_READ (1 << 1) /* read may not return all columns */
-#define HA_TABLE_SCAN_ON_INDEX (1 << 2) /* No separate data/index file */
+#define HA_NO_TRANSACTIONS (1ULL << 0) /* Doesn't support transactions */
+#define HA_PARTIAL_COLUMN_READ (1ULL << 1) /* read may not return all columns */
+#define HA_TABLE_SCAN_ON_INDEX (1ULL << 2) /* No separate data/index file */
/*
The following should be set if the following is not true when scanning
a table with rnd_next()
@@ -70,37 +71,37 @@
If this flag is not set, filesort will do a position() call for each matched
row to be able to find the row later.
*/
-#define HA_REC_NOT_IN_SEQ (1 << 3)
-#define HA_CAN_GEOMETRY (1 << 4)
+#define HA_REC_NOT_IN_SEQ (1ULL << 3)
+#define HA_CAN_GEOMETRY (1ULL << 4)
/*
Reading keys in random order is as fast as reading keys in sort order
(Used in records.cc to decide if we should use a record cache and by
filesort to decide if we should sort key + data or key + pointer-to-row
*/
-#define HA_FAST_KEY_READ (1 << 5)
+#define HA_FAST_KEY_READ (1ULL << 5)
/*
Set the following flag if we on delete should force all key to be read
and on update read all keys that changes
*/
-#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1 << 6)
-#define HA_NULL_IN_KEY (1 << 7) /* One can have keys with NULL */
-#define HA_DUPLICATE_POS (1 << 8) /* ha_position() gives dup row */
-#define HA_NO_BLOBS (1 << 9) /* Doesn't support blobs */
-#define HA_CAN_INDEX_BLOBS (1 << 10)
-#define HA_AUTO_PART_KEY (1 << 11) /* auto-increment in multi-part key */
-#define HA_REQUIRE_PRIMARY_KEY (1 << 12) /* .. and can't create a hidden one */
-#define HA_STATS_RECORDS_IS_EXACT (1 << 13) /* stats.records is exact */
+#define HA_REQUIRES_KEY_COLUMNS_FOR_DELETE (1ULL << 6)
+#define HA_NULL_IN_KEY (1ULL << 7) /* One can have keys with NULL */
+#define HA_DUPLICATE_POS (1ULL << 8) /* ha_position() gives dup row */
+#define HA_NO_BLOBS (1ULL << 9) /* Doesn't support blobs */
+#define HA_CAN_INDEX_BLOBS (1ULL << 10)
+#define HA_AUTO_PART_KEY (1ULL << 11) /* auto-increment in multi-part key */
+#define HA_REQUIRE_PRIMARY_KEY (1ULL << 12) /* .. and can't create a hidden one */
+#define HA_STATS_RECORDS_IS_EXACT (1ULL << 13) /* stats.records is exact */
/*
INSERT_DELAYED only works with handlers that uses MySQL internal table
level locks
*/
-#define HA_CAN_INSERT_DELAYED (1 << 14)
+#define HA_CAN_INSERT_DELAYED (1ULL << 14)
/*
If we get the primary key columns for free when we do an index read
It also implies that we have to retrive the primary key when using
position() and rnd_pos().
*/
-#define HA_PRIMARY_KEY_IN_READ_INDEX (1 << 15)
+#define HA_PRIMARY_KEY_IN_READ_INDEX (1ULL << 15)
/*
If HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is set, it means that to position()
uses a primary key given by the record argument.
@@ -108,36 +109,36 @@
If not set, the position is returned as the current rows position
regardless of what argument is given.
*/
-#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1 << 16)
-#define HA_CAN_RTREEKEYS (1 << 17)
-#define HA_NOT_DELETE_WITH_CACHE (1 << 18)
+#define HA_PRIMARY_KEY_REQUIRED_FOR_POSITION (1ULL << 16)
+#define HA_CAN_RTREEKEYS (1ULL << 17)
+#define HA_NOT_DELETE_WITH_CACHE (1ULL << 18)
/*
The following is we need to a primary key to delete (and update) a row.
If there is no primary key, all columns needs to be read on update and delete
*/
-#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1 << 19)
-#define HA_NO_PREFIX_CHAR_KEYS (1 << 20)
-#define HA_CAN_FULLTEXT (1 << 21)
-#define HA_CAN_SQL_HANDLER (1 << 22)
-#define HA_NO_AUTO_INCREMENT (1 << 23)
+#define HA_PRIMARY_KEY_REQUIRED_FOR_DELETE (1ULL << 19)
+#define HA_NO_PREFIX_CHAR_KEYS (1ULL << 20)
+#define HA_CAN_FULLTEXT (1ULL << 21)
+#define HA_CAN_SQL_HANDLER (1ULL << 22)
+#define HA_NO_AUTO_INCREMENT (1ULL << 23)
/* Has automatic checksums and uses the old checksum format */
-#define HA_HAS_OLD_CHECKSUM (1 << 24)
+#define HA_HAS_OLD_CHECKSUM (1ULL << 24)
/* Table data are stored in separate files (for lower_case_table_names) */
-#define HA_FILE_BASED (1 << 26)
-#define HA_NO_VARCHAR (1 << 27)
-#define HA_CAN_BIT_FIELD (1 << 28) /* supports bit fields */
-#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
-#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
-#define HA_NO_COPY_ON_ALTER (LL(1) << 31)
-#define HA_HAS_RECORDS (LL(1) << 32) /* records() gives exact count*/
+#define HA_FILE_BASED (1ULL << 26)
+#define HA_NO_VARCHAR (1ULL << 27)
+#define HA_CAN_BIT_FIELD (1ULL << 28) /* supports bit fields */
+#define HA_NEED_READ_RANGE_BUFFER (1ULL << 29) /* for read_multi_range */
+#define HA_ANY_INDEX_MAY_BE_UNIQUE (1ULL << 30)
+#define HA_NO_COPY_ON_ALTER (1ULL << 31)
+#define HA_HAS_RECORDS (1ULL << 32) /* records() gives exact count*/
/* Has it's own method of binlog logging */
-#define HA_HAS_OWN_BINLOGGING (LL(1) << 33)
+#define HA_HAS_OWN_BINLOGGING (1ULL << 33)
/*
Engine is capable of row-format and statement-format logging,
respectively
*/
-#define HA_BINLOG_ROW_CAPABLE (LL(1) << 34)
-#define HA_BINLOG_STMT_CAPABLE (LL(1) << 35)
+#define HA_BINLOG_ROW_CAPABLE (1ULL << 34)
+#define HA_BINLOG_STMT_CAPABLE (1ULL << 35)
/*
When a multiple key conflict happens in a REPLACE command mysql
expects the conflicts to be reported in the ascending order of
@@ -160,20 +161,20 @@
This flag helps the underlying SE to inform the server that the keys are not
ordered.
*/
-#define HA_DUPLICATE_KEY_NOT_IN_ORDER (LL(1) << 36)
+#define HA_DUPLICATE_KEY_NOT_IN_ORDER (1ULL << 36)
/*
Engine supports REPAIR TABLE. Used by CHECK TABLE FOR UPGRADE if an
incompatible table is detected. If this flag is set, CHECK TABLE FOR UPGRADE
will report ER_TABLE_NEEDS_UPGRADE, otherwise ER_TABLE_NEED_REBUILD.
*/
-#define HA_CAN_REPAIR (LL(1) << 37)
+#define HA_CAN_REPAIR (1ULL << 37)
/* Has automatic checksums and uses the new checksum format */
-#define HA_HAS_NEW_CHECKSUM (LL(1) << 38)
-#define HA_CAN_VIRTUAL_COLUMNS (LL(1) << 39)
-#define HA_MRR_CANT_SORT (LL(1) << 40)
-#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (LL(1) << 41)
+#define HA_HAS_NEW_CHECKSUM (1ULL << 38)
+#define HA_CAN_VIRTUAL_COLUMNS (1ULL << 39)
+#define HA_MRR_CANT_SORT (1ULL << 40)
+#define HA_RECORD_MUST_BE_CLEAN_ON_WRITE (1ULL << 41)
/*
Table condition pushdown must be performed regardless of
@@ -186,7 +187,7 @@
then the "query=..." condition must be always pushed down into storage
engine.
*/
-#define HA_MUST_USE_TABLE_CONDITION_PUSHDOWN (LL(1) << 42)
+#define HA_MUST_USE_TABLE_CONDITION_PUSHDOWN (1ULL << 42)
/*
Set of all binlog flags. Currently only contain the capabilities
@@ -352,25 +353,23 @@ static const uint MYSQL_START_TRANS_OPT_READ_WRITE = 4;
enum legacy_db_type
{
- DB_TYPE_UNKNOWN=0,DB_TYPE_DIAB_ISAM=1,
- DB_TYPE_HASH,DB_TYPE_MISAM,DB_TYPE_PISAM,
- DB_TYPE_RMS_ISAM, DB_TYPE_HEAP, DB_TYPE_ISAM,
- DB_TYPE_MRG_ISAM, DB_TYPE_MYISAM, DB_TYPE_MRG_MYISAM,
- DB_TYPE_BERKELEY_DB, DB_TYPE_INNODB,
- DB_TYPE_GEMINI, DB_TYPE_NDBCLUSTER,
- DB_TYPE_EXAMPLE_DB, DB_TYPE_ARCHIVE_DB, DB_TYPE_CSV_DB,
- DB_TYPE_FEDERATED_DB,
- DB_TYPE_BLACKHOLE_DB,
- DB_TYPE_PARTITION_DB,
- DB_TYPE_BINLOG,
- DB_TYPE_SOLID,
- DB_TYPE_PBXT,
- DB_TYPE_TABLE_FUNCTION,
- DB_TYPE_MEMCACHE,
- DB_TYPE_FALCON,
- DB_TYPE_MARIA,
- /** Performance schema engine. */
- DB_TYPE_PERFORMANCE_SCHEMA,
+ /* note these numerical values are fixed and can *not* be changed */
+ DB_TYPE_UNKNOWN=0,
+ DB_TYPE_HEAP=6,
+ DB_TYPE_MYISAM=9,
+ DB_TYPE_MRG_MYISAM=10,
+ DB_TYPE_INNODB=12,
+ DB_TYPE_NDBCLUSTER=14,
+ DB_TYPE_EXAMPLE_DB=15,
+ DB_TYPE_ARCHIVE_DB=16,
+ DB_TYPE_CSV_DB=17,
+ DB_TYPE_FEDERATED_DB=18,
+ DB_TYPE_BLACKHOLE_DB=19,
+ DB_TYPE_PARTITION_DB=20,
+ DB_TYPE_BINLOG=21,
+ DB_TYPE_PBXT=23,
+ DB_TYPE_MARIA=27,
+ DB_TYPE_PERFORMANCE_SCHEMA=28,
DB_TYPE_FIRST_DYNAMIC=42,
DB_TYPE_DEFAULT=127 // Must be last
};
@@ -627,6 +626,7 @@ enum enum_schema_tables
SCH_PARAMETERS,
SCH_PARTITIONS,
SCH_PLUGINS,
+ SCH_ALL_PLUGINS,
SCH_PROCESSLIST,
SCH_PROFILES,
SCH_REFERENTIAL_CONSTRAINTS,
@@ -651,6 +651,7 @@ enum enum_schema_tables
};
struct TABLE_SHARE;
+struct HA_CREATE_INFO;
struct st_foreign_key_info;
typedef struct st_foreign_key_info FOREIGN_KEY_INFO;
typedef bool (stat_print_fn)(THD *thd, const char *type, uint type_len,
@@ -730,22 +731,26 @@ struct ha_index_option_struct;
enum ha_option_type { HA_OPTION_TYPE_ULL, /* unsigned long long */
HA_OPTION_TYPE_STRING, /* char * */
HA_OPTION_TYPE_ENUM, /* uint */
- HA_OPTION_TYPE_BOOL}; /* bool */
+ HA_OPTION_TYPE_BOOL, /* bool */
+ HA_OPTION_TYPE_SYSVAR};/* type of the sysval */
#define HA_xOPTION_NUMBER(name, struc, field, def, min, max, blk_siz) \
{ HA_OPTION_TYPE_ULL, name, sizeof(name)-1, \
- offsetof(struc, field), def, min, max, blk_siz, 0 }
+ offsetof(struc, field), def, min, max, blk_siz, 0, 0 }
#define HA_xOPTION_STRING(name, struc, field) \
{ HA_OPTION_TYPE_STRING, name, sizeof(name)-1, \
- offsetof(struc, field), 0, 0, 0, 0, 0 }
+ offsetof(struc, field), 0, 0, 0, 0, 0, 0}
#define HA_xOPTION_ENUM(name, struc, field, values, def) \
{ HA_OPTION_TYPE_ENUM, name, sizeof(name)-1, \
offsetof(struc, field), def, 0, \
- sizeof(values)-1, 0, values }
+ sizeof(values)-1, 0, values, 0 }
#define HA_xOPTION_BOOL(name, struc, field, def) \
{ HA_OPTION_TYPE_BOOL, name, sizeof(name)-1, \
- offsetof(struc, field), def, 0, 1, 0, 0 }
-#define HA_xOPTION_END { HA_OPTION_TYPE_ULL, 0, 0, 0, 0, 0, 0, 0, 0 }
+ offsetof(struc, field), def, 0, 1, 0, 0, 0 }
+#define HA_xOPTION_SYSVAR(name, struc, field, sysvar) \
+ { HA_OPTION_TYPE_SYSVAR, name, sizeof(name)-1, \
+ offsetof(struc, field), 0, 0, 0, 0, 0, MYSQL_SYSVAR(sysvar) }
+#define HA_xOPTION_END { HA_OPTION_TYPE_ULL, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
#define HA_TOPTION_NUMBER(name, field, def, min, max, blk_siz) \
HA_xOPTION_NUMBER(name, ha_table_option_struct, field, def, min, max, blk_siz)
@@ -755,6 +760,8 @@ enum ha_option_type { HA_OPTION_TYPE_ULL, /* unsigned long long */
HA_xOPTION_ENUM(name, ha_table_option_struct, field, values, def)
#define HA_TOPTION_BOOL(name, field, def) \
HA_xOPTION_BOOL(name, ha_table_option_struct, field, def)
+#define HA_TOPTION_SYSVAR(name, field, sysvar) \
+ HA_xOPTION_SYSVAR(name, ha_table_option_struct, field, sysvar)
#define HA_TOPTION_END HA_xOPTION_END
#define HA_FOPTION_NUMBER(name, field, def, min, max, blk_siz) \
@@ -765,6 +772,8 @@ enum ha_option_type { HA_OPTION_TYPE_ULL, /* unsigned long long */
HA_xOPTION_ENUM(name, ha_field_option_struct, field, values, def)
#define HA_FOPTION_BOOL(name, field, def) \
HA_xOPTION_BOOL(name, ha_field_option_struct, field, def)
+#define HA_FOPTION_SYSVAR(name, field, sysvar) \
+ HA_xOPTION_SYSVAR(name, ha_field_option_struct, field, sysvar)
#define HA_FOPTION_END HA_xOPTION_END
#define HA_IOPTION_NUMBER(name, field, def, min, max, blk_siz) \
@@ -775,6 +784,8 @@ enum ha_option_type { HA_OPTION_TYPE_ULL, /* unsigned long long */
HA_xOPTION_ENUM(name, ha_index_option_struct, field, values, def)
#define HA_IOPTION_BOOL(name, field, values, def) \
HA_xOPTION_BOOL(name, ha_index_option_struct, field, values, def)
+#define HA_IOPTION_SYSVAR(name, field, sysvar) \
+ HA_xOPTION_SYSVAR(name, ha_index_option_struct, field, sysvar)
#define HA_IOPTION_END HA_xOPTION_END
typedef struct st_ha_create_table_option {
@@ -785,6 +796,7 @@ typedef struct st_ha_create_table_option {
ulonglong def_value;
ulonglong min_value, max_value, block_size;
const char *values;
+ struct st_mysql_sys_var *var;
} ha_create_table_option;
enum handler_iterator_type
@@ -1093,18 +1105,6 @@ struct handlerton
enum handler_create_iterator_result
(*create_iterator)(handlerton *hton, enum handler_iterator_type type,
struct handler_iterator *fill_this_in);
- int (*discover)(handlerton *hton, THD* thd, const char *db,
- const char *name,
- uchar **frmblob,
- size_t *frmlen);
- int (*find_files)(handlerton *hton, THD *thd,
- const char *db,
- const char *path,
- const char *wild, bool dir, List<LEX_STRING> *files);
- int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db,
- const char *name);
-
- uint32 license; /* Flag for Engine License */
/*
Optional clauses in the CREATE/ALTER TABLE
*/
@@ -1112,14 +1112,124 @@ struct handlerton
ha_create_table_option *field_options; // these are specified per field
ha_create_table_option *index_options; // these are specified per index
+ /**
+ The list of extensions of files created for a single table in the
+ database directory (datadir/db_name/).
+
+ Used by open_table_error(), by the default rename_table and delete_table
+ handler methods, and by the default discovery implementation.
+
+ For engines that have more than one file name extentions (separate
+ metadata, index, and/or data files), the order of elements is relevant.
+ First element of engine file name extentions array should be metadata
+ file extention. This is implied by the open_table_error()
+ and the default discovery implementation.
+
+ Second element - data file extention. This is implied
+ assumed by REPAIR TABLE ... USE_FRM implementation.
+ */
+ const char **tablefile_extensions; // by default - empty list
+
+ /*********************************************************************
+ Table discovery API.
+ It allows the server to "discover" tables that exist in the storage
+ engine, without user issuing an explicit CREATE TABLE statement.
+ **********************************************************************/
+
+ /*
+ This method is required for any engine that supports automatic table
+ discovery, there is no default implementation.
+
+ Given a TABLE_SHARE discover_table() fills it in with a correct table
+ structure using one of the TABLE_SHARE::init_from_* methods.
+
+ Returns HA_ERR_NO_SUCH_TABLE if the table did not exist in the engine,
+ zero if the table was discovered successfully, or any other
+ HA_ERR_* error code as appropriate if the table existed, but the
+ discovery failed.
+ */
+ int (*discover_table)(handlerton *hton, THD* thd, TABLE_SHARE *share);
+
+ /*
+ The discover_table_names method tells the server
+ about all tables in the specified database that the engine
+ knows about. Tables (or file names of tables) are added to
+ the provided discovered_list collector object using
+ add_table() or add_file() methods.
+ */
+ class discovered_list
+ {
+ public:
+ virtual bool add_table(const char *tname, size_t tlen) = 0;
+ virtual bool add_file(const char *fname) = 0;
+ protected: virtual ~discovered_list() {}
+ };
+
+ /*
+ By default (if not implemented by the engine, but the discovery_table() is
+ implemented) it will perform a file-based discovery:
+
+ - if tablefile_extensions[0] is not null, this will discovers all tables
+ with the tablefile_extensions[0] extension.
+
+ Returns 0 on success and 1 on error.
+ */
+ int (*discover_table_names)(handlerton *hton, LEX_STRING *db, MY_DIR *dir,
+ discovered_list *result);
+
+ /*
+ This is a method that allows to server to check if a table exists without
+ an overhead of the complete discovery.
+
+ By default (if not implemented by the engine, but the discovery_table() is
+ implemented) it will try to perform a file-based discovery:
+
+ - if tablefile_extensions[0] is not null this will look for a file name
+ with the tablefile_extensions[0] extension.
+
+ - if tablefile_extensions[0] is null, this will resort to discover_table().
+
+ Note that resorting to discover_table() is slow and the engine
+ should probably implement its own discover_table_existence() method,
+ if its tablefile_extensions[0] is null.
+
+ Returns 1 if the table exists and 0 if it does not.
+ */
+ int (*discover_table_existence)(handlerton *hton, const char *db,
+ const char *table_name);
+
+ /*
+ This is the assisted table discovery method. Unlike the fully
+ automatic discovery as above, here a user is expected to issue an
+ explicit CREATE TABLE with the appropriate table attributes to
+ "assist" the discovery of a table. But this "discovering" CREATE TABLE
+ statement will not specify the table structure - the engine discovers
+ it using this method. For example, FederatedX uses it in
+
+ CREATE TABLE t1 ENGINE=FEDERATED CONNECTION="mysql://foo/bar/t1";
+
+ Given a TABLE_SHARE discover_table_structure() fills it in with a correct
+ table structure using one of the TABLE_SHARE::init_from_* methods.
+
+ Assisted discovery works independently from the automatic discover.
+ An engine is allowed to support only assisted discovery and not
+ support automatic one. Or vice versa.
+ */
+ int (*discover_table_structure)(handlerton *hton, THD* thd,
+ TABLE_SHARE *share, HA_CREATE_INFO *info);
};
-inline LEX_STRING *hton_name(const handlerton *hton)
+static inline LEX_STRING *hton_name(const handlerton *hton)
{
return &(hton2plugin[hton->slot]->name);
}
+static inline sys_var *find_hton_sysvar(handlerton *hton, st_mysql_sys_var *var)
+{
+ return find_plugin_sysvar(hton2plugin[hton->slot], var);
+}
+
/* Possible flags of a handlerton (there can be 32 of them) */
#define HTON_NO_FLAGS 0
@@ -1315,9 +1425,10 @@ struct st_partition_iter;
enum ha_choice { HA_CHOICE_UNDEF, HA_CHOICE_NO, HA_CHOICE_YES };
-typedef struct st_ha_create_information
+struct HA_CREATE_INFO
{
CHARSET_INFO *table_charset, *default_table_charset;
+ LEX_CUSTRING tabledef_version;
LEX_STRING connect_string;
const char *password, *tablespace;
LEX_STRING comment;
@@ -1346,16 +1457,18 @@ typedef struct st_ha_create_information
uint merge_insert_method;
uint extra_size; /* length of extra data segment */
enum ha_choice transactional;
- bool frm_only; ///< 1 if no ha_create_table()
bool varchar; ///< 1 if table has a VARCHAR
enum ha_storage_media storage_media; ///< DEFAULT, DISK or MEMORY
enum ha_choice page_checksum; ///< If we have page_checksums
engine_option_value *option_list; ///< list of table create options
+
/* the following three are only for ALTER TABLE, check_if_incompatible_data() */
ha_table_option_struct *option_struct; ///< structure with parsed table options
ha_field_option_struct **fields_option_struct; ///< array of field option structures
ha_index_option_struct **indexes_option_struct; ///< array of index option structures
-} HA_CREATE_INFO;
+
+ bool tmp_table() { return options & HA_LEX_CREATE_TMP_TABLE; }
+};
typedef struct st_key_create_information
@@ -2046,8 +2159,8 @@ public:
int ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info);
- int ha_create_handler_files(const char *name, const char *old_name,
- int action_flag, HA_CREATE_INFO *info);
+ int ha_create_partitioning_metadata(const char *name, const char *old_name,
+ int action_flag);
int ha_change_partitions(HA_CREATE_INFO *create_info,
const char *path,
@@ -2494,18 +2607,7 @@ public:
virtual void free_foreign_key_create_info(char* str) {}
/** The following can be called without an open handler */
const char *table_type() const { return hton_name(ht)->str; }
- /**
- If frm_error() is called then we will use this to find out what file
- extentions exist for the storage engine. This is also used by the default
- rename_table and delete_table method in handler.cc.
-
- For engines that have two file name extentions (separate meta/index file
- and data file), the order of elements is relevant. First element of engine
- file name extentions array should be meta/index file extention. Second
- element - data file extention. This order is assumed by
- prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
- */
- virtual const char **bas_ext() const =0;
+ const char **bas_ext() const { return ht->tablefile_extensions; }
virtual int get_default_no_partitions(HA_CREATE_INFO *create_info)
{ return 1;}
@@ -3020,8 +3122,8 @@ private:
virtual void drop_table(const char *name);
virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0;
- virtual int create_handler_files(const char *name, const char *old_name,
- int action_flag, HA_CREATE_INFO *info)
+ virtual int create_partitioning_metadata(const char *name, const char *old_name,
+ int action_flag)
{ return FALSE; }
virtual int change_partitions(HA_CREATE_INFO *create_info,
@@ -3091,6 +3193,8 @@ static inline bool ha_storage_engine_is_enabled(const handlerton *db_type)
(db_type->state == SHOW_OPTION_YES) : FALSE;
}
+#define view_pseudo_hton ((handlerton *)1)
+
/* basic stuff */
int ha_init_errors(void);
int ha_init(void);
@@ -3108,8 +3212,7 @@ void ha_checkpoint_state(bool disable);
void ha_commit_checkpoint_request(void *cookie, void (*pre_hook)(void *));
int ha_create_table(THD *thd, const char *path,
const char *db, const char *table_name,
- HA_CREATE_INFO *create_info,
- bool update_create_info);
+ HA_CREATE_INFO *create_info, LEX_CUSTRING *frm);
int ha_delete_table(THD *thd, handlerton *db_type, const char *path,
const char *db, const char *alias, bool generate_warning);
@@ -3117,14 +3220,31 @@ int ha_delete_table(THD *thd, handlerton *db_type, const char *path,
bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat);
/* discovery */
-int ha_create_table_from_engine(THD* thd, const char *db, const char *name);
-bool ha_check_if_table_exists(THD* thd, const char *db, const char *name,
- bool *exists);
-int ha_discover(THD* thd, const char* dbname, const char* name,
- uchar** frmblob, size_t* frmlen);
-int ha_find_files(THD *thd,const char *db,const char *path,
- const char *wild, bool dir, List<LEX_STRING>* files);
-int ha_table_exists_in_engine(THD* thd, const char* db, const char* name);
+#ifdef MYSQL_SERVER
+class Discovered_table_list: public handlerton::discovered_list
+{
+ THD *thd;
+ const char *wild, *wend;
+public:
+ Dynamic_array<LEX_STRING*> *tables;
+
+ Discovered_table_list(THD *thd_arg, Dynamic_array<LEX_STRING*> *tables_arg,
+ const LEX_STRING *wild_arg);
+ ~Discovered_table_list() {}
+
+ bool add_table(const char *tname, size_t tlen);
+ bool add_file(const char *fname);
+
+ void sort();
+ void remove_duplicates(); // assumes that the list is sorted
+};
+
+int ha_discover_table(THD *thd, TABLE_SHARE *share);
+int ha_discover_table_names(THD *thd, LEX_STRING *db, MY_DIR *dirp,
+ Discovered_table_list *result);
+bool ha_table_exists(THD *thd, const char *db, const char *table_name,
+ handlerton **hton= 0);
+#endif
/* key cache */
extern "C" int ha_init_key_cache(const char *name, KEY_CACHE *key_cache, void *);
diff --git a/sql/innodb_priv.h b/sql/innodb_priv.h
index 5406c292b18..24ee848bed1 100644
--- a/sql/innodb_priv.h
+++ b/sql/innodb_priv.h
@@ -25,7 +25,7 @@ class THD;
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
bool schema_table_store_record(THD *thd, TABLE *table);
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
-bool check_global_access(THD *thd, ulong want_access);
+bool check_global_access(THD *thd, ulong want_access, bool no_errors=false);
uint strconvert(CHARSET_INFO *from_cs, const char *from,
CHARSET_INFO *to_cs, char *to, uint to_length,
uint *errors);
diff --git a/sql/item.cc b/sql/item.cc
index 665521c641e..ecc7917022e 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2012, Monty Program Ab
+ Copyright (c) 2010, 2013, Monty Program Ab
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
@@ -198,7 +198,7 @@ Hybrid_type_traits_integer::fix_length_and_dec(Item *item, Item *arg) const
void item_init(void)
{
- item_user_lock_init();
+ item_func_sleep_init();
uuid_short_init();
}
@@ -807,10 +807,15 @@ bool Item_ident::remove_dependence_processor(uchar * arg)
bool Item_ident::collect_outer_ref_processor(uchar *param)
{
Collect_deps_prm *prm= (Collect_deps_prm *)param;
- if (depended_from &&
+ if (depended_from &&
depended_from->nest_level_base == prm->nest_level_base &&
depended_from->nest_level < prm->nest_level)
- prm->parameters->add_unique(this, &cmp_items);
+ {
+ if (prm->collect)
+ prm->parameters->add_unique(this, &cmp_items);
+ else
+ prm->count++;
+ }
return FALSE;
}
@@ -1272,11 +1277,15 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
DBUG_ASSERT(0);
}
- return 0;
+ return null_value= 0;
err:
+ /*
+ if the item was not null and convertion failed, we return a zero date
+ if allowed, otherwise - null.
+ */
bzero((char*) ltime,sizeof(*ltime));
- return 1;
+ return null_value|= (fuzzydate & (TIME_NO_ZERO_DATE|TIME_NO_ZERO_IN_DATE));
}
bool Item::get_seconds(ulonglong *sec, ulong *sec_part)
@@ -4001,8 +4010,8 @@ double Item_copy_string::val_real()
longlong Item_copy_string::val_int()
{
int err;
- return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),
- str_value.length(),10, (char**) 0,
+ return null_value ? 0 : my_strntoll(str_value.charset(),str_value.ptr(),
+ str_value.length(), 10, (char**) 0,
&err);
}
@@ -4172,7 +4181,7 @@ double Item_copy_decimal::val_real()
longlong Item_copy_decimal::val_int()
{
if (null_value)
- return LL(0);
+ return 0;
else
{
longlong result;
@@ -6478,6 +6487,13 @@ Item* Item::cache_const_expr_transformer(uchar *arg)
return this;
}
+/**
+ Find Item by reference in the expression
+*/
+bool Item::find_item_processor(uchar *arg)
+{
+ return (this == ((Item *) arg));
+}
bool Item_field::send(Protocol *protocol, String *buffer)
{
@@ -8090,7 +8106,7 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
}
if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of())))
goto error;
- memcpy(def_field, field_arg->field, field_arg->field->size_of());
+ memcpy((void *)def_field, (void *)field_arg->field, field_arg->field->size_of());
def_field->move_field_offset((my_ptrdiff_t)
(def_field->table->s->default_values -
def_field->table->record[0]));
@@ -8226,7 +8242,7 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items)
Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
if (!def_field)
return TRUE;
- memcpy(def_field, field_arg->field, field_arg->field->size_of());
+ memcpy((void *)def_field, (void *)field_arg->field, field_arg->field->size_of());
def_field->move_field_offset((my_ptrdiff_t)
(def_field->table->insert_values -
def_field->table->record[0]));
@@ -8640,7 +8656,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
Item_cache* Item_cache::get_cache(const Item *item)
{
- return get_cache(item, item->result_type());
+ return get_cache(item, item->cmp_type());
}
diff --git a/sql/item.h b/sql/item.h
index 8ec701e0255..6f1b6801669 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -553,6 +553,8 @@ class COND_EQUAL;
class st_select_lex_unit;
+class Item_func_not;
+
class Item {
Item(const Item &); /* Prevent use of these */
void operator=(Item &);
@@ -1153,6 +1155,7 @@ public:
virtual bool collect_item_field_processor(uchar * arg) { return 0; }
virtual bool add_field_to_set_processor(uchar * arg) { return 0; }
virtual bool find_item_in_field_list_processor(uchar *arg) { return 0; }
+ virtual bool find_item_processor(uchar *arg);
virtual bool change_context_processor(uchar *context) { return 0; }
virtual bool reset_query_id_processor(uchar *query_id_arg) { return 0; }
virtual bool is_expensive_processor(uchar *arg) { return 0; }
@@ -1167,9 +1170,10 @@ public:
virtual bool eval_not_null_tables(uchar *opt_arg) { return 0; }
virtual bool is_subquery_processor (uchar *opt_arg) { return 0; }
virtual bool limit_index_condition_pushdown_processor(uchar *opt_arg)
- {
+ {
return FALSE;
}
+ virtual bool exists2in_processor(uchar *opt_arg) { return 0; }
/* To call bool function for all arguments */
struct bool_func_call_args
@@ -1186,6 +1190,7 @@ public:
return FALSE;
}
+
/*
The next function differs from the previous one that a bitmap to be updated
is passed as uchar *arg.
@@ -1315,7 +1320,9 @@ public:
List<Item> *parameters;
/* unit from which we count nest_level */
st_select_lex_unit *nest_level_base;
+ uint count;
int nest_level;
+ bool collect;
};
/**
Collect outer references
@@ -1478,6 +1485,15 @@ public:
virtual void get_cache_parameters(List<Item> &parameters) { };
virtual void mark_as_condition_AND_part(TABLE_LIST *embedding) {};
+
+ /* how much position should be reserved for Exists2In transformation */
+ virtual uint exists2in_reserved_items() { return 0; };
+
+ /**
+ Inform the item that it is located under a NOT, which is a top-level item.
+ */
+ virtual void under_not(Item_func_not * upper
+ __attribute__((unused))) {};
};
@@ -2982,6 +2998,13 @@ public:
alias_name_used_arg)
{}
+ bool fix_fields(THD *thd, Item **it)
+ {
+ if ((!(*ref)->fixed && (*ref)->fix_fields(thd, ref)) ||
+ (*ref)->check_cols(1))
+ return TRUE;
+ return Item_ref::fix_fields(thd, it);
+ }
void save_val(Field *to);
double val_real();
longlong val_int();
@@ -3201,7 +3224,7 @@ public:
bool subst_argument_checker(uchar **arg);
Item *equal_fields_propagator(uchar *arg);
Item *replace_equal_field(uchar *arg);
- table_map used_tables() const;
+ table_map used_tables() const;
table_map not_null_tables() const;
void update_used_tables();
bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
@@ -3568,7 +3591,7 @@ public:
}
virtual longlong val_int()
{
- return null_value ? LL(0) : cached_value;
+ return null_value ? 0 : cached_value;
}
virtual void copy();
};
@@ -4029,6 +4052,7 @@ public:
bool cache_value();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
int save_in_field(Field *field, bool no_conversions);
+ Item_result cmp_type() const { return TIME_RESULT; }
void store_packed(longlong val_arg, Item *example);
/*
Having a clone_item method tells optimizer that this object
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 3b09da68927..6f10e84a5f5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -241,15 +241,15 @@ static uint collect_cmp_types(Item **items, uint nitems, bool skip_nulls= FALSE)
items[i]->cmp_type() == ROW_RESULT) &&
cmp_row_type(items[0], items[i]))
return 0;
- found_types|= 1<< (uint)item_cmp_type(left_result,
- items[i]->cmp_type());
+ found_types|= 1U << (uint)item_cmp_type(left_result,
+ items[i]->cmp_type());
}
/*
Even if all right-hand items are NULLs and we are skipping them all, we need
at least one type bit in the found_type bitmask.
*/
if (skip_nulls && !found_types)
- found_types= 1 << (uint)left_result;
+ found_types= 1U << (uint)left_result;
return found_types;
}
@@ -906,7 +906,8 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
}
if ((*is_null= item->null_value))
return ~(ulonglong) 0;
- if (cache_arg && item->const_item() && item->type() != Item::CACHE_ITEM)
+ if (cache_arg && item->const_item() &&
+ !(item->type() == Item::CACHE_ITEM && item->cmp_type() == TIME_RESULT))
{
Query_arena backup;
Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup);
@@ -1434,7 +1435,7 @@ bool Item_in_optimizer::eval_not_null_tables(uchar *opt_arg)
return FALSE;
}
-bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
+bool Item_in_optimizer::fix_left(THD *thd)
{
if ((!args[0]->fixed && args[0]->fix_fields(thd, args)) ||
(!cache && !(cache= Item_cache::get_cache(args[0]))))
@@ -1482,6 +1483,13 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
cache->store(args[0]);
cache->cache_value();
}
+ if (args[1]->fixed)
+ {
+ /* to avoid overriding is called to update left expression */
+ used_tables_cache|= args[1]->used_tables();
+ with_sum_func= with_sum_func || args[1]->with_sum_func;
+ const_item_cache= const_item_cache && args[1]->const_item();
+ }
return 0;
}
@@ -1489,15 +1497,17 @@ bool Item_in_optimizer::fix_left(THD *thd, Item **ref)
bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
{
DBUG_ASSERT(fixed == 0);
- if (fix_left(thd, ref))
+ if (fix_left(thd))
return TRUE;
if (args[0]->maybe_null)
maybe_null=1;
if (!args[1]->fixed && args[1]->fix_fields(thd, args+1))
return TRUE;
+
Item_in_subselect * sub= (Item_in_subselect *)args[1];
- if (args[0]->cols() != sub->engine->cols())
+ if (!invisible_mode() &&
+ args[0]->cols() != sub->engine->cols())
{
my_error(ER_OPERAND_COLUMNS, MYF(0), args[0]->cols());
return TRUE;
@@ -1513,6 +1523,30 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref)
return FALSE;
}
+/**
+ Check if Item_in_optimizer should work as a pass-through item for its
+ arguments.
+
+ @note
+ Item_in_optimizer should work as pass-through for
+ - subqueries that were processed by ALL/ANY->MIN/MAX rewrite
+ - subqueries taht were originally EXISTS subqueries (and were coverted by
+ the EXISTS->IN rewrite)
+
+ When Item_in_optimizer is not not working as a pass-through, it
+ - caches its "left argument", args[0].
+ - makes adjustments to subquery item's return value for proper NULL
+ value handling
+*/
+
+bool Item_in_optimizer::invisible_mode()
+{
+ /* MAX/MIN transformed or EXISTS->IN prepared => do nothing */
+ return (args[1]->type() != Item::SUBSELECT_ITEM ||
+ ((Item_subselect *)args[1])->substype() ==
+ Item_subselect::EXISTS_SUBS);
+}
+
/**
Add an expression cache for this subquery if it is needed
@@ -1536,8 +1570,9 @@ Item *Item_in_optimizer::expr_cache_insert_transformer(uchar *thd_arg)
{
THD *thd= (THD*) thd_arg;
DBUG_ENTER("Item_in_optimizer::expr_cache_insert_transformer");
- if (args[1]->type() != Item::SUBSELECT_ITEM)
- DBUG_RETURN(this); // MAX/MIN transformed => do nothing
+
+ if (invisible_mode())
+ DBUG_RETURN(this);
if (expr_cache)
DBUG_RETURN(expr_cache);
@@ -1560,13 +1595,16 @@ Item *Item_in_optimizer::expr_cache_insert_transformer(uchar *thd_arg)
void Item_in_optimizer::get_cache_parameters(List<Item> &parameters)
{
/* Add left expression to the list of the parameters of the subquery */
- if (args[0]->cols() == 1)
- parameters.add_unique(args[0], &cmp_items);
- else
+ if (!invisible_mode())
{
- for (uint i= 0; i < args[0]->cols(); i++)
+ if (args[0]->cols() == 1)
+ parameters.add_unique(args[0], &cmp_items);
+ else
{
- parameters.add_unique(args[0]->element_index(i), &cmp_items);
+ for (uint i= 0; i < args[0]->cols(); i++)
+ {
+ parameters.add_unique(args[0]->element_index(i), &cmp_items);
+ }
}
}
args[1]->get_cache_parameters(parameters);
@@ -1649,17 +1687,19 @@ longlong Item_in_optimizer::val_int()
DBUG_ASSERT(fixed == 1);
cache->store(args[0]);
cache->cache_value();
+ DBUG_ENTER(" Item_in_optimizer::val_int");
- if (args[1]->type() != Item::SUBSELECT_ITEM)
+ if (invisible_mode())
{
- /* MAX/MIN transformed => pass through */
longlong res= args[1]->val_int();
null_value= args[1]->null_value;
- return (res);
+ DBUG_PRINT("info", ("pass trough"));
+ DBUG_RETURN(res);
}
if (cache->null_value)
{
+ DBUG_PRINT("info", ("Left NULL..."));
/*
We're evaluating
"<outer_value_list> [NOT] IN (SELECT <inner_value_list>...)"
@@ -1731,11 +1771,11 @@ longlong Item_in_optimizer::val_int()
for (uint i= 0; i < ncols; i++)
item_subs->set_cond_guard_var(i, TRUE);
}
- return 0;
+ DBUG_RETURN(0);
}
tmp= args[1]->val_bool_result();
null_value= args[1]->null_value;
- return tmp;
+ DBUG_RETURN(tmp);
}
@@ -1786,7 +1826,8 @@ bool Item_in_optimizer::is_null()
@retval NULL if an error occurred
*/
-Item *Item_in_optimizer::transform(Item_transformer transformer, uchar *argument)
+Item *Item_in_optimizer::transform(Item_transformer transformer,
+ uchar *argument)
{
Item *new_item;
@@ -1806,7 +1847,7 @@ Item *Item_in_optimizer::transform(Item_transformer transformer, uchar *argument
if ((*args) != new_item)
current_thd->change_item_tree(args, new_item);
- if (args[1]->type() != Item::SUBSELECT_ITEM)
+ if (invisible_mode())
{
/* MAX/MIN transformed => pass through */
new_item= args[1]->transform(transformer, argument);
@@ -2824,12 +2865,12 @@ Item *Item_func_case::find_item(String *str)
cmp_type= item_cmp_type(left_result_type, args[i]->cmp_type());
DBUG_ASSERT(cmp_type != ROW_RESULT);
DBUG_ASSERT(cmp_items[(uint)cmp_type]);
- if (!(value_added_map & (1<<(uint)cmp_type)))
+ if (!(value_added_map & (1U << (uint)cmp_type)))
{
cmp_items[(uint)cmp_type]->store_value(args[first_expr_num]);
if ((null_value=args[first_expr_num]->null_value))
return else_expr_num != -1 ? args[else_expr_num] : 0;
- value_added_map|= 1<<(uint)cmp_type;
+ value_added_map|= 1U << (uint)cmp_type;
}
if (!cmp_items[(uint)cmp_type]->cmp(args[i]) && !args[i]->null_value)
return args[i + 1];
@@ -3036,10 +3077,10 @@ void Item_func_case::fix_length_and_dec()
return;
Item *date_arg= 0;
- if (found_types & (1 << TIME_RESULT))
+ if (found_types & (1U << TIME_RESULT))
date_arg= find_date_time_item(args, arg_count, 0);
- if (found_types & (1 << STRING_RESULT))
+ if (found_types & (1U << STRING_RESULT))
{
/*
If we'll do string comparison, we also need to aggregate
@@ -3080,7 +3121,7 @@ void Item_func_case::fix_length_and_dec()
for (i= 0; i <= (uint)TIME_RESULT; i++)
{
- if (found_types & (1 << i) && !cmp_items[i])
+ if (found_types & (1U << i) && !cmp_items[i])
{
DBUG_ASSERT((Item_result)i != ROW_RESULT);
@@ -3936,7 +3977,7 @@ void Item_func_in::fix_length_and_dec()
}
for (i= 0; i <= (uint)TIME_RESULT; i++)
{
- if (found_types & 1 << i)
+ if (found_types & (1U << i))
{
(type_cnt)++;
cmp_type= (Item_result) i;
@@ -4063,14 +4104,14 @@ void Item_func_in::fix_length_and_dec()
}
else
{
- if (found_types & (1 << TIME_RESULT))
+ if (found_types & (1U << TIME_RESULT))
date_arg= find_date_time_item(args, arg_count, 0);
- if (found_types & (1 << STRING_RESULT) &&
+ if (found_types & (1U << STRING_RESULT) &&
agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
return;
for (i= 0; i <= (uint) TIME_RESULT; i++)
{
- if (found_types & (1 << i) && !cmp_items[i])
+ if (found_types & (1U << i) && !cmp_items[i])
{
if (!cmp_items[i] && !(cmp_items[i]=
cmp_item::get_comparator((Item_result)i, date_arg,
@@ -4156,12 +4197,12 @@ longlong Item_func_in::val_int()
Item_result cmp_type= item_cmp_type(left_result_type, args[i]->cmp_type());
in_item= cmp_items[(uint)cmp_type];
DBUG_ASSERT(in_item);
- if (!(value_added_map & (1 << (uint)cmp_type)))
+ if (!(value_added_map & (1U << (uint)cmp_type)))
{
in_item->store_value(args[0]);
if ((null_value= args[0]->null_value))
return 0;
- value_added_map|= 1 << (uint)cmp_type;
+ value_added_map|= 1U << (uint)cmp_type;
}
if (!in_item->cmp(args[i]) && !args[i]->null_value)
return (longlong) (!negated);
@@ -5350,6 +5391,7 @@ Item *Item_func_not::neg_transformer(THD *thd) /* NOT(x) -> x */
bool Item_func_not::fix_fields(THD *thd, Item **ref)
{
+ args[0]->under_not(this);
if (args[0]->type() == FIELD_ITEM)
{
/* replace "NOT <field>" with "<filed> == 0" */
@@ -5533,6 +5575,7 @@ Item_equal::Item_equal(Item *f1, Item *f2, bool with_const_item)
equal_items.push_back(f1);
equal_items.push_back(f2);
compare_as_dates= with_const_item && f2->cmp_type() == TIME_RESULT;
+ upper_levels= NULL;
}
@@ -5561,10 +5604,11 @@ Item_equal::Item_equal(Item_equal *item_equal)
with_const= item_equal->with_const;
compare_as_dates= item_equal->compare_as_dates;
cond_false= item_equal->cond_false;
+ upper_levels= item_equal->upper_levels;
}
-/*
+/**
@brief
Add a constant item to the Item_equal object
@@ -5618,6 +5662,7 @@ void Item_equal::add_const(Item *c, Item *f)
const_item_cache= 1;
}
+
/**
@brief
Check whether a field is referred to in the multiple equality
@@ -5686,6 +5731,87 @@ void Item_equal::merge(Item_equal *item)
/**
@brief
+ Merge members of another Item_equal object into this one
+
+ @param item multiple equality whose members are to be merged
+
+ @details
+ If the Item_equal 'item' happened to have some elements of the list
+ of equal items belonging to 'this' object then the function merges
+ the equal items from 'item' into this list.
+ If both lists contains constants and they are different then
+ the value of the cond_false flag is set to TRUE.
+
+ @retval
+ 1 the lists of equal items in 'item' and 'this' contain common elements
+ @retval
+ 0 otherwise
+
+ @notes
+ The method 'merge' just joins the list of equal items belonging to 'item'
+ to the list of equal items belonging to this object assuming that the lists
+ are disjoint. It would be more correct to call the method 'join'.
+ The method 'merge_with_check' really merges two lists of equal items if they
+ have common members.
+*/
+
+bool Item_equal::merge_with_check(Item_equal *item)
+{
+ bool intersected= FALSE;
+ Item_equal_fields_iterator_slow fi(*this);
+ while (fi++)
+ {
+ if (item->contains(fi.get_curr_field()))
+ {
+ fi.remove();
+ intersected= TRUE;
+ }
+ }
+ if (intersected)
+ item->merge(this);
+ return intersected;
+}
+
+
+/**
+ @brief
+ Merge this object into a list of Item_equal objects
+
+ @param list the list of Item_equal objects to merge into
+
+ @details
+ If the list of equal items from 'this' object contains common members
+ with the lists of equal items belonging to Item_equal objects from 'list'
+ then all involved Item_equal objects e1,...,ek are merged into one
+ Item equal that replaces e1,...,ek in the 'list'. Otherwise this
+ Item_equal is joined to the 'list'.
+*/
+
+void Item_equal::merge_into_list(List<Item_equal> *list)
+{
+ Item_equal *item;
+ List_iterator<Item_equal> it(*list);
+ Item_equal *merge_into= NULL;
+ while((item= it++))
+ {
+ if (!merge_into)
+ {
+ if (merge_with_check(item))
+ merge_into= item;
+ }
+ else
+ {
+ if (item->merge_with_check(merge_into))
+ it.remove();
+ }
+ }
+ if (!merge_into)
+ list->push_back(this);
+}
+
+
+/**
+ @brief
Order equal items of the multiple equality according to a sorting criteria
@param compare function to compare items from the equal_items list
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index afb7bf005bb..4ca31e01df9 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -246,12 +246,12 @@ protected:
*/
int result_for_null_param;
public:
- Item_in_optimizer(Item *a, Item_in_subselect *b):
- Item_bool_func(a, reinterpret_cast<Item *>(b)), cache(0), expr_cache(0),
+ Item_in_optimizer(Item *a, Item *b):
+ Item_bool_func(a, b), cache(0), expr_cache(0),
save_cache(0), result_for_null_param(UNKNOWN)
{ with_subselect= true; }
bool fix_fields(THD *, Item **);
- bool fix_left(THD *thd, Item **ref);
+ bool fix_left(THD *thd);
table_map not_null_tables() const { return 0; }
bool is_null();
longlong val_int();
@@ -269,6 +269,8 @@ public:
bool is_top_level_item();
bool eval_not_null_tables(uchar *opt_arg);
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
+ bool invisible_mode();
+ void reset_cache() { cache= NULL; }
};
class Comp_creator
@@ -436,8 +438,11 @@ public:
class Item_func_not :public Item_bool_func
{
+ bool abort_on_null;
public:
- Item_func_not(Item *a) :Item_bool_func(a) {}
+ Item_func_not(Item *a) :Item_bool_func(a), abort_on_null(FALSE) {}
+ virtual void top_level_item() { abort_on_null= 1; }
+ bool is_top_level_item() { return abort_on_null; }
longlong val_int();
enum Functype functype() const { return NOT_FUNC; }
const char *func_name() const { return "not"; }
@@ -495,16 +500,13 @@ class Item_func_not_all :public Item_func_not
Item_sum_hybrid *test_sum_item;
Item_maxmin_subselect *test_sub_item;
- bool abort_on_null;
public:
bool show;
Item_func_not_all(Item *a)
- :Item_func_not(a), test_sum_item(0), test_sub_item(0), abort_on_null(0),
+ :Item_func_not(a), test_sum_item(0), test_sub_item(0),
show(0)
{}
- virtual void top_level_item() { abort_on_null= 1; }
- bool is_top_level_item() { return abort_on_null; }
table_map not_null_tables() const { return 0; }
longlong val_int();
enum Functype functype() const { return NOT_ALL_FUNC; }
@@ -550,6 +552,7 @@ public:
- Otherwise, UINT_MAX
*/
uint in_equality_no;
+ virtual uint exists2in_reserved_items() { return 1; };
};
class Item_func_equal :public Item_bool_rowready_func2
@@ -1575,6 +1578,11 @@ public:
DBUG_ASSERT(nlist->elements);
list.prepand(nlist);
}
+ void add_at_end(List<Item> *nlist)
+ {
+ DBUG_ASSERT(nlist->elements);
+ list.concat(nlist);
+ }
bool fix_fields(THD *, Item **ref);
void fix_after_pullout(st_select_lex *new_parent, Item **ref);
@@ -1600,6 +1608,7 @@ public:
bool eval_not_null_tables(uchar *opt_arg);
};
+template <template<class> class LI, class T> class Item_equal_iterator;
/*
The class Item_equal is used to represent conjunctions of equality
@@ -1727,7 +1736,11 @@ class Item_equal: public Item_bool_func
used in the original equality.
*/
Item_field *context_field;
+
public:
+
+ COND_EQUAL *upper_levels; /* multiple equalities of upper and levels */
+
inline Item_equal()
: Item_bool_func(), with_const(FALSE), eval_item(0), cond_false(0),
context_field(NULL)
@@ -1744,6 +1757,8 @@ public:
/** Get number of field items / references to field items in this object */
uint n_field_items() { return equal_items.elements-test(with_const); }
void merge(Item_equal *item);
+ bool merge_with_check(Item_equal *equal_item);
+ void merge_into_list(List<Item_equal> *list);
void update_const();
enum Functype functype() const { return MULT_EQUAL_FUNC; }
longlong val_int();
@@ -1759,7 +1774,8 @@ public:
CHARSET_INFO *compare_collation();
void set_context_field(Item_field *ctx_field) { context_field= ctx_field; }
- friend class Item_equal_fields_iterator;
+ friend class Item_equal_iterator<List_iterator_fast,Item>;
+ friend class Item_equal_iterator<List_iterator,Item>;
friend Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
Item_equal *item_equal);
friend bool setup_sj_materialization_part1(struct st_join_table *tab);
@@ -1778,43 +1794,55 @@ public:
{
upper_levels= 0;
}
+ void copy(COND_EQUAL &cond_equal)
+ {
+ max_members= cond_equal.max_members;
+ upper_levels= cond_equal.upper_levels;
+ if (cond_equal.current_level.is_empty())
+ current_level.empty();
+ else
+ current_level= cond_equal.current_level;
+ }
};
/*
- The class Item_equal_fields_iterator is used to iterate over references
- to table/view columns from a list of equal items.
+ The template Item_equal_iterator is used to define classes
+ Item_equal_fields_iterator and Item_equal_fields_iterator_slow.
+ These are helper classes for the class Item equal
+ Both classes are used to iterate over references to table/view columns
+ from the list of equal items that included in an Item_equal object.
+ The second class supports the operation of removal of the current member
+ from the list when performing an iteration.
*/
-class Item_equal_fields_iterator : public List_iterator_fast<Item>
+template <template<class> class LI, typename T> class Item_equal_iterator
+ : public LI<T>
{
+protected:
Item_equal *item_equal;
Item *curr_item;
public:
- Item_equal_fields_iterator(Item_equal &item_eq)
- :List_iterator_fast<Item> (item_eq.equal_items)
+ Item_equal_iterator<LI,T>(Item_equal &item_eq)
+ :LI<T> (item_eq.equal_items)
{
curr_item= NULL;
item_equal= &item_eq;
if (item_eq.with_const)
{
- List_iterator_fast<Item> *list_it= this;
+ LI<T> *list_it= this;
curr_item= (*list_it)++;
}
}
Item* operator++(int)
{
- List_iterator_fast<Item> *list_it= this;
+ LI<T> *list_it= this;
curr_item= (*list_it)++;
return curr_item;
}
- Item ** ref()
- {
- return List_iterator_fast<Item>::ref();
- }
void rewind(void)
{
- List_iterator_fast<Item> *list_it= this;
+ LI<T> *list_it= this;
list_it->rewind();
if (item_equal->with_const)
curr_item= (*list_it)++;
@@ -1826,6 +1854,36 @@ public:
}
};
+typedef Item_equal_iterator<List_iterator_fast,Item > Item_equal_iterator_fast;
+
+class Item_equal_fields_iterator
+ :public Item_equal_iterator_fast
+{
+public:
+ Item_equal_fields_iterator(Item_equal &item_eq)
+ :Item_equal_iterator_fast(item_eq)
+ { }
+ Item ** ref()
+ {
+ return List_iterator_fast<Item>::ref();
+ }
+};
+
+typedef Item_equal_iterator<List_iterator,Item > Item_equal_iterator_iterator_slow;
+
+class Item_equal_fields_iterator_slow
+ :public Item_equal_iterator_iterator_slow
+{
+public:
+ Item_equal_fields_iterator_slow(Item_equal &item_eq)
+ :Item_equal_iterator_iterator_slow(item_eq)
+ { }
+ void remove()
+ {
+ List_iterator<Item>::remove();
+ }
+};
+
class Item_cond_and :public Item_cond
{
@@ -1851,6 +1909,7 @@ public:
}
Item *neg_transformer(THD *thd);
void mark_as_condition_AND_part(TABLE_LIST *embedding);
+ virtual uint exists2in_reserved_items() { return list.elements; };
};
inline bool is_cond_and(Item *item)
diff --git a/sql/item_create.cc b/sql/item_create.cc
index fc31b074055..ba6eb7ff603 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -4453,8 +4453,7 @@ Create_func_make_set::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- Item *param_1= item_list->pop();
- return new (thd->mem_root) Item_func_make_set(param_1, *item_list);
+ return new (thd->mem_root) Item_func_make_set(*item_list);
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index ed457adcff9..4df7638370a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -769,13 +769,14 @@ void Item_num_op::find_num_type(void)
{
hybrid_type= DECIMAL_RESULT;
result_precision();
+ fix_decimals();
}
else
{
DBUG_ASSERT(r0 == INT_RESULT && r1 == INT_RESULT);
- decimals= 0;
hybrid_type=INT_RESULT;
result_precision();
+ decimals= 0;
}
DBUG_PRINT("info", ("Type: %s",
(hybrid_type == REAL_RESULT ? "REAL_RESULT" :
@@ -1706,6 +1707,7 @@ void Item_func_div::fix_length_and_dec()
break;
case DECIMAL_RESULT:
result_precision();
+ fix_decimals();
break;
case STRING_RESULT:
case ROW_RESULT:
@@ -1905,6 +1907,16 @@ longlong Item_func_neg::int_op()
if (args[0]->unsigned_flag &&
(ulonglong) value > (ulonglong) LONGLONG_MAX + 1)
return raise_integer_overflow();
+
+ if (value == LONGLONG_MIN)
+ {
+ if (args[0]->unsigned_flag != unsigned_flag)
+ /* negation of LONGLONG_MIN is LONGLONG_MIN. */
+ return LONGLONG_MIN;
+ else
+ return raise_integer_overflow();
+ }
+
return check_integer_overflow(-value, !args[0]->unsigned_flag && value < 0);
}
@@ -2201,7 +2213,7 @@ longlong Item_func_shift_left::val_int()
return 0;
}
null_value=0;
- return (shift < sizeof(longlong)*8 ? (longlong) res : LL(0));
+ return (shift < sizeof(longlong)*8 ? (longlong) res : 0);
}
longlong Item_func_shift_right::val_int()
@@ -2216,7 +2228,7 @@ longlong Item_func_shift_right::val_int()
return 0;
}
null_value=0;
- return (shift < sizeof(longlong)*8 ? (longlong) res : LL(0));
+ return (shift < sizeof(longlong)*8 ? (longlong) res : 0);
}
@@ -3149,7 +3161,7 @@ void Item_func_find_in_set::fix_length_and_dec()
find->length(), 0);
enum_bit=0;
if (enum_value)
- enum_bit=LL(1) << (enum_value-1);
+ enum_bit=1LL << (enum_value-1);
}
}
}
@@ -3230,7 +3242,7 @@ longlong Item_func_find_in_set::val_int()
wc == (my_wc_t) separator)
return (longlong) ++position;
else
- return LL(0);
+ return 0;
}
}
return 0;
@@ -3736,120 +3748,6 @@ udf_handler::~udf_handler()
bool udf_handler::get_arguments() { return 0; }
#endif /* HAVE_DLOPEN */
-/*
-** User level locks
-*/
-
-mysql_mutex_t LOCK_user_locks;
-static HASH hash_user_locks;
-
-class User_level_lock
-{
- uchar *key;
- size_t key_length;
-
-public:
- int count;
- bool locked;
- mysql_cond_t cond;
- my_thread_id thread_id;
- void set_thread(THD *thd) { thread_id= thd->thread_id; }
-
- User_level_lock(const uchar *key_arg,uint length, ulong id)
- :key_length(length),count(1),locked(1), thread_id(id)
- {
- key= (uchar*) my_memdup(key_arg,length,MYF(0));
- mysql_cond_init(key_user_level_lock_cond, &cond, NULL);
- if (key)
- {
- if (my_hash_insert(&hash_user_locks,(uchar*) this))
- {
- my_free(key);
- key=0;
- }
- }
- }
- ~User_level_lock()
- {
- if (key)
- {
- my_hash_delete(&hash_user_locks,(uchar*) this);
- my_free(key);
- }
- mysql_cond_destroy(&cond);
- }
- inline bool initialized() { return key != 0; }
- friend void item_user_lock_release(User_level_lock *ull);
- friend uchar *ull_get_key(const User_level_lock *ull, size_t *length,
- my_bool not_used);
-};
-
-uchar *ull_get_key(const User_level_lock *ull, size_t *length,
- my_bool not_used __attribute__((unused)))
-{
- *length= ull->key_length;
- return ull->key;
-}
-
-#ifdef HAVE_PSI_INTERFACE
-static PSI_mutex_key key_LOCK_user_locks;
-
-static PSI_mutex_info all_user_mutexes[]=
-{
- { &key_LOCK_user_locks, "LOCK_user_locks", PSI_FLAG_GLOBAL}
-};
-
-static void init_user_lock_psi_keys(void)
-{
- const char* category= "sql";
- int count;
-
- if (PSI_server == NULL)
- return;
-
- count= array_elements(all_user_mutexes);
- PSI_server->register_mutex(category, all_user_mutexes, count);
-}
-#endif
-
-static bool item_user_lock_inited= 0;
-
-void item_user_lock_init(void)
-{
-#ifdef HAVE_PSI_INTERFACE
- init_user_lock_psi_keys();
-#endif
-
- mysql_mutex_init(key_LOCK_user_locks, &LOCK_user_locks, MY_MUTEX_INIT_SLOW);
- my_hash_init(&hash_user_locks,system_charset_info,
- 16,0,0,(my_hash_get_key) ull_get_key,NULL,0);
- item_user_lock_inited= 1;
-}
-
-void item_user_lock_free(void)
-{
- if (item_user_lock_inited)
- {
- item_user_lock_inited= 0;
- my_hash_free(&hash_user_locks);
- mysql_mutex_destroy(&LOCK_user_locks);
- }
-}
-
-void item_user_lock_release(User_level_lock *ull)
-{
- ull->locked=0;
- ull->thread_id= 0;
- if (--ull->count)
- mysql_cond_signal(&ull->cond);
- else
- delete ull;
-}
-
-/**
- Wait until we are at or past the given position in the master binlog
- on the slave.
-*/
longlong Item_master_pos_wait::val_int()
{
@@ -3951,7 +3849,7 @@ class Interruptible_wait
/** Time to wait before polling the connection status. */
-const ulonglong Interruptible_wait::m_interrupt_interval= 5 * ULL(1000000000);
+const ulonglong Interruptible_wait::m_interrupt_interval= 5 * 1000000000ULL;
/**
@@ -3996,7 +3894,136 @@ int Interruptible_wait::wait(mysql_cond_t *cond, mysql_mutex_t *mutex)
/**
- Get a user level lock. If the thread has an old lock this is first released.
+ For locks with EXPLICIT duration, MDL returns a new ticket
+ every time a lock is granted. This allows to implement recursive
+ locks without extra allocation or additional data structures, such
+ as below. However, if there are too many tickets in the same
+ MDL_context, MDL_context::find_ticket() is getting too slow,
+ since it's using a linear search.
+ This is why a separate structure is allocated for a user
+ level lock, and before requesting a new lock from MDL,
+ GET_LOCK() checks thd->ull_hash if such lock is already granted,
+ and if so, simply increments a reference counter.
+*/
+
+class User_level_lock
+{
+public:
+ MDL_ticket *lock;
+ int refs;
+};
+
+
+/** Extract a hash key from User_level_lock. */
+
+uchar *ull_get_key(const uchar *ptr, size_t *length,
+ my_bool not_used __attribute__((unused)))
+{
+ User_level_lock *ull = (User_level_lock*) ptr;
+ MDL_key *key = ull->lock->get_key();
+ *length= key->length();
+ return (uchar*) key->ptr();
+}
+
+
+/**
+ Release all user level locks for this THD.
+*/
+
+void mysql_ull_cleanup(THD *thd)
+{
+ User_level_lock *ull;
+ DBUG_ENTER("mysql_ull_cleanup");
+
+ for (uint i= 0; i < thd->ull_hash.records; i++)
+ {
+ ull = (User_level_lock*) my_hash_element(&thd->ull_hash, i);
+ thd->mdl_context.release_lock(ull->lock);
+ my_free(ull);
+ }
+
+ my_hash_free(&thd->ull_hash);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ Set explicit duration for metadata locks corresponding to
+ user level locks to protect them from being released at the end
+ of transaction.
+*/
+
+void mysql_ull_set_explicit_lock_duration(THD *thd)
+{
+ User_level_lock *ull;
+ DBUG_ENTER("mysql_ull_set_explicit_lock_duration");
+
+ for (uint i= 0; i < thd->ull_hash.records; i++)
+ {
+ ull= (User_level_lock*) my_hash_element(&thd->ull_hash, i);
+ thd->mdl_context.set_lock_duration(ull->lock, MDL_EXPLICIT);
+ }
+ DBUG_VOID_RETURN;
+}
+
+
+/**
+ When MDL detects a lock wait timeout, it pushes
+ an error into the statement diagnostics area.
+ For GET_LOCK(), lock wait timeout is not an error,
+ but a special return value (0). NULL is returned in
+ case of error.
+ Capture and suppress lock wait timeout.
+*/
+
+class Lock_wait_timeout_handler: public Internal_error_handler
+{
+public:
+ Lock_wait_timeout_handler() :m_lock_wait_timeout(false) {}
+
+ bool m_lock_wait_timeout;
+
+ bool handle_condition(THD * /* thd */, uint sql_errno,
+ const char * /* sqlstate */,
+ MYSQL_ERROR::enum_warning_level /* level */,
+ const char *message,
+ MYSQL_ERROR ** /* cond_hdl */);
+};
+
+bool
+Lock_wait_timeout_handler::
+handle_condition(THD * /* thd */, uint sql_errno,
+ const char * /* sqlstate */,
+ MYSQL_ERROR::enum_warning_level /* level */,
+ const char *message,
+ MYSQL_ERROR ** /* cond_hdl */)
+{
+ if (sql_errno == ER_LOCK_WAIT_TIMEOUT)
+ {
+ m_lock_wait_timeout= true;
+ return true; /* condition handled */
+ }
+ return false;
+}
+
+
+static int ull_name_ok(String *name)
+{
+ if (!name || !name->length())
+ return 0;
+
+ if (name->length() > NAME_LEN)
+ {
+ my_error(ER_TOO_LONG_IDENT, MYF(0), name->c_ptr_safe());
+ return 0;
+ }
+ return 1;
+}
+
+
+/**
+ Get a user level lock.
@retval
1 : Got lock
@@ -4009,14 +4036,13 @@ int Interruptible_wait::wait(mysql_cond_t *cond, mysql_mutex_t *mutex)
longlong Item_func_get_lock::val_int()
{
DBUG_ASSERT(fixed == 1);
- String *res=args[0]->val_str(&value);
+ String *res= args[0]->val_str(&value);
ulonglong timeout= args[1]->val_int();
- THD *thd=current_thd;
+ THD *thd= current_thd;
User_level_lock *ull;
- int error;
- Interruptible_wait timed_cond(thd);
DBUG_ENTER("Item_func_get_lock::val_int");
+ null_value= 1;
/*
In slave thread no need to get locks, everything is serialized. Anyway
there is no way to make GET_LOCK() work on slave like it did on master
@@ -4025,103 +4051,70 @@ longlong Item_func_get_lock::val_int()
it's not guaranteed to be same as on master.
*/
if (thd->slave_thread)
+ {
+ null_value= 0;
DBUG_RETURN(1);
+ }
- mysql_mutex_lock(&LOCK_user_locks);
-
- if (!res || !res->length())
- {
- mysql_mutex_unlock(&LOCK_user_locks);
- null_value=1;
+ if (!ull_name_ok(res))
DBUG_RETURN(0);
- }
+
DBUG_PRINT("info", ("lock %.*s, thd=%ld", res->length(), res->ptr(),
(long) thd->real_id));
- null_value=0;
-
- if (thd->ull)
+ /* HASH entries are of type User_level_lock. */
+ if (! my_hash_inited(&thd->ull_hash) &&
+ my_hash_init(&thd->ull_hash, &my_charset_bin,
+ 16 /* small hash */, 0, 0, ull_get_key, NULL, 0))
{
- item_user_lock_release(thd->ull);
- thd->ull=0;
- }
-
- if (!(ull= ((User_level_lock *) my_hash_search(&hash_user_locks,
- (uchar*) res->ptr(),
- (size_t) res->length()))))
- {
- ull= new User_level_lock((uchar*) res->ptr(), (size_t) res->length(),
- thd->thread_id);
- if (!ull || !ull->initialized())
- {
- delete ull;
- mysql_mutex_unlock(&LOCK_user_locks);
- null_value=1; // Probably out of memory
- DBUG_RETURN(0);
- }
- ull->set_thread(thd);
- thd->ull=ull;
- mysql_mutex_unlock(&LOCK_user_locks);
- DBUG_PRINT("info", ("made new lock"));
- DBUG_RETURN(1); // Got new lock
+ DBUG_RETURN(0);
}
- ull->count++;
- DBUG_PRINT("info", ("ull->count=%d", ull->count));
- /*
- Structure is now initialized. Try to get the lock.
- Set up control struct to allow others to abort locks.
- */
- THD_STAGE_INFO(thd, stage_user_lock);
- thd->mysys_var->current_mutex= &LOCK_user_locks;
- thd->mysys_var->current_cond= &ull->cond;
+ MDL_request ull_request;
+ ull_request.init(MDL_key::USER_LOCK, res->c_ptr_safe(), "",
+ MDL_SHARED_NO_WRITE, MDL_EXPLICIT);
+ MDL_key *ull_key = &ull_request.key;
- timed_cond.set_timeout(timeout * ULL(1000000000));
- error= 0;
- thd_wait_begin(thd, THD_WAIT_USER_LOCK);
- while (ull->locked && !thd->killed)
+ if ((ull= (User_level_lock*)
+ my_hash_search(&thd->ull_hash, ull_key->ptr(), ull_key->length())))
{
- DBUG_PRINT("info", ("waiting on lock"));
- error= timed_cond.wait(&ull->cond, &LOCK_user_locks);
- if (error == ETIMEDOUT || error == ETIME)
- {
- DBUG_PRINT("info", ("lock wait timeout"));
- break;
- }
- error= 0;
+ /* Recursive lock */
+ ull->refs++;
+ null_value = 0;
+ DBUG_RETURN(1);
}
- thd_wait_end(thd);
- if (ull->locked)
+ Lock_wait_timeout_handler lock_wait_timeout_handler;
+ thd->push_internal_handler(&lock_wait_timeout_handler);
+ bool error= thd->mdl_context.acquire_lock(&ull_request, timeout);
+ (void) thd->pop_internal_handler();
+ if (error)
{
- if (!--ull->count)
- {
- DBUG_ASSERT(0);
- delete ull; // Should never happen
- }
- if (!error) // Killed (thd->killed != 0)
- {
- error=1;
- null_value=1; // Return NULL
- }
+ if (lock_wait_timeout_handler.m_lock_wait_timeout)
+ null_value= 0;
+ DBUG_RETURN(0);
}
- else // We got the lock
+
+ ull= (User_level_lock*) my_malloc(sizeof(User_level_lock),
+ MYF(MY_WME|MY_THREAD_SPECIFIC));
+ if (ull == NULL)
{
- ull->locked=1;
- ull->set_thread(thd);
- ull->thread_id= thd->thread_id;
- thd->ull=ull;
- error=0;
- DBUG_PRINT("info", ("got the lock"));
+ thd->mdl_context.release_lock(ull_request.ticket);
+ DBUG_RETURN(0);
}
- mysql_mutex_unlock(&LOCK_user_locks);
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd->mysys_var->current_mutex= 0;
- thd->mysys_var->current_cond= 0;
- mysql_mutex_unlock(&thd->mysys_var->mutex);
+ ull->lock= ull_request.ticket;
+ ull->refs= 1;
+
+ if (my_hash_insert(&thd->ull_hash, (uchar*) ull))
+ {
+ thd->mdl_context.release_lock(ull->lock);
+ my_free(ull);
+ DBUG_RETURN(0);
+ }
+ null_value= 0;
- DBUG_RETURN(!error ? 1 : 0);
+ DBUG_RETURN(1);
}
@@ -4136,43 +4129,86 @@ longlong Item_func_get_lock::val_int()
longlong Item_func_release_lock::val_int()
{
DBUG_ASSERT(fixed == 1);
- String *res=args[0]->val_str(&value);
- User_level_lock *ull;
- longlong result;
- THD *thd=current_thd;
+ String *res= args[0]->val_str(&value);
+ THD *thd= current_thd;
DBUG_ENTER("Item_func_release_lock::val_int");
- if (!res || !res->length())
- {
- null_value=1;
+ null_value= 1;
+
+ if (!ull_name_ok(res))
DBUG_RETURN(0);
- }
+
DBUG_PRINT("info", ("lock %.*s", res->length(), res->ptr()));
- null_value=0;
- result=0;
- mysql_mutex_lock(&LOCK_user_locks);
- if (!(ull= ((User_level_lock*) my_hash_search(&hash_user_locks,
- (const uchar*) res->ptr(),
- (size_t) res->length()))))
+ MDL_key ull_key;
+ ull_key.mdl_key_init(MDL_key::USER_LOCK, res->c_ptr_safe(), "");
+
+ User_level_lock *ull;
+
+ if (!(ull=
+ (User_level_lock*) my_hash_search(&thd->ull_hash,
+ ull_key.ptr(), ull_key.length())))
{
- null_value=1;
+ null_value= thd->mdl_context.get_lock_owner(&ull_key) == 0;
+ DBUG_RETURN(0);
}
- else
+ null_value= 0;
+ if (--ull->refs == 0)
{
- DBUG_PRINT("info", ("ull->locked=%d ull->thread=%lu thd=%lu",
- (int) ull->locked,
- (long)ull->thread_id,
- (long)thd->thread_id));
- if (ull->locked && current_thd->thread_id == ull->thread_id)
- {
- DBUG_PRINT("info", ("release lock"));
- result=1; // Release is ok
- item_user_lock_release(ull);
- thd->ull=0;
- }
+ my_hash_delete(&thd->ull_hash, (uchar*) ull);
+ thd->mdl_context.release_lock(ull->lock);
+ my_free(ull);
}
- mysql_mutex_unlock(&LOCK_user_locks);
- DBUG_RETURN(result);
+ DBUG_RETURN(1);
+}
+
+
+/**
+ Check a user level lock.
+
+ Sets null_value=TRUE on error.
+
+ @retval
+ 1 Available
+ @retval
+ 0 Already taken, or error
+*/
+
+longlong Item_func_is_free_lock::val_int()
+{
+ DBUG_ASSERT(fixed == 1);
+ String *res= args[0]->val_str(&value);
+ THD *thd= current_thd;
+ null_value= 1;
+
+ if (!ull_name_ok(res))
+ return 0;
+
+ MDL_key ull_key;
+ ull_key.mdl_key_init(MDL_key::USER_LOCK, res->c_ptr_safe(), "");
+
+ null_value= 0;
+ return thd->mdl_context.get_lock_owner(&ull_key) == 0;
+}
+
+
+longlong Item_func_is_used_lock::val_int()
+{
+ DBUG_ASSERT(fixed == 1);
+ String *res= args[0]->val_str(&value);
+ THD *thd= current_thd;
+ null_value= 1;
+
+ if (!ull_name_ok(res))
+ return 0;
+
+ MDL_key ull_key;
+ ull_key.mdl_key_init(MDL_key::USER_LOCK, res->c_ptr_safe(), "");
+ ulong thread_id = thd->mdl_context.get_lock_owner(&ull_key);
+ if (thread_id == 0)
+ return 0;
+
+ null_value= 0;
+ return thread_id;
}
@@ -4273,6 +4309,54 @@ void Item_func_benchmark::print(String *str, enum_query_type query_type)
}
+mysql_mutex_t LOCK_item_func_sleep;
+
+#ifdef HAVE_PSI_INTERFACE
+static PSI_mutex_key key_LOCK_item_func_sleep;
+
+static PSI_mutex_info item_func_sleep_mutexes[]=
+{
+ { &key_LOCK_item_func_sleep, "LOCK_user_locks", PSI_FLAG_GLOBAL}
+};
+
+
+static void init_item_func_sleep_psi_keys(void)
+{
+ const char* category= "sql";
+ int count;
+
+ if (PSI_server == NULL)
+ return;
+
+ count= array_elements(item_func_sleep_mutexes);
+ PSI_server->register_mutex(category, item_func_sleep_mutexes, count);
+}
+#endif
+
+static bool item_func_sleep_inited= 0;
+
+
+void item_func_sleep_init(void)
+{
+#ifdef HAVE_PSI_INTERFACE
+ init_item_func_sleep_psi_keys();
+#endif
+
+ mysql_mutex_init(key_LOCK_item_func_sleep, &LOCK_item_func_sleep, MY_MUTEX_INIT_SLOW);
+ item_func_sleep_inited= 1;
+}
+
+
+void item_func_sleep_free(void)
+{
+ if (item_func_sleep_inited)
+ {
+ item_func_sleep_inited= 0;
+ mysql_mutex_destroy(&LOCK_item_func_sleep);
+ }
+}
+
+
/** This function is just used to create tests with time gaps. */
longlong Item_func_sleep::val_int()
@@ -4301,23 +4385,23 @@ longlong Item_func_sleep::val_int()
timed_cond.set_timeout((ulonglong) (timeout * 1000000000.0));
mysql_cond_init(key_item_func_sleep_cond, &cond, NULL);
- mysql_mutex_lock(&LOCK_user_locks);
+ mysql_mutex_lock(&LOCK_item_func_sleep);
THD_STAGE_INFO(thd, stage_user_sleep);
- thd->mysys_var->current_mutex= &LOCK_user_locks;
+ thd->mysys_var->current_mutex= &LOCK_item_func_sleep;
thd->mysys_var->current_cond= &cond;
error= 0;
thd_wait_begin(thd, THD_WAIT_SLEEP);
while (!thd->killed)
{
- error= timed_cond.wait(&cond, &LOCK_user_locks);
+ error= timed_cond.wait(&cond, &LOCK_item_func_sleep);
if (error == ETIMEDOUT || error == ETIME)
break;
error= 0;
}
thd_wait_end(thd);
- mysql_mutex_unlock(&LOCK_user_locks);
+ mysql_mutex_unlock(&LOCK_item_func_sleep);
mysql_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
thd->mysys_var->current_cond= 0;
@@ -4653,7 +4737,7 @@ double user_var_entry::val_real(bool *null_value)
longlong user_var_entry::val_int(bool *null_value) const
{
if ((*null_value= (value == 0)))
- return LL(0);
+ return 0;
switch (type) {
case REAL_RESULT:
@@ -4677,7 +4761,7 @@ longlong user_var_entry::val_int(bool *null_value) const
DBUG_ASSERT(0); // Impossible
break;
}
- return LL(0); // Impossible
+ return 0; // Impossible
}
@@ -4815,7 +4899,7 @@ void Item_func_set_user_var::save_item_result(Item *item)
{
DBUG_ENTER("Item_func_set_user_var::save_item_result");
- switch (cached_result_type) {
+ switch (args[0]->result_type()) {
case REAL_RESULT:
save_result.vreal= item->val_result();
break;
@@ -5170,7 +5254,7 @@ longlong Item_func_get_user_var::val_int()
{
DBUG_ASSERT(fixed == 1);
if (!var_entry)
- return LL(0); // No such variable
+ return 0; // No such variable
return (var_entry->val_int(&null_value));
}
@@ -5652,24 +5736,6 @@ enum_field_types Item_func_get_system_var::field_type() const
}
-/*
- Uses var, var_type, component, cache_present, used_query_id, thd,
- cached_llval, null_value, cached_null_value
-*/
-#define get_sys_var_safe(type) \
-do { \
- type value; \
- mysql_mutex_lock(&LOCK_global_system_variables); \
- value= *(type*) var->value_ptr(thd, var_type, &component); \
- mysql_mutex_unlock(&LOCK_global_system_variables); \
- cache_present |= GET_SYS_VAR_CACHE_LONG; \
- used_query_id= thd->query_id; \
- cached_llval= null_value ? 0 : (longlong) value; \
- cached_null_value= null_value; \
- return cached_llval; \
-} while (0)
-
-
longlong Item_func_get_system_var::val_int()
{
THD *thd= current_thd;
@@ -5703,51 +5769,11 @@ longlong Item_func_get_system_var::val_int()
}
}
- switch (var->show_type())
- {
- case SHOW_SINT: get_sys_var_safe (int);
- case SHOW_SLONG: get_sys_var_safe (long);
- case SHOW_SLONGLONG:get_sys_var_safe (longlong);
- case SHOW_UINT: get_sys_var_safe (uint);
- case SHOW_ULONG: get_sys_var_safe (ulong);
- case SHOW_ULONGLONG:get_sys_var_safe (ulonglong);
- case SHOW_HA_ROWS: get_sys_var_safe (ha_rows);
- case SHOW_BOOL: get_sys_var_safe (bool);
- case SHOW_MY_BOOL: get_sys_var_safe (my_bool);
- case SHOW_DOUBLE:
- {
- double dval= val_real();
-
- used_query_id= thd->query_id;
- cached_llval= (longlong) dval;
- cache_present|= GET_SYS_VAR_CACHE_LONG;
- return cached_llval;
- }
- case SHOW_CHAR:
- case SHOW_CHAR_PTR:
- case SHOW_LEX_STRING:
- {
- String *str_val= val_str(NULL);
-
- if (str_val && str_val->length())
- cached_llval= longlong_from_string_with_check (system_charset_info,
- str_val->c_ptr(),
- str_val->c_ptr() +
- str_val->length());
- else
- {
- null_value= TRUE;
- cached_llval= 0;
- }
-
- cache_present|= GET_SYS_VAR_CACHE_LONG;
- return cached_llval;
- }
-
- default:
- my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name.str);
- return 0; // keep the compiler happy
- }
+ cached_llval= var->val_int(&null_value, thd, var_type, &component);
+ cache_present |= GET_SYS_VAR_CACHE_LONG;
+ used_query_id= thd->query_id;
+ cached_null_value= null_value;
+ return cached_llval;
}
@@ -5780,61 +5806,10 @@ String* Item_func_get_system_var::val_str(String* str)
}
}
- str= &cached_strval;
- switch (var->show_type())
- {
- case SHOW_CHAR:
- case SHOW_CHAR_PTR:
- case SHOW_LEX_STRING:
- {
- mysql_mutex_lock(&LOCK_global_system_variables);
- char *cptr= var->show_type() == SHOW_CHAR ?
- (char*) var->value_ptr(thd, var_type, &component) :
- *(char**) var->value_ptr(thd, var_type, &component);
- if (cptr)
- {
- size_t len= var->show_type() == SHOW_LEX_STRING ?
- ((LEX_STRING*)(var->value_ptr(thd, var_type, &component)))->length :
- strlen(cptr);
- if (str->copy(cptr, len, collation.collation))
- {
- null_value= TRUE;
- str= NULL;
- }
- }
- else
- {
- null_value= TRUE;
- str= NULL;
- }
- mysql_mutex_unlock(&LOCK_global_system_variables);
- break;
- }
-
- case SHOW_SINT:
- case SHOW_SLONG:
- case SHOW_SLONGLONG:
- case SHOW_UINT:
- case SHOW_ULONG:
- case SHOW_ULONGLONG:
- case SHOW_HA_ROWS:
- case SHOW_BOOL:
- case SHOW_MY_BOOL:
- str->set (val_int(), collation.collation);
- break;
- case SHOW_DOUBLE:
- str->set_real (val_real(), decimals, collation.collation);
- break;
-
- default:
- my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name.str);
- str= NULL;
- break;
- }
-
+ str= var->val_str(&cached_strval, thd, var_type, &component);
cache_present|= GET_SYS_VAR_CACHE_STRING;
used_query_id= thd->query_id;
- cached_null_value= null_value;
+ cached_null_value= null_value= !str;
return str;
}
@@ -5872,58 +5847,11 @@ double Item_func_get_system_var::val_real()
}
}
- switch (var->show_type())
- {
- case SHOW_DOUBLE:
- mysql_mutex_lock(&LOCK_global_system_variables);
- cached_dval= *(double*) var->value_ptr(thd, var_type, &component);
- mysql_mutex_unlock(&LOCK_global_system_variables);
- used_query_id= thd->query_id;
- cached_null_value= null_value;
- if (null_value)
- cached_dval= 0;
- cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
- return cached_dval;
- case SHOW_CHAR:
- case SHOW_LEX_STRING:
- case SHOW_CHAR_PTR:
- {
- mysql_mutex_lock(&LOCK_global_system_variables);
- char *cptr= var->show_type() == SHOW_CHAR ?
- (char*) var->value_ptr(thd, var_type, &component) :
- *(char**) var->value_ptr(thd, var_type, &component);
- if (cptr)
- cached_dval= double_from_string_with_check (system_charset_info,
- cptr, cptr + strlen (cptr));
- else
- {
- null_value= TRUE;
- cached_dval= 0;
- }
- mysql_mutex_unlock(&LOCK_global_system_variables);
- used_query_id= thd->query_id;
- cached_null_value= null_value;
- cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
- return cached_dval;
- }
- case SHOW_SINT:
- case SHOW_SLONG:
- case SHOW_SLONGLONG:
- case SHOW_UINT:
- case SHOW_ULONG:
- case SHOW_ULONGLONG:
- case SHOW_HA_ROWS:
- case SHOW_BOOL:
- case SHOW_MY_BOOL:
- cached_dval= (double) val_int();
- cache_present|= GET_SYS_VAR_CACHE_DOUBLE;
- used_query_id= thd->query_id;
- cached_null_value= null_value;
- return cached_dval;
- default:
- my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name.str);
- return 0;
- }
+ cached_dval= var->val_real(&null_value, thd, var_type, &component);
+ cache_present |= GET_SYS_VAR_CACHE_DOUBLE;
+ used_query_id= thd->query_id;
+ cached_null_value= null_value;
+ return cached_dval;
}
@@ -6009,15 +5937,12 @@ void Item_func_match::init_search(bool no_order)
{
DBUG_ENTER("Item_func_match::init_search");
+ if (!table->file->get_table()) // the handler isn't opened yet
+ DBUG_VOID_RETURN;
+
/* Check if init_search() has been called before */
if (ft_handler)
{
- /*
- We should reset ft_handler as it is cleaned up
- on destruction of FT_SELECT object
- (necessary in case of re-execution of subquery).
- TODO: FT_SELECT should not clean up ft_handler.
- */
if (join_key)
table->file->ft_handler= ft_handler;
DBUG_VOID_RETURN;
@@ -6026,10 +5951,10 @@ void Item_func_match::init_search(bool no_order)
if (key == NO_SUCH_KEY)
{
List<Item> fields;
- fields.push_back(new Item_string(" ",1, cmp_collation.collation));
- for (uint i=1; i < arg_count; i++)
+ fields.push_back(new Item_string(" ", 1, cmp_collation.collation));
+ for (uint i= 1; i < arg_count; i++)
fields.push_back(args[i]);
- concat_ws=new Item_func_concat_ws(fields);
+ concat_ws= new Item_func_concat_ws(fields);
/*
Above function used only to get value and do not need fix_fields for it:
Item_string - basic constant
@@ -6041,10 +5966,10 @@ void Item_func_match::init_search(bool no_order)
if (master)
{
- join_key=master->join_key=join_key|master->join_key;
+ join_key= master->join_key= join_key | master->join_key;
master->init_search(no_order);
- ft_handler=master->ft_handler;
- join_key=master->join_key;
+ ft_handler= master->ft_handler;
+ join_key= master->join_key;
DBUG_VOID_RETURN;
}
@@ -6054,7 +5979,7 @@ void Item_func_match::init_search(bool no_order)
if (!(ft_tmp=key_item()->val_str(&value)))
{
ft_tmp= &value;
- value.set("",0,cmp_collation.collation);
+ value.set("", 0, cmp_collation.collation);
}
if (ft_tmp->charset() != cmp_collation.collation)
@@ -6067,7 +5992,11 @@ void Item_func_match::init_search(bool no_order)
if (join_key && !no_order)
flags|=FT_SORTED;
- ft_handler=table->file->ft_init_ext(flags, key, ft_tmp);
+
+ if (key != NO_SUCH_KEY)
+ THD_STAGE_INFO(table->in_use, stage_fulltext_initialization);
+
+ ft_handler= table->file->ft_init_ext(flags, key, ft_tmp);
if (join_key)
table->file->ft_handler=ft_handler;
@@ -6127,7 +6056,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
table=((Item_field *)item)->field->table;
if (!(table->file->ha_table_flags() & HA_CAN_FULLTEXT))
{
- my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0));
+ my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0), table->file->table_type());
return 1;
}
table->fulltext_searched=1;
@@ -6348,61 +6277,6 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
}
-/**
- Check a user level lock.
-
- Sets null_value=TRUE on error.
-
- @retval
- 1 Available
- @retval
- 0 Already taken, or error
-*/
-
-longlong Item_func_is_free_lock::val_int()
-{
- DBUG_ASSERT(fixed == 1);
- String *res=args[0]->val_str(&value);
- User_level_lock *ull;
-
- null_value=0;
- if (!res || !res->length())
- {
- null_value=1;
- return 0;
- }
-
- mysql_mutex_lock(&LOCK_user_locks);
- ull= (User_level_lock *) my_hash_search(&hash_user_locks, (uchar*) res->ptr(),
- (size_t) res->length());
- mysql_mutex_unlock(&LOCK_user_locks);
- if (!ull || !ull->locked)
- return 1;
- return 0;
-}
-
-longlong Item_func_is_used_lock::val_int()
-{
- DBUG_ASSERT(fixed == 1);
- String *res=args[0]->val_str(&value);
- User_level_lock *ull;
-
- null_value=1;
- if (!res || !res->length())
- return 0;
-
- mysql_mutex_lock(&LOCK_user_locks);
- ull= (User_level_lock *) my_hash_search(&hash_user_locks, (uchar*) res->ptr(),
- (size_t) res->length());
- mysql_mutex_unlock(&LOCK_user_locks);
- if (!ull || !ull->locked)
- return 0;
-
- null_value=0;
- return ull->thread_id;
-}
-
-
longlong Item_func_row_count::val_int()
{
DBUG_ASSERT(fixed == 1);
diff --git a/sql/item_func.h b/sql/item_func.h
index f562c87fe1c..ab6ec706248 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -431,6 +431,13 @@ public:
void fix_num_length_and_dec();
virtual void find_num_type()= 0; /* To be called from fix_length_and_dec */
+ inline void fix_decimals()
+ {
+ DBUG_ASSERT(result_type() == DECIMAL_RESULT);
+ if (decimals == NOT_FIXED_DEC)
+ set_if_smaller(decimals, max_length - 1);
+ }
+
double val_real();
longlong val_int();
my_decimal *val_decimal(my_decimal *);
@@ -1250,6 +1257,9 @@ public:
};
+void item_func_sleep_init(void);
+void item_func_sleep_free(void);
+
class Item_func_sleep :public Item_int_func
{
public:
@@ -1499,14 +1509,8 @@ public:
#endif /* HAVE_DLOPEN */
-/*
-** User level locks
-*/
-
-class User_level_lock;
-void item_user_lock_init(void);
-void item_user_lock_release(User_level_lock *ull);
-void item_user_lock_free(void);
+void mysql_ull_cleanup(THD *thd);
+void mysql_ull_set_explicit_lock_duration(THD *thd);
class Item_func_get_lock :public Item_int_func
{
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index e3e80bdf59f..0a7f18e6546 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -561,8 +561,8 @@ longlong Item_func_spatial_mbr_rel::val_int()
args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
!(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
- g1->get_mbr(&mbr1, &dummy) ||
- g2->get_mbr(&mbr2, &dummy))))
+ g1->get_mbr(&mbr1, &dummy) || !mbr1.valid() ||
+ g2->get_mbr(&mbr2, &dummy) || !mbr2.valid())))
return 0;
switch (spatial_rel) {
@@ -687,12 +687,11 @@ longlong Item_func_spatial_rel::val_int()
if ((null_value=
(args[0]->null_value || args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())))))
+ !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
+ g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() ||
+ g2->get_mbr(&mbr2, &c_end) || !mbr2.valid())))
goto exit;
- g1->get_mbr(&mbr1, &c_end);
- g2->get_mbr(&mbr2, &c_end);
-
umbr= mbr1;
umbr.add_mbr(&mbr2);
collector.set_extent(umbr.xmin, umbr.xmax, umbr.ymin, umbr.ymax);
@@ -826,14 +825,14 @@ String *Item_func_spatial_operation::val_str(String *str_value)
if ((null_value=
(args[0]->null_value || args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())))))
+ !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
+ g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() ||
+ g2->get_mbr(&mbr2, &c_end) || !mbr2.valid())))
{
str_value= 0;
goto exit;
}
- g1->get_mbr(&mbr1, &c_end);
- g2->get_mbr(&mbr2, &c_end);
mbr1.add_mbr(&mbr2);
collector.set_extent(mbr1.xmin, mbr1.xmax, mbr1.ymin, mbr1.ymax);
@@ -1358,11 +1357,11 @@ longlong Item_func_issimple::val_int()
DBUG_ENTER("Item_func_issimple::val_int");
DBUG_ASSERT(fixed == 1);
- if ((null_value= args[0]->null_value) ||
- !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))
+ if ((null_value= (args[0]->null_value ||
+ !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
+ g->get_mbr(&mbr, &c_end))))
DBUG_RETURN(0);
- g->get_mbr(&mbr, &c_end);
collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax);
if (g->get_class_info()->m_type_id == Geometry::wkb_point)
@@ -1598,11 +1597,11 @@ double Item_func_distance::val_real()
if ((null_value= (args[0]->null_value || args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())))))
+ !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
+ g1->get_mbr(&mbr1, &c_end) ||
+ g2->get_mbr(&mbr2, &c_end))))
goto mem_error;
- g1->get_mbr(&mbr1, &c_end);
- g2->get_mbr(&mbr2, &c_end);
mbr1.add_mbr(&mbr2);
collector.set_extent(mbr1.xmin, mbr1.xmax, mbr1.ymin, mbr1.ymax);
diff --git a/sql/item_row.cc b/sql/item_row.cc
index ee7bd837553..03b460e3ada 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -47,13 +47,13 @@ Item_row::Item_row(List<Item> &arg):
items= (Item**) sql_alloc(sizeof(Item*)*arg_count);
else
items= 0;
- List_iterator<Item> li(arg);
+ List_iterator_fast<Item> li(arg);
uint i= 0;
Item *item;
while ((item= li++))
{
items[i]= item;
- i++;
+ i++;
}
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 5071e494f04..3df03e63297 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2460,38 +2460,16 @@ String *Item_func_elt::val_str(String *str)
}
-void Item_func_make_set::split_sum_func(THD *thd, Item **ref_pointer_array,
- List<Item> &fields)
-{
- item->split_sum_func2(thd, ref_pointer_array, fields, &item, TRUE);
- Item_str_func::split_sum_func(thd, ref_pointer_array, fields);
-}
-
-
void Item_func_make_set::fix_length_and_dec()
{
- uint32 char_length= arg_count - 1; /* Separators */
+ uint32 char_length= arg_count - 2; /* Separators */
- if (agg_arg_charsets_for_string_result(collation, args, arg_count))
+ if (agg_arg_charsets_for_string_result(collation, args + 1, arg_count - 1))
return;
- for (uint i=0 ; i < arg_count ; i++)
+ for (uint i=1 ; i < arg_count ; i++)
char_length+= args[i]->max_char_length();
fix_char_length(char_length);
- used_tables_cache|= item->used_tables();
- not_null_tables_cache&= item->not_null_tables();
- const_item_cache&= item->const_item();
- with_sum_func= with_sum_func || item->with_sum_func;
- with_field= with_field || item->with_field;
-}
-
-
-void Item_func_make_set::update_used_tables()
-{
- Item_func::update_used_tables();
- item->update_used_tables();
- used_tables_cache|=item->used_tables();
- const_item_cache&=item->const_item();
}
@@ -2500,15 +2478,15 @@ String *Item_func_make_set::val_str(String *str)
DBUG_ASSERT(fixed == 1);
ulonglong bits;
bool first_found=0;
- Item **ptr=args;
+ Item **ptr=args+1;
String *result=&my_empty_string;
- bits=item->val_int();
- if ((null_value=item->null_value))
+ bits=args[0]->val_int();
+ if ((null_value=args[0]->null_value))
return NULL;
- if (arg_count < 64)
- bits &= ((ulonglong) 1 << arg_count)-1;
+ if (arg_count < 65)
+ bits &= ((ulonglong) 1 << (arg_count-1))-1;
for (; bits; bits >>= 1, ptr++)
{
@@ -2548,39 +2526,6 @@ String *Item_func_make_set::val_str(String *str)
}
-Item *Item_func_make_set::transform(Item_transformer transformer, uchar *arg)
-{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
-
- Item *new_item= item->transform(transformer, arg);
- if (!new_item)
- return 0;
-
- /*
- THD::change_item_tree() should be called only if the tree was
- really transformed, i.e. when a new item has been created.
- Otherwise we'll be allocating a lot of unnecessary memory for
- change records at each execution.
- */
- if (item != new_item)
- current_thd->change_item_tree(&item, new_item);
- return Item_str_func::transform(transformer, arg);
-}
-
-
-void Item_func_make_set::print(String *str, enum_query_type query_type)
-{
- str->append(STRING_WITH_LEN("make_set("));
- item->print(str, query_type);
- if (arg_count)
- {
- str->append(',');
- print_args(str, 0, query_type);
- }
- str->append(')');
-}
-
-
String *Item_func_char::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -2987,7 +2932,7 @@ String *Item_func_conv_charset::val_str(String *str)
return null_value ? 0 : &str_value;
String *arg= args[0]->val_str(str);
uint dummy_errors;
- if (!arg)
+ if (args[0]->null_value)
{
null_value=1;
return 0;
@@ -3414,7 +3359,7 @@ String* Item_func_inet_ntoa::val_str(String* str)
Also return null if n > 255.255.255.255
*/
- if ((null_value= (args[0]->null_value || n > (ulonglong) LL(4294967295))))
+ if ((null_value= (args[0]->null_value || n > 0xffffffff)))
return 0; // Null value
str->set_charset(collation.collation);
@@ -4671,11 +4616,16 @@ null:
void Item_dyncol_get::print(String *str, enum_query_type query_type)
{
+ /* see create_func_dyncol_get */
+ DBUG_ASSERT(str->length() >= 5);
+ DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0);
+
+ str->length(str->length() - 5); // removing "cast("
str->append(STRING_WITH_LEN("column_get("));
args[0]->print(str, query_type);
str->append(',');
args[1]->print(str, query_type);
- str->append(')');
+ /* let the parent cast item add " as <type>)" */
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 486b7cf36ef..00863e9af2b 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -544,31 +544,13 @@ public:
class Item_func_make_set :public Item_str_func
{
- Item *item;
String tmp_str;
public:
- Item_func_make_set(Item *a,List<Item> &list) :Item_str_func(list),item(a) {}
+ Item_func_make_set(List<Item> &list) :Item_str_func(list) {}
String *val_str(String *str);
- bool fix_fields(THD *thd, Item **ref)
- {
- DBUG_ASSERT(fixed == 0);
- return ((!item->fixed && item->fix_fields(thd, &item)) ||
- item->check_cols(1) ||
- Item_func::fix_fields(thd, ref));
- }
- void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
void fix_length_and_dec();
- void update_used_tables();
const char *func_name() const { return "make_set"; }
-
- bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
- {
- return item->walk(processor, walk_subquery, arg) ||
- Item_str_func::walk(processor, walk_subquery, arg);
- }
- Item *transform(Item_transformer transformer, uchar *arg);
- virtual void print(String *str, enum_query_type query_type);
};
@@ -859,25 +841,37 @@ public:
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_int();
- return args[0]->val_int();
+ longlong res= args[0]->val_int();
+ if ((null_value= args[0]->null_value))
+ return 0;
+ return res;
}
double val_real()
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_real();
- return args[0]->val_real();
+ double res= args[0]->val_real();
+ if ((null_value= args[0]->null_value))
+ return 0;
+ return res;
}
my_decimal *val_decimal(my_decimal *d)
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_decimal(d);
- return args[0]->val_decimal(d);
+ my_decimal *res= args[0]->val_decimal(d);
+ if ((null_value= args[0]->null_value))
+ return NULL;
+ return res;
}
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::get_date(ltime, fuzzydate);
- return args[0]->get_date(ltime, fuzzydate);
+ bool res= args[0]->get_date(ltime, fuzzydate);
+ if ((null_value= args[0]->null_value))
+ return 1;
+ return res;
}
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 87e96da8f62..2128de391e0 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -43,6 +43,9 @@
double get_post_group_estimate(JOIN* join, double join_op_rows);
+const char *exists_outer_expr_name= "<exists outer expr>";
+
+int check_and_do_in_subquery_rewrites(JOIN *join);
Item_subselect::Item_subselect():
Item_result_field(), value_assigned(0), own_engine(0), thd(0), old_engine(0),
@@ -83,15 +86,24 @@ void Item_subselect::init(st_select_lex *select_lex,
if (unit->item)
{
- /*
- Item can be changed in JOIN::prepare while engine in JOIN::optimize
- => we do not copy old_engine here
- */
engine= unit->item->engine;
- own_engine= FALSE;
parsing_place= unit->item->parsing_place;
- thd->change_item_tree((Item**)&unit->item, this);
- engine->change_result(this, result, TRUE);
+ if (unit->item->substype() == EXISTS_SUBS &&
+ ((Item_exists_subselect *)unit->item)->exists_transformed)
+ {
+ /* it is permanent transformation of EXISTS to IN */
+ unit->item= this;
+ engine->change_result(this, result, FALSE);
+ }
+ else
+ {
+ /*
+ Item can be changed in JOIN::prepare while engine in JOIN::optimize
+ => we do not copy old_engine here
+ */
+ thd->change_item_tree((Item**)&unit->item, this);
+ engine->change_result(this, result, TRUE);
+ }
}
else
{
@@ -462,7 +474,7 @@ public:
void Item_subselect::recalc_used_tables(st_select_lex *new_parent,
bool after_pullout)
{
- List_iterator<Ref_to_outside> it(upper_refs);
+ List_iterator_fast<Ref_to_outside> it(upper_refs);
Ref_to_outside *upper;
used_tables_cache= 0;
@@ -547,8 +559,19 @@ bool Item_subselect::is_expensive()
if (!cur_join)
continue;
- /* If a subquery is not optimized we cannot estimate its cost. */
- if (!cur_join->join_tab)
+ /*
+ Subqueries whose result is known after optimization are not expensive.
+ Such subqueries have all tables optimized away, thus have no join plan.
+ */
+ if (cur_join->optimized &&
+ (cur_join->zero_result_cause || !cur_join->tables_list))
+ return false;
+
+ /*
+ If a subquery is not optimized we cannot estimate its cost. A subquery is
+ considered optimized if it has a join plan.
+ */
+ if (!(cur_join->optimized && cur_join->join_tab))
return true;
if (sl->first_inner_unit())
@@ -661,9 +684,12 @@ bool Item_subselect::exec()
void Item_subselect::get_cache_parameters(List<Item> &parameters)
{
- Collect_deps_prm prm= {&parameters,
- unit->first_select()->nest_level_base,
- unit->first_select()->nest_level};
+ Collect_deps_prm prm= {&parameters, // parameters
+ unit->first_select()->nest_level_base, // nest_level_base
+ 0, // count
+ unit->first_select()->nest_level, // nest_level
+ TRUE // collect
+ };
walk(&Item::collect_outer_ref_processor, TRUE, (uchar*)&prm);
}
@@ -1087,6 +1113,11 @@ enum Item_result Item_singlerow_subselect::result_type() const
return engine->type();
}
+enum Item_result Item_singlerow_subselect::cmp_type() const
+{
+ return engine->cmptype();
+}
+
/*
Don't rely on the result type to calculate field type.
Ask the engine instead.
@@ -1298,10 +1329,12 @@ bool Item_singlerow_subselect::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
Item_exists_subselect::Item_exists_subselect(st_select_lex *select_lex):
- Item_subselect()
+ Item_subselect(), upper_not(NULL), abort_on_null(0),
+ emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
{
DBUG_ENTER("Item_exists_subselect::Item_exists_subselect");
bool val_bool();
+
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
null_value= FALSE; //can't be NULL
@@ -1335,21 +1368,19 @@ bool Item_in_subselect::test_limit(st_select_lex_unit *unit_arg)
Item_in_subselect::Item_in_subselect(Item * left_exp,
st_select_lex *select_lex):
- Item_exists_subselect(),
- left_expr_cache(0), first_execution(TRUE), in_strategy(SUBS_NOT_TRANSFORMED),
- optimizer(0), pushed_cond_guards(NULL), emb_on_expr_nest(NULL),
- is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE),
- is_flattenable_semijoin(FALSE),
- is_registered_semijoin(FALSE),
+ Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
+ in_strategy(SUBS_NOT_TRANSFORMED),
+ pushed_cond_guards(NULL), is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE),
+ is_flattenable_semijoin(FALSE), is_registered_semijoin(FALSE),
upper_item(0)
{
DBUG_ENTER("Item_in_subselect::Item_in_subselect");
+ DBUG_PRINT("info", ("in_strategy: %u", (uint)in_strategy));
left_expr= left_exp;
func= &eq_creator;
init(select_lex, new select_exists_subselect(this));
max_columns= UINT_MAX;
maybe_null= 1;
- abort_on_null= 0;
reset();
//if test_limit will fail then error will be reported to client
test_limit(select_lex->master_unit());
@@ -1745,8 +1776,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
SELECT_LEX *current= thd->lex->current_select;
thd->lex->current_select= current->return_after_parsing();
- //optimizer never use Item **ref => we can pass 0 as parameter
- if (!optimizer || optimizer->fix_left(thd, 0))
+ if (!optimizer || optimizer->fix_left(thd))
{
thd->lex->current_select= current;
DBUG_RETURN(true);
@@ -1852,7 +1882,8 @@ bool Item_allany_subselect::transform_into_max_min(JOIN *join)
print_where(item, "rewrite with MIN/MAX", QT_ORDINARY););
save_allow_sum_func= thd->lex->allow_sum_func;
- thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
+ thd->lex->allow_sum_func|=
+ (nesting_map)1 << thd->lex->current_select->nest_level;
/*
Item_sum_(max|min) can't substitute other item => we can use 0 as
reference, also Item_sum_(max|min) can't be fixed after creation, so
@@ -2125,8 +2156,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
SELECT_LEX *current= thd->lex->current_select;
thd->lex->current_select= current->return_after_parsing();
- //optimizer never use Item **ref => we can pass 0 as parameter
- if (!optimizer || optimizer->fix_left(thd, 0))
+ if (!optimizer || optimizer->fix_left(thd))
{
thd->lex->current_select= current;
DBUG_RETURN(true);
@@ -2370,6 +2400,12 @@ Item_in_subselect::select_transformer(JOIN *join)
return select_in_like_transformer(join);
}
+bool
+Item_exists_subselect::select_transformer(JOIN *join)
+{
+ return select_prepare_to_be_in();
+}
+
/**
Create the predicates needed to transform an IN/ALL/ANY subselect into a
@@ -2505,6 +2541,437 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg)
}
+/*
+ If this select can potentially be converted by EXISTS->IN conversion, wrap it
+ in an Item_in_optimizer object. Final decision whether to do the conversion
+ is done at a later phase.
+*/
+
+bool Item_exists_subselect::select_prepare_to_be_in()
+{
+ bool trans_res= FALSE;
+ DBUG_ENTER("Item_exists_subselect::select_prepare_to_be_in");
+ if (!optimizer &&
+ thd->lex->sql_command == SQLCOM_SELECT &&
+ !unit->first_select()->is_part_of_union() &&
+ optimizer_flag(thd, OPTIMIZER_SWITCH_EXISTS_TO_IN) &&
+ (is_top_level_item() ||
+ (upper_not && upper_not->is_top_level_item())))
+ {
+ Query_arena *arena, backup;
+ bool result;
+ arena= thd->activate_stmt_arena_if_needed(&backup);
+ result= (!(optimizer= new Item_in_optimizer(new Item_int(1), this)));
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+ if (result)
+ trans_res= TRUE;
+ else
+ substitution= optimizer;
+ }
+ DBUG_RETURN(trans_res);
+}
+
+/**
+ Check if 'func' is an equality in form "inner_table.column = outer_expr"
+
+ @param func Expression to check
+ @param local_field OUT Return "inner_table.column" here
+ @param outer_expr OUT Return outer_expr here
+
+ @return true - 'func' is an Equality.
+*/
+
+static bool check_equality_for_exist2in(Item_func *func,
+ Item_ident **local_field,
+ Item **outer_exp)
+{
+ Item **args;
+ if (func->functype() != Item_func::EQ_FUNC)
+ return FALSE;
+ DBUG_ASSERT(func->arg_count == 2);
+ args= func->arguments();
+ if (args[0]->real_type() == Item::FIELD_ITEM &&
+ args[0]->all_used_tables() != OUTER_REF_TABLE_BIT &&
+ args[1]->all_used_tables() == OUTER_REF_TABLE_BIT)
+ {
+ /* It is Item_field or Item_direct_view_ref) */
+ DBUG_ASSERT(args[0]->type() == Item::FIELD_ITEM ||
+ args[0]->type() == Item::REF_ITEM);
+ *local_field= (Item_ident *)args[0];
+ *outer_exp= args[1];
+ return TRUE;
+ }
+ else if (args[1]->real_type() == Item::FIELD_ITEM &&
+ args[1]->all_used_tables() != OUTER_REF_TABLE_BIT &&
+ args[0]->all_used_tables() == OUTER_REF_TABLE_BIT)
+ {
+ /* It is Item_field or Item_direct_view_ref) */
+ DBUG_ASSERT(args[0]->type() == Item::FIELD_ITEM ||
+ args[0]->type() == Item::REF_ITEM);
+ *local_field= (Item_ident *)args[1];
+ *outer_exp= args[0];
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+typedef struct st_eq_field_outer
+{
+ Item_func **eq_ref;
+ Item_ident *local_field;
+ Item *outer_exp;
+} EQ_FIELD_OUTER;
+
+
+/**
+ Check if 'conds' is a set of AND-ed outer_expr=inner_table.col equalities
+
+ @detail
+ Check if 'conds' has form
+
+ outer1=inner_tbl1.col1 AND ... AND outer2=inner_tbl1.col2 AND remainder_cond
+
+ @param conds Condition to be checked
+ @parm result Array to collect EQ_FIELD_OUTER elements describing
+ inner-vs-outer equalities the function has found.
+ @return
+ false - some inner-vs-outer equalities were found
+ true - otherwise.
+*/
+
+static bool find_inner_outer_equalities(Item **conds,
+ Dynamic_array<EQ_FIELD_OUTER> &result)
+{
+ bool found= FALSE;
+ EQ_FIELD_OUTER element;
+ if (is_cond_and(*conds))
+ {
+ List_iterator<Item> li(*((Item_cond*)*conds)->argument_list());
+ Item *item;
+ while ((item= li++))
+ {
+ if (item->type() == Item::FUNC_ITEM &&
+ check_equality_for_exist2in((Item_func *)item,
+ &element.local_field,
+ &element.outer_exp))
+ {
+ found= TRUE;
+ element.eq_ref= (Item_func **)li.ref();
+ if (result.append(element))
+ goto alloc_err;
+ }
+ }
+ }
+ else if ((*conds)->type() == Item::FUNC_ITEM &&
+ check_equality_for_exist2in((Item_func *)*conds,
+ &element.local_field,
+ &element.outer_exp))
+ {
+ found= TRUE;
+ element.eq_ref= (Item_func **)conds;
+ if (result.append(element))
+ goto alloc_err;
+ }
+
+ return !found;
+alloc_err:
+ return TRUE;
+}
+
+/**
+ Converts EXISTS subquery to IN subquery if it is possible and has sense
+
+ @param opt_arg Pointer on THD
+
+ @return TRUE in case of error and FALSE otherwise.
+*/
+
+bool Item_exists_subselect::exists2in_processor(uchar *opt_arg)
+{
+ THD *thd= (THD *)opt_arg;
+ SELECT_LEX *first_select=unit->first_select(), *save_select;
+ JOIN *join= first_select->join;
+ Item_func *eq= NULL, **eq_ref= NULL;
+ Item_ident *local_field= NULL;
+ Item *outer_exp= NULL;
+ Item *left_exp= NULL; Item_in_subselect *in_subs;
+ Query_arena *arena= NULL, backup;
+ int res= FALSE;
+ List<Item> outer;
+ Dynamic_array<EQ_FIELD_OUTER> eqs(5, 5);
+ bool will_be_correlated;
+ DBUG_ENTER("Item_exists_subselect::exists2in_processor");
+
+ if (!optimizer ||
+ !optimizer_flag(thd, OPTIMIZER_SWITCH_EXISTS_TO_IN) ||
+ (!is_top_level_item() && (!upper_not ||
+ !upper_not->is_top_level_item())) ||
+ first_select->is_part_of_union() ||
+ first_select->group_list.elements ||
+ first_select->order_list.elements ||
+ join->having ||
+ first_select->with_sum_func ||
+ !first_select->leaf_tables.elements||
+ !join->conds)
+ DBUG_RETURN(FALSE);
+
+ DBUG_ASSERT(first_select->order_list.elements == 0 &&
+ first_select->group_list.elements == 0 &&
+ first_select->having == NULL);
+
+ if (find_inner_outer_equalities(&join->conds, eqs))
+ DBUG_RETURN(FALSE);
+
+ DBUG_ASSERT(eqs.elements() != 0);
+
+ save_select= thd->lex->current_select;
+ thd->lex->current_select= first_select;
+
+ /* check that the subquery has only dependencies we are going pull out */
+ {
+ List<Item> unused;
+ Collect_deps_prm prm= {&unused, // parameters
+ unit->first_select()->nest_level_base, // nest_level_base
+ 0, // count
+ unit->first_select()->nest_level, // nest_level
+ FALSE // collect
+ };
+ walk(&Item::collect_outer_ref_processor, TRUE, (uchar*)&prm);
+ DBUG_ASSERT(prm.count > 0);
+ DBUG_ASSERT(prm.count >= (uint)eqs.elements());
+ will_be_correlated= prm.count > (uint)eqs.elements();
+ if (upper_not && will_be_correlated)
+ goto out;
+ }
+
+ if ((uint)eqs.elements() > (first_select->item_list.elements +
+ first_select->select_n_reserved))
+ goto out;
+ /* It is simple query */
+ DBUG_ASSERT(first_select->join->all_fields.elements ==
+ first_select->item_list.elements);
+
+ arena= thd->activate_stmt_arena_if_needed(&backup);
+
+ while (first_select->item_list.elements > (uint)eqs.elements())
+ {
+ first_select->item_list.pop();
+ first_select->join->all_fields.elements--;
+ }
+ {
+ List_iterator<Item> it(first_select->item_list);
+
+ for (uint i= 0; i < (uint)eqs.elements(); i++)
+ {
+ Item *item= it++;
+ eq_ref= eqs.at(i).eq_ref;
+ eq= *eq_ref;
+ local_field= eqs.at(i).local_field;
+ outer_exp= eqs.at(i).outer_exp;
+ /* Add the field to the SELECT_LIST */
+ if (item)
+ it.replace(local_field);
+ else
+ {
+ first_select->item_list.push_back(local_field);
+ first_select->join->all_fields.elements++;
+ }
+ first_select->ref_pointer_array[i]= (Item *)local_field;
+
+ /* remove the parts from condition */
+ if (!upper_not || !local_field->maybe_null)
+ {
+ eq->arguments()[0]= new Item_int(1);
+ eq->arguments()[1]= new Item_int(1);
+ }
+ else
+ {
+ *eq_ref= new Item_func_isnotnull(
+ new Item_field(thd,
+ ((Item_field*)(local_field->real_item()))->context,
+ ((Item_field*)(local_field->real_item()))->field));
+ if((*eq_ref)->fix_fields(thd, (Item **)eq_ref))
+ {
+ res= TRUE;
+ goto out;
+ }
+ }
+ outer_exp->fix_after_pullout(unit->outer_select(), &outer_exp);
+ outer_exp->update_used_tables();
+ outer.push_back(outer_exp);
+ }
+ }
+
+ join->conds->update_used_tables();
+
+ /* make IN SUBQUERY and put outer_exp as left part */
+ if (eqs.elements() == 1)
+ left_exp= outer_exp;
+ else
+ {
+ if (!(left_exp= new Item_row(outer)))
+ {
+ res= TRUE;
+ goto out;
+ }
+ }
+
+ /* make EXISTS->IN permanet (see Item_subselect::init()) */
+ set_exists_transformed();
+
+ first_select->select_limit= NULL;
+ if (!(in_subs= new Item_in_subselect(left_exp, first_select)))
+ {
+ res= TRUE;
+ goto out;
+ }
+ in_subs->set_exists_transformed();
+ optimizer->arguments()[0]= left_exp;
+ optimizer->arguments()[1]= in_subs;
+ in_subs->optimizer= optimizer;
+ DBUG_ASSERT(is_top_level_item() ||
+ (upper_not && upper_not->is_top_level_item()));
+ in_subs->top_level_item();
+ {
+ SELECT_LEX *current= thd->lex->current_select;
+ optimizer->reset_cache(); // renew cache, and we will not keep it
+ thd->lex->current_select= unit->outer_select();
+ DBUG_ASSERT(optimizer);
+ if (optimizer->fix_left(thd))
+ {
+ res= TRUE;
+ /*
+ We should not restore thd->lex->current_select because it will be
+ reset on exit from this procedure
+ */
+ goto out;
+ }
+ /*
+ As far as Item_ref_in_optimizer do not substitute itself on fix_fields
+ we can use same item for all selects.
+ */
+ in_subs->expr= new Item_direct_ref(&first_select->context,
+ (Item**)optimizer->get_cache(),
+ (char *)"<no matter>",
+ (char *)in_left_expr_name);
+ if (in_subs->fix_fields(thd, optimizer->arguments() + 1))
+ {
+ res= TRUE;
+ /*
+ We should not restore thd->lex->current_select because it will be
+ reset on exit from this procedure
+ */
+ goto out;
+ }
+ {
+ /* Move dependence list */
+ List_iterator_fast<Ref_to_outside> it(upper_refs);
+ Ref_to_outside *upper;
+ while ((upper= it++))
+ {
+ uint i;
+ for (i= 0; i < (uint)eqs.elements(); i++)
+ if (eqs.at(i).outer_exp->
+ walk(&Item::find_item_processor, TRUE, (uchar*)upper->item))
+ break;
+ if (i == (uint)eqs.elements() &&
+ (in_subs->upper_refs.push_back(upper, thd->stmt_arena->mem_root)))
+ goto out;
+ }
+ }
+ in_subs->update_used_tables();
+ /*
+ The engine of the subquery is fixed so above fix_fields() is not
+ complete and should be fixed
+ */
+ in_subs->upper_refs= upper_refs;
+ upper_refs.empty();
+ thd->lex->current_select= current;
+ }
+
+ DBUG_ASSERT(unit->item == in_subs);
+ DBUG_ASSERT(join == first_select->join);
+ /*
+ Fix dependency info
+ */
+ in_subs->is_correlated= will_be_correlated;
+ if (!will_be_correlated)
+ {
+ first_select->uncacheable&= ~UNCACHEABLE_DEPENDENT_GENERATED;
+ unit->uncacheable&= ~UNCACHEABLE_DEPENDENT_GENERATED;
+ }
+ /*
+ set possible optimization strategies
+ */
+ in_subs->emb_on_expr_nest= emb_on_expr_nest;
+ res= check_and_do_in_subquery_rewrites(join);
+ first_select->join->prepare_stage2();
+
+ first_select->fix_prepare_information(thd, &join->conds, &join->having);
+
+ if (upper_not)
+ {
+ Item *exp;
+ if (eqs.elements() == 1)
+ {
+ exp= (optimizer->arguments()[0]->maybe_null ?
+ (Item*)
+ new Item_cond_and(
+ new Item_func_isnotnull(
+ new Item_direct_ref(&unit->outer_select()->context,
+ optimizer->arguments(),
+ (char *)"<no matter>",
+ (char *)exists_outer_expr_name)),
+ optimizer) :
+ (Item *)optimizer);
+ }
+ else
+ {
+ List<Item> *and_list= new List<Item>;
+ if (!and_list)
+ {
+ res= TRUE;
+ goto out;
+ }
+ for (size_t i= 0; i < eqs.elements(); i++)
+ {
+ if (optimizer->arguments()[0]->maybe_null)
+ {
+ and_list->
+ push_front(
+ new Item_func_isnotnull(
+ new Item_direct_ref(&unit->outer_select()->context,
+ optimizer->arguments()[0]->addr(i),
+ (char *)"<no matter>",
+ (char *)exists_outer_expr_name)));
+ }
+ }
+ if (and_list->elements > 0)
+ {
+ and_list->push_front(optimizer);
+ exp= new Item_cond_and(*and_list);
+ }
+ else
+ exp= optimizer;
+ }
+ upper_not->arguments()[0]= exp;
+ if (!exp->fixed && exp->fix_fields(thd, upper_not->arguments()))
+ {
+ res= TRUE;
+ goto out;
+ }
+ }
+
+out:
+ thd->lex->current_select= save_select;
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+ DBUG_RETURN(res);
+}
+
+
/**
Prepare IN/ALL/ANY/SOME subquery transformation and call the appropriate
transformation function.
@@ -2621,14 +3088,23 @@ void Item_in_subselect::print(String *str, enum_query_type query_type)
Item_subselect::print(str, query_type);
}
+bool Item_exists_subselect::fix_fields(THD *thd_arg, Item **ref)
+{
+ DBUG_ENTER("Item_exists_subselect::fix_fields");
+ if (exists_transformed)
+ DBUG_RETURN( !( (*ref)= new Item_int(1)));
+ DBUG_RETURN(Item_subselect::fix_fields(thd_arg, ref));
+}
+
bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
{
uint outer_cols_num;
List<Item> *inner_cols;
+ DBUG_ENTER("Item_in_subselect::fix_fields");
if (test_strategy(SUBS_SEMI_JOIN))
- return !( (*ref)= new Item_int(1));
+ DBUG_RETURN( !( (*ref)= new Item_int(1)) );
/*
Check if the outer and inner IN operands match in those cases when we
@@ -2660,7 +3136,7 @@ bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
if (outer_cols_num != inner_cols->elements)
{
my_error(ER_OPERAND_COLUMNS, MYF(0), outer_cols_num);
- return TRUE;
+ DBUG_RETURN(TRUE);
}
if (outer_cols_num > 1)
{
@@ -2670,7 +3146,7 @@ bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
{
inner_col= inner_col_it++;
if (inner_col->check_cols(left_expr->element_index(i)->cols()))
- return TRUE;
+ DBUG_RETURN(TRUE);
}
}
}
@@ -2678,12 +3154,12 @@ bool Item_in_subselect::fix_fields(THD *thd_arg, Item **ref)
if (thd_arg->lex->is_view_context_analysis() &&
left_expr && !left_expr->fixed &&
left_expr->fix_fields(thd_arg, &left_expr))
- return TRUE;
+ DBUG_RETURN(TRUE);
else
if (Item_subselect::fix_fields(thd_arg, ref))
- return TRUE;
+ DBUG_RETURN(TRUE);
fixed= TRUE;
- return FALSE;
+ DBUG_RETURN(FALSE);
}
@@ -3044,12 +3520,13 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
{
Item *sel_item;
List_iterator_fast<Item> li(item_list);
- res_type= STRING_RESULT;
+ cmp_type= res_type= STRING_RESULT;
res_field_type= MYSQL_TYPE_VAR_STRING;
for (uint i= 0; (sel_item= li++); i++)
{
item->max_length= sel_item->max_length;
res_type= sel_item->result_type();
+ cmp_type= sel_item->cmp_type();
res_field_type= sel_item->field_type();
item->decimals= sel_item->decimals;
item->unsigned_flag= sel_item->unsigned_flag;
@@ -3060,7 +3537,7 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
//psergey-backport-timours: row[i]->store(sel_item);
}
if (item_list.elements > 1)
- res_type= ROW_RESULT;
+ cmp_type= res_type= ROW_RESULT;
}
void subselect_single_select_engine::fix_length_and_dec(Item_cache **row)
@@ -3811,6 +4288,7 @@ subselect_single_select_engine::change_result(Item_subselect *si,
select_result_interceptor *res,
bool temp)
{
+ DBUG_ENTER("subselect_single_select_engine::change_result");
item= si;
if (temp)
{
@@ -3831,7 +4309,7 @@ subselect_single_select_engine::change_result(Item_subselect *si,
that would not require a lot of extra code that would be harder to manage
than the current code.
*/
- return select_lex->join->change_result(res);
+ DBUG_RETURN(select_lex->join->change_result(res));
}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 1da129380e7..e806f45041a 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -244,6 +244,7 @@ public:
virtual bool expr_cache_is_needed(THD *);
virtual void get_cache_parameters(List<Item> &parameters);
virtual bool is_subquery_processor (uchar *opt_arg) { return 1; }
+ bool exists2in_processor(uchar *opt_arg) { return 0; }
bool limit_index_condition_pushdown_processor(uchar *opt_arg)
{
return TRUE;
@@ -286,6 +287,7 @@ public:
bool val_bool();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
enum Item_result result_type() const;
+ enum Item_result cmp_type() const;
enum_field_types field_type() const;
void fix_length_and_dec();
@@ -338,13 +340,35 @@ public:
class Item_exists_subselect :public Item_subselect
{
protected:
+ Item_func_not *upper_not;
bool value; /* value of this item (boolean: exists/not-exists) */
+ bool abort_on_null;
void init_length_and_dec();
+ bool select_prepare_to_be_in();
public:
+ /*
+ Used by subquery optimizations to keep track about in which clause this
+ subquery predicate is located:
+ NO_JOIN_NEST - the predicate is an AND-part of the WHERE
+ join nest pointer - the predicate is an AND-part of ON expression
+ of a join nest
+ NULL - for all other locations
+ */
+ TABLE_LIST *emb_on_expr_nest;
+ /**
+ Reference on the Item_in_optimizer wrapper of this subquery
+ */
+ Item_in_optimizer *optimizer;
+ /* true if we got this from EXISTS or to IN */
+ bool exists_transformed;
+
Item_exists_subselect(st_select_lex *select_lex);
- Item_exists_subselect(): Item_subselect() {}
+ Item_exists_subselect()
+ :Item_subselect(), upper_not(NULL),abort_on_null(0),
+ emb_on_expr_nest(NULL), optimizer(0), exists_transformed(0)
+ {}
subs_type substype() { return EXISTS_SUBS; }
void reset()
@@ -360,11 +384,24 @@ public:
String *val_str(String*);
my_decimal *val_decimal(my_decimal *);
bool val_bool();
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
virtual void print(String *str, enum_query_type query_type);
+ bool select_transformer(JOIN *join);
+ void top_level_item() { abort_on_null=1; }
+ inline bool is_top_level_item() { return abort_on_null; }
+ bool exists2in_processor(uchar *opt_arg);
Item* expr_cache_insert_transformer(uchar *thd_arg);
+ void mark_as_condition_AND_part(TABLE_LIST *embedding)
+ {
+ emb_on_expr_nest= embedding;
+ }
+ virtual void under_not(Item_func_not *upper) { upper_not= upper; };
+
+ void set_exists_transformed() { exists_transformed= TRUE; }
+
friend class select_exists_subselect;
friend class subselect_uniquesubquery_engine;
friend class subselect_indexsubquery_engine;
@@ -424,11 +461,8 @@ protected:
*/
Item *expr;
bool was_null;
- bool abort_on_null;
/* A bitmap of possible execution strategies for an IN predicate. */
uchar in_strategy;
-public:
- Item_in_optimizer *optimizer;
protected:
/* Used to trigger on/off conditions that were pushed down to subselect */
bool *pushed_cond_guards;
@@ -451,15 +485,6 @@ public:
/* Priority of this predicate in the convert-to-semi-join-nest process. */
int sj_convert_priority;
/*
- Used by subquery optimizations to keep track about in which clause this
- subquery predicate is located:
- NO_JOIN_NEST - the predicate is an AND-part of the WHERE
- join nest pointer - the predicate is an AND-part of ON expression
- of a join nest
- NULL - for all other locations
- */
- TABLE_LIST *emb_on_expr_nest;
- /*
Types of left_expr and subquery's select list allow to perform subquery
materialization. Currently, we set this to FALSE when it as well could
be TRUE. This is to be properly addressed with fix for BUG#36752.
@@ -527,7 +552,9 @@ public:
*/
Item *original_item()
{
- return is_flattenable_semijoin ? (Item*)this : (Item*)optimizer;
+ return (is_flattenable_semijoin && !exists_transformed ?
+ (Item*)this :
+ (Item*)optimizer);
}
bool *get_cond_guard(int i)
@@ -546,11 +573,9 @@ public:
Item_in_subselect(Item * left_expr, st_select_lex *select_lex);
Item_in_subselect()
:Item_exists_subselect(), left_expr_cache(0), first_execution(TRUE),
- abort_on_null(0), in_strategy(SUBS_NOT_TRANSFORMED), optimizer(0),
- pushed_cond_guards(NULL), func(NULL), emb_on_expr_nest(NULL),
- is_jtbm_merged(FALSE), is_jtbm_const_tab(FALSE),
- upper_item(0)
- {}
+ in_strategy(SUBS_NOT_TRANSFORMED),
+ pushed_cond_guards(NULL), func(NULL), is_jtbm_merged(FALSE),
+ is_jtbm_const_tab(FALSE), upper_item(0) {}
void cleanup();
subs_type substype() { return IN_SUBS; }
void reset()
@@ -571,8 +596,6 @@ public:
my_decimal *val_decimal(my_decimal *);
void update_null_value () { (void) val_bool(); }
bool val_bool();
- void top_level_item() { abort_on_null=1; }
- inline bool is_top_level_item() { return abort_on_null; }
bool test_limit(st_select_lex_unit *unit);
virtual void print(String *str, enum_query_type query_type);
bool fix_fields(THD *thd, Item **ref);
@@ -589,19 +612,14 @@ public:
void set_first_execution() { if (first_execution) first_execution= FALSE; }
bool expr_cache_is_needed(THD *thd);
inline bool left_expr_has_null();
-
+
int optimize(double *out_rows, double *cost);
- /*
+ /*
Return the identifier that we could use to identify the subquery for the
user.
*/
int get_identifier();
- void mark_as_condition_AND_part(TABLE_LIST *embedding)
- {
- emb_on_expr_nest= embedding;
- }
-
bool test_strategy(uchar strategy)
{ return test(in_strategy & strategy); }
@@ -630,6 +648,9 @@ public:
void add_strategy (uchar strategy)
{
+ DBUG_ENTER("Item_in_subselect::add_strategy");
+ DBUG_PRINT("enter", ("current: %u add: %u",
+ (uint) in_strategy, (uint) strategy));
DBUG_ASSERT(strategy != SUBS_NOT_TRANSFORMED);
DBUG_ASSERT(!(strategy & SUBS_STRATEGY_CHOSEN));
/*
@@ -639,16 +660,25 @@ public:
DBUG_ASSERT(!(in_strategy & SUBS_STRATEGY_CHOSEN));
*/
in_strategy|= strategy;
+ DBUG_VOID_RETURN;
}
void reset_strategy(uchar strategy)
{
+ DBUG_ENTER("Item_in_subselect::reset_strategy");
+ DBUG_PRINT("enter", ("current: %u new: %u",
+ (uint) in_strategy, (uint) strategy));
DBUG_ASSERT(strategy != SUBS_NOT_TRANSFORMED);
in_strategy= strategy;
+ DBUG_VOID_RETURN;
}
void set_strategy(uchar strategy)
{
+ DBUG_ENTER("Item_in_subselect::set_strategy");
+ DBUG_PRINT("enter", ("current: %u set: %u",
+ (uint) in_strategy,
+ (uint) (SUBS_STRATEGY_CHOSEN | strategy)));
/* Check that only one strategy is set for execution. */
DBUG_ASSERT(strategy == SUBS_SEMI_JOIN ||
strategy == SUBS_IN_TO_EXISTS ||
@@ -658,7 +688,12 @@ public:
strategy == SUBS_MAXMIN_INJECTED ||
strategy == SUBS_MAXMIN_ENGINE);
in_strategy= (SUBS_STRATEGY_CHOSEN | strategy);
+ DBUG_VOID_RETURN;
}
+ bool exists2in_processor(uchar *opt_arg __attribute__((unused)))
+ {
+ return 0;
+ };
friend class Item_ref_null_helper;
friend class Item_is_not_null_test;
@@ -666,6 +701,7 @@ public:
friend class subselect_indexsubquery_engine;
friend class subselect_hash_sj_engine;
friend class subselect_partial_match_engine;
+ friend class Item_exists_subselect;
};
@@ -698,6 +734,7 @@ protected:
THD *thd; /* pointer to current THD */
Item_subselect *item; /* item, that use this engine */
enum Item_result res_type; /* type of results */
+ enum Item_result cmp_type; /* how to compare the results */
enum_field_types res_field_type; /* column type of the results */
bool maybe_null; /* may be null (first item in select) */
public:
@@ -712,7 +749,7 @@ public:
{
result= res;
item= si;
- res_type= STRING_RESULT;
+ cmp_type= res_type= STRING_RESULT;
res_field_type= MYSQL_TYPE_VAR_STRING;
maybe_null= 0;
set_thd(thd_arg);
@@ -752,6 +789,7 @@ public:
virtual uint cols()= 0; /* return number of columns in select */
virtual uint8 uncacheable()= 0; /* query is uncacheable */
enum Item_result type() { return res_type; }
+ enum Item_result cmptype() { return cmp_type; }
enum_field_types field_type() { return res_field_type; }
virtual void exclude()= 0;
virtual bool may_be_null() { return maybe_null; };
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 8816e1352a9..03afd1a4365 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -152,9 +152,10 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
If it is there under a construct where it is not allowed
we report an error.
*/
- invalid= !(allow_sum_func & (1 << max_arg_level));
+ invalid= !(allow_sum_func & ((nesting_map)1 << max_arg_level));
}
- else if (max_arg_level >= 0 || !(allow_sum_func & (1 << nest_level)))
+ else if (max_arg_level >= 0 ||
+ !(allow_sum_func & ((nesting_map)1 << nest_level)))
{
/*
The set function can be aggregated only in outer subqueries.
@@ -163,7 +164,8 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
*/
if (register_sum_func(thd, ref))
return TRUE;
- invalid= aggr_level < 0 && !(allow_sum_func & (1 << nest_level));
+ invalid= aggr_level < 0 &&
+ !(allow_sum_func & ((nesting_map)1 << nest_level));
if (!invalid && thd->variables.sql_mode & MODE_ANSI)
invalid= aggr_level < 0 && max_arg_level < nest_level;
}
@@ -311,14 +313,15 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref)
sl && sl->nest_level > max_arg_level;
sl= sl->master_unit()->outer_select() )
{
- if (aggr_level < 0 && (allow_sum_func & (1 << sl->nest_level)))
+ if (aggr_level < 0 &&
+ (allow_sum_func & ((nesting_map)1 << sl->nest_level)))
{
/* Found the most nested subquery where the function can be aggregated */
aggr_level= sl->nest_level;
aggr_sel= sl;
}
}
- if (sl && (allow_sum_func & (1 << sl->nest_level)))
+ if (sl && (allow_sum_func & ((nesting_map)1 << sl->nest_level)))
{
/*
We reached the subquery of level max_arg_level and checked
@@ -375,7 +378,12 @@ bool Item_sum::collect_outer_ref_processor(uchar *param)
if ((ds= depended_from()) &&
ds->nest_level_base == prm->nest_level_base &&
ds->nest_level < prm->nest_level)
- prm->parameters->add_unique(this, &cmp_items);
+ {
+ if (prm->collect)
+ prm->parameters->add_unique(this, &cmp_items);
+ else
+ prm->count++;
+ }
return FALSE;
}
@@ -559,7 +567,7 @@ void Item_sum::update_used_tables ()
used_tables_cache&= PSEUDO_TABLE_BITS;
// the aggregate function is aggregated into its local context
- used_tables_cache |= (1 << aggr_sel->join->table_count) - 1;
+ used_tables_cache|= ((table_map)1 << aggr_sel->join->tables) - 1;
} because if we do it, table elimination will assume that
- constructs like "COUNT(*)" use columns from all tables
@@ -727,7 +735,15 @@ int simple_raw_key_cmp(void* arg, const void* key1, const void* key2)
}
-int item_sum_distinct_walk(void *element, element_count num_of_dups,
+static int item_sum_distinct_walk_for_count(void *element,
+ element_count num_of_dups,
+ void *item)
+{
+ return ((Aggregator_distinct*) (item))->unique_walk_function_for_count(element);
+}
+
+
+static int item_sum_distinct_walk(void *element, element_count num_of_dups,
void *item)
{
return ((Aggregator_distinct*) (item))->unique_walk_function(element);
@@ -1097,7 +1113,12 @@ void Aggregator_distinct::endup()
{
/* go over the tree of distinct keys and calculate the aggregate value */
use_distinct_values= TRUE;
- tree->walk(table, item_sum_distinct_walk, (void*) this);
+ tree_walk_action func;
+ if (item_sum->sum_func() == Item_sum::COUNT_DISTINCT_FUNC)
+ func= item_sum_distinct_walk_for_count;
+ else
+ func= item_sum_distinct_walk;
+ tree->walk(table, func, (void*) this);
use_distinct_values= FALSE;
}
/* prevent consecutive recalculations */
@@ -1474,6 +1495,22 @@ bool Aggregator_distinct::unique_walk_function(void *element)
}
+/*
+ A variant of unique_walk_function() that is to be used with Item_sum_count.
+
+ COUNT is a special aggregate function: it doesn't need the values, it only
+ needs to count them. COUNT needs to know the values are not NULLs, but NULL
+ values are not put into the Unique, so we don't need to check for NULLs here.
+*/
+
+bool Aggregator_distinct::unique_walk_function_for_count(void *element)
+{
+ Item_sum_count *sum= (Item_sum_count *)item_sum;
+ sum->count++;
+ return 0;
+}
+
+
Aggregator_distinct::~Aggregator_distinct()
{
if (tree)
@@ -1589,9 +1626,10 @@ void Item_sum_avg::fix_length_and_dec()
f_scale= args[0]->decimals;
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
}
- else {
+ else
+ {
decimals= min(args[0]->decimals + prec_increment, NOT_FIXED_DEC);
- max_length= args[0]->max_length + prec_increment;
+ max_length= min(args[0]->max_length + prec_increment, float_length(decimals));
}
}
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 40a28d8beae..6769c47a411 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1,7 +1,7 @@
#ifndef ITEM_SUM_INCLUDED
#define ITEM_SUM_INCLUDED
/* Copyright (c) 2000, 2011 Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+ Copyright (c) 2008, 2013 Monty Program Ab.
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
@@ -642,6 +642,7 @@ public:
virtual bool arg_is_null();
bool unique_walk_function(void *element);
+ bool unique_walk_function_for_count(void *element);
static int composite_key_cmp(void* arg, uchar* key1, uchar* key2);
};
@@ -1119,7 +1120,7 @@ public:
class Item_sum_or :public Item_sum_bit
{
public:
- Item_sum_or(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
+ Item_sum_or(Item *item_par) :Item_sum_bit(item_par, 0) {}
Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {}
bool add();
const char *func_name() const { return "bit_or("; }
@@ -1140,7 +1141,7 @@ class Item_sum_and :public Item_sum_bit
class Item_sum_xor :public Item_sum_bit
{
public:
- Item_sum_xor(Item *item_par) :Item_sum_bit(item_par,LL(0)) {}
+ Item_sum_xor(Item *item_par) :Item_sum_bit(item_par, 0) {}
Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {}
bool add();
const char *func_name() const { return "bit_xor("; }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 02a7b8511af..f43a4e79431 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -709,8 +709,8 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
{
longlong value;
const char *start= str;
- for (value=0; str != end && my_isdigit(cs,*str) ; str++)
- value= value*LL(10) + (longlong) (*str - '0');
+ for (value=0; str != end && my_isdigit(cs, *str) ; str++)
+ value= value*10 + *str - '0';
msec_length= 6 - (str - start);
values[i]= value;
while (str != end && !my_isdigit(cs,*str))
@@ -923,16 +923,14 @@ longlong Item_func_dayofmonth::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.day;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.day;
}
longlong Item_func_month::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.month;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.month;
}
@@ -983,16 +981,14 @@ longlong Item_func_hour::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.hour;
+ return get_arg0_time(&ltime) ? 0 : ltime.hour;
}
longlong Item_func_minute::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.minute;
+ return get_arg0_time(&ltime) ? 0 : ltime.minute;
}
/**
@@ -1002,8 +998,7 @@ longlong Item_func_second::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.second;
+ return get_arg0_time(&ltime) ? 0 : ltime.second;
}
@@ -1120,8 +1115,7 @@ longlong Item_func_year::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.year;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.year;
}
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 3e3cd698efc..9b2db9e816e 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -491,6 +491,7 @@ public:
enum Item_result result_type () const { return STRING_RESULT; }
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
+ Item_result cmp_type() const { return TIME_RESULT; }
String *val_str(String *str);
longlong val_int();
double val_real();
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 5a824e48b7b..723429f107a 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -2704,8 +2704,12 @@ int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len)
node.parent= data->parent; // Set parent for the new node to old parent
data->parent= numnodes; // Remember current node as new parent
+ DBUG_ASSERT(data->level <= MAX_LEVEL);
data->pos[data->level]= numnodes;
- node.level= data->level++;
+ if (data->level < MAX_LEVEL)
+ node.level= data->level++;
+ else
+ return MY_XML_ERROR;
node.type= st->current_node_type; // TAG or ATTR
node.beg= attr;
node.end= attr + len;
diff --git a/sql/lock.cc b/sql/lock.cc
index bf53a925424..67c8b240c6f 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -93,7 +93,7 @@ extern HASH open_cache;
static int lock_external(THD *thd, TABLE **table,uint count);
static int unlock_external(THD *thd, TABLE **table,uint count);
-static void print_lock_error(int error, const char *);
+static void print_lock_error(int error, TABLE *);
/* Map the return value of thr_lock to an error from errmsg.txt */
static int thr_lock_errno_to_mysql[]=
@@ -356,7 +356,7 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
if ((error=(*tables)->file->ha_external_lock(thd,lock_type)))
{
- print_lock_error(error, (*tables)->file->table_type());
+ print_lock_error(error, *tables);
while (--i)
{
tables--;
@@ -671,7 +671,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
if ((error=(*table)->file->ha_external_lock(thd, F_UNLCK)))
{
error_code=error;
- print_lock_error(error_code, (*table)->file->table_type());
+ print_lock_error(error_code, *table);
}
}
table++;
@@ -894,7 +894,7 @@ bool lock_object_name(THD *thd, MDL_key::enum_mdl_namespace mdl_type,
}
-static void print_lock_error(int error, const char *table)
+static void print_lock_error(int error, TABLE *table)
{
int textno;
DBUG_ENTER("print_lock_error");
@@ -910,17 +910,15 @@ static void print_lock_error(int error, const char *table)
textno=ER_LOCK_DEADLOCK;
break;
case HA_ERR_WRONG_COMMAND:
- textno=ER_ILLEGAL_HA;
- break;
+ my_error(ER_ILLEGAL_HA, MYF(0), table->file->table_type(),
+ table->s->db.str, table->s->table_name.str);
+ DBUG_VOID_RETURN;
default:
textno=ER_CANT_LOCK;
break;
}
- if ( textno == ER_ILLEGAL_HA )
- my_error(textno, MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG), table);
- else
- my_error(textno, MYF(ME_BELL+ME_OLDWIN+ME_WAITTANG), error);
+ my_error(textno, MYF(0), error);
DBUG_VOID_RETURN;
}
diff --git a/sql/log.cc b/sql/log.cc
index 254449da05a..088816d7954 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2290,7 +2290,7 @@ static int find_uniq_filename(char *name)
DBUG_RETURN(1);
}
file_info= dir_info->dir_entry;
- for (i= dir_info->number_off_files ; i-- ; file_info++)
+ for (i= dir_info->number_of_files ; i-- ; file_info++)
{
if (memcmp(file_info->name, start, length) == 0 &&
test_if_number(file_info->name+length, &number,0))
@@ -2301,7 +2301,7 @@ static int find_uniq_filename(char *name)
my_dirend(dir_info);
/* check if reached the maximum possible extension number */
- if ((max_found == MAX_LOG_UNIQUE_FN_EXT))
+ if (max_found == MAX_LOG_UNIQUE_FN_EXT)
{
sql_print_error("Log filename extension number exhausted: %06lu. \
Please fix this by archiving old logs and \
@@ -2965,6 +2965,19 @@ void MYSQL_BIN_LOG::cleanup()
{
xid_count_per_binlog *b;
+ /* Wait for the binlog background thread to stop. */
+ if (!is_relay_log && binlog_background_thread_started)
+ {
+ mysql_mutex_lock(&LOCK_binlog_background_thread);
+ binlog_background_thread_stop= true;
+ mysql_cond_signal(&COND_binlog_background_thread);
+ while (binlog_background_thread_stop)
+ mysql_cond_wait(&COND_binlog_background_thread_end,
+ &LOCK_binlog_background_thread);
+ mysql_mutex_unlock(&LOCK_binlog_background_thread);
+ binlog_background_thread_started= false;
+ }
+
inited= 0;
close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
delete description_event_for_queue;
@@ -2981,19 +2994,6 @@ void MYSQL_BIN_LOG::cleanup()
my_free(b);
}
- /* Wait for the binlog background thread to stop. */
- if (!is_relay_log && binlog_background_thread_started)
- {
- mysql_mutex_lock(&LOCK_binlog_background_thread);
- binlog_background_thread_stop= true;
- mysql_cond_signal(&COND_binlog_background_thread);
- while (binlog_background_thread_stop)
- mysql_cond_wait(&COND_binlog_background_thread_end,
- &LOCK_binlog_background_thread);
- mysql_mutex_unlock(&LOCK_binlog_background_thread);
- binlog_background_thread_started= false;
- }
-
mysql_mutex_destroy(&LOCK_log);
mysql_mutex_destroy(&LOCK_index);
mysql_mutex_destroy(&LOCK_xid_list);
@@ -3715,17 +3715,10 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd, bool create_new_log)
/* Now wait for all checkpoint requests and pending unlog() to complete. */
mysql_mutex_lock(&LOCK_xid_list);
- xid_count_per_binlog *b;
for (;;)
{
- I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
- while ((b= it++))
- {
- if (b->xid_count > 0)
- break;
- }
- if (!b)
- break; /* No more pending XIDs */
+ if (is_xidlist_idle_nolock())
+ break;
/*
Wait until signalled that one more binlog dropped to zero, then check
again.
@@ -4503,6 +4496,32 @@ MYSQL_BIN_LOG::can_purge_log(const char *log_file_name)
#endif /* HAVE_REPLICATION */
+bool
+MYSQL_BIN_LOG::is_xidlist_idle()
+{
+ bool res;
+ mysql_mutex_lock(&LOCK_xid_list);
+ res= is_xidlist_idle_nolock();
+ mysql_mutex_unlock(&LOCK_xid_list);
+ return res;
+}
+
+
+bool
+MYSQL_BIN_LOG::is_xidlist_idle_nolock()
+{
+ xid_count_per_binlog *b;
+
+ I_List_iterator<xid_count_per_binlog> it(binlog_xid_count_list);
+ while ((b= it++))
+ {
+ if (b->xid_count > 0)
+ return false;
+ }
+ return true;
+}
+
+
/**
Create a new log file name.
@@ -8228,6 +8247,13 @@ binlog_background_thread(void *arg __attribute__((unused)))
{
stop= binlog_background_thread_stop;
queue= binlog_background_thread_queue;
+ if (stop && !mysql_bin_log.is_xidlist_idle())
+ {
+ /*
+ Delay stop until all pending binlog checkpoints have been processed.
+ */
+ stop= false;
+ }
if (stop || queue)
break;
mysql_cond_wait(&mysql_bin_log.COND_binlog_background_thread,
@@ -8238,9 +8264,18 @@ binlog_background_thread(void *arg __attribute__((unused)))
mysql_mutex_unlock(&mysql_bin_log.LOCK_binlog_background_thread);
/* Process any incoming commit_checkpoint_notify() calls. */
+ DBUG_EXECUTE_IF("inject_binlog_background_thread_before_mark_xid_done",
+ DBUG_ASSERT(!debug_sync_set_action(
+ thd,
+ STRING_WITH_LEN("binlog_background_thread_before_mark_xid_done "
+ "SIGNAL injected_binlog_background_thread "
+ "WAIT_FOR something_that_will_never_happen "
+ "TIMEOUT 2")));
+ );
while (queue)
{
THD_STAGE_INFO(thd, stage_binlog_processing_checkpoint_notify);
+ DEBUG_SYNC(current_thd, "binlog_background_thread_before_mark_xid_done");
/* Grab next pointer first, as mark_xid_done() may free the element. */
next= queue->next_in_queue;
mysql_bin_log.mark_xid_done(queue->binlog_id, true);
diff --git a/sql/log.h b/sql/log.h
index 80fe34b5ff2..da8faa36a00 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -526,6 +526,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
int write_transaction_or_stmt(group_commit_entry *entry);
bool write_transaction_to_binlog_events(group_commit_entry *entry);
void trx_group_commit_leader(group_commit_entry *leader);
+ bool is_xidlist_idle_nolock();
public:
/*
@@ -771,6 +772,7 @@ public:
inline IO_CACHE *get_index_file() { return &index_file;}
inline uint32 get_open_count() { return open_count; }
void set_status_variables(THD *thd);
+ bool is_xidlist_idle();
};
class Log_event_handler
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 7de72338d97..ccfbd621c04 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -577,7 +577,7 @@ static void cleanup_load_tmpdir()
*(p++)= '-';
*p= 0;
- for (i=0 ; i < (uint)dirp->number_off_files; i++)
+ for (i=0 ; i < (uint)dirp->number_of_files; i++)
{
file=dirp->dir_entry+i;
if (is_prefix(file->name, prefbuf))
@@ -1370,7 +1370,7 @@ failed my_b_read"));
Log_event *res= 0;
#ifndef max_allowed_packet
THD *thd=current_thd;
- uint max_allowed_packet= thd ? slave_max_allowed_packet:~(ulong)0;
+ uint max_allowed_packet= thd ? slave_max_allowed_packet:~(uint)0;
#endif
if (data_len > max_allowed_packet)
@@ -1808,6 +1808,7 @@ void Log_event::print_header(IO_CACHE* file,
/**
Prints a quoted string to io cache.
Control characters are displayed as hex sequence, e.g. \x00
+ Single-quote and backslash characters are escaped with a \
@param[in] file IO cache
@param[in] prt Pointer to string
@@ -1823,6 +1824,10 @@ my_b_write_quoted(IO_CACHE *file, const uchar *ptr, uint length)
{
if (*s > 0x1F)
my_b_write(file, s, 1);
+ else if (*s == '\'')
+ my_b_write(file, "\\'", 2);
+ else if (*s == '\\')
+ my_b_write(file, "\\\\", 2);
else
{
uchar hex[10];
@@ -4563,109 +4568,6 @@ Format_description_log_event(const char* buf,
checksum_alg= (uint8) BINLOG_CHECKSUM_ALG_UNDEF;
}
- /*
- In some previous versions, the events were given other event type
- id numbers than in the present version. When replicating from such
- a version, we therefore set up an array that maps those id numbers
- to the id numbers of the present server.
-
- If post_header_len is null, it means malloc failed, and is_valid
- will fail, so there is no need to do anything.
-
- The trees in which events have wrong id's are:
-
- mysql-5.1-wl1012.old mysql-5.1-wl2325-5.0-drop6p13-alpha
- mysql-5.1-wl2325-5.0-drop6 mysql-5.1-wl2325-5.0
- mysql-5.1-wl2325-no-dd
-
- (this was found by grepping for two lines in sequence where the
- first matches "FORMAT_DESCRIPTION_EVENT," and the second matches
- "TABLE_MAP_EVENT," in log_event.h in all trees)
-
- In these trees, the following server_versions existed since
- TABLE_MAP_EVENT was introduced:
-
- 5.1.1-a_drop5p3 5.1.1-a_drop5p4 5.1.1-alpha
- 5.1.2-a_drop5p10 5.1.2-a_drop5p11 5.1.2-a_drop5p12
- 5.1.2-a_drop5p13 5.1.2-a_drop5p14 5.1.2-a_drop5p15
- 5.1.2-a_drop5p16 5.1.2-a_drop5p16b 5.1.2-a_drop5p16c
- 5.1.2-a_drop5p17 5.1.2-a_drop5p4 5.1.2-a_drop5p5
- 5.1.2-a_drop5p6 5.1.2-a_drop5p7 5.1.2-a_drop5p8
- 5.1.2-a_drop5p9 5.1.3-a_drop5p17 5.1.3-a_drop5p17b
- 5.1.3-a_drop5p17c 5.1.4-a_drop5p18 5.1.4-a_drop5p19
- 5.1.4-a_drop5p20 5.1.4-a_drop6p0 5.1.4-a_drop6p1
- 5.1.4-a_drop6p2 5.1.5-a_drop5p20 5.2.0-a_drop6p3
- 5.2.0-a_drop6p4 5.2.0-a_drop6p5 5.2.0-a_drop6p6
- 5.2.1-a_drop6p10 5.2.1-a_drop6p11 5.2.1-a_drop6p12
- 5.2.1-a_drop6p6 5.2.1-a_drop6p7 5.2.1-a_drop6p8
- 5.2.2-a_drop6p13 5.2.2-a_drop6p13-alpha 5.2.2-a_drop6p13b
- 5.2.2-a_drop6p13c
-
- (this was found by grepping for "mysql," in all historical
- versions of configure.in in the trees listed above).
-
- There are 5.1.1-alpha versions that use the new event id's, so we
- do not test that version string. So replication from 5.1.1-alpha
- with the other event id's to a new version does not work.
- Moreover, we can safely ignore the part after drop[56]. This
- allows us to simplify the big list above to the following regexes:
-
- 5\.1\.[1-5]-a_drop5.*
- 5\.1\.4-a_drop6.*
- 5\.2\.[0-2]-a_drop6.*
-
- This is what we test for in the 'if' below.
- */
- if (post_header_len &&
- server_version[0] == '5' && server_version[1] == '.' &&
- server_version[3] == '.' &&
- strncmp(server_version + 5, "-a_drop", 7) == 0 &&
- ((server_version[2] == '1' &&
- server_version[4] >= '1' && server_version[4] <= '5' &&
- server_version[12] == '5') ||
- (server_version[2] == '1' &&
- server_version[4] == '4' &&
- server_version[12] == '6') ||
- (server_version[2] == '2' &&
- server_version[4] >= '0' && server_version[4] <= '2' &&
- server_version[12] == '6')))
- {
- if (number_of_event_types != 22)
- {
- DBUG_PRINT("info", (" number_of_event_types=%d",
- number_of_event_types));
- /* this makes is_valid() return false. */
- my_free(post_header_len);
- post_header_len= NULL;
- DBUG_VOID_RETURN;
- }
- static const uint8 perm[23]=
- {
- UNKNOWN_EVENT, START_EVENT_V3, QUERY_EVENT, STOP_EVENT, ROTATE_EVENT,
- INTVAR_EVENT, LOAD_EVENT, SLAVE_EVENT, CREATE_FILE_EVENT,
- APPEND_BLOCK_EVENT, EXEC_LOAD_EVENT, DELETE_FILE_EVENT,
- NEW_LOAD_EVENT,
- RAND_EVENT, USER_VAR_EVENT,
- FORMAT_DESCRIPTION_EVENT,
- TABLE_MAP_EVENT,
- PRE_GA_WRITE_ROWS_EVENT,
- PRE_GA_UPDATE_ROWS_EVENT,
- PRE_GA_DELETE_ROWS_EVENT,
- XID_EVENT,
- BEGIN_LOAD_QUERY_EVENT,
- EXECUTE_LOAD_QUERY_EVENT,
- };
- event_type_permutation= perm;
- /*
- Since we use (permuted) event id's to index the post_header_len
- array, we need to permute the post_header_len array too.
- */
- uint8 post_header_len_temp[23];
- for (int i= 1; i < 23; i++)
- post_header_len_temp[perm[i] - 1]= post_header_len[i - 1];
- for (int i= 0; i < 22; i++)
- post_header_len[i] = post_header_len_temp[i];
- }
DBUG_VOID_RETURN;
}
@@ -4828,10 +4730,21 @@ do_server_version_split(char* version,
for (uint i= 0; i<=2; i++)
{
number= strtoul(p, &r, 10);
- split_versions->ver[i]= (uchar) number;
- DBUG_ASSERT(number < 256); // fit in uchar
+ /*
+ It is an invalid version if any version number greater than 255 or
+ first number is not followed by '.'.
+ */
+ if (number < 256 && (*r == '.' || i != 0))
+ split_versions->ver[i]= (uchar) number;
+ else
+ {
+ split_versions->ver[0]= 0;
+ split_versions->ver[1]= 0;
+ split_versions->ver[2]= 0;
+ break;
+ }
+
p= r;
- DBUG_ASSERT(!((i == 0) && (*r != '.'))); // should be true in practice
if (*r == '.')
p++; // skip the dot
}
@@ -4849,7 +4762,6 @@ do_server_version_split(char* version,
into 'server_version_split':
X.Y.Zabc (X,Y,Z numbers, a not a digit) -> {X,Y,Z}
X.Yabc -> {X,Y,0}
- Xabc -> {X,0,0}
'server_version_split' is then used for lookups to find if the server which
created this event has some known bug.
*/
diff --git a/sql/log_event.h b/sql/log_event.h
index ff13cab9cd5..be63304b529 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -551,7 +552,7 @@ struct sql_ex_info
/* Shouldn't be defined before */
#define EXPECTED_OPTIONS \
- ((ULL(1) << 14) | (ULL(1) << 26) | (ULL(1) << 27) | (ULL(1) << 19))
+ ((1ULL << 14) | (1ULL << 26) | (1ULL << 27) | (1ULL << 19))
#if OPTIONS_WRITTEN_TO_BIN_LOG != EXPECTED_OPTIONS
#error OPTIONS_WRITTEN_TO_BIN_LOG must NOT change their values!
@@ -1127,7 +1128,7 @@ public:
return thd ? thd->db : 0;
}
#else
- Log_event() : temp_buf(0) {}
+ Log_event() : temp_buf(0), flags(0) {}
/* avoid having to link mysqlbinlog against libpthread */
static Log_event* read_log_event(IO_CACHE* file,
const Format_description_log_event
@@ -2464,12 +2465,26 @@ public:
#ifdef MYSQL_SERVER
bool write(IO_CACHE* file);
#endif
- bool is_valid() const
+ bool header_is_valid() const
{
return ((common_header_len >= ((binlog_version==1) ? OLD_HEADER_LEN :
LOG_EVENT_MINIMAL_HEADER_LEN)) &&
(post_header_len != NULL));
}
+
+ bool version_is_valid() const
+ {
+ /* It is invalid only when all version numbers are 0 */
+ return !(server_version_split.ver[0] == 0 &&
+ server_version_split.ver[1] == 0 &&
+ server_version_split.ver[2] == 0);
+ }
+
+ bool is_valid() const
+ {
+ return header_is_valid() && version_is_valid();
+ }
+
int get_data_size()
{
/*
diff --git a/sql/mdl.cc b/sql/mdl.cc
index a18df0fede1..9402de02c36 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -85,7 +85,8 @@ PSI_stage_info MDL_key::m_namespace_to_wait_state_name[NAMESPACE_END]=
{0, "Waiting for stored procedure metadata lock", 0},
{0, "Waiting for trigger metadata lock", 0},
{0, "Waiting for event metadata lock", 0},
- {0, "Waiting for commit lock", 0}
+ {0, "Waiting for commit lock", 0},
+ {0, "User lock"} /* Be compatible with old status. */
};
#ifdef HAVE_PSI_INTERFACE
@@ -124,6 +125,7 @@ public:
void init();
void destroy();
MDL_lock *find_or_insert(const MDL_key *key);
+ unsigned long get_lock_owner(const MDL_key *key);
void remove(MDL_lock *lock);
private:
bool move_from_hash_to_lock_mutex(MDL_lock *lock);
@@ -399,6 +401,7 @@ public:
bool ignore_lock_priority) const;
inline static MDL_lock *create(const MDL_key *key);
+ inline unsigned long get_lock_owner() const;
void reschedule_waiters();
@@ -874,6 +877,43 @@ bool MDL_map::move_from_hash_to_lock_mutex(MDL_lock *lock)
/**
+ * Return thread id of the owner of the lock, if it is owned.
+ */
+
+unsigned long
+MDL_map::get_lock_owner(const MDL_key *mdl_key)
+{
+ MDL_lock *lock;
+ unsigned long res= 0;
+
+ if (mdl_key->mdl_namespace() == MDL_key::GLOBAL ||
+ mdl_key->mdl_namespace() == MDL_key::COMMIT)
+ {
+ lock= (mdl_key->mdl_namespace() == MDL_key::GLOBAL) ? m_global_lock :
+ m_commit_lock;
+ mysql_prlock_rdlock(&lock->m_rwlock);
+ res= lock->get_lock_owner();
+ mysql_prlock_unlock(&lock->m_rwlock);
+ }
+ else
+ {
+ my_hash_value_type hash_value= my_calc_hash(&m_locks,
+ mdl_key->ptr(),
+ mdl_key->length());
+ mysql_mutex_lock(&m_mutex);
+ lock= (MDL_lock*) my_hash_search_using_hash_value(&m_locks,
+ hash_value,
+ mdl_key->ptr(),
+ mdl_key->length());
+ if (lock)
+ res= lock->get_lock_owner();
+ mysql_mutex_unlock(&m_mutex);
+ }
+ return res;
+}
+
+
+/**
Destroy MDL_lock object or delegate this responsibility to
whatever thread that holds the last outstanding reference to
it.
@@ -1638,6 +1678,23 @@ MDL_lock::can_grant_lock(enum_mdl_type type_arg,
}
+/**
+ Return thread id of the thread to which the first ticket was
+ granted.
+*/
+
+inline unsigned long
+MDL_lock::get_lock_owner() const
+{
+ Ticket_iterator it(m_granted);
+ MDL_ticket *ticket;
+
+ if ((ticket= it++))
+ return thd_get_thread_id(ticket->get_ctx()->get_thd());
+ return 0;
+}
+
+
/** Remove a ticket from waiting or pending queue and wakeup up waiters. */
void MDL_lock::remove_ticket(Ticket_list MDL_lock::*list, MDL_ticket *ticket)
@@ -2111,31 +2168,37 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
find_deadlock();
- if (lock->needs_notification(ticket))
+ struct timespec abs_shortwait;
+ set_timespec(abs_shortwait, 1);
+ wait_status= MDL_wait::EMPTY;
+
+ while (cmp_timespec(abs_shortwait, abs_timeout) <= 0)
{
- struct timespec abs_shortwait;
- set_timespec(abs_shortwait, 1);
- wait_status= MDL_wait::EMPTY;
+ /* abs_timeout is far away. Wait a short while and notify locks. */
+ wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE,
+ mdl_request->key.get_wait_state_name());
- while (cmp_timespec(abs_shortwait, abs_timeout) <= 0)
+ if (wait_status != MDL_wait::EMPTY)
+ break;
+ /* Check if the client is gone while we were waiting. */
+ if (! thd_is_connected(m_thd))
{
- /* abs_timeout is far away. Wait a short while and notify locks. */
- wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE,
- mdl_request->key.get_wait_state_name());
-
- if (wait_status != MDL_wait::EMPTY)
- break;
+ /*
+ * The client is disconnected. Don't wait forever:
+ * assume it's the same as a wait timeout, this
+ * ensures all error handling is correct.
+ */
+ wait_status= MDL_wait::TIMEOUT;
+ break;
+ }
- mysql_prlock_wrlock(&lock->m_rwlock);
+ mysql_prlock_wrlock(&lock->m_rwlock);
+ if (lock->needs_notification(ticket))
lock->notify_conflicting_locks(this);
- mysql_prlock_unlock(&lock->m_rwlock);
- set_timespec(abs_shortwait, 1);
- }
- if (wait_status == MDL_wait::EMPTY)
- wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
- mdl_request->key.get_wait_state_name());
+ mysql_prlock_unlock(&lock->m_rwlock);
+ set_timespec(abs_shortwait, 1);
}
- else
+ if (wait_status == MDL_wait::EMPTY)
wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
mdl_request->key.get_wait_state_name());
@@ -2630,7 +2693,7 @@ void MDL_context::release_lock(MDL_ticket *ticket)
the corresponding lists, i.e. stored in reverse temporal order.
This allows to employ this function to:
- back off in case of a lock conflict.
- - release all locks in the end of a statment or transaction
+ - release all locks in the end of a statement or transaction
- rollback to a savepoint.
*/
@@ -2742,6 +2805,22 @@ MDL_context::is_lock_owner(MDL_key::enum_mdl_namespace mdl_namespace,
/**
+ Return thread id of the owner of the lock or 0 if
+ there is no owner.
+ @note: Lock type is not considered at all, the function
+ simply checks that there is some lock for the given key.
+
+ @return thread id of the owner of the lock or 0
+*/
+
+unsigned long
+MDL_context::get_lock_owner(MDL_key *key)
+{
+ return mdl_locks.get_lock_owner(key);
+}
+
+
+/**
Check if we have any pending locks which conflict with existing shared lock.
@pre The ticket must match an acquired lock.
@@ -2754,6 +2833,11 @@ bool MDL_ticket::has_pending_conflicting_lock() const
return m_lock->has_pending_conflicting_lock(m_type);
}
+/** Return a key identifying this lock. */
+MDL_key *MDL_ticket::get_key() const
+{
+ return &m_lock->key;
+}
/**
Releases metadata locks that were acquired after a specific savepoint.
diff --git a/sql/mdl.h b/sql/mdl.h
index 477f4df7807..944c6bb6349 100644
--- a/sql/mdl.h
+++ b/sql/mdl.h
@@ -234,6 +234,7 @@ public:
TRIGGER,
EVENT,
COMMIT,
+ USER_LOCK, /* user level locks. */
/* This should be the last ! */
NAMESPACE_END };
@@ -264,8 +265,14 @@ public:
const char *db, const char *name)
{
m_ptr[0]= (char) mdl_namespace;
- m_db_name_length= (uint16) (strmov(m_ptr + 1, db) - m_ptr - 1);
- m_length= (uint16) (strmov(m_ptr + m_db_name_length + 2, name) - m_ptr + 1);
+ /*
+ It is responsibility of caller to ensure that db and object names
+ are not longer than NAME_LEN. Still we play safe and try to avoid
+ buffer overruns.
+ */
+ m_db_name_length= (uint16) (strmake(m_ptr + 1, db, NAME_LEN) - m_ptr - 1);
+ m_length= (uint16) (strmake(m_ptr + m_db_name_length + 2, name, NAME_LEN) -
+ m_ptr + 1);
}
void mdl_key_init(const MDL_key *rhs)
{
@@ -508,6 +515,7 @@ public:
}
enum_mdl_type get_type() const { return m_type; }
MDL_lock *get_lock() const { return m_lock; }
+ MDL_key *get_key() const;
void downgrade_exclusive_lock(enum_mdl_type type);
bool has_stronger_or_equal_type(enum_mdl_type type) const;
@@ -671,6 +679,7 @@ public:
bool is_lock_owner(MDL_key::enum_mdl_namespace mdl_namespace,
const char *db, const char *name,
enum_mdl_type mdl_type);
+ unsigned long get_lock_owner(MDL_key *mdl_key);
bool has_lock(const MDL_savepoint &mdl_savepoint, MDL_ticket *mdl_ticket);
@@ -739,9 +748,9 @@ private:
Lists of MDL tickets:
---------------------
The entire set of locks acquired by a connection can be separated
- in three subsets according to their: locks released at the end of
- statement, at the end of transaction and locks are released
- explicitly.
+ in three subsets according to their duration: locks released at
+ the end of statement, at the end of transaction and locks are
+ released explicitly.
Statement and transactional locks are locks with automatic scope.
They are accumulated in the course of a transaction, and released
@@ -750,11 +759,12 @@ private:
locks). They must not be (and never are) released manually,
i.e. with release_lock() call.
- Locks with explicit duration are taken for locks that span
+ Tickets with explicit duration are taken for locks that span
multiple transactions or savepoints.
These are: HANDLER SQL locks (HANDLER SQL is
transaction-agnostic), LOCK TABLES locks (you can COMMIT/etc
- under LOCK TABLES, and the locked tables stay locked), and
+ under LOCK TABLES, and the locked tables stay locked), user level
+ locks (GET_LOCK()/RELEASE_LOCK() functions) and
locks implementing "global read lock".
Statement/transactional locks are always prepended to the
@@ -763,20 +773,19 @@ private:
a savepoint, we start popping and releasing tickets from the
front until we reach the last ticket acquired after the savepoint.
- Locks with explicit duration stored are not stored in any
+ Locks with explicit duration are not stored in any
particular order, and among each other can be split into
- three sets:
+ four sets:
- [LOCK TABLES locks] [HANDLER locks] [GLOBAL READ LOCK locks]
+ [LOCK TABLES locks] [USER locks] [HANDLER locks] [GLOBAL READ LOCK locks]
The following is known about these sets:
- * GLOBAL READ LOCK locks are always stored after LOCK TABLES
- locks and after HANDLER locks. This is because one can't say
- SET GLOBAL read_only=1 or FLUSH TABLES WITH READ LOCK
- if one has locked tables. One can, however, LOCK TABLES
- after having entered the read only mode. Note, that
- subsequent LOCK TABLES statement will unlock the previous
+ * GLOBAL READ LOCK locks are always stored last.
+ This is because one can't say SET GLOBAL read_only=1 or
+ FLUSH TABLES WITH READ LOCK if one has locked tables. One can,
+ however, LOCK TABLES after having entered the read only mode.
+ Note, that subsequent LOCK TABLES statement will unlock the previous
set of tables, but not the GRL!
There are no HANDLER locks after GRL locks because
SET GLOBAL read_only performs a FLUSH TABLES WITH
@@ -863,6 +872,17 @@ void mdl_destroy();
extern bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
bool needs_thr_lock_abort);
+extern "C" unsigned long thd_get_thread_id(const MYSQL_THD thd);
+
+/**
+ Check if a connection in question is no longer connected.
+
+ @details
+ Replication apply thread is always connected. Otherwise,
+ does a poll on the associated socket to check if the client
+ is gone.
+*/
+extern "C" int thd_is_connected(MYSQL_THD thd);
#ifndef DBUG_OFF
extern mysql_mutex_t LOCK_open;
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index e6cbed7eb13..b6133eac3ae 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -1648,7 +1648,7 @@ int DsMrr_impl::dsmrr_explain_info(uint mrr_mode, char *str, size_t size)
uint used_str_len= strlen(used_str);
uint copy_len= min(used_str_len, size);
- memcpy(str, used_str, size);
+ memcpy(str, used_str, copy_len);
return copy_len;
}
return 0;
diff --git a/sql/my_apc.cc b/sql/my_apc.cc
index 5d1adb6bca7..755b3890433 100644
--- a/sql/my_apc.cc
+++ b/sql/my_apc.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2011 - 2012, Monty Program Ab
+ Copyright (c) 2011, 2013 Monty Program Ab.
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
@@ -17,7 +17,6 @@
#ifndef MY_APC_STANDALONE
-#include "sql_priv.h"
#include "sql_class.h"
#endif
diff --git a/sql/my_apc.h b/sql/my_apc.h
index 7f19809c082..c84074b2da5 100644
--- a/sql/my_apc.h
+++ b/sql/my_apc.h
@@ -1,7 +1,7 @@
-#ifndef INCLUDES_MY_APC_H
-#define INCLUDES_MY_APC_H
+#ifndef SQL_MY_APC_INCLUDED
+#define SQL_MY_APC_INCLUDED
/*
- Copyright (c) 2011 - 2012, Monty Program Ab
+ Copyright (c) 2011, 2013 Monty Program Ab.
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
@@ -134,5 +134,5 @@ private:
void init_show_explain_psi_keys(void);
#endif
-#endif //INCLUDES_MY_APC_H
+#endif //SQL_MY_APC_INCLUDED
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 8e97861bbad..35f57bebd02 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -469,7 +469,7 @@ ulong delay_key_write_options;
uint protocol_version;
uint lower_case_table_names;
ulong tc_heuristic_recover= 0;
-uint volatile thread_count;
+int32 thread_count;
int32 thread_running;
ulong thread_created;
ulong back_log, connect_timeout, concurrency, server_id;
@@ -493,6 +493,7 @@ ulong executed_events=0;
query_id_t global_query_id;
my_atomic_rwlock_t global_query_id_lock;
my_atomic_rwlock_t thread_running_lock;
+my_atomic_rwlock_t thread_count_lock;
my_atomic_rwlock_t statistics_lock;
ulong aborted_threads, aborted_connects;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
@@ -667,7 +668,7 @@ SHOW_COMP_OPTION have_openssl;
pthread_key(MEM_ROOT**,THR_MALLOC);
pthread_key(THD*, THR_THD);
-mysql_mutex_t LOCK_thread_count;
+mysql_mutex_t LOCK_thread_count, LOCK_thread_cache;
mysql_mutex_t
LOCK_status, LOCK_error_log, LOCK_short_uuid_generator,
LOCK_delayed_insert, LOCK_delayed_status, LOCK_delayed_create,
@@ -835,7 +836,8 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_xid_list,
key_relay_log_info_sleep_lock,
key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
- key_LOCK_error_messages, key_LOG_INFO_lock, key_LOCK_thread_count,
+ key_LOCK_error_messages, key_LOG_INFO_lock,
+ key_LOCK_thread_count, key_LOCK_thread_cache,
key_PARTITION_LOCK_auto_inc;
PSI_mutex_key key_RELAYLOG_LOCK_index;
@@ -906,6 +908,7 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOCK_commit_ordered, "LOCK_commit_ordered", PSI_FLAG_GLOBAL},
{ &key_LOG_INFO_lock, "LOG_INFO::lock", 0},
{ &key_LOCK_thread_count, "LOCK_thread_count", PSI_FLAG_GLOBAL},
+ { &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL},
{ &key_PARTITION_LOCK_auto_inc, "HA_DATA_PARTITION::LOCK_auto_inc", 0}
};
@@ -1409,6 +1412,7 @@ static void clean_up(bool print_message);
static int test_if_case_insensitive(const char *dir_name);
#ifndef EMBEDDED_LIBRARY
+static bool pid_file_created= false;
static void usage(void);
static void start_signal_handler(void);
static void close_server_sock();
@@ -1417,6 +1421,7 @@ static void wait_for_signal_thread_to_end(void);
static void create_pid_file();
static void mysqld_exit(int exit_code) __attribute__((noreturn));
#endif
+static void delete_pid_file(myf flags);
static void end_ssl();
@@ -1574,7 +1579,7 @@ static void close_connections(void)
end_slave();
/* Give threads time to die. */
- for (int i= 0; thread_count && i < 100; i++)
+ for (int i= 0; *(volatile int32*) &thread_count && i < 100; i++)
my_sleep(20000);
/*
@@ -1915,10 +1920,9 @@ void clean_up(bool print_message)
#endif
query_cache_destroy();
hostname_cache_free();
- item_user_lock_free();
+ item_func_sleep_free();
lex_free(); /* Free some memory */
item_create_cleanup();
- free_charsets();
if (!opt_noacl)
{
#ifdef HAVE_DLOPEN
@@ -1965,10 +1969,8 @@ void clean_up(bool print_message)
debug_sync_end();
#endif /* defined(ENABLED_DEBUG_SYNC) */
-#if !defined(EMBEDDED_LIBRARY)
- if (!opt_bootstrap)
- mysql_file_delete(key_file_pid, pidfile_name, MYF(0)); // This may not always exist
-#endif
+ delete_pid_file(MYF(0));
+
if (print_message && my_default_lc_messages && server_start_time)
sql_print_information(ER_DEFAULT(ER_SHUTDOWN_COMPLETE),my_progname);
cleanup_errmsgs();
@@ -1982,7 +1984,9 @@ void clean_up(bool print_message)
sys_var_end();
my_atomic_rwlock_destroy(&global_query_id_lock);
my_atomic_rwlock_destroy(&thread_running_lock);
+ my_atomic_rwlock_destroy(&thread_count_lock);
my_atomic_rwlock_destroy(&statistics_lock);
+ free_charsets();
mysql_mutex_lock(&LOCK_thread_count);
DBUG_PRINT("quit", ("got thread count lock"));
ready_to_exit=1;
@@ -2026,6 +2030,7 @@ static void clean_up_mutexes()
DBUG_ENTER("clean_up_mutexes");
mysql_rwlock_destroy(&LOCK_grant);
mysql_mutex_destroy(&LOCK_thread_count);
+ mysql_mutex_destroy(&LOCK_thread_cache);
mysql_mutex_destroy(&LOCK_status);
mysql_mutex_destroy(&LOCK_delayed_insert);
mysql_mutex_destroy(&LOCK_delayed_status);
@@ -2276,8 +2281,27 @@ static MYSQL_SOCKET activate_tcp_port(uint port)
{
ip_sock= mysql_socket_socket(key_socket_tcpip, a->ai_family,
a->ai_socktype, a->ai_protocol);
- if (mysql_socket_getfd(ip_sock) != INVALID_SOCKET)
+
+ char ip_addr[INET6_ADDRSTRLEN];
+ if (vio_get_normalized_ip_string(a->ai_addr, a->ai_addrlen,
+ ip_addr, sizeof (ip_addr)))
+ {
+ ip_addr[0]= 0;
+ }
+
+ if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
+ {
+ sql_print_error("Failed to create a socket for %s '%s': errno: %d.",
+ (a->ai_family == AF_INET) ? "IPv4" : "IPv6",
+ (const char *) ip_addr,
+ (int) socket_errno);
+ }
+ else
+ {
+ sql_print_information("Server socket created on IP: '%s'.",
+ (const char *) ip_addr);
break;
+ }
}
if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
@@ -2514,7 +2538,7 @@ void close_connection(THD *thd, uint sql_errno)
{
sleep(0); /* Workaround to avoid tailcall optimisation */
}
- MYSQL_AUDIT_NOTIFY_CONNECTION_DISCONNECT(thd, sql_errno);
+ mysql_audit_notify_connection_disconnect(thd, sql_errno);
DBUG_VOID_RETURN;
}
#endif /* EMBEDDED_LIBRARY */
@@ -2561,6 +2585,28 @@ void dec_connection_count(THD *thd)
/*
+ Delete THD and decrement thread counters, including thread_running
+*/
+
+void delete_running_thd(THD *thd)
+{
+ mysql_mutex_lock(&LOCK_thread_count);
+ thd->unlink();
+ mysql_mutex_unlock(&LOCK_thread_count);
+
+ delete thd;
+ dec_thread_running();
+ thread_safe_decrement32(&thread_count, &thread_count_lock);
+ if (!thread_count)
+ {
+ mysql_mutex_lock(&LOCK_thread_count);
+ mysql_cond_broadcast(&COND_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
+ }
+}
+
+
+/*
Unlink thd from global list of available connections and free thd
SYNOPSIS
@@ -2584,7 +2630,6 @@ void unlink_thd(THD *thd)
mysql_mutex_unlock(&LOCK_status);
mysql_mutex_lock(&LOCK_thread_count);
- thread_count--;
thd->unlink();
/*
Used by binlog_reset_master. It would be cleaner to use
@@ -2592,13 +2637,11 @@ void unlink_thd(THD *thd)
sync feature has been shut down at this point.
*/
DBUG_EXECUTE_IF("sleep_after_lock_thread_count_before_delete_thd", sleep(5););
- /*
- We must delete thd inside the lock to ensure that we don't start cleanup
- before THD is deleted
- */
- delete thd;
mysql_mutex_unlock(&LOCK_thread_count);
+ delete thd;
+ thread_safe_decrement32(&thread_count, &thread_count_lock);
+
DBUG_VOID_RETURN;
}
@@ -2610,7 +2653,7 @@ void unlink_thd(THD *thd)
cache_thread()
NOTES
- LOCK_thread_count has to be locked
+ LOCK_thread_cache is used to protect the cache variables
RETURN
0 Thread was not put in cache
@@ -2621,7 +2664,9 @@ void unlink_thd(THD *thd)
static bool cache_thread()
{
- mysql_mutex_assert_owner(&LOCK_thread_count);
+ DBUG_ENTER("cache_thread");
+
+ mysql_mutex_lock(&LOCK_thread_cache);
if (cached_thread_count < thread_cache_size &&
! abort_loop && !kill_cached_threads)
{
@@ -2638,7 +2683,7 @@ static bool cache_thread()
#endif
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
- mysql_cond_wait(&COND_thread_cache, &LOCK_thread_count);
+ mysql_cond_wait(&COND_thread_cache, &LOCK_thread_cache);
cached_thread_count--;
if (kill_cached_threads)
mysql_cond_signal(&COND_flush_thread_cache);
@@ -2647,6 +2692,8 @@ static bool cache_thread()
THD *thd;
wake_thread--;
thd= thread_cache.get();
+ mysql_mutex_unlock(&LOCK_thread_cache);
+
thd->thread_stack= (char*) &thd; // For store_globals
(void) thd->store_globals();
@@ -2668,11 +2715,16 @@ static bool cache_thread()
thd->mysys_var->abort= 0;
thd->thr_create_utime= microsecond_interval_timer();
thd->start_utime= thd->thr_create_utime;
+
+ /* Link thd into list of all active threads (THD's) */
+ mysql_mutex_lock(&LOCK_thread_count);
threads.append(thd);
- return(1);
+ mysql_mutex_unlock(&LOCK_thread_count);
+ DBUG_RETURN(1);
}
}
- return(0);
+ mysql_mutex_unlock(&LOCK_thread_cache);
+ DBUG_RETURN(0);
}
@@ -2701,19 +2753,22 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
unlink_thd(thd);
/* Mark that current_thd is not valid anymore */
set_current_thd(0);
- if (put_in_cache)
+ if (put_in_cache && cache_thread())
+ DBUG_RETURN(0); // Thread is reused
+
+ /*
+ It's safe to check for thread_count outside of the mutex
+ as we are only interested to see if it was counted to 0 by the
+ above unlink_thd() call. We should only signal COND_thread_count if
+ thread_count is likely to be 0. (false positives are ok)
+ */
+ if (!thread_count)
{
mysql_mutex_lock(&LOCK_thread_count);
- put_in_cache= cache_thread();
+ DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
+ mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
- if (put_in_cache)
- DBUG_RETURN(0); // Thread is reused
}
-
- /* It's safe to broadcast outside a lock (COND... is not deleted here) */
- DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
- mysql_cond_broadcast(&COND_thread_count);
-
DBUG_LEAVE; // Must match DBUG_ENTER()
my_thread_end();
@@ -2724,15 +2779,17 @@ bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
void flush_thread_cache()
{
- mysql_mutex_lock(&LOCK_thread_count);
+ DBUG_ENTER("flush_thread_cache");
+ mysql_mutex_lock(&LOCK_thread_cache);
kill_cached_threads++;
while (cached_thread_count)
{
mysql_cond_broadcast(&COND_thread_cache);
- mysql_cond_wait(&COND_flush_thread_cache, &LOCK_thread_count);
+ mysql_cond_wait(&COND_flush_thread_cache, &LOCK_thread_cache);
}
kill_cached_threads--;
- mysql_mutex_unlock(&LOCK_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_cache);
+ DBUG_VOID_RETURN;
}
@@ -3322,14 +3379,7 @@ pthread_handler_t handle_shutdown(void *arg)
}
#endif
-const char *load_default_groups[]= {
-#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-"mysql_cluster",
-#endif
-"mysqld", "server", MYSQL_BASE_VERSION,
-"mariadb", MARIADB_BASE_VERSION,
-"client-server",
-0, 0};
+#include <mysqld_default_groups.h>
#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
static const int load_default_groups_sz=
@@ -4136,6 +4186,7 @@ static int init_thread_environment()
{
DBUG_ENTER("init_thread_environment");
mysql_mutex_init(key_LOCK_thread_count, &LOCK_thread_count, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(key_LOCK_thread_cache, &LOCK_thread_cache, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_status, &LOCK_status, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_LOCK_delayed_insert,
&LOCK_delayed_insert, MY_MUTEX_INIT_FAST);
@@ -5149,9 +5200,7 @@ int mysqld_main(int argc, char **argv)
(void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
-
- if (!opt_bootstrap)
- mysql_file_delete(key_file_pid, pidfile_name, MYF(MY_WME)); // Not needed anymore
+ delete_pid_file(MYF(MY_WME));
if (mysql_socket_getfd(unix_sock) != INVALID_SOCKET)
unlink(mysqld_unix_port);
@@ -5537,7 +5586,7 @@ static void bootstrap(MYSQL_FILE *file)
thd->max_client_packet_length= thd->net.max_packet;
thd->security_ctx->master_access= ~(ulong)0;
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
- thread_count++;
+ thread_count++; // Safe as only one thread running
in_bootstrap= TRUE;
bootstrap_file=file;
@@ -5618,54 +5667,69 @@ void handle_connection_in_main_thread(THD *thd)
void create_thread_to_handle_connection(THD *thd)
{
+ DBUG_ENTER("create_thread_to_handle_connection");
+ mysql_mutex_assert_owner(&LOCK_thread_count);
+
+ /* Check if we can get thread from the cache */
if (cached_thread_count > wake_thread)
{
- /* Get thread from cache */
- thread_cache.push_back(thd);
- wake_thread++;
- mysql_cond_signal(&COND_thread_cache);
- }
- else
- {
- char error_message_buff[MYSQL_ERRMSG_SIZE];
- /* Create new thread to handle connection */
- int error;
- thread_created++;
- threads.append(thd);
- DBUG_PRINT("info",(("creating thread %lu"), thd->thread_id));
- thd->prior_thr_create_utime= microsecond_interval_timer();
- if ((error= mysql_thread_create(key_thread_one_connection,
- &thd->real_id, &connection_attrib,
- handle_one_connection,
- (void*) thd)))
+ mysql_mutex_lock(&LOCK_thread_cache);
+ /* Recheck condition when we have the lock */
+ if (cached_thread_count > wake_thread)
{
- /* purecov: begin inspected */
- DBUG_PRINT("error",
- ("Can't create thread to handle request (error %d)",
- error));
- thread_count--;
- thd->killed= KILL_CONNECTION; // Safety
mysql_mutex_unlock(&LOCK_thread_count);
+ /* Get thread from cache */
+ thread_cache.push_back(thd);
+ wake_thread++;
+ mysql_cond_signal(&COND_thread_cache);
+ mysql_mutex_unlock(&LOCK_thread_cache);
+ DBUG_PRINT("info",("Thread created"));
+ DBUG_VOID_RETURN;
+ }
+ mysql_mutex_unlock(&LOCK_thread_cache);
+ }
- mysql_mutex_lock(&LOCK_connection_count);
- (*thd->scheduler->connection_count)--;
- mysql_mutex_unlock(&LOCK_connection_count);
+ char error_message_buff[MYSQL_ERRMSG_SIZE];
+ /* Create new thread to handle connection */
+ int error;
+ thread_created++;
+ threads.append(thd);
+ DBUG_PRINT("info",(("creating thread %lu"), thd->thread_id));
+ thd->prior_thr_create_utime= microsecond_interval_timer();
+ if ((error= mysql_thread_create(key_thread_one_connection,
+ &thd->real_id, &connection_attrib,
+ handle_one_connection,
+ (void*) thd)))
+ {
+ /* purecov: begin inspected */
+ DBUG_PRINT("error",
+ ("Can't create thread to handle request (error %d)",
+ error));
+ thd->killed= KILL_CONNECTION; // Safety
+ mysql_mutex_unlock(&LOCK_thread_count);
- statistic_increment(aborted_connects,&LOCK_status);
- /* Can't use my_error() since store_globals has not been called. */
- my_snprintf(error_message_buff, sizeof(error_message_buff),
- ER_THD(thd, ER_CANT_CREATE_THREAD), error);
- net_send_error(thd, ER_CANT_CREATE_THREAD, error_message_buff, NULL);
- close_connection(thd, ER_OUT_OF_RESOURCES);
- mysql_mutex_lock(&LOCK_thread_count);
- delete thd;
- mysql_mutex_unlock(&LOCK_thread_count);
- return;
- /* purecov: end */
- }
+ mysql_mutex_lock(&LOCK_connection_count);
+ (*thd->scheduler->connection_count)--;
+ mysql_mutex_unlock(&LOCK_connection_count);
+
+ statistic_increment(aborted_connects,&LOCK_status);
+ /* Can't use my_error() since store_globals has not been called. */
+ my_snprintf(error_message_buff, sizeof(error_message_buff),
+ ER_THD(thd, ER_CANT_CREATE_THREAD), error);
+ net_send_error(thd, ER_CANT_CREATE_THREAD, error_message_buff, NULL);
+ close_connection(thd, ER_OUT_OF_RESOURCES);
+
+ mysql_mutex_lock(&LOCK_thread_count);
+ thd->unlink();
+ mysql_mutex_unlock(&LOCK_thread_count);
+ delete thd;
+ thread_safe_decrement32(&thread_count, &thread_count_lock);
+ return;
+ /* purecov: end */
}
mysql_mutex_unlock(&LOCK_thread_count);
DBUG_PRINT("info",("Thread created"));
+ DBUG_VOID_RETURN;
}
@@ -5712,10 +5776,10 @@ static void create_new_thread(THD *thd)
mysql_mutex_unlock(&LOCK_connection_count);
- /* Start a new thread to handle connection. */
+ thread_safe_increment32(&thread_count, &thread_count_lock);
+ /* Start a new thread to handle connection. */
mysql_mutex_lock(&LOCK_thread_count);
-
/*
The initialization of thread_id is done in create_embedded_thd() for
the embedded library.
@@ -5723,8 +5787,6 @@ static void create_new_thread(THD *thd)
*/
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
- thread_count++;
-
MYSQL_CALLBACK(thd->scheduler, add_connection, (thd));
DBUG_VOID_RETURN;
@@ -5941,21 +6003,6 @@ void handle_connections_sockets()
}
#endif /* HAVE_LIBWRAP */
- {
- size_socket dummyLen;
- struct sockaddr_storage dummy;
- dummyLen = sizeof(dummy);
- if (getsockname(mysql_socket_getfd(new_sock),
- (struct sockaddr *)&dummy,
- (SOCKET_SIZE_TYPE *)&dummyLen) < 0 )
- {
- sql_perror("Error on new connection socket");
- (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
- (void) mysql_socket_close(new_sock);
- continue;
- }
- }
-
/*
** Don't allow too many connections
*/
@@ -7376,8 +7423,8 @@ SHOW_VAR status_vars[]= {
{"Feature_locale", (char*) offsetof(STATUS_VAR, feature_locale), SHOW_LONG_STATUS},
{"Feature_subquery", (char*) offsetof(STATUS_VAR, feature_subquery), SHOW_LONG_STATUS},
{"Feature_timezone", (char*) offsetof(STATUS_VAR, feature_timezone), SHOW_LONG_STATUS},
- {"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
- {"Feature_xml", (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS},
+ {"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
+ {"Feature_xml", (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS},
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_NOFLUSH},
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
@@ -7386,8 +7433,8 @@ SHOW_VAR status_vars[]= {
{"Handler_icp_attempts", (char*) offsetof(STATUS_VAR, ha_icp_attempts), SHOW_LONG_STATUS},
{"Handler_icp_match", (char*) offsetof(STATUS_VAR, ha_icp_match), SHOW_LONG_STATUS},
{"Handler_mrr_init", (char*) offsetof(STATUS_VAR, ha_mrr_init_count), SHOW_LONG_STATUS},
- {"Handler_mrr_key_refills", (char*) offsetof(STATUS_VAR, ha_mrr_key_refills_count), SHOW_LONG_STATUS},
- {"Handler_mrr_rowid_refills", (char*) offsetof(STATUS_VAR, ha_mrr_rowid_refills_count), SHOW_LONG_STATUS},
+ {"Handler_mrr_key_refills", (char*) offsetof(STATUS_VAR, ha_mrr_key_refills_count), SHOW_LONG_STATUS},
+ {"Handler_mrr_rowid_refills",(char*) offsetof(STATUS_VAR, ha_mrr_rowid_refills_count), SHOW_LONG_STATUS},
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
@@ -7414,9 +7461,10 @@ SHOW_VAR status_vars[]= {
{"Open_table_definitions", (char*) &show_table_definitions, SHOW_SIMPLE_FUNC},
{"Open_tables", (char*) &show_open_tables, SHOW_SIMPLE_FUNC},
{"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
+ {"Opened_plugin_libraries", (char*) &dlopen_count, SHOW_LONG},
{"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS},
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
- {"Opened_views", (char*) offsetof(STATUS_VAR, opened_views), SHOW_LONG_STATUS},
+ {"Opened_views", (char*) offsetof(STATUS_VAR, opened_views), SHOW_LONG_STATUS},
{"Prepared_stmt_count", (char*) &show_prepared_stmt_count, SHOW_SIMPLE_FUNC},
{"Rows_sent", (char*) offsetof(STATUS_VAR, rows_sent), SHOW_LONGLONG_STATUS},
{"Rows_read", (char*) offsetof(STATUS_VAR, rows_read), SHOW_LONGLONG_STATUS},
@@ -7710,12 +7758,13 @@ static int mysql_init_variables(void)
log_error_file_ptr= log_error_file;
protocol_version= PROTOCOL_VERSION;
what_to_log= ~ (1L << (uint) COM_TIME);
- refresh_version= 1L; /* Increments on each reload */
+ refresh_version= 2L; /* Increments on each reload. 0 and 1 are reserved */
denied_connections= 0;
executed_events= 0;
global_query_id= thread_id= 1L;
my_atomic_rwlock_init(&global_query_id_lock);
my_atomic_rwlock_init(&thread_running_lock);
+ my_atomic_rwlock_init(&thread_count_lock);
my_atomic_rwlock_init(&statistics_lock);
strmov(server_version, MYSQL_SERVER_VERSION);
threads.empty();
@@ -8084,28 +8133,6 @@ mysqld_get_one_option(int optid,
case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL;
break;
- case (int) OPT_BIND_ADDRESS:
- {
- struct addrinfo *res_lst, hints;
-
- bzero(&hints, sizeof(struct addrinfo));
- hints.ai_socktype= SOCK_STREAM;
- hints.ai_protocol= IPPROTO_TCP;
-
- if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0)
- {
- sql_print_error("Can't start server: cannot resolve hostname!");
- return 1;
- }
-
- if (res_lst->ai_next)
- {
- sql_print_error("Can't start server: bind-address refers to multiple interfaces!");
- return 1;
- }
- freeaddrinfo(res_lst);
- }
- break;
case OPT_CONSOLE:
if (opt_console)
opt_error_log= 0; // Force logs to stdout
@@ -8418,7 +8445,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
global_system_variables.sql_mode=
expand_sql_mode(global_system_variables.sql_mode);
-#if defined(HAVE_BROKEN_REALPATH)
+#if !defined(HAVE_REALPATH) || defined(HAVE_BROKEN_REALPATH)
my_use_symdir=0;
my_disable_symlinks=1;
have_symlink=SHOW_OPTION_NO;
@@ -8805,13 +8832,14 @@ static void create_pid_file()
if ((file= mysql_file_create(key_file_pid, pidfile_name, 0664,
O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0)
{
- char buff[21], *end;
+ char buff[MAX_BIGINT_WIDTH + 1], *end;
end= int10_to_str((long) getpid(), buff, 10);
*end++= '\n';
if (!mysql_file_write(file, (uchar*) buff, (uint) (end-buff),
MYF(MY_WME | MY_NABP)))
{
mysql_file_close(file, MYF(0));
+ pid_file_created= true;
return;
}
mysql_file_close(file, MYF(0));
@@ -8821,6 +8849,26 @@ static void create_pid_file()
}
#endif /* EMBEDDED_LIBRARY */
+
+/**
+ Remove the process' pid file.
+
+ @param flags file operation flags
+*/
+
+static void delete_pid_file(myf flags)
+{
+#ifndef EMBEDDED_LIBRARY
+ if (pid_file_created)
+ {
+ mysql_file_delete(key_file_pid, pidfile_name, flags);
+ pid_file_created= false;
+ }
+#endif /* EMBEDDED_LIBRARY */
+ return;
+}
+
+
/** Clear most status variables. */
void refresh_status(THD *thd)
{
@@ -8844,13 +8892,9 @@ void refresh_status(THD *thd)
/*
Set max_used_connections to the number of currently open
- connections. Lock LOCK_thread_count out of LOCK_status to avoid
- deadlocks. Status reset becomes not atomic, but status data is
- not exact anyway.
+ connections. This is not perfect, but status data is not exact anyway.
*/
- mysql_mutex_lock(&LOCK_thread_count);
max_used_connections= thread_count-delayed_insert_threads;
- mysql_mutex_unlock(&LOCK_thread_count);
}
#ifdef HAVE_PSI_INTERFACE
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 716423f9bd2..7e4295365ce 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -57,6 +57,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_running_thd(THD *thd);
void unlink_thd(THD *thd);
bool one_thread_per_connection_end(THD *thd, bool put_in_cache);
void flush_thread_cache();
@@ -90,7 +91,6 @@ extern bool opt_ignore_builtin_innodb;
extern my_bool opt_character_set_client_handshake;
extern bool volatile abort_loop;
extern bool in_bootstrap;
-extern uint volatile thread_count;
extern uint connection_count;
extern my_bool opt_safe_user_create;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
@@ -466,7 +466,7 @@ extern MYSQL_PLUGIN_IMPORT key_map key_map_full; /* Should be threaded
Server mutex locks and condition variables.
*/
extern mysql_mutex_t
- LOCK_user_locks, LOCK_status,
+ LOCK_item_func_sleep, LOCK_status,
LOCK_error_log, LOCK_delayed_insert, LOCK_short_uuid_generator,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager,
@@ -483,7 +483,8 @@ extern mysql_rwlock_t LOCK_system_variables_hash;
extern mysql_cond_t COND_thread_count;
extern mysql_cond_t COND_manager;
extern int32 thread_running;
-extern my_atomic_rwlock_t thread_running_lock;
+extern int32 thread_count;
+extern my_atomic_rwlock_t thread_running_lock, thread_count_lock;
extern char *opt_ssl_ca, *opt_ssl_capath, *opt_ssl_cert, *opt_ssl_cipher,
*opt_ssl_key, *opt_ssl_crl, *opt_ssl_crlpath;
@@ -585,7 +586,7 @@ inline query_id_t next_query_id()
my_atomic_rwlock_wrlock(&global_query_id_lock);
id= my_atomic_add64(&global_query_id, 1);
my_atomic_rwlock_wrunlock(&global_query_id_lock);
- return (id+1);
+ return (id);
}
inline query_id_t get_query_id()
@@ -615,42 +616,30 @@ inline void table_case_convert(char * name, uint length)
name, length, name, length);
}
-inline ulong sql_rnd_with_mutex()
+inline void thread_safe_increment32(int32 *value, my_atomic_rwlock_t *lock)
{
- mysql_mutex_lock(&LOCK_thread_count);
- ulong tmp=(ulong) (my_rnd(&sql_rand) * 0xffffffff); /* make all bits random */
- mysql_mutex_unlock(&LOCK_thread_count);
- return tmp;
+ my_atomic_rwlock_wrlock(lock);
+ (void) my_atomic_add32(value, 1);
+ my_atomic_rwlock_wrunlock(lock);
}
-inline int32
-inc_thread_running()
+inline void thread_safe_decrement32(int32 *value, my_atomic_rwlock_t *lock)
{
- int32 num_thread_running;
- my_atomic_rwlock_wrlock(&thread_running_lock);
- num_thread_running= my_atomic_add32(&thread_running, 1);
- my_atomic_rwlock_wrunlock(&thread_running_lock);
- return (num_thread_running+1);
+ my_atomic_rwlock_wrlock(lock);
+ (void) my_atomic_add32(value, -1);
+ my_atomic_rwlock_wrunlock(lock);
}
-inline int32
-dec_thread_running()
+inline void
+inc_thread_running()
{
- int32 num_thread_running;
- my_atomic_rwlock_wrlock(&thread_running_lock);
- num_thread_running= my_atomic_add32(&thread_running, -1);
- my_atomic_rwlock_wrunlock(&thread_running_lock);
- return (num_thread_running-1);
+ thread_safe_increment32(&thread_running, &thread_running_lock);
}
-inline int32
-get_thread_running()
+inline void
+dec_thread_running()
{
- int32 num_thread_running;
- my_atomic_rwlock_wrlock(&thread_running_lock);
- num_thread_running= my_atomic_load32(&thread_running);
- my_atomic_rwlock_wrunlock(&thread_running_lock);
- return num_thread_running;
+ thread_safe_decrement32(&thread_running, &thread_running_lock);
}
void set_server_version(void);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 2205d2fcab4..96354f05110 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -132,7 +132,12 @@
static int sel_cmp(Field *f,uchar *a,uchar *b,uint8 a_flag,uint8 b_flag);
-static uchar is_null_string[2]= {1,0};
+/*
+ this should be long enough so that any memcmp with a string that
+ starts from '\0' won't cross is_null_string boundaries, even
+ if the memcmp is optimized to compare 4- 8- or 16- bytes at once
+*/
+static uchar is_null_string[20]= {1,0};
class RANGE_OPT_PARAM;
/*
@@ -2000,7 +2005,7 @@ int QUICK_ROR_INTERSECT_SELECT::init()
1 error
*/
-int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
+int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
{
handler *save_file= file, *org_file;
my_bool org_key_read;
@@ -2028,7 +2033,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
DBUG_RETURN(0);
}
- if (!(file= head->file->clone(head->s->normalized_path.str, thd->mem_root)))
+ if (!(file= head->file->clone(head->s->normalized_path.str, alloc)))
{
/*
Manually set the error flag. Note: there seems to be quite a few
@@ -2129,7 +2134,8 @@ failure:
0 OK
other error code
*/
-int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
+int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler,
+ MEM_ROOT *alloc)
{
List_iterator_fast<QUICK_SELECT_WITH_RECORD> quick_it(quick_selects);
QUICK_SELECT_WITH_RECORD *cur;
@@ -2146,7 +2152,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
There is no use of this->file. Use it for the first of merged range
selects.
*/
- int error= quick->init_ror_merged_scan(TRUE);
+ int error= quick->init_ror_merged_scan(TRUE, alloc);
if (error)
DBUG_RETURN(error);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
@@ -2158,7 +2164,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
const MY_BITMAP * const save_read_set= quick->head->read_set;
const MY_BITMAP * const save_write_set= quick->head->write_set;
#endif
- if (quick->init_ror_merged_scan(FALSE))
+ if (quick->init_ror_merged_scan(FALSE, alloc))
DBUG_RETURN(1);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
@@ -2192,7 +2198,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
int QUICK_ROR_INTERSECT_SELECT::reset()
{
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::reset");
- if (!scans_inited && init_ror_merged_scan(TRUE))
+ if (!scans_inited && init_ror_merged_scan(TRUE, &alloc))
DBUG_RETURN(1);
scans_inited= TRUE;
List_iterator_fast<QUICK_SELECT_WITH_RECORD> it(quick_selects);
@@ -2329,7 +2335,7 @@ int QUICK_ROR_UNION_SELECT::reset()
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
- if (quick->init_ror_merged_scan(FALSE))
+ if (quick->init_ror_merged_scan(FALSE, &alloc))
DBUG_RETURN(1);
}
scans_inited= TRUE;
@@ -7373,8 +7379,10 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
DBUG_RETURN(tree);
}
/* Here when simple cond */
- if (cond->const_item() && !cond->is_expensive())
+ if (cond->const_item())
{
+ if (cond->is_expensive())
+ DBUG_RETURN(0);
/*
During the cond->val_int() evaluation we can come across a subselect
item which may allocate memory on the thd->mem_root and assumes
@@ -11691,7 +11699,8 @@ static bool get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
KEY_PART_INFO **first_non_infix_part);
static bool
check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
- Field::imagetype image_type);
+ Field::imagetype image_type,
+ bool *has_min_max_fld, bool *has_other_fld);
static void
cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
@@ -12031,6 +12040,13 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
else
goto next_index;
}
+ /*
+ This function is called on the precondition that the index is covering.
+ Therefore if the GROUP BY list contains more elements than the index,
+ these are duplicates. The GROUP BY list cannot be a prefix of the index.
+ */
+ if (cur_part == end_part && tmp_group)
+ goto next_index;
}
/*
Check (GA2) if this is a DISTINCT query.
@@ -12084,7 +12100,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
cur_parts have bits set for only used keyparts.
*/
ulonglong all_parts, cur_parts;
- all_parts= (1<<max_key_part) - 1;
+ all_parts= (1ULL << max_key_part) - 1;
cur_parts= used_key_parts_map.to_ulonglong() >> 1;
if (all_parts != cur_parts)
goto next_index;
@@ -12241,10 +12257,12 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
DBUG_RETURN(NULL);
/* Check (SA3) for the where clause. */
+ bool has_min_max_fld= false, has_other_fld= false;
if (join->conds && min_max_arg_item &&
!check_group_min_max_predicates(join->conds, min_max_arg_item,
(index_info->flags & HA_SPATIAL) ?
- Field::itMBR : Field::itRAW))
+ Field::itMBR : Field::itRAW,
+ &has_min_max_fld, &has_other_fld))
DBUG_RETURN(NULL);
/*
@@ -12292,16 +12310,24 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
SYNOPSIS
check_group_min_max_predicates()
- cond tree (or subtree) describing all or part of the WHERE
- clause being analyzed
- min_max_arg_item the field referenced by the MIN/MAX function(s)
- min_max_arg_part the keypart of the MIN/MAX argument if any
+ cond [in] the expression tree being analyzed
+ min_max_arg [in] the field referenced by the MIN/MAX function(s)
+ image_type [in]
+ has_min_max_arg [out] true if the subtree being analyzed references min_max_arg
+ has_other_arg [out] true if the subtree being analyzed references a column
+ other min_max_arg
DESCRIPTION
The function walks recursively over the cond tree representing a WHERE
clause, and checks condition (SA3) - if a field is referenced by a MIN/MAX
aggregate function, it is referenced only by one of the following
- predicates: {=, !=, <, <=, >, >=, between, is null, is not null}.
+ predicates $FUNC$:
+ {=, !=, <, <=, >, >=, between, is [not] null, multiple equal}.
+ In addition the function checks that the WHERE condition is equivalent to
+ "cond1 AND cond2" where :
+ cond1 - does not use min_max_column at all.
+ cond2 - is an AND/OR tree with leaves in form
+ "$FUNC$(min_max_column[, const])".
RETURN
TRUE if cond passes the test
@@ -12310,7 +12336,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
static bool
check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
- Field::imagetype image_type)
+ Field::imagetype image_type,
+ bool *has_min_max_arg, bool *has_other_arg)
{
DBUG_ENTER("check_group_min_max_predicates");
DBUG_ASSERT(cond && min_max_arg_item);
@@ -12322,12 +12349,24 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
DBUG_PRINT("info", ("Analyzing: %s", ((Item_func*) cond)->func_name()));
List_iterator_fast<Item> li(*((Item_cond*) cond)->argument_list());
Item *and_or_arg;
+ Item_func::Functype func_type= ((Item_cond*) cond)->functype();
+ bool has_min_max= false, has_other= false;
while ((and_or_arg= li++))
{
- if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item,
- image_type))
+ /*
+ The WHERE clause doesn't pass the condition if:
+ (1) any subtree doesn't pass the condition or
+ (2) the subtree passes the test, but it is an OR and it references both
+ the min/max argument and other columns.
+ */
+ if (!check_group_min_max_predicates(and_or_arg, min_max_arg_item, //1
+ image_type,
+ &has_min_max, &has_other) ||
+ (func_type == Item_func::COND_OR_FUNC && has_min_max && has_other))//2
DBUG_RETURN(FALSE);
}
+ *has_min_max_arg= has_min_max || *has_min_max_arg;
+ *has_other_arg= has_other || *has_other_arg;
DBUG_RETURN(TRUE);
}
@@ -12361,6 +12400,10 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
if (cond_type == Item::FIELD_ITEM)
{
DBUG_PRINT("info", ("Analyzing: %s", cond->full_name()));
+ if (min_max_arg_item->eq((Item_field*)cond, 1))
+ *has_min_max_arg= true;
+ else
+ *has_other_arg= true;
DBUG_RETURN(TRUE);
}
@@ -12369,9 +12412,33 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
/* Test if cond references only group-by or non-group fields. */
Item_func *pred= (Item_func*) cond;
+ Item_func::Functype pred_type= pred->functype();
+ DBUG_PRINT("info", ("Analyzing: %s", pred->func_name()));
+ if (pred_type == Item_func::MULT_EQUAL_FUNC)
+ {
+ /*
+ Check that each field in a multiple equality is either a constant or
+ it is a reference to the min/max argument, or it doesn't contain the
+ min/max argument at all.
+ */
+ Item_equal_fields_iterator eq_it(*((Item_equal*)pred));
+ Item *eq_item;
+ bool has_min_max= false, has_other= false;
+ while ((eq_item= eq_it++))
+ {
+ if (min_max_arg_item->eq(eq_item->real_item(), 1))
+ has_min_max= true;
+ else
+ has_other= true;
+ }
+ *has_min_max_arg= has_min_max || *has_min_max_arg;
+ *has_other_arg= has_other || *has_other_arg;
+ DBUG_RETURN(!(has_min_max && has_other));
+ }
+
Item **arguments= pred->arguments();
Item *cur_arg;
- DBUG_PRINT("info", ("Analyzing: %s", pred->func_name()));
+ bool has_min_max= false, has_other= false;
for (uint arg_idx= 0; arg_idx < pred->argument_count (); arg_idx++)
{
cur_arg= arguments[arg_idx]->real_item();
@@ -12380,11 +12447,11 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
{
if (min_max_arg_item->eq(cur_arg, 1))
{
- /*
- If pred references the MIN/MAX argument, check whether pred is a range
- condition that compares the MIN/MAX argument with a constant.
- */
- Item_func::Functype pred_type= pred->functype();
+ has_min_max= true;
+ /*
+ If pred references the MIN/MAX argument, check whether pred is a range
+ condition that compares the MIN/MAX argument with a constant.
+ */
if (pred_type != Item_func::EQUAL_FUNC &&
pred_type != Item_func::LT_FUNC &&
pred_type != Item_func::LE_FUNC &&
@@ -12424,14 +12491,16 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
min_max_arg_item->field->cmp_type() != args[1]->result_type())))
DBUG_RETURN(FALSE);
}
+ else
+ has_other= true;
}
else if (cur_arg->type() == Item::FUNC_ITEM)
{
- if (!check_group_min_max_predicates(cur_arg, min_max_arg_item,
- image_type))
+ if (!check_group_min_max_predicates(cur_arg, min_max_arg_item, image_type,
+ &has_min_max, &has_other))
DBUG_RETURN(FALSE);
}
- else if (cur_arg->const_item())
+ else if (cur_arg->const_item() && !cur_arg->is_expensive())
{
/*
For predicates of the form "const OP expr" we also have to check 'expr'
@@ -12441,7 +12510,11 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
}
else
DBUG_RETURN(FALSE);
+ if(has_min_max && has_other)
+ DBUG_RETURN(FALSE);
}
+ *has_min_max_arg= has_min_max || *has_min_max_arg;
+ *has_other_arg= has_other || *has_other_arg;
DBUG_RETURN(TRUE);
}
diff --git a/sql/opt_range.h b/sql/opt_range.h
index c59b2a7eb02..fff6e414ad9 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -323,7 +323,7 @@ public:
0 Ok
other Error
*/
- virtual int init_ror_merged_scan(bool reuse_handler)
+ virtual int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
{ DBUG_ASSERT(0); return 1; }
/*
@@ -473,7 +473,7 @@ public:
uchar *cur_prefix);
bool reverse_sorted() { return 0; }
bool unique_key_range();
- int init_ror_merged_scan(bool reuse_handler);
+ int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
void save_last_pos()
{ file->position(record); }
int get_type() { return QS_TYPE_RANGE; }
@@ -722,7 +722,7 @@ public:
#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
- int init_ror_merged_scan(bool reuse_handler);
+ int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
bool push_quick_back(MEM_ROOT *alloc, QUICK_RANGE_SELECT *quick_sel_range);
class QUICK_SELECT_WITH_RECORD : public Sql_alloc
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 8cd4ba08ff3..49ad8462fb4 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -666,6 +666,9 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
8. No execution method was already chosen (by a prepared statement)
9. Parent select is not a table-less select
10. Neither parent nor child select have STRAIGHT_JOIN option.
+ 11. It is first optimisation (the subquery could be moved from ON
+ clause during first optimisation and then be considered for SJ
+ on the second when it is too late)
*/
if (optimizer_flag(thd, OPTIMIZER_SWITCH_SEMIJOIN) &&
in_subs && // 1
@@ -679,7 +682,8 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
select_lex->outer_select()->leaf_tables.elements && // 9
!((join->select_options | // 10
select_lex->outer_select()->join->select_options) // 10
- & SELECT_STRAIGHT_JOIN)) // 10
+ & SELECT_STRAIGHT_JOIN) && // 10
+ select_lex->first_cond_optimization) // 11
{
DBUG_PRINT("info", ("Subquery is semi-join conversion candidate"));
@@ -1509,6 +1513,9 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
*/
parent_lex->leaf_tables.concat(&subq_lex->leaf_tables);
+ if (subq_lex->options & OPTION_SCHEMA_TABLE)
+ parent_lex->options |= OPTION_SCHEMA_TABLE;
+
/*
Same as above for next_local chain
(a theory: a next_local chain always starts with ::leaf_tables
@@ -1726,6 +1733,9 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
*/
parent_lex->leaf_tables.push_back(jtbm);
+ if (subq_pred->unit->first_select()->options & OPTION_SCHEMA_TABLE)
+ parent_lex->options |= OPTION_SCHEMA_TABLE;
+
/*
Same as above for TABLE_LIST::next_local chain
(a theory: a next_local chain always starts with ::leaf_tables
@@ -2545,6 +2555,10 @@ void advance_sj_state(JOIN *join, table_map remaining_tables, uint idx,
/* Mark strategy as used */
(*strategy)->mark_used();
pos->sj_strategy= sj_strategy;
+ if (sj_strategy == SJ_OPT_MATERIALIZE)
+ join->sjm_lookup_tables |= handled_fanout;
+ else
+ join->sjm_lookup_tables &= ~handled_fanout;
*current_read_time= read_time;
*current_record_count= rec_count;
join->cur_dups_producing_tables &= ~handled_fanout;
@@ -3069,6 +3083,13 @@ void restore_prev_sj_state(const table_map remaining_tables,
const JOIN_TAB *tab, uint idx)
{
TABLE_LIST *emb_sj_nest;
+
+ if (tab->emb_sj_nest)
+ {
+ table_map subq_tables= tab->emb_sj_nest->sj_inner_tables;
+ tab->join->sjm_lookup_tables &= ~subq_tables;
+ }
+
if ((emb_sj_nest= tab->emb_sj_nest))
{
/* If we're removing the last SJ-inner table, remove the sj-nest */
@@ -3246,6 +3267,7 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
uint tablenr;
table_map remaining_tables= 0;
table_map handled_tabs= 0;
+ join->sjm_lookup_tables= 0;
for (tablenr= table_count - 1 ; tablenr != join->const_tables - 1; tablenr--)
{
POSITION *pos= join->best_positions + tablenr;
@@ -3271,6 +3293,7 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
first= tablenr - sjm->tables + 1;
join->best_positions[first].n_sj_tables= sjm->tables;
join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE;
+ join->sjm_lookup_tables|= s->table->map;
}
else if (pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN)
{
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index fa3a07b72c5..069fe6452e8 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -84,7 +84,7 @@ static ulonglong get_exact_record_count(List<TABLE_LIST> &tables)
while ((tl= ti++))
{
ha_rows tmp= tl->table->file->records();
- if ((tmp == HA_POS_ERROR))
+ if (tmp == HA_POS_ERROR)
return ULONGLONG_MAX;
count*= tmp;
}
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 028afd7899e..934f4e970cb 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1582,29 +1582,21 @@ bool check_partition_dirs(partition_info *part_info)
partition_element *subpart_elem;
while ((subpart_elem= sub_it++))
{
- if (test_if_data_home_dir(subpart_elem->data_file_name))
- goto dd_err;
- if (test_if_data_home_dir(subpart_elem->index_file_name))
- goto id_err;
+ if (error_if_data_home_dir(subpart_elem->data_file_name,
+ "DATA DIRECTORY") ||
+ error_if_data_home_dir(subpart_elem->index_file_name,
+ "INDEX DIRECTORY"))
+ return 1;
}
}
else
{
- if (test_if_data_home_dir(part_elem->data_file_name))
- goto dd_err;
- if (test_if_data_home_dir(part_elem->index_file_name))
- goto id_err;
+ if (error_if_data_home_dir(part_elem->data_file_name, "DATA DIRECTORY") ||
+ error_if_data_home_dir(part_elem->index_file_name, "INDEX DIRECTORY"))
+ return 1;
}
}
return 0;
-
-dd_err:
- my_error(ER_WRONG_ARGUMENTS,MYF(0),"DATA DIRECTORY");
- return 1;
-
-id_err:
- my_error(ER_WRONG_ARGUMENTS,MYF(0),"INDEX DIRECTORY");
- return 1;
}
@@ -2286,4 +2278,9 @@ void partition_info::print_debug(const char *str, uint *value)
{
}
+bool check_partition_dirs(partition_info *part_info)
+{
+ return 0;
+}
+
#endif /* WITH_PARTITION_STORAGE_ENGINE */
diff --git a/sql/partition_info.h b/sql/partition_info.h
index e59d4ec8ba4..2fbdfff6636 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -306,6 +306,7 @@ private:
char *create_default_partition_names(uint part_no, uint num_parts,
uint start_no);
char *create_subpartition_name(uint subpart_no, const char *part_name);
+public:
bool has_unique_name(partition_element *element);
};
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc
index 258dae0edb2..1d21b3f9445 100644
--- a/sql/rpl_handler.cc
+++ b/sql/rpl_handler.cc
@@ -555,4 +555,24 @@ int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void
{
return binlog_relay_io_delegate->remove_observer(observer, (st_plugin_int *)p);
}
+#else
+int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
+{
+ return 0;
+}
+
+int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p)
+{
+ return 0;
+}
+
+int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
+{
+ return 0;
+}
+
+int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p)
+{
+ return 0;
+}
#endif /* HAVE_REPLICATION */
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 1b9e744bcc1..1be97b34204 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -1,5 +1,6 @@
/*
Copyright (c) 2006, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2013, Monty Program Ab.
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
@@ -521,9 +522,9 @@ bool is_conversion_ok(int order, Relay_log_info *rli)
bool allow_non_lossy, allow_lossy;
allow_non_lossy = slave_type_conversions_options &
- (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
+ (1ULL << SLAVE_TYPE_CONVERSIONS_ALL_NON_LOSSY);
allow_lossy= slave_type_conversions_options &
- (ULL(1) << SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
+ (1ULL << SLAVE_TYPE_CONVERSIONS_ALL_LOSSY);
DBUG_PRINT("enter", ("order: %d, flags:%s%s", order,
allow_non_lossy ? " ALL_NON_LOSSY" : "",
@@ -878,8 +879,13 @@ TABLE *table_def::create_conversion_table(THD *thd, Relay_log_info *rli, TABLE *
DBUG_ENTER("table_def::create_conversion_table");
List<Create_field> field_list;
-
- for (uint col= 0 ; col < size() ; ++col)
+ /*
+ At slave, columns may differ. So we should create
+ min(columns@master, columns@slave) columns in the
+ conversion table.
+ */
+ uint const cols_to_create= min(target_table->s->fields, size());
+ for (uint col= 0 ; col < cols_to_create; ++col)
{
Create_field *field_def=
(Create_field*) alloc_root(thd->mem_root, sizeof(Create_field));
diff --git a/sql/scheduler.cc b/sql/scheduler.cc
index 7f250158ccb..71789b0303b 100644
--- a/sql/scheduler.cc
+++ b/sql/scheduler.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
- Copyright (c) 2012, Monty Program Ab
+ Copyright (c) 2012, 2013, Monty Program Ab
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
@@ -152,52 +152,3 @@ void one_thread_scheduler(scheduler_functions *func)
func->end_thread= no_threads_end;
}
-
-
-/*
- no pluggable schedulers in mariadb.
- when we'll want it, we'll do it properly
-*/
-#if 0
-
-static scheduler_functions *saved_thread_scheduler;
-static uint saved_thread_handling;
-
-extern "C"
-int my_thread_scheduler_set(scheduler_functions *scheduler)
-{
- DBUG_ASSERT(scheduler != 0);
-
- if (scheduler == NULL)
- return 1;
-
- saved_thread_scheduler= thread_scheduler;
- saved_thread_handling= thread_handling;
- thread_scheduler= scheduler;
- // Scheduler loaded dynamically
- thread_handling= SCHEDULER_TYPES_COUNT;
- return 0;
-}
-
-
-extern "C"
-int my_thread_scheduler_reset()
-{
- DBUG_ASSERT(saved_thread_scheduler != NULL);
-
- if (saved_thread_scheduler == NULL)
- return 1;
-
- thread_scheduler= saved_thread_scheduler;
- thread_handling= saved_thread_handling;
- saved_thread_scheduler= 0;
- return 0;
-}
-#else
-extern "C" int my_thread_scheduler_set(scheduler_functions *scheduler)
-{ return 1; }
-
-extern "C" int my_thread_scheduler_reset()
-{ return 1; }
-#endif
-
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 9f5404d75ce..18d86a13998 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -253,8 +253,7 @@ uchar *sys_var::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
bool sys_var::set_default(THD *thd, enum_var_type type)
{
- LEX_STRING empty={0,0};
- set_var var(type, this, &empty, 0);
+ set_var var(type, this, &null_lex_str, 0);
if (type == OPT_GLOBAL || scope() == GLOBAL)
global_save_default(thd, &var);
@@ -264,6 +263,114 @@ bool sys_var::set_default(THD *thd, enum_var_type type)
return check(thd, &var) || update(thd, &var);
}
+
+#define do_num_val(T,CMD) \
+do { \
+ mysql_mutex_lock(&LOCK_global_system_variables); \
+ T val= *(T*) value_ptr(thd, type, base); \
+ mysql_mutex_unlock(&LOCK_global_system_variables); \
+ CMD; \
+} while (0)
+
+#define case_for_integers(CMD) \
+ case SHOW_SINT: do_num_val (int,CMD); \
+ case SHOW_SLONG: do_num_val (long,CMD); \
+ case SHOW_SLONGLONG:do_num_val (longlong,CMD); \
+ case SHOW_UINT: do_num_val (uint,CMD); \
+ case SHOW_ULONG: do_num_val (ulong,CMD); \
+ case SHOW_ULONGLONG:do_num_val (ulonglong,CMD); \
+ case SHOW_HA_ROWS: do_num_val (ha_rows,CMD); \
+ case SHOW_BOOL: do_num_val (bool,CMD); \
+ case SHOW_MY_BOOL: do_num_val (my_bool,CMD)
+
+#define case_for_double(CMD) \
+ case SHOW_DOUBLE: do_num_val (double,CMD)
+
+#define case_get_string_as_lex_string \
+ case SHOW_CHAR: \
+ mysql_mutex_lock(&LOCK_global_system_variables); \
+ sval.str= (char*) value_ptr(thd, type, base); \
+ sval.length= sval.str ? strlen(sval.str) : 0; \
+ break; \
+ case SHOW_CHAR_PTR: \
+ mysql_mutex_lock(&LOCK_global_system_variables); \
+ sval.str= *(char**) value_ptr(thd, type, base); \
+ sval.length= sval.str ? strlen(sval.str) : 0; \
+ break; \
+ case SHOW_LEX_STRING: \
+ mysql_mutex_lock(&LOCK_global_system_variables); \
+ sval= *(LEX_STRING *) value_ptr(thd, type, base); \
+ break
+
+longlong sys_var::val_int(bool *is_null,
+ THD *thd, enum_var_type type, LEX_STRING *base)
+{
+ LEX_STRING sval;
+ *is_null= false;
+ switch (show_type())
+ {
+ case_get_string_as_lex_string;
+ case_for_integers(return val);
+ case_for_double(return val);
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name.str);
+ return 0;
+ }
+
+ longlong ret= 0;
+ if (!(*is_null= !sval.str))
+ ret= longlong_from_string_with_check(system_charset_info,
+ sval.str, sval.str + sval.length);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ return ret;
+}
+
+
+String *sys_var::val_str(String *str,
+ THD *thd, enum_var_type type, LEX_STRING *base)
+{
+ LEX_STRING sval;
+ switch (show_type())
+ {
+ case_get_string_as_lex_string;
+ case_for_integers(return str->set((ulonglong)val, system_charset_info) ? 0 : str);
+ case_for_double(return str->set_real(val, 6, system_charset_info) ? 0 : str);
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name.str);
+ return 0;
+ }
+
+ if (!sval.str || str->copy(sval.str, sval.length, system_charset_info))
+ str= NULL;
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ return str;
+}
+
+
+double sys_var::val_real(bool *is_null,
+ THD *thd, enum_var_type type, LEX_STRING *base)
+{
+ LEX_STRING sval;
+ *is_null= false;
+ switch (show_type())
+ {
+ case_get_string_as_lex_string;
+ case_for_integers(return val);
+ case_for_double(return val);
+ default:
+ my_error(ER_VAR_CANT_BE_READ, MYF(0), name.str);
+ return 0;
+ }
+
+ double ret= 0;
+ if (!(*is_null= !sval.str))
+ ret= double_from_string_with_check(system_charset_info,
+ sval.str, sval.str + sval.length);
+ mysql_mutex_unlock(&LOCK_global_system_variables);
+ return ret;
+}
+
+
void sys_var::do_deprecated_warning(THD *thd)
{
if (deprecation_substitute != NULL)
diff --git a/sql/set_var.h b/sql/set_var.h
index f912c9fffad..6cb0cd33f87 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -108,6 +108,10 @@ public:
bool set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
+ longlong val_int(bool *is_null, THD *thd, enum_var_type type, LEX_STRING *base);
+ String *val_str(String *str, THD *thd, enum_var_type type, LEX_STRING *base);
+ double val_real(bool *is_null, THD *thd, enum_var_type type, LEX_STRING *base);
+
SHOW_TYPE show_type() { return show_val_type; }
int scope() const { return flags & SCOPE_MASK; }
CHARSET_INFO *charset(THD *thd);
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 49f35719a77..f1d5af44fd5 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -75,30 +75,30 @@ ER_CANT_CREATE_FILE
swe "Kan inte skapa filen '%-.200s' (Felkod: %M)"
ukr "Ðе можу Ñтворити файл '%-.200s' (помилка: %M)"
ER_CANT_CREATE_TABLE
- cze "Nemohu vytvo-Břit tabulku '%-.200s' (chybový kód: %M)"
- dan "Kan ikke oprette tabellen '%-.200s' (Fejlkode: %M)"
- nla "Kan tabel '%-.200s' niet aanmaken (Errcode: %M)"
- eng "Can't create table '%-.200s' (errno: %M)"
- jps "'%-.200s' テーブルãŒä½œã‚Œã¾ã›ã‚“.(errno: %M)",
- est "Ei suuda luua tabelit '%-.200s' (veakood: %M)"
- fre "Ne peut créer la table '%-.200s' (Errcode: %M)"
- ger "Kann Tabelle '%-.200s' nicht erzeugen (Fehler: %M)"
- greek "ΑδÏνατη η δημιουÏγία του πίνακα '%-.200s' (κωδικός λάθους: %M)"
- hun "A '%-.200s' tabla nem hozhato letre (hibakod: %M)"
- ita "Impossibile creare la tabella '%-.200s' (errno: %M)"
- jpn "'%-.200s' テーブルãŒä½œã‚Œã¾ã›ã‚“.(errno: %M)"
- kor "í…Œì´ë¸” '%-.200s'를 만들지 못했습니다. (ì—러번호: %M)"
- nor "Kan ikke opprette tabellen '%-.200s' (Feilkode: %M)"
- norwegian-ny "Kan ikkje opprette tabellen '%-.200s' (Feilkode: %M)"
- pol "Nie można stworzyć tabeli '%-.200s' (Kod błędu: %M)"
- por "Não pode criar a tabela '%-.200s' (erro no. %M)"
- rum "Nu pot sa creez tabla '%-.200s' (Eroare: %M)"
- rus "Ðевозможно Ñоздать таблицу '%-.200s' (ошибка: %M)"
- serbian "Ne mogu da kreiram tabelu '%-.200s' (errno: %M)"
- slo "Nemôžem vytvoriť tabuľku '%-.200s' (chybový kód: %M)"
- spa "No puedo crear tabla '%-.200s' (Error: %M)"
- swe "Kan inte skapa tabellen '%-.200s' (Felkod: %M)"
- ukr "Ðе можу Ñтворити таблицю '%-.200s' (помилка: %M)"
+ cze "Nemohu vytvo-Břit tabulku %`s.%`s (chybový kód: %M)"
+ dan "Kan ikke oprette tabellen %`s.%`s (Fejlkode: %M)"
+ nla "Kan tabel %`s.%`s niet aanmaken (Errcode: %M)"
+ eng "Can't create table %`s.%`s (errno: %M)"
+ jps "%`s.%`s テーブルãŒä½œã‚Œã¾ã›ã‚“.(errno: %M)",
+ est "Ei suuda luua tabelit %`s.%`s (veakood: %M)"
+ fre "Ne peut créer la table %`s.%`s (Errcode: %M)"
+ ger "Kann Tabelle %`s.%`s nicht erzeugen (Fehler: %M)"
+ greek "ΑδÏνατη η δημιουÏγία του πίνακα %`s.%`s (κωδικός λάθους: %M)"
+ hun "A %`s.%`s tabla nem hozhato letre (hibakod: %M)"
+ ita "Impossibile creare la tabella %`s.%`s (errno: %M)"
+ jpn "%`s.%`s テーブルãŒä½œã‚Œã¾ã›ã‚“.(errno: %M)"
+ kor "í…Œì´ë¸” %`s.%`s를 만들지 못했습니다. (ì—러번호: %M)"
+ nor "Kan ikke opprette tabellen %`s.%`s (Feilkode: %M)"
+ norwegian-ny "Kan ikkje opprette tabellen %`s.%`s (Feilkode: %M)"
+ pol "Nie można stworzyć tabeli %`s.%`s (Kod błędu: %M)"
+ por "Não pode criar a tabela %`s.%`s (erro no. %M)"
+ rum "Nu pot sa creez tabla %`s.%`s (Eroare: %M)"
+ rus "Ðевозможно Ñоздать таблицу %`s.%`s (ошибка: %M)"
+ serbian "Ne mogu da kreiram tabelu %`s.%`s (errno: %M)"
+ slo "Nemôžem vytvoriť tabuľku %`s.%`s (chybový kód: %M)"
+ spa "No puedo crear tabla %`s.%`s (Error: %M)"
+ swe "Kan inte skapa tabellen %`s.%`s (Felkod: %M)"
+ ukr "Ðе можу Ñтворити таблицю %`s.%`s (помилка: %M)"
ER_CANT_CREATE_DB
cze "Nemohu vytvo-Břit databázi '%-.192s' (chybový kód: %M)"
dan "Kan ikke oprette databasen '%-.192s' (Fejlkode: %M)"
@@ -696,53 +696,26 @@ ER_FORM_NOT_FOUND
swe "Formulär '%-.192s' finns inte i '%-.192s'"
ukr "ВиглÑд '%-.192s' не Ñ–Ñнує Ð´Ð»Ñ '%-.192s'"
ER_GET_ERRNO
- cze "Obsluha tabulky vr-Bátila chybu %M"
- dan "Modtog fejl %M fra tabel håndteringen"
- nla "Fout %M van tabel handler"
- eng "Got error %M from storage engine"
- est "Tabeli handler tagastas vea %M"
- fre "Reçu l'erreur %M du handler de la table"
- ger "Fehler %M (Speicher-Engine)"
- greek "Ελήφθη μήνυμα λάθους %M από τον χειÏιστή πίνακα (table handler)"
- hun "%M hibajelzes a tablakezelotol"
- ita "Rilevato l'errore %M dal gestore delle tabelle"
- jpn "Got error %M from table handler"
- kor "í…Œì´ë¸” handlerì—ì„œ %M ì—러가 ë°œìƒ í•˜ì˜€ìŠµë‹ˆë‹¤."
- nor "Mottok feil %M fra tabell håndterer"
- norwegian-ny "Mottok feil %M fra tabell handterar"
- pol "Otrzymano bł?d %M z obsługi tabeli"
- por "Obteve erro %M no manipulador de tabelas"
- rum "Eroarea %M obtinuta din handlerul tabelei"
- rus "Получена ошибка %M от обработчика таблиц"
- serbian "Handler tabela je vratio grešku %M"
- slo "Obsluha tabuľky vrátila chybu %M"
- spa "Error %M desde el manejador de la tabla"
- swe "Fick felkod %M från databashanteraren"
- ukr "Отримано помилку %M від деÑкриптора таблиці"
+ nla "Fout %M van tabel handler %s"
+ eng "Got error %M from storage engine %s"
+ fre "Reçu l'erreur %M du handler de la table %s"
+ ger "Fehler %M von Speicher-Engine %s"
+ greek "Ελήφθη μήνυμα λάθους %M από τον χειÏιστή πίνακα (table handler) %s"
+ ita "Rilevato l'errore %M dal gestore delle tabelle %s"
+ nor "Mottok feil %M fra tabell håndterer %s"
+ norwegian-ny "Mottok feil %M fra tabell handterar %s"
+ pol "Otrzymano bł?d %M z obsługi tabeli %s"
+ por "Obteve erro %M no manipulador de tabelas %s"
+ rum "Eroarea %M obtinuta din handlerul tabelei %s"
+ rus "Получена ошибка %M от обработчика таблиц %s"
+ spa "Error %M desde el manejador de la tabla %s"
+ swe "Fick felkod %M från databashanteraren %s"
+ ukr "Отримано помилку %M від деÑкриптора таблиці %s"
ER_ILLEGAL_HA
- cze "Obsluha tabulky '%-.192s' nem-Bá tento parametr"
- dan "Denne mulighed eksisterer ikke for tabeltypen '%-.192s'"
- nla "Tabel handler voor '%-.192s' heeft deze optie niet"
- eng "Table storage engine for '%-.192s' doesn't have this option"
- est "Tabeli '%-.192s' handler ei toeta antud operatsiooni"
- fre "Le handler de la table '%-.192s' n'a pas cette option"
- ger "Diese Option gibt es nicht (Speicher-Engine für '%-.192s')"
- greek "Ο χειÏιστής πίνακα (table handler) για '%-.192s' δεν διαθέτει αυτή την επιλογή"
- hun "A(z) '%-.192s' tablakezelonek nincs ilyen opcioja"
- ita "Il gestore delle tabelle per '%-.192s' non ha questa opzione"
- jpn "Table handler for '%-.192s' doesn't have this option"
- kor "'%-.192s'ì˜ í…Œì´ë¸” handler는 ì´ëŸ¬í•œ ì˜µì…˜ì„ ì œê³µí•˜ì§€ ì•Šì니다."
- nor "Tabell håndtereren for '%-.192s' har ikke denne muligheten"
- norwegian-ny "Tabell håndteraren for '%-.192s' har ikkje denne moglegheita"
- pol "Obsługa tabeli '%-.192s' nie posiada tej opcji"
- por "Manipulador de tabela para '%-.192s' não tem esta opção"
- rum "Handlerul tabelei pentru '%-.192s' nu are aceasta optiune"
- rus "Обработчик таблицы '%-.192s' не поддерживает Ñту возможноÑÑ‚ÑŒ"
- serbian "Handler tabela za '%-.192s' nema ovu opciju"
- slo "Obsluha tabuľky '%-.192s' nemá tento parameter"
- spa "El manejador de la tabla de '%-.192s' no tiene esta opcion"
- swe "Tabellhanteraren for tabell '%-.192s' stödjer ej detta"
- ukr "ДеÑкриптор таблиці '%-.192s' не має цієї влаÑтивоÑÑ‚Ñ–"
+ eng "Storage engine %s of the table %`s.%`s doesn't have this option"
+ ger "Diese Option gibt es nicht in Speicher-Engine %s für %`s.%`s"
+ rus "Обработчик %s таблицы %`s.%`s не поддерживает Ñту возможноÑÑ‚ÑŒ"
+ ukr "ДеÑкриптор %s таблиці %`s.%`s не має цієї влаÑтивоÑÑ‚Ñ–"
ER_KEY_NOT_FOUND
cze "Nemohu naj-Bít záznam v '%-.192s'"
dan "Kan ikke finde posten i '%-.192s'"
@@ -1750,28 +1723,10 @@ ER_KEY_COLUMN_DOES_NOT_EXITS 42000 S1009
swe "Nyckelkolumn '%-.192s' finns inte"
ukr "Ключовий Ñтовбець '%-.192s' не Ñ–Ñнує у таблиці"
ER_BLOB_USED_AS_KEY 42000 S1009
- cze "Blob sloupec '%-.192s' nem-Bůže být použit jako klíÄ"
- dan "BLOB feltet '%-.192s' kan ikke bruges ved specifikation af indeks"
- nla "BLOB kolom '%-.192s' kan niet gebruikt worden bij zoeksleutel specificatie"
- eng "BLOB column '%-.192s' can't be used in key specification with the used table type"
- est "BLOB-tüüpi tulpa '%-.192s' ei saa kasutada võtmena"
- fre "Champ BLOB '%-.192s' ne peut être utilisé dans une clé"
- ger "BLOB-Feld '%-.192s' kann beim verwendeten Tabellentyp nicht als Schlüssel verwendet werden"
- greek "Πεδίο Ï„Ïπου Blob '%-.192s' δεν μποÏεί να χÏησιμοποιηθεί στον οÏισμό ενός ÎºÎ»ÎµÎ¹Î´Î¹Î¿Ï (key specification)"
- hun "Blob objektum '%-.192s' nem hasznalhato kulcskent"
- ita "La colonna BLOB '%-.192s' non puo` essere usata nella specifica della chiave"
- kor "BLOB 칼럼 '%-.192s'는 키 ì •ì˜ì—ì„œ ì‚¬ìš©ë  ìˆ˜ 없습니다."
- nor "Blob felt '%-.192s' kan ikke brukes ved spesifikasjon av nøkler"
- norwegian-ny "Blob kolonne '%-.192s' kan ikkje brukast ved spesifikasjon av nyklar"
- pol "Kolumna typu Blob '%-.192s' nie może być użyta w specyfikacji klucza"
- por "Coluna BLOB '%-.192s' não pode ser utilizada na especificação de chave para o tipo de tabela usado"
- rum "Coloana de tip BLOB '%-.192s' nu poate fi folosita in specificarea cheii cu tipul de tabla folosit"
- rus "Столбец типа BLOB '%-.192s' не может быть иÑпользован как значение ключа в таблице такого типа"
- serbian "BLOB kolona '%-.192s' ne može biti upotrebljena za navoÄ‘enje kljuÄa sa tipom tabele koji se trenutno koristi"
- slo "Blob pole '%-.192s' nemôže byÅ¥ použité ako kľúÄ"
- spa "La columna Blob '%-.192s' no puede ser usada en una declaracion de clave"
- swe "En BLOB '%-.192s' kan inte vara nyckel med den använda tabelltypen"
- ukr "BLOB Ñтовбець '%-.192s' не може бути викориÑтаний у визначенні ключа в цьому типі таблиці"
+ eng "BLOB column %`s can't be used in key specification in the %s table"
+ ger "BLOB-Feld %`s kann beim %s Tabellen nicht als Schlüssel verwendet werden"
+ rus "Столбец типа BLOB %`s не может быть иÑпользован как значение ключа в %s таблице"
+ ukr "BLOB Ñтовбець %`s не може бути викориÑтаний у визначенні ключа в %s таблиці"
ER_TOO_BIG_FIELDLENGTH 42000 S1009
cze "P-Bříliš velká délka sloupce '%-.192s' (nejvíce %lu). Použijte BLOB"
dan "For stor feltlængde for kolonne '%-.192s' (maks = %lu). Brug BLOB i stedet"
@@ -3691,39 +3646,39 @@ ER_TOO_LONG_STRING 42000
swe "Resultatsträngen är längre än max_allowed_packet"
ukr "Строка результату довша ніж max_allowed_packet"
ER_TABLE_CANT_HANDLE_BLOB 42000
- cze "Typ pou-Bžité tabulky nepodporuje BLOB/TEXT sloupce"
- dan "Denne tabeltype understøtter ikke brug af BLOB og TEXT kolonner"
- nla "Het gebruikte tabel type ondersteunt geen BLOB/TEXT kolommen"
- eng "The used table type doesn't support BLOB/TEXT columns"
- est "Valitud tabelitüüp ei toeta BLOB/TEXT tüüpi välju"
- fre "Ce type de table ne supporte pas les colonnes BLOB/TEXT"
- ger "Der verwendete Tabellentyp unterstützt keine BLOB- und TEXT-Felder"
- hun "A hasznalt tabla tipus nem tamogatja a BLOB/TEXT mezoket"
- ita "Il tipo di tabella usata non supporta colonne di tipo BLOB/TEXT"
- por "Tipo de tabela usado não permite colunas BLOB/TEXT"
- rum "Tipul de tabela folosit nu suporta coloane de tip BLOB/TEXT"
- rus "ИÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÐµÐ¼Ð°Ñ Ñ‚Ð°Ð±Ð»Ð¸Ñ†Ð° не поддерживает типы BLOB/TEXT"
- serbian "Iskorišteni tip tabele ne podržava kolone tipa 'BLOB' odnosno 'TEXT'"
- spa "El tipo de tabla usada no permite soporte para columnas BLOB/TEXT"
- swe "Den använda tabelltypen kan inte hantera BLOB/TEXT-kolumner"
- ukr "ВикориÑтаний тип таблиці не підтримує BLOB/TEXT Ñтовбці"
+ cze "Typ pou-Bžité tabulky (%s) nepodporuje BLOB/TEXT sloupce"
+ dan "Denne tabeltype (%s) understøtter ikke brug af BLOB og TEXT kolonner"
+ nla "Het gebruikte tabel type (%s) ondersteunt geen BLOB/TEXT kolommen"
+ eng "Storage engine %s doesn't support BLOB/TEXT columns"
+ est "Valitud tabelitüüp (%s) ei toeta BLOB/TEXT tüüpi välju"
+ fre "Ce type de table (%s) ne supporte pas les colonnes BLOB/TEXT"
+ ger "Der verwendete Tabellentyp (%s) unterstützt keine BLOB- und TEXT-Felder"
+ hun "A hasznalt tabla tipus (%s) nem tamogatja a BLOB/TEXT mezoket"
+ ita "Il tipo di tabella usata (%s) non supporta colonne di tipo BLOB/TEXT"
+ por "Tipo de tabela usado (%s) não permite colunas BLOB/TEXT"
+ rum "Tipul de tabela folosit (%s) nu suporta coloane de tip BLOB/TEXT"
+ rus "%s таблицы не поддерживают типы BLOB/TEXT"
+ serbian "Iskorišteni tip tabele (%s) ne podržava kolone tipa 'BLOB' odnosno 'TEXT'"
+ spa "El tipo de tabla usada (%s) no permite soporte para columnas BLOB/TEXT"
+ swe "Den använda tabelltypen (%s) kan inte hantera BLOB/TEXT-kolumner"
+ ukr "%s таблиці не підтримують BLOB/TEXT Ñтовбці"
ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 42000
- cze "Typ pou-Bžité tabulky nepodporuje AUTO_INCREMENT sloupce"
- dan "Denne tabeltype understøtter ikke brug af AUTO_INCREMENT kolonner"
- nla "Het gebruikte tabel type ondersteunt geen AUTO_INCREMENT kolommen"
- eng "The used table type doesn't support AUTO_INCREMENT columns"
- est "Valitud tabelitüüp ei toeta AUTO_INCREMENT tüüpi välju"
- fre "Ce type de table ne supporte pas les colonnes AUTO_INCREMENT"
- ger "Der verwendete Tabellentyp unterstützt keine AUTO_INCREMENT-Felder"
- hun "A hasznalt tabla tipus nem tamogatja az AUTO_INCREMENT tipusu mezoket"
- ita "Il tipo di tabella usata non supporta colonne di tipo AUTO_INCREMENT"
- por "Tipo de tabela usado não permite colunas AUTO_INCREMENT"
- rum "Tipul de tabela folosit nu suporta coloane de tip AUTO_INCREMENT"
- rus "ИÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÐµÐ¼Ð°Ñ Ñ‚Ð°Ð±Ð»Ð¸Ñ†Ð° не поддерживает автоинкрементные Ñтолбцы"
- serbian "Iskorišteni tip tabele ne podržava kolone tipa 'AUTO_INCREMENT'"
- spa "El tipo de tabla usada no permite soporte para columnas AUTO_INCREMENT"
- swe "Den använda tabelltypen kan inte hantera AUTO_INCREMENT-kolumner"
- ukr "ВикориÑтаний тип таблиці не підтримує AUTO_INCREMENT Ñтовбці"
+ cze "Typ pou-Bžité tabulky (%s) nepodporuje AUTO_INCREMENT sloupce"
+ dan "Denne tabeltype understøtter (%s) ikke brug af AUTO_INCREMENT kolonner"
+ nla "Het gebruikte tabel type (%s) ondersteunt geen AUTO_INCREMENT kolommen"
+ eng "Storage engine %s doesn't support AUTO_INCREMENT columns"
+ est "Valitud tabelitüüp (%s) ei toeta AUTO_INCREMENT tüüpi välju"
+ fre "Ce type de table (%s) ne supporte pas les colonnes AUTO_INCREMENT"
+ ger "Der verwendete Tabellentyp (%s) unterstützt keine AUTO_INCREMENT-Felder"
+ hun "A hasznalt tabla tipus (%s) nem tamogatja az AUTO_INCREMENT tipusu mezoket"
+ ita "Il tipo di tabella usata (%s) non supporta colonne di tipo AUTO_INCREMENT"
+ por "Tipo de tabela usado (%s) não permite colunas AUTO_INCREMENT"
+ rum "Tipul de tabela folosit (%s) nu suporta coloane de tip AUTO_INCREMENT"
+ rus "%s таблицы не поддерживают автоинкрементные Ñтолбцы"
+ serbian "Iskorišteni tip tabele (%s) ne podržava kolone tipa 'AUTO_INCREMENT'"
+ spa "El tipo de tabla usada (%s) no permite soporte para columnas AUTO_INCREMENT"
+ swe "Den använda tabelltypen (%s) kan inte hantera AUTO_INCREMENT-kolumner"
+ ukr "%s таблиці не підтримують AUTO_INCREMENT Ñтовбці"
ER_DELAYED_INSERT_TABLE_LOCKED
cze "INSERT DELAYED nen-Bí možno s tabulkou '%-.192s' použít, protože je zamÄená pomocí LOCK TABLES"
dan "INSERT DELAYED kan ikke bruges med tabellen '%-.192s', fordi tabellen er låst med LOCK TABLES"
@@ -3766,29 +3721,10 @@ ER_WRONG_COLUMN_NAME 42000
swe "Felaktigt kolumnnamn '%-.100s'"
ukr "Ðевірне ім'Ñ ÑÑ‚Ð¾Ð²Ð±Ñ†Ñ '%-.100s'"
ER_WRONG_KEY_COLUMN 42000
- cze "Handler pou-Bžité tabulky neumí indexovat sloupce '%-.192s'"
- dan "Den brugte tabeltype kan ikke indeksere kolonnen '%-.192s'"
- nla "De gebruikte tabel 'handler' kan kolom '%-.192s' niet indexeren"
- eng "The used storage engine can't index column '%-.192s'"
- est "Tabelihandler ei oska indekseerida tulpa '%-.192s'"
- fre "Le handler de la table ne peut indexé la colonne '%-.192s'"
- ger "Die verwendete Speicher-Engine kann die Spalte '%-.192s' nicht indizieren"
- greek "The used table handler can't index column '%-.192s'"
- hun "A hasznalt tablakezelo nem tudja a '%-.192s' mezot indexelni"
- ita "Il gestore delle tabelle non puo` indicizzare la colonna '%-.192s'"
- jpn "The used table handler can't index column '%-.192s'"
- kor "The used table handler can't index column '%-.192s'"
- nor "The used table handler can't index column '%-.192s'"
- norwegian-ny "The used table handler can't index column '%-.192s'"
- pol "The used table handler can't index column '%-.192s'"
- por "O manipulador de tabela usado não pode indexar a coluna '%-.192s'"
- rum "Handler-ul tabelei folosite nu poate indexa coloana '%-.192s'"
- rus "ИÑпользованный обработчик таблицы не может проиндекÑировать Ñтолбец '%-.192s'"
- serbian "Handler tabele ne može da indeksira kolonu '%-.192s'"
- slo "The used table handler can't index column '%-.192s'"
- spa "El manipulador de tabla usado no puede indexar columna '%-.192s'"
- swe "Den använda tabelltypen kan inte indexera kolumn '%-.192s'"
- ukr "ВикориÑтаний вказівник таблиці не може індекÑувати Ñтовбець '%-.192s'"
+ eng "The storage engine %s can't index column %`s"
+ ger "Die Speicher-Engine %s kann die Spalte %`s nicht indizieren"
+ rus "Обработчик таблиц %s не может проиндекÑировать Ñтолбец %`s"
+ ukr "Вказівник таблиц %s не може індекÑувати Ñтовбець %`s"
ER_WRONG_MRG_TABLE
cze "V-Bšechny tabulky v MERGE tabulce nejsou definovány stejně"
dan "Tabellerne i MERGE er ikke defineret ens"
@@ -4088,22 +4024,8 @@ ER_NEW_ABORTING_CONNECTION 08S01
spa "Abortada conexión %ld para db: '%-.192s' usuario: '%-.48s' servidor: '%-.64s' (%-.64s)"
swe "Avbröt länken för tråd %ld till db '%-.192s', användare '%-.48s', host '%-.64s' (%-.64s)"
ukr "Перервано з'Ñ”Ð´Ð½Ð°Ð½Ð½Ñ %ld до бази данних: '%-.192s' кориÑтувач: '%-.48s' хоÑÑ‚: '%-.64s' (%-.64s)"
-ER_DUMP_NOT_IMPLEMENTED
- cze "Handler tabulky nepodporuje bin-Bární dump"
- dan "Denne tabeltype unserstøtter ikke binært tabeldump"
- nla "De 'handler' voor de tabel ondersteund geen binaire tabel dump"
- eng "The storage engine for the table does not support binary table dump"
- fre "Ce type de table ne supporte pas les copies binaires"
- ger "Die Speicher-Engine für die Tabelle unterstützt keinen binären Tabellen-Dump"
- ita "Il gestore per la tabella non supporta il dump binario"
- jpn "The handler for the table does not support binary table dump"
- por "O manipulador de tabela não suporta 'dump' binário de tabela"
- rum "The handler for the table does not support binary table dump"
- rus "Обработчик Ñтой таблицы не поддерживает двоичного ÑÐ¾Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð¾Ð±Ñ€Ð°Ð·Ð° таблицы (dump)"
- serbian "Handler tabele ne podržava binarni dump tabele"
- spa "El manipulador de tabla no soporta dump para tabla binaria"
- swe "Tabellhanteraren klarar inte en binär kopiering av tabellen"
- ukr "Цей тип таблиці не підтримує бінарну передачу таблиці"
+ER_unused_2
+ eng "You should never see it"
ER_FLUSH_MASTER_BINLOG_CLOSED
eng "Binlog closed, cannot RESET MASTER"
ger "Binlog geschlossen. Kann RESET MASTER nicht ausführen"
@@ -4477,18 +4399,18 @@ ER_LOCK_DEADLOCK 40001
spa "Encontrado deadlock cuando tentando obtener el bloqueo; Tente recomenzar la transición"
swe "Fick 'DEADLOCK' vid låsförsök av block/rad. Försök att starta om transaktionen"
ER_TABLE_CANT_HANDLE_FT
- nla "Het gebruikte tabel type ondersteund geen FULLTEXT indexen"
- eng "The used table type doesn't support FULLTEXT indexes"
- est "Antud tabelitüüp ei toeta FULLTEXT indekseid"
- fre "Le type de table utilisé ne supporte pas les index FULLTEXT"
- ger "Der verwendete Tabellentyp unterstützt keine FULLTEXT-Indizes"
- ita "La tabella usata non supporta gli indici FULLTEXT"
- por "O tipo de tabela utilizado não suporta índices de texto completo (fulltext indexes)"
- rus "ИÑпользуемый тип таблиц не поддерживает полнотекÑтовых индекÑов"
- serbian "Upotrebljeni tip tabele ne podržava 'FULLTEXT' indekse"
- spa "El tipo de tabla usada no soporta índices FULLTEXT"
- swe "Tabelltypen har inte hantering av FULLTEXT-index"
- ukr "ВикориÑтаний тип таблиці не підтримує FULLTEXT індекÑів"
+ nla "Het gebruikte tabel type (%s) ondersteund geen FULLTEXT indexen"
+ eng "The storage engine %s doesn't support FULLTEXT indexes"
+ est "Antud tabelitüüp (%s) ei toeta FULLTEXT indekseid"
+ fre "Le type de table utilisé (%s) ne supporte pas les index FULLTEXT"
+ ger "Der verwendete Tabellentyp (%s) unterstützt keine FULLTEXT-Indizes"
+ ita "La tabella usata (%s) non supporta gli indici FULLTEXT"
+ por "O tipo de tabela utilizado (%s) não suporta índices de texto completo (fulltext indexes)"
+ rus "ИÑпользуемый тип таблиц (%s) не поддерживает полнотекÑтовых индекÑов"
+ serbian "Upotrebljeni tip tabele (%s) ne podržava 'FULLTEXT' indekse"
+ spa "El tipo de tabla usada (%s) no soporta índices FULLTEXT"
+ swe "Tabelltypen (%s) har inte hantering av FULLTEXT-index"
+ ukr "ВикориÑтаний тип таблиці (%s) не підтримує FULLTEXT індекÑів"
ER_CANNOT_ADD_FOREIGN
nla "Kan foreign key beperking niet toevoegen"
eng "Cannot add foreign key constraint"
@@ -4989,13 +4911,13 @@ ER_WRONG_NAME_FOR_CATALOG 42000
spa "Nombre de catalog incorrecto '%-.100s'"
swe "Felaktigt katalog namn '%-.100s'"
ER_WARN_QC_RESIZE
- eng "Query cache failed to set size %lu; new query cache size is %lu"
- ger "Änderung der Query-Cache-Größe auf %lu fehlgeschlagen; neue Query-Cache-Größe ist %lu"
- por "Falha em Query cache para configurar tamanho %lu, novo tamanho de query cache é %lu"
- rus "Кеш запроÑов не может уÑтановить размер %lu, новый размер кеша зпроÑов - %lu"
- spa "Query cache fallada para configurar tamaño %lu, nuevo tamaño de query cache es %lu"
- swe "Storleken av "Query cache" kunde inte sättas till %lu, ny storlek är %lu"
- ukr "Кеш запитів неÑпроможен вÑтановити розмір %lu, новий розмір кеша запитів - %lu"
+ eng "Query cache failed to set size %llu; new query cache size is %lu"
+ ger "Änderung der Query-Cache-Größe auf %llu fehlgeschlagen; neue Query-Cache-Größe ist %lu"
+ por "Falha em Query cache para configurar tamanho %llu, novo tamanho de query cache é %lu"
+ rus "Кеш запроÑов не может уÑтановить размер %llu, новый размер кеша зпроÑов - %lu"
+ spa "Query cache fallada para configurar tamaño %llu, nuevo tamaño de query cache es %lu"
+ swe "Storleken av "Query cache" kunde inte sättas till %llu, ny storlek är %lu"
+ ukr "Кеш запитів неÑпроможен вÑтановити розмір %llu, новий розмір кеша запитів - %lu"
ER_BAD_FT_COLUMN
eng "Column '%-.192s' cannot be part of FULLTEXT index"
ger "Feld '%-.192s' kann nicht Teil eines FULLTEXT-Index sein"
@@ -5622,8 +5544,8 @@ ER_NON_GROUPING_FIELD_USED 42000
eng "Non-grouping field '%-.192s' is used in %-.64s clause"
ger "In der %-.192s-Klausel wird das die Nicht-Gruppierungsspalte '%-.64s' verwendet"
ER_TABLE_CANT_HANDLE_SPKEYS
- eng "The used table type doesn't support SPATIAL indexes"
- ger "Der verwendete Tabellentyp unterstützt keine SPATIAL-Indizes"
+ eng "The storage engine %s doesn't support SPATIAL indexes"
+ ger "Der verwendete Tabellentyp (%s) unterstützt keine SPATIAL-Indizes"
ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
eng "Triggers can not be created on system tables"
ger "Trigger können nicht auf Systemtabellen erzeugt werden"
@@ -6018,8 +5940,8 @@ ER_ONLY_INTEGERS_ALLOWED
eng "Only integers allowed as number here"
ger "An dieser Stelle sind nur Ganzzahlen zulässig"
ER_UNSUPORTED_LOG_ENGINE
- eng "This storage engine cannot be used for log tables"
- ger "Diese Speicher-Engine kann für Logtabellen nicht verwendet werden"
+ eng "Storage engine %s cannot be used for log tables"
+ ger "Speicher-Engine %s kann für Logtabellen nicht verwendet werden"
ER_BAD_LOG_STATEMENT
eng "You cannot '%s' a log table if logging is enabled"
ger "Sie können eine Logtabelle nicht '%s', wenn Loggen angeschaltet ist"
@@ -6189,13 +6111,13 @@ ER_EXCEPTIONS_WRITE_ERROR
eng "Write to exceptions table failed. Message: %-.128s""
ger "Schreiben in Ausnahme-Tabelle fehlgeschlagen. Meldung: %-.128s""
ER_TOO_LONG_TABLE_COMMENT
- eng "Comment for table '%-.64s' is too long (max = %lu)"
- por "Comentário para a tabela '%-.64s' é longo demais (max = %lu)"
- ger "Kommentar für Tabelle '%-.64s' ist zu lang (max = %lu)"
+ eng "Comment for table '%-.64s' is too long (max = %u)"
+ por "Comentário para a tabela '%-.64s' é longo demais (max = %u)"
+ ger "Kommentar für Tabelle '%-.64s' ist zu lang (max = %u)"
ER_TOO_LONG_FIELD_COMMENT
- eng "Comment for field '%-.64s' is too long (max = %lu)"
- por "Comentário para o campo '%-.64s' é longo demais (max = %lu)"
- ger "Kommentar für Feld '%-.64s' ist zu lang (max = %lu)"
+ eng "Comment for field '%-.64s' is too long (max = %u)"
+ por "Comentário para o campo '%-.64s' é longo demais (max = %u)"
+ ger "Kommentar für Feld '%-.64s' ist zu lang (max = %u)"
ER_FUNC_INEXISTENT_NAME_COLLISION 42000
eng "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual"
ger "FUNCTION %s existiert nicht. Erläuterungen im Abschnitt 'Function Name Parsing and Resolution' im Referenzhandbuch"
@@ -6500,7 +6422,7 @@ ER_BINLOG_UNSAFE_INSERT_TWO_KEYS
ER_TABLE_IN_FK_CHECK
eng "Table is being used in foreign key check."
-ER_UNUSED_1
+ER_unused_1
eng "You should never see it"
ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST
@@ -6821,4 +6743,7 @@ ER_CANT_START_STOP_SLAVE
ER_SLAVE_STARTED
eng "SLAVE '%.*s' started"
ER_SLAVE_STOPPED
- eng "SLAVE '%.*s' stopped" \ No newline at end of file
+ eng "SLAVE '%.*s' stopped"
+ER_SQL_DISCOVER_ERROR
+ eng "Engine %s failed to discover table %`-.192s.%`-.192s with '%s'"
+
diff --git a/sql/slave.cc b/sql/slave.cc
index 78fa7998012..41eb7247b8c 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1351,6 +1351,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
unavailable (very old master not supporting UNIX_TIMESTAMP()?).
*/
+#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("dbug.before_get_UNIX_TIMESTAMP",
{
const char act[]=
@@ -1360,6 +1361,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
DBUG_ASSERT(!debug_sync_set_action(current_thd,
STRING_WITH_LEN(act)));
};);
+#endif
master_res= NULL;
if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) &&
@@ -1401,6 +1403,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
Note: we could have put a @@SERVER_ID in the previous SELECT
UNIX_TIMESTAMP() instead, but this would not have worked on 3.23 masters.
*/
+#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("dbug.before_get_SERVER_ID",
{
const char act[]=
@@ -1410,6 +1413,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
DBUG_ASSERT(!debug_sync_set_action(current_thd,
STRING_WITH_LEN(act)));
};);
+#endif
master_res= NULL;
master_row= NULL;
if (!mysql_real_query(mysql,
@@ -3263,6 +3267,7 @@ pthread_handler_t handle_slave_io(void *arg)
connected:
+#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("dbug.before_get_running_status_yes",
{
const char act[]=
@@ -3272,6 +3277,7 @@ connected:
DBUG_ASSERT(!debug_sync_set_action(thd,
STRING_WITH_LEN(act)));
};);
+#endif
// TODO: the assignment below should be under mutex (5.0)
mi->slave_running= MYSQL_SLAVE_RUN_CONNECT;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 7cd2e789351..37f5e97110a 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -2432,7 +2432,7 @@ sp_head::fill_field_definition(THD *thd, LEX *lex,
lex->charset ? lex->charset :
thd->variables.collation_database,
lex->uint_geom_type,
- lex->vcol_info, NULL))
+ lex->vcol_info, NULL, FALSE))
return TRUE;
if (field_def->interval_list.elements)
diff --git a/sql/spatial.cc b/sql/spatial.cc
index de0b563eaf4..2359f4fa271 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -312,6 +312,9 @@ bool Geometry::envelope(String *result) const
const char *end;
if (get_mbr(&mbr, &end))
+ return 1;
+
+ if (!mbr.valid())
{
/* Empty geometry */
if (result->reserve(1 + 4*2))
@@ -444,18 +447,19 @@ const char *Geometry::append_points(String *txt, uint32 n_points,
const char *Geometry::get_mbr_for_points(MBR *mbr, const char *data,
uint offset) const
{
- uint32 points;
+ uint32 n_points;
/* read number of points */
if (no_data(data, 4))
return 0;
- points= uint4korr(data);
+ n_points= uint4korr(data);
data+= 4;
- if (no_data(data, (POINT_DATA_SIZE + offset) * points))
+ if (n_points > max_n_points ||
+ no_data(data, (POINT_DATA_SIZE + offset) * n_points))
return 0;
/* Calculate MBR for points */
- while (points--)
+ while (n_points--)
{
data+= offset;
mbr->add_xy(data, data + SIZEOF_STORED_DOUBLE);
@@ -559,9 +563,12 @@ const Geometry::Class_info *Gis_point::get_class_info() const
uint32 Gis_line_string::get_data_size() const
{
- if (no_data(m_data, 4))
+ uint32 n_points, size;
+ if (no_data(m_data, 4) ||
+ (n_points= uint4korr(m_data)) > max_n_points ||
+ no_data(m_data, (size= 4 + n_points * POINT_DATA_SIZE)))
return GET_SIZE_ERROR;
- return 4 + uint4korr(m_data) * POINT_DATA_SIZE;
+ return size;
}
@@ -631,7 +638,7 @@ bool Gis_line_string::get_data_as_wkt(String *txt, const char **end) const
n_points= uint4korr(data);
data += 4;
- if (n_points < 1 ||
+ if (n_points < 1 || n_points > max_n_points ||
no_data(data, POINT_DATA_SIZE * n_points) ||
txt->reserve(((MAX_DIGITS_IN_DOUBLE + 1)*2 + 1) * n_points))
return 1;
@@ -669,7 +676,8 @@ int Gis_line_string::geom_length(double *len, const char **end) const
return 1;
n_points= uint4korr(data);
data+= 4;
- if (n_points < 1 || no_data(data, POINT_DATA_SIZE * n_points))
+ if (n_points < 1 || n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points))
return 1;
get_point(&prev_x, &prev_y, data);
@@ -717,7 +725,7 @@ int Gis_line_string::is_closed(int *closed) const
return 0;
}
data+= 4;
- if (n_points == 0 ||
+ if (n_points == 0 || n_points > max_n_points ||
no_data(data, POINT_DATA_SIZE * n_points))
return 1;
@@ -753,6 +761,9 @@ int Gis_line_string::end_point(String *result) const
if (no_data(m_data, 4))
return 1;
n_points= uint4korr(m_data);
+ if (n_points == 0 || n_points > max_n_points ||
+ no_data(m_data, POINT_DATA_SIZE * n_points))
+ return 1;
return create_point(result, m_data + 4 + (n_points - 1) * POINT_DATA_SIZE);
}
@@ -762,11 +773,14 @@ int Gis_line_string::point_n(uint32 num, String *result) const
uint32 n_points;
if (no_data(m_data, 4))
return 1;
+ num--;
n_points= uint4korr(m_data);
- if ((uint32) (num - 1) >= n_points) // means (num > n_points || num < 1)
+ if (num >= n_points ||
+ num > max_n_points || // means (num > n_points || num < 1)
+ no_data(m_data, num * POINT_DATA_SIZE))
return 1;
- return create_point(result, m_data + 4 + (num - 1) * POINT_DATA_SIZE);
+ return create_point(result, m_data + 4 + num*POINT_DATA_SIZE);
}
@@ -782,7 +796,8 @@ int Gis_line_string::store_shapes(Gcalc_shape_transporter *trn) const
return 1;
n_points= uint4korr(data);
data+= 4;
- if (n_points < 1 || no_data(data, POINT_DATA_SIZE * n_points))
+ if (n_points < 1 || n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points))
return 1;
trn->start_line();
@@ -815,6 +830,7 @@ const Geometry::Class_info *Gis_line_string::get_class_info() const
uint32 Gis_polygon::get_data_size() const
{
uint32 n_linear_rings;
+ uint32 n_points;
const char *data= m_data;
if (no_data(data, 4))
@@ -824,10 +840,13 @@ uint32 Gis_polygon::get_data_size() const
while (n_linear_rings--)
{
- if (no_data(data, 4))
+ if (no_data(data, 4) ||
+ (n_points= uint4korr(data)) > max_n_points)
return GET_SIZE_ERROR;
- data+= 4 + uint4korr(data)*POINT_DATA_SIZE;
+ data+= 4 + n_points*POINT_DATA_SIZE;
}
+ if (no_data(data, 0))
+ return GET_SIZE_ERROR;
return (uint32) (data - m_data);
}
@@ -966,7 +985,7 @@ bool Gis_polygon::get_data_as_wkt(String *txt, const char **end) const
return 1;
n_points= uint4korr(data);
data+= 4;
- if (no_data(data, POINT_DATA_SIZE * n_points) ||
+ if (n_points > max_n_points || no_data(data, POINT_DATA_SIZE * n_points) ||
txt->reserve(2 + ((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points))
return 1;
txt->qs_append('(');
@@ -1020,7 +1039,8 @@ int Gis_polygon::area(double *ar, const char **end_of_data) const
if (no_data(data, 4))
return 1;
n_points= uint4korr(data);
- if (no_data(data, POINT_DATA_SIZE * n_points))
+ if (n_points == 0 || n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points))
return 1;
get_point(&prev_x, &prev_y, data+4);
data+= (4+POINT_DATA_SIZE);
@@ -1056,7 +1076,8 @@ int Gis_polygon::exterior_ring(String *result) const
n_points= uint4korr(data);
data+= 4;
length= n_points * POINT_DATA_SIZE;
- if (no_data(data, length) || result->reserve(1 + 4 + 4 + length))
+ if (n_points > max_n_points ||
+ no_data(data, length) || result->reserve(1 + 4 + 4 + length))
return 1;
result->q_append((char) wkb_ndr);
@@ -1102,7 +1123,8 @@ int Gis_polygon::interior_ring_n(uint32 num, String *result) const
n_points= uint4korr(data);
points_size= n_points * POINT_DATA_SIZE;
data+= 4;
- if (no_data(data, points_size) || result->reserve(1 + 4 + 4 + points_size))
+ if (n_points > max_n_points ||
+ no_data(data, points_size) || result->reserve(1 + 4 + 4 + points_size))
return 1;
result->q_append((char) wkb_ndr);
@@ -1122,13 +1144,11 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
const char *data= m_data;
bool first_loop= 1;
- if (no_data(data, 4))
+ if (no_data(data, 4) ||
+ (n_linear_rings= uint4korr(data)) == 0)
return 1;
- n_linear_rings= uint4korr(data);
data+= 4;
- DBUG_ASSERT(n_linear_rings > 0);
-
while (n_linear_rings--)
{
uint32 n_points, org_n_points;
@@ -1141,7 +1161,8 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
return 1;
org_n_points= n_points= uint4korr(data);
data+= 4;
- if (no_data(data, POINT_DATA_SIZE * n_points))
+ if (n_points == 0 || n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points))
return 1;
get_point(&prev_x, &prev_y, data);
data+= POINT_DATA_SIZE;
@@ -1215,7 +1236,8 @@ int Gis_polygon::store_shapes(Gcalc_shape_transporter *trn) const
return 1;
n_points= uint4korr(data);
data+= 4;
- if (!n_points || no_data(data, POINT_DATA_SIZE * n_points))
+ if (!n_points || n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points))
return 1;
trn->start_ring();
@@ -1268,9 +1290,14 @@ const Geometry::Class_info *Gis_polygon::get_class_info() const
uint32 Gis_multi_point::get_data_size() const
{
- if (no_data(m_data, 4))
- return GET_SIZE_ERROR;
- return 4 + uint4korr(m_data)*(POINT_DATA_SIZE + WKB_HEADER_SIZE);
+ uint32 n_points;
+ uint32 size;
+
+ if (no_data(m_data, 4) ||
+ (n_points= uint4korr(m_data)) > max_n_points ||
+ no_data(m_data, (size= 4 + n_points*(POINT_DATA_SIZE + WKB_HEADER_SIZE))))
+ return GET_SIZE_ERROR;
+ return size;
}
@@ -1364,8 +1391,8 @@ bool Gis_multi_point::get_data_as_wkt(String *txt, const char **end) const
return 1;
n_points= uint4korr(m_data);
- if (no_data(m_data+4,
- n_points * (POINT_DATA_SIZE + WKB_HEADER_SIZE)) ||
+ if (n_points > max_n_points ||
+ no_data(m_data+4, n_points * (POINT_DATA_SIZE + WKB_HEADER_SIZE)) ||
txt->reserve(((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points))
return 1;
*end= append_points(txt, n_points, m_data+4, WKB_HEADER_SIZE);
@@ -1446,6 +1473,7 @@ const Geometry::Class_info *Gis_multi_point::get_class_info() const
uint32 Gis_multi_line_string::get_data_size() const
{
uint32 n_line_strings;
+ uint32 n_points;
const char *data= m_data;
if (no_data(data, 4))
@@ -1455,11 +1483,13 @@ uint32 Gis_multi_line_string::get_data_size() const
while (n_line_strings--)
{
- if (no_data(data, WKB_HEADER_SIZE + 4))
+ if (no_data(data, WKB_HEADER_SIZE + 4) ||
+ (n_points= uint4korr(data + WKB_HEADER_SIZE)) > max_n_points)
return GET_SIZE_ERROR;
- data+= (WKB_HEADER_SIZE + 4 + uint4korr(data + WKB_HEADER_SIZE) *
- POINT_DATA_SIZE);
+ data+= (WKB_HEADER_SIZE + 4 + n_points*POINT_DATA_SIZE);
}
+ if (no_data(data, 0))
+ return GET_SIZE_ERROR;
return (uint32) (data - m_data);
}
@@ -1583,7 +1613,7 @@ bool Gis_multi_line_string::get_data_as_wkt(String *txt,
return 1;
n_points= uint4korr(data + WKB_HEADER_SIZE);
data+= WKB_HEADER_SIZE + 4;
- if (no_data(data, n_points * POINT_DATA_SIZE) ||
+ if (n_points > max_n_points || no_data(data, n_points * POINT_DATA_SIZE) ||
txt->reserve(2 + ((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points))
return 1;
txt->qs_append('(');
@@ -1644,7 +1674,7 @@ int Gis_multi_line_string::geometry_n(uint32 num, String *result) const
return 1;
n_points= uint4korr(data + WKB_HEADER_SIZE);
length= WKB_HEADER_SIZE + 4+ POINT_DATA_SIZE * n_points;
- if (no_data(data, length))
+ if (n_points > max_n_points || no_data(data, length))
return 1;
if (!--num)
break;
@@ -1755,6 +1785,7 @@ const Geometry::Class_info *Gis_multi_line_string::get_class_info() const
uint32 Gis_multi_polygon::get_data_size() const
{
uint32 n_polygons;
+ uint32 n_points;
const char *data= m_data;
if (no_data(data, 4))
@@ -1773,11 +1804,14 @@ uint32 Gis_multi_polygon::get_data_size() const
while (n_linear_rings--)
{
- if (no_data(data, 4))
+ if (no_data(data, 4) ||
+ (n_points= uint4korr(data)) > max_n_points)
return GET_SIZE_ERROR;
- data+= 4 + uint4korr(data) * POINT_DATA_SIZE;
+ data+= 4 + n_points * POINT_DATA_SIZE;
}
}
+ if (no_data(data, 0))
+ return GET_SIZE_ERROR;
return (uint32) (data - m_data);
}
@@ -1905,7 +1939,8 @@ bool Gis_multi_polygon::get_data_as_wkt(String *txt, const char **end) const
return 1;
uint32 n_points= uint4korr(data);
data+= 4;
- if (no_data(data, POINT_DATA_SIZE * n_points) ||
+ if (n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points) ||
txt->reserve(2 + ((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points,
512))
return 1;
@@ -1988,6 +2023,8 @@ int Gis_multi_polygon::geometry_n(uint32 num, String *result) const
if (no_data(data, 4))
return 1;
n_points= uint4korr(data);
+ if (n_points > max_n_points)
+ return 1;
data+= 4 + POINT_DATA_SIZE * n_points;
}
} while (--num);
@@ -2317,7 +2354,7 @@ bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const
n_objects= uint4korr(data);
data+= 4;
if (n_objects == 0)
- return 1;
+ goto exit;
while (n_objects--)
{
@@ -2334,6 +2371,7 @@ bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const
if (geom->get_mbr(mbr, &data))
return 1;
}
+exit:
*end= data;
return 0;
}
@@ -2351,10 +2389,11 @@ int Gis_geometry_collection::area(double *ar, const char **end) const
return 1;
n_objects= uint4korr(data);
data+= 4;
- if (n_objects == 0)
- return 1;
result= 0.0;
+ if (n_objects == 0)
+ goto exit;
+
while (n_objects--)
{
uint32 wkb_type;
@@ -2371,6 +2410,7 @@ int Gis_geometry_collection::area(double *ar, const char **end) const
return 1;
result+= *ar;
}
+exit:
*end= data;
*ar= result;
return 0;
@@ -2389,10 +2429,11 @@ int Gis_geometry_collection::geom_length(double *len, const char **end) const
return 1;
n_objects= uint4korr(data);
data+= 4;
+ result= 0.0;
+
if (n_objects == 0)
- return 1;
+ goto exit;
- result= 0.0;
while (n_objects--)
{
uint32 wkb_type;
@@ -2409,6 +2450,8 @@ int Gis_geometry_collection::geom_length(double *len, const char **end) const
return 1;
result+= *len;
}
+
+exit:
*end= data;
*len= result;
return 0;
diff --git a/sql/spatial.h b/sql/spatial.h
index 1277e7bc01c..9aaedfe8a20 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -200,6 +200,9 @@ struct MBR
return (d == intersection.dimension());
}
+
+ int valid() const
+ { return xmin <= xmax && ymin <= ymax; }
};
@@ -210,6 +213,11 @@ struct Geometry_buffer;
class Geometry
{
public:
+ // Maximum number of points in feature that can fit into String
+ static const uint32 max_n_points=
+ (uint32) (INT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
+ POINT_DATA_SIZE;
+
Geometry() {} /* Remove gcc warning */
virtual ~Geometry() {} /* Remove gcc warning */
static void *operator new(size_t size, void *buffer)
@@ -391,10 +399,6 @@ public:
class Gis_line_string: public Geometry
{
- // Maximum number of points in LineString that can fit into String
- static const uint32 max_n_points=
- (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
- POINT_DATA_SIZE;
public:
Gis_line_string() {} /* Remove gcc warning */
virtual ~Gis_line_string() {} /* Remove gcc warning */
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index cb7e35fae09..db734389b7f 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -52,6 +52,8 @@
#include "sql_db.h"
#include "sql_array.h"
+#include "sql_plugin_compat.h"
+
bool mysql_user_table_is_in_short_password_format= false;
static const
@@ -4532,12 +4534,16 @@ end:
@see check_access
@see check_table_access
- @note This functions assumes that either number of tables to be inspected
+ @note
+ This functions assumes that either number of tables to be inspected
by it is limited explicitly (i.e. is is not UINT_MAX) or table list
used and thd->lex->query_tables_own_last value correspond to each
other (the latter should be either 0 or point to next_global member
of one of elements of this table list).
+ We delay locking of LOCK_grant until we really need it as we assume that
+ most privileges be resolved with user or db level accesses.
+
@return Access status
@retval FALSE Access granted; But column privileges might need to be
checked.
@@ -4554,6 +4560,8 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
Security_context *sctx= thd->security_ctx;
uint i;
ulong orig_want_access= want_access;
+ my_bool locked= 0;
+ GRANT_TABLE *grant_table;
DBUG_ENTER("check_grant");
DBUG_ASSERT(number > 0);
@@ -4577,11 +4585,9 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
*/
tl->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
}
+ number= i;
- mysql_rwlock_rdlock(&LOCK_grant);
- for (tl= tables;
- tl && number-- && tl != first_not_own_table;
- tl= tl->next_global)
+ for (tl= tables; number-- ; tl= tl->next_global)
{
sctx = test(tl->security_ctx) ? tl->security_ctx : thd->security_ctx;
@@ -4634,13 +4640,18 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
}
continue;
}
- GRANT_TABLE *grant_table= table_hash_search(sctx->host, sctx->ip,
- tl->get_db_name(),
- sctx->priv_user,
- tl->get_table_name(),
- FALSE);
- if (!grant_table)
+ if (!locked)
+ {
+ locked= 1;
+ mysql_rwlock_rdlock(&LOCK_grant);
+ }
+
+ if (!(grant_table= table_hash_search(sctx->host, sctx->ip,
+ tl->get_db_name(),
+ sctx->priv_user,
+ tl->get_table_name(),
+ FALSE)))
{
want_access &= ~tl->grant.privilege;
goto err; // No grants
@@ -4667,11 +4678,13 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
goto err; // impossible
}
}
- mysql_rwlock_unlock(&LOCK_grant);
+ if (locked)
+ mysql_rwlock_unlock(&LOCK_grant);
DBUG_RETURN(FALSE);
err:
- mysql_rwlock_unlock(&LOCK_grant);
+ if (locked)
+ mysql_rwlock_unlock(&LOCK_grant);
if (!no_errors) // Not a silent skip of table
{
char command[128];
@@ -7025,10 +7038,8 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
tables->db= (char*)sp_db;
tables->table_name= tables->alias= (char*)sp_name;
- thd->make_lex_string(&combo->user,
- combo->user.str, strlen(combo->user.str), 0);
- thd->make_lex_string(&combo->host,
- combo->host.str, strlen(combo->host.str), 0);
+ thd->make_lex_string(&combo->user, combo->user.str, strlen(combo->user.str));
+ thd->make_lex_string(&combo->host, combo->host.str, strlen(combo->host.str));
combo->password= empty_lex_str;
combo->plugin= empty_lex_str;
@@ -7950,7 +7961,7 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
data_len= SCRAMBLE_LENGTH;
}
- end= strnmov(end, server_version, SERVER_VERSION_LENGTH) + 1;
+ end= strxnmov(end, SERVER_VERSION_LENGTH, RPL_VERSION_HACK, server_version, NullS) + 1;
int4store((uchar*) end, mpvio->thd->thread_id);
end+= 4;
@@ -8254,7 +8265,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
thd->user_connect= 0;
strmake(sctx->priv_user, sctx->user, USERNAME_LENGTH);
- if (thd->make_lex_string(&mpvio->db, db_buff, db_len, 0) == 0)
+ if (thd->make_lex_string(&mpvio->db, db_buff, db_len) == 0)
DBUG_RETURN(1); /* The error is set by make_lex_string(). */
/*
@@ -8480,7 +8491,7 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
Security_context *sctx= thd->security_ctx;
- if (thd->make_lex_string(&mpvio->db, db, db_len, 0) == 0)
+ if (thd->make_lex_string(&mpvio->db, db, db_len) == 0)
return packet_error; /* The error is set by make_lex_string(). */
my_free(sctx->user);
if (!(sctx->user= my_strndup(user, user_len, MYF(MY_WME))))
@@ -8869,7 +8880,20 @@ static int do_auth_once(THD *thd, const LEX_STRING *auth_plugin_name,
if (plugin)
{
st_mysql_auth *auth= (st_mysql_auth *) plugin_decl(plugin)->info;
- res= auth->authenticate_user(mpvio, &mpvio->auth_info);
+ switch (auth->interface_version) {
+ case 0x0200:
+ res= auth->authenticate_user(mpvio, &mpvio->auth_info);
+ break;
+ case 0x0100:
+ {
+ MYSQL_SERVER_AUTH_INFO_0x0100 compat;
+ compat.downgrade(&mpvio->auth_info);
+ res= auth->authenticate_user(mpvio, (MYSQL_SERVER_AUTH_INFO *)&compat);
+ compat.upgrade(&mpvio->auth_info);
+ }
+ break;
+ default: DBUG_ASSERT(0);
+ }
if (unlock_plugin)
plugin_unlock(thd, plugin);
@@ -8920,8 +8944,6 @@ bool acl_authenticate(THD *thd, uint connect_errors,
: COM_CONNECT;
DBUG_ENTER("acl_authenticate");
- compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH);
-
bzero(&mpvio, sizeof(mpvio));
mpvio.read_packet= server_mpvio_read_packet;
mpvio.write_packet= server_mpvio_write_packet;
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index e6bbef482a7..9e3ea46f526 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -89,6 +89,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
const char **ext;
MY_STAT stat_info;
Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_OPEN_FOR_REPAIR |
MYSQL_OPEN_HAS_MDL_LOCK |
MYSQL_LOCK_IGNORE_TIMEOUT));
DBUG_ENTER("prepare_for_repair");
@@ -98,8 +99,6 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
if (!(table= table_list->table))
{
- char key[MAX_DBKEY_LENGTH];
- uint key_length;
/*
If the table didn't exist, we have a shared metadata lock
on it that is left from mysql_admin_table()'s attempt to
@@ -112,9 +111,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
Attempt to do full-blown table open in mysql_admin_table() has failed.
Let us try to open at least a .FRM for this table.
*/
- my_hash_value_type hash_value;
- key_length= create_table_def_key(thd, key, table_list, 0);
table_list->mdl_request.init(MDL_key::TABLE,
table_list->db, table_list->table_name,
MDL_EXCLUSIVE, MDL_TRANSACTION);
@@ -125,11 +122,8 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN(0);
has_mdl_lock= TRUE;
- hash_value= my_calc_hash(&table_def_cache, (uchar*) key, key_length);
- mysql_mutex_lock(&LOCK_open);
- share= get_table_share(thd, table_list, key, key_length, 0,
- &error, hash_value);
- mysql_mutex_unlock(&LOCK_open);
+ share= get_table_share(thd, table_list->db, table_list->table_name,
+ GTS_TABLE);
if (share == NULL)
DBUG_RETURN(0); // Can't open frm file
@@ -199,7 +193,8 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
*/
pos_in_locked_tables= table->pos_in_locked_tables;
if (wait_while_table_is_used(thd, table,
- HA_EXTRA_PREPARE_FOR_FORCED_CLOSE))
+ HA_EXTRA_PREPARE_FOR_FORCED_CLOSE,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
goto end;
/* Close table but don't remove from locked list */
close_all_tables_for_name(thd, table_list->table->s,
@@ -593,8 +588,10 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
*/
if (lock_type == TL_WRITE && !table->table->s->tmp_table)
{
+ table->table->s->protect_against_usage();
if (wait_while_table_is_used(thd, table->table,
- HA_EXTRA_PREPARE_FOR_RENAME))
+ HA_EXTRA_PREPARE_FOR_RENAME,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
goto err;
DEBUG_SYNC(thd, "after_admin_flush");
/* Flush entries in the query cache involving this table. */
@@ -826,6 +823,11 @@ send_result_message:
case HA_ADMIN_TRY_ALTER:
{
+ uint save_flags;
+ Alter_info *alter_info= &lex->alter_info;
+
+ /* Store the original value of alter_info->flags */
+ save_flags= alter_info->flags;
/*
This is currently used only by InnoDB. ha_innobase::optimize() answers
"try with alter", so here we close the table, do an ALTER TABLE,
@@ -833,10 +835,19 @@ send_result_message:
We have to end the row, so analyze could return more rows.
*/
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
- protocol->store(STRING_WITH_LEN(
- "Table does not support optimize, doing recreate + analyze instead"),
- system_charset_info);
- if (protocol->write())
+ if(alter_info->flags & ALTER_ADMIN_PARTITION)
+ {
+ protocol->store(STRING_WITH_LEN(
+ "Table does not support optimize on partitions. All partitions "
+ "will be rebuilt and analyzed."),system_charset_info);
+ }
+ else
+ {
+ protocol->store(STRING_WITH_LEN(
+ "Table does not support optimize, doing recreate + analyze instead"),
+ system_charset_info);
+ }
+ if (protocol->write())
goto err;
DBUG_PRINT("info", ("HA_ADMIN_TRY_ALTER, trying analyze..."));
TABLE_LIST *save_next_local= table->next_local,
@@ -855,6 +866,11 @@ send_result_message:
table->mdl_request.ticket= NULL;
DEBUG_SYNC(thd, "ha_admin_open_ltable");
table->mdl_request.set_type(MDL_SHARED_WRITE);
+ /*
+ Reset the ALTER_ADMIN_PARTITION bit in alter_info->flags
+ to force analyze on all partitions.
+ */
+ alter_info->flags &= ~(ALTER_ADMIN_PARTITION);
if ((table->table= open_ltable(thd, table, lock_type, 0)))
{
result_code= table->table->file->ha_analyze(thd, check_opt);
@@ -865,6 +881,7 @@ send_result_message:
}
else
result_code= -1; // open failed
+ alter_info->flags= save_flags;
}
/* Start a new row for the final status row */
protocol->prepare_for_resend();
diff --git a/sql/sql_array.h b/sql/sql_array.h
index f07126bc0ef..43ca4ef4219 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -104,7 +104,7 @@ public:
MYF(MY_THREAD_SPECIFIC));
}
- Elem& at(int idx)
+ Elem& at(size_t idx)
{
return *(((Elem*)array.buffer) + idx);
}
@@ -124,11 +124,21 @@ public:
return (insert_dynamic(&array, (uchar*)&el));
}
- int elements()
+ bool append_val(Elem el)
+ {
+ return (insert_dynamic(&array, (uchar*)&el));
+ }
+
+ size_t elements()
{
return array.elements;
}
+ void set_elements(size_t n)
+ {
+ array.elements= n;
+ }
+
~Dynamic_array()
{
delete_dynamic(&array);
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index 46afe4b7596..a651ce61374 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -43,10 +43,16 @@ static inline bool mysql_audit_general_enabled()
return mysql_global_audit_mask[0] & MYSQL_AUDIT_GENERAL_CLASSMASK;
}
+static inline bool mysql_audit_connection_enabled()
+{
+ return mysql_global_audit_mask[0] & MYSQL_AUDIT_CONNECTION_CLASSMASK;
+}
+
#else
static inline void mysql_audit_notify(THD *thd, uint event_class,
uint event_subtype, ...) { }
#define mysql_audit_general_enabled() 0
+#define mysql_audit_connection_enabled() 0
#endif
extern void mysql_audit_release(THD *thd);
@@ -137,41 +143,58 @@ void mysql_audit_general(THD *thd, uint event_subtype,
}
}
-#define MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd) mysql_audit_notify(\
- (thd), MYSQL_AUDIT_CONNECTION_CLASS, MYSQL_AUDIT_CONNECTION_CONNECT,\
- (thd)->stmt_da->is_error() ? (thd)->stmt_da->sql_errno() : 0,\
- (thd)->thread_id, (thd)->security_ctx->user,\
- (thd)->security_ctx->user ? strlen((thd)->security_ctx->user) : 0,\
- (thd)->security_ctx->priv_user, strlen((thd)->security_ctx->priv_user),\
- (thd)->security_ctx->external_user,\
- (thd)->security_ctx->external_user ?\
- strlen((thd)->security_ctx->external_user) : 0,\
- (thd)->security_ctx->proxy_user, strlen((thd)->security_ctx->proxy_user),\
- (thd)->security_ctx->host,\
- (thd)->security_ctx->host ? strlen((thd)->security_ctx->host) : 0,\
- (thd)->security_ctx->ip,\
- (thd)->security_ctx->ip ? strlen((thd)->security_ctx->ip) : 0,\
- (thd)->db, (thd)->db ? strlen((thd)->db) : 0)
-
-#define MYSQL_AUDIT_NOTIFY_CONNECTION_DISCONNECT(thd, errcode)\
- mysql_audit_notify(\
- (thd), MYSQL_AUDIT_CONNECTION_CLASS, MYSQL_AUDIT_CONNECTION_DISCONNECT,\
- (errcode), (thd)->thread_id, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
-
-#define MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER(thd) mysql_audit_notify(\
- (thd), MYSQL_AUDIT_CONNECTION_CLASS, MYSQL_AUDIT_CONNECTION_CHANGE_USER,\
- (thd)->stmt_da->is_error() ? (thd)->stmt_da->sql_errno() : 0,\
- (thd)->thread_id, (thd)->security_ctx->user,\
- (thd)->security_ctx->user ? strlen((thd)->security_ctx->user) : 0,\
- (thd)->security_ctx->priv_user, strlen((thd)->security_ctx->priv_user),\
- (thd)->security_ctx->external_user,\
- (thd)->security_ctx->external_user ?\
- strlen((thd)->security_ctx->external_user) : 0,\
- (thd)->security_ctx->proxy_user, strlen((thd)->security_ctx->proxy_user),\
- (thd)->security_ctx->host,\
- (thd)->security_ctx->host ? strlen((thd)->security_ctx->host) : 0,\
- (thd)->security_ctx->ip,\
- (thd)->security_ctx->ip ? strlen((thd)->security_ctx->ip) : 0,\
- (thd)->db, (thd)->db ? strlen((thd)->db) : 0)
+static inline
+void mysql_audit_notify_connection_connect(THD *thd)
+{
+ if (mysql_audit_connection_enabled())
+ {
+ const Security_context *sctx= thd->security_ctx;
+ mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS,
+ MYSQL_AUDIT_CONNECTION_CONNECT,
+ thd->stmt_da->is_error() ? thd->stmt_da->sql_errno() : 0,
+ thd->thread_id,
+ sctx->user, sctx->user ? strlen(sctx->user) : 0,
+ sctx->priv_user, strlen(sctx->priv_user),
+ sctx->external_user,
+ sctx->external_user ? strlen(sctx->external_user) : 0,
+ sctx->proxy_user, strlen(sctx->proxy_user),
+ sctx->host, sctx->host ? strlen(sctx->host) : 0,
+ sctx->ip, sctx->ip ? strlen(sctx->ip) : 0,
+ thd->db, thd->db ? strlen(thd->db) : 0);
+ }
+}
+
+static inline
+void mysql_audit_notify_connection_disconnect(THD *thd, int errcode)
+{
+ if (mysql_audit_connection_enabled())
+ {
+ mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS,
+ MYSQL_AUDIT_CONNECTION_DISCONNECT,
+ errcode, thd->thread_id,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ }
+}
+
+static inline
+void mysql_audit_notify_connection_change_user(THD *thd)
+{
+ if (mysql_audit_connection_enabled())
+ {
+ const Security_context *sctx= thd->security_ctx;
+ mysql_audit_notify(thd, MYSQL_AUDIT_CONNECTION_CLASS,
+ MYSQL_AUDIT_CONNECTION_CHANGE_USER,
+ thd->stmt_da->is_error() ? thd->stmt_da->sql_errno() : 0,
+ thd->thread_id,
+ sctx->user, sctx->user ? strlen(sctx->user) : 0,
+ sctx->priv_user, strlen(sctx->priv_user),
+ sctx->external_user,
+ sctx->external_user ? strlen(sctx->external_user) : 0,
+ sctx->proxy_user, strlen(sctx->proxy_user),
+ sctx->host, sctx->host ? strlen(sctx->host) : 0,
+ sctx->ip, sctx->ip ? strlen(sctx->ip) : 0,
+ thd->db, thd->db ? strlen(thd->db) : 0);
+ }
+}
#endif /* SQL_AUDIT_INCLUDED */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 969e2f2c7e4..004fbb24294 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -55,7 +55,7 @@
#include <hash.h>
#include "rpl_filter.h"
#include "sql_table.h" // build_table_filename
-#include "datadict.h" // dd_frm_type()
+#include "datadict.h" // dd_frm_is_view()
#include "sql_hset.h" // Hash_set
#ifdef __WIN__
#include <io.h>
@@ -167,6 +167,24 @@ Repair_mrg_table_error_handler::handle_condition(THD *,
Protects table_def_hash, used and unused lists in the
TABLE_SHARE object, LRU lists of used TABLEs and used
TABLE_SHAREs, refresh_version and the table id counter.
+ In particular:
+
+ end_of_unused_share
+ last_table_id
+ oldest_unused_share
+ refresh_version
+ table_cache_count
+ table_def_cache
+ table_def_shutdown_in_progress
+ unused_tables
+ TABLE::next
+ TABLE::prev
+ TABLE_SHARE::free_tables
+ TABLE_SHARE::m_flush_tickets
+ TABLE_SHARE::next
+ TABLE_SHARE::prev
+ TABLE_SHARE::ref_count
+ TABLE_SHARE::used_tables
*/
mysql_mutex_t LOCK_open;
@@ -302,18 +320,18 @@ static void check_unused(THD *thd)
Create a table cache key
SYNOPSIS
- create_table_def_key()
+ create_tmp_table_def_key()
thd Thread handler
key Create key here (must be of size MAX_DBKEY_LENGTH)
- table_list Table definition
- tmp_table Set if table is a tmp table
+ db Database name.
+ table_name Table name.
IMPLEMENTATION
The table cache_key is created from:
db_name + \0
table_name + \0
- if the table is a tmp table, we add the following to make each tmp table
+ additionally we add the following to make each tmp table
unique on the slave:
4 bytes for master thread id
@@ -323,22 +341,13 @@ static void check_unused(THD *thd)
Length of key
*/
-uint create_table_def_key(THD *thd, char *key,
- const TABLE_LIST *table_list,
- bool tmp_table)
+uint create_tmp_table_def_key(THD *thd, char *key,
+ const char *db, const char *table_name)
{
- char *db_end= strnmov(key, table_list->db, MAX_DBKEY_LENGTH - 2);
- *db_end++= '\0';
- char *table_end= strnmov(db_end, table_list->table_name,
- key + MAX_DBKEY_LENGTH - 1 - db_end);
- *table_end++= '\0';
- uint key_length= (uint) (table_end-key);
- if (tmp_table)
- {
- int4store(key + key_length, thd->server_id);
- int4store(key + key_length + 4, thd->variables.pseudo_thread_id);
- key_length+= TMP_TABLE_KEY_EXTRA;
- }
+ uint key_length= create_table_def_key(key, db, table_name);
+ int4store(key + key_length, thd->server_id);
+ int4store(key + key_length + 4, thd->variables.pseudo_thread_id);
+ key_length+= TMP_TABLE_KEY_EXTRA;
return key_length;
}
@@ -561,78 +570,75 @@ static void table_def_unuse_table(TABLE *table)
table_list Table that should be opened
key Table cache key
key_length Length of key
- db_flags Flags to open_table_def():
- OPEN_VIEW
- error out: Error code from open_table_def()
+ flags operation: what to open table or view
+ hash_value = my_calc_hash(&table_def_cache, key, key_length)
IMPLEMENTATION
Get a table definition from the table definition cache.
If it doesn't exist, create a new from the table definition file.
- NOTES
- We must have wrlock on LOCK_open when we come here
- (To be changed later)
-
RETURN
0 Error
# Share for table
*/
-TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
- uint key_length, uint db_flags, int *error,
+TABLE_SHARE *get_table_share(THD *thd, const char *db, const char *table_name,
+ char *key, uint key_length, uint flags,
my_hash_value_type hash_value)
{
TABLE_SHARE *share;
DBUG_ENTER("get_table_share");
- *error= 0;
-
- /*
- To be able perform any operation on table we should own
- some kind of metadata lock on it.
- */
- DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE,
- table_list->db,
- table_list->table_name,
- MDL_SHARED));
+ mysql_mutex_lock(&LOCK_open);
/* Read table definition from cache */
- if ((share= (TABLE_SHARE*) my_hash_search_using_hash_value(&table_def_cache,
- hash_value, (uchar*) key, key_length)))
- goto found;
+ share= (TABLE_SHARE*) my_hash_search_using_hash_value(&table_def_cache,
+ hash_value, (uchar*) key, key_length);
- if (!(share= alloc_table_share(table_list, key, key_length)))
+ if (!share)
{
- DBUG_RETURN(0);
- }
+ if (!(share= alloc_table_share(db, table_name, key, key_length)))
+ goto err;
- /*
- We assign a new table id under the protection of LOCK_open.
- We do this instead of creating a new mutex
- and using it for the sole purpose of serializing accesses to a
- static variable, we assign the table id here. We assign it to the
- share before inserting it into the table_def_cache to be really
- sure that it cannot be read from the cache without having a table
- id assigned.
-
- CAVEAT. This means that the table cannot be used for
- binlogging/replication purposes, unless get_table_share() has been
- called directly or indirectly.
- */
- assign_new_table_id(share);
-
- if (my_hash_insert(&table_def_cache, (uchar*) share))
- {
- free_table_share(share);
- DBUG_RETURN(0); // return error
- }
- if (open_table_def(thd, share, db_flags))
- {
- *error= share->error;
- (void) my_hash_delete(&table_def_cache, (uchar*) share);
- DBUG_RETURN(0);
- }
- share->ref_count++; // Mark in use
+ /*
+ We assign a new table id under the protection of LOCK_open.
+ We do this instead of creating a new mutex
+ and using it for the sole purpose of serializing accesses to a
+ static variable, we assign the table id here. We assign it to the
+ share before inserting it into the table_def_cache to be really
+ sure that it cannot be read from the cache without having a table
+ id assigned.
+
+ CAVEAT. This means that the table cannot be used for
+ binlogging/replication purposes, unless get_table_share() has been
+ called directly or indirectly.
+ */
+ assign_new_table_id(share);
+
+ if (my_hash_insert(&table_def_cache, (uchar*) share))
+ {
+ free_table_share(share);
+ goto err;
+ }
+ share->ref_count++; // Mark in use
+ share->error= OPEN_FRM_OPEN_ERROR;
+ mysql_mutex_lock(&share->LOCK_ha_data);
+ mysql_mutex_unlock(&LOCK_open);
+
+ if (flags & GTS_FORCE_DISCOVERY)
+ ha_discover_table(thd, share); // don't read the frm at all
+ else
+ open_table_def(thd, share, flags | GTS_FORCE_DISCOVERY); // frm or discover
+
+ mysql_mutex_unlock(&share->LOCK_ha_data);
+ mysql_mutex_lock(&LOCK_open);
+
+ if (share->error)
+ {
+ share->ref_count--;
+ (void) my_hash_delete(&table_def_cache, (uchar*) share);
+ goto err;
+ }
#ifdef HAVE_PSI_TABLE_INTERFACE
share->m_psi= PSI_CALL(get_table_share)(false, share);
@@ -640,25 +646,38 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
share->m_psi= NULL;
#endif
- DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
- (ulong) share, share->ref_count));
- DBUG_RETURN(share);
+ DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
+ (ulong) share, share->ref_count));
+
+ goto end;
+ }
+
+ /* cannot force discovery of a cached share */
+ DBUG_ASSERT(!(flags & GTS_FORCE_DISCOVERY));
+
+ /* make sure that open_table_def() for this share is not running */
+ mysql_mutex_lock(&share->LOCK_ha_data);
+ mysql_mutex_unlock(&share->LOCK_ha_data);
-found:
/*
We found an existing table definition. Return it if we didn't get
an error when reading the table definition from file.
*/
if (share->error)
{
- /* Table definition contained an error */
- open_table_error(share, share->error, share->open_errno, share->errarg);
- DBUG_RETURN(0);
+ open_table_error(share, share->error, share->open_errno);
+ goto err;
}
- if (share->is_view && !(db_flags & OPEN_VIEW))
+
+ if (share->is_view && !(flags & GTS_VIEW))
{
- open_table_error(share, 1, ENOENT, 0);
- DBUG_RETURN(0);
+ open_table_error(share, OPEN_FRM_NOT_A_TABLE, ENOENT);
+ goto err;
+ }
+ if (!share->is_view && !(flags & GTS_TABLE))
+ {
+ open_table_error(share, OPEN_FRM_NOT_A_VIEW, ENOENT);
+ goto err;
}
++share->ref_count;
@@ -683,99 +702,28 @@ found:
DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
(ulong) share, share->ref_count));
- DBUG_RETURN(share);
-}
-
-
-/**
- Get a table share. If it didn't exist, try creating it from engine
-
- For arguments and return values, see get_table_share()
-*/
-
-static TABLE_SHARE *
-get_table_share_with_discover(THD *thd, TABLE_LIST *table_list,
- char *key, uint key_length,
- uint db_flags, int *error,
- my_hash_value_type hash_value)
+ goto end;
-{
- TABLE_SHARE *share;
- bool exists;
- DBUG_ENTER("get_table_share_with_discover");
-
- share= get_table_share(thd, table_list, key, key_length, db_flags, error,
- hash_value);
- /*
- If share is not NULL, we found an existing share.
-
- If share is NULL, and there is no error, we're inside
- pre-locking, which silences 'ER_NO_SUCH_TABLE' errors
- with the intention to silently drop non-existing tables
- from the pre-locking list. In this case we still need to try
- auto-discover before returning a NULL share.
-
- Or, we're inside SHOW CREATE VIEW, which
- also installs a silencer for ER_NO_SUCH_TABLE error.
-
- If share is NULL and the error is ER_NO_SUCH_TABLE, this is
- the same as above, only that the error was not silenced by
- pre-locking or SHOW CREATE VIEW.
-
- In both these cases it won't harm to try to discover the
- table.
-
- Finally, if share is still NULL, it's a real error and we need
- to abort.
-
- @todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
- */
- if (share ||
- (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE &&
- thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE_IN_ENGINE))
- DBUG_RETURN(share);
-
- *error= 0;
+err:
+ mysql_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(0);
- /* Table didn't exist. Check if some engine can provide it */
- if (ha_check_if_table_exists(thd, table_list->db, table_list->table_name,
- &exists))
- {
- thd->clear_error();
- /* Conventionally, the storage engine API does not report errors. */
- my_error(ER_OUT_OF_RESOURCES, MYF(0));
- }
- else if (! exists)
+end:
+ if (flags & GTS_NOLOCK)
{
+ release_table_share(share);
/*
- No such table in any engine.
- Hide "Table doesn't exist" errors if the table belongs to a view.
- The check for thd->is_error() is necessary to not push an
- unwanted error in case the error was already silenced.
- @todo Rework the alternative ways to deal with ER_NO_SUCH TABLE.
+ if GTS_NOLOCK is requested, the returned share pointer cannot be used,
+ the share it points to may go away any moment.
+ But perhaps the caller is only interested to know whether a share or
+ table existed?
+ Let's return an invalid pointer here to catch dereferencing attempts.
*/
- if (thd->is_error())
- {
- if (table_list->parent_l)
- {
- thd->clear_error();
- my_error(ER_WRONG_MRG_TABLE, MYF(0));
- }
- else if (table_list->belong_to_view)
- {
- TABLE_LIST *view= table_list->belong_to_view;
- thd->clear_error();
- my_error(ER_VIEW_INVALID, MYF(0),
- view->view_db.str, view->view_name.str);
- }
- }
- }
- else
- {
- thd->clear_error();
- *error= 7; /* Run auto-discover. */
+ share= (TABLE_SHARE*) 1;
}
- DBUG_RETURN(NULL);
+
+ mysql_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(share);
}
@@ -843,15 +791,13 @@ void release_table_share(TABLE_SHARE *share)
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
{
char key[SAFE_NAME_LEN*2+2];
- TABLE_LIST table_list;
uint key_length;
mysql_mutex_assert_owner(&LOCK_open);
- table_list.db= (char*) db;
- table_list.table_name= (char*) table_name;
- key_length= create_table_def_key((THD*) 0, key, &table_list, 0);
- return (TABLE_SHARE*) my_hash_search(&table_def_cache,
- (uchar*) key, key_length);
+ key_length= create_table_def_key(key, db, table_name);
+ TABLE_SHARE* share= (TABLE_SHARE*)my_hash_search(&table_def_cache,
+ (uchar*) key, key_length);
+ return !share || share->error ? 0 : share;
}
@@ -1085,7 +1031,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables,
if (share)
{
kill_delayed_threads_for_table(share);
- /* tdc_remove_table() also sets TABLE_SHARE::version to 0. */
+ /* tdc_remove_table() calls share->remove_from_cache_at_close() */
tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table->db,
table->table_name, TRUE);
found=1;
@@ -2138,7 +2084,7 @@ TABLE *find_temporary_table(THD *thd, const char *db, const char *table_name)
TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl)
{
char key[MAX_DBKEY_LENGTH];
- uint key_length= create_table_def_key(thd, key, tl, 1);
+ uint key_length= create_tmp_table_def_key(thd, key, tl->db, tl->table_name);
return find_temporary_table(thd, key, key_length);
}
@@ -2318,15 +2264,12 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db,
char *key;
uint key_length;
TABLE_SHARE *share= table->s;
- TABLE_LIST table_list;
DBUG_ENTER("rename_temporary_table");
if (!(key=(char*) alloc_root(&share->mem_root, MAX_DBKEY_LENGTH)))
DBUG_RETURN(1); /* purecov: inspected */
- table_list.db= (char*) db;
- table_list.table_name= (char*) table_name;
- key_length= create_table_def_key(thd, key, &table_list, 1);
+ key_length= create_tmp_table_def_key(thd, key, db, table_name);
share->set_table_cache_key(key, key_length);
DBUG_RETURN(0);
}
@@ -2351,7 +2294,8 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db,
*/
bool wait_while_table_is_used(THD *thd, TABLE *table,
- enum ha_extra_function function)
+ enum ha_extra_function function,
+ enum_tdc_remove_table_type remove_type)
{
DBUG_ENTER("wait_while_table_is_used");
DBUG_PRINT("enter", ("table: '%s' share: 0x%lx db_stat: %u version: %lu",
@@ -2362,7 +2306,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
table->mdl_ticket, thd->variables.lock_wait_timeout))
DBUG_RETURN(TRUE);
- tdc_remove_table(thd, TDC_RT_REMOVE_NOT_OWN,
+ tdc_remove_table(thd, remove_type,
table->s->db.str, table->s->table_name.str,
FALSE);
/* extra() call must come only after all instances above are closed */
@@ -2415,71 +2359,6 @@ void drop_open_table(THD *thd, TABLE *table, const char *db_name,
/**
- Check that table exists in table definition cache, on disk
- or in some storage engine.
-
- @param thd Thread context
- @param table Table list element
- @param fast_check Check only if share or .frm file exists
- @param[out] exists Out parameter which is set to TRUE if table
- exists and to FALSE otherwise.
-
- @note This function acquires LOCK_open internally.
-
- @note If there is no .FRM file for the table but it exists in one
- of engines (e.g. it was created on another node of NDB cluster)
- this function will fetch and create proper .FRM file for it.
-
- @retval TRUE Some error occurred
- @retval FALSE No error. 'exists' out parameter set accordingly.
-*/
-
-bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool fast_check,
- bool *exists)
-{
- char path[FN_REFLEN + 1];
- TABLE_SHARE *share;
- DBUG_ENTER("check_if_table_exists");
-
- *exists= TRUE;
-
- DBUG_ASSERT(fast_check ||
- thd->mdl_context.
- is_lock_owner(MDL_key::TABLE, table->db,
- table->table_name, MDL_SHARED));
-
- mysql_mutex_lock(&LOCK_open);
- share= get_cached_table_share(table->db, table->table_name);
- mysql_mutex_unlock(&LOCK_open);
-
- if (share)
- goto end;
-
- build_table_filename(path, sizeof(path) - 1, table->db, table->table_name,
- reg_ext, 0);
-
- if (!access(path, F_OK))
- goto end;
-
- if (fast_check)
- {
- *exists= FALSE;
- goto end;
- }
-
- /* .FRM file doesn't exist. Check if some engine can provide it. */
- if (ha_check_if_table_exists(thd, table->db, table->table_name, exists))
- {
- my_printf_error(ER_OUT_OF_RESOURCES, "Failed to open '%-.64s', error while "
- "unpacking from engine", MYF(0), table->table_name);
- DBUG_RETURN(TRUE);
- }
-end:
- DBUG_RETURN(FALSE);
-}
-
-
-/**
An error handler which converts, if possible, ER_LOCK_DEADLOCK error
that can occur when we are trying to acquire a metadata lock to
a request for back-off and re-start of open_tables() process.
@@ -2752,11 +2631,9 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
char *alias= table_list->alias;
uint flags= ot_ctx->get_flags();
MDL_ticket *mdl_ticket;
- int error;
TABLE_SHARE *share;
my_hash_value_type hash_value;
- bool recycled_free_table;
-
+ uint gts_flags;
DBUG_ENTER("open_table");
/* an open table operation needs a lot of the stack space */
@@ -2766,8 +2643,9 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (thd->killed)
DBUG_RETURN(TRUE);
- key_length= (create_table_def_key(thd, key, table_list, 1) -
- TMP_TABLE_KEY_EXTRA);
+ key_length= create_tmp_table_def_key(thd, key, table_list->db,
+ table_list->table_name) -
+ TMP_TABLE_KEY_EXTRA;
/*
Unless requested otherwise, try to resolve this table in the list
@@ -2899,7 +2777,6 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
MDL_SHARED))
{
char path[FN_REFLEN + 1];
- enum legacy_db_type not_used;
build_table_filename(path, sizeof(path) - 1,
table_list->db, table_list->table_name, reg_ext, 0);
/*
@@ -2909,7 +2786,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
during prelocking process (in this case in theory we still
should hold shared metadata lock on it).
*/
- if (dd_frm_type(thd, path, &not_used) == FRMTYPE_VIEW)
+ if (dd_frm_is_view(thd, path))
{
if (!tdc_open_view(thd, table_list, alias, key, key_length,
mem_root, 0))
@@ -2959,12 +2836,12 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
global read lock until end of this statement in order to have
this statement blocked by active FLUSH TABLES WITH READ LOCK.
- We don't block acquire this protection under LOCK TABLES as
+ We don't need to acquire this protection under LOCK TABLES as
such protection already acquired at LOCK TABLES time and
not released until UNLOCK TABLES.
We don't block statements which modify only temporary tables
- as these tables are not preserved by backup by any form of
+ as these tables are not preserved by any form of
backup which uses FLUSH TABLES WITH READ LOCK.
TODO: The fact that we sometimes acquire protection against
@@ -3029,12 +2906,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (table_list->open_strategy == TABLE_LIST::OPEN_IF_EXISTS)
{
- bool exists;
-
- if (check_if_table_exists(thd, table_list, 0, &exists))
- DBUG_RETURN(TRUE);
-
- if (!exists)
+ if (!ha_table_exists(thd, table_list->db, table_list->table_name))
DBUG_RETURN(FALSE);
/* Table exists. Let us try to open it. */
@@ -3042,26 +2914,40 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
else if (table_list->open_strategy == TABLE_LIST::OPEN_STUB)
DBUG_RETURN(FALSE);
+ if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
+ gts_flags= GTS_TABLE;
+ else if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
+ gts_flags= GTS_VIEW;
+ else
+ gts_flags= GTS_TABLE | GTS_VIEW;
+
retry_share:
- mysql_mutex_lock(&LOCK_open);
+ share= get_table_share(thd, table_list->db, table_list->table_name,
+ key, key_length, gts_flags, hash_value);
- if (!(share= get_table_share_with_discover(thd, table_list, key,
- key_length, OPEN_VIEW,
- &error,
- hash_value)))
+ if (!share)
{
- mysql_mutex_unlock(&LOCK_open);
/*
- If thd->is_error() is not set, we either need discover
- (error == 7), or the error was silenced by the prelocking
- handler (error == 0), in which case we should skip this
- table.
+ Hide "Table doesn't exist" errors if the table belongs to a view.
+ The check for thd->is_error() is necessary to not push an
+ unwanted error in case the error was already silenced.
+ @todo Rework the alternative ways to deal with ER_NO_SUCH TABLE.
*/
- if (error == 7 && !thd->is_error())
+ if (thd->is_error())
{
- (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER,
- table_list);
+ if (table_list->parent_l)
+ {
+ thd->clear_error();
+ my_error(ER_WRONG_MRG_TABLE, MYF(0));
+ }
+ else if (table_list->belong_to_view)
+ {
+ TABLE_LIST *view= table_list->belong_to_view;
+ thd->clear_error();
+ my_error(ER_VIEW_INVALID, MYF(0),
+ view->view_db.str, view->view_name.str);
+ }
}
DBUG_RETURN(TRUE);
}
@@ -3080,7 +2966,7 @@ retry_share:
if (table_list->parent_l)
{
my_error(ER_WRONG_MRG_TABLE, MYF(0));
- goto err_unlock;
+ goto err_lock;
}
/*
@@ -3088,13 +2974,7 @@ retry_share:
that it was a view when the statement was prepared.
*/
if (check_and_update_table_version(thd, table_list, share))
- goto err_unlock;
- if (table_list->i_s_requested_object & OPEN_TABLE_ONLY)
- {
- my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
- table_list->table_name);
- goto err_unlock;
- }
+ goto err_lock;
/* Open view */
if (open_new_frm(thd, share, alias,
@@ -3103,7 +2983,9 @@ retry_share:
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
thd->open_options,
0, table_list, mem_root))
- goto err_unlock;
+ goto err_lock;
+
+ mysql_mutex_lock(&LOCK_open);
/* TODO: Don't free this */
release_table_share(share);
@@ -3114,21 +2996,9 @@ retry_share:
DBUG_RETURN(FALSE);
}
- /*
- Note that situation when we are trying to open a table for what
- was a view during previous execution of PS will be handled in by
- the caller. Here we should simply open our table even if
- TABLE_LIST::view is true.
- */
-
- if (table_list->i_s_requested_object & OPEN_VIEW_ONLY)
- {
- my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
- table_list->table_name);
- goto err_unlock;
- }
-
- if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
+ mysql_mutex_lock(&LOCK_open);
+ if (!(flags & MYSQL_OPEN_IGNORE_FLUSH) ||
+ (share->protected_against_usage() && !(flags & MYSQL_OPEN_FOR_REPAIR)))
{
if (share->has_old_version())
{
@@ -3180,19 +3050,24 @@ retry_share:
{
table= share->free_tables.front();
table_def_use_table(thd, table);
- recycled_free_table= true;
- /* We need to release share as we have EXTRA reference to it in our hands. */
+
+ /* Release the share as we hold an extra reference to it */
release_table_share(share);
+ mysql_mutex_unlock(&LOCK_open);
+
+ DBUG_ASSERT(table->file != NULL);
+ table->file->rebind_psi();
}
else
{
- /* We have too many TABLE instances around let us try to get rid of them. */
+ enum open_frm_error error;
+
+ /* If we have too many TABLE instances around, try to get rid of them */
while (table_cache_count > table_cache_size && unused_tables)
free_cache_entry(unused_tables);
mysql_mutex_unlock(&LOCK_open);
- recycled_free_table= false;
/* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
goto err_lock;
@@ -3210,7 +3085,7 @@ retry_share:
{
my_free(table);
- if (error == 7)
+ if (error == OPEN_FRM_DISCOVER)
(void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER,
table_list);
else if (share->crashed)
@@ -3227,18 +3102,10 @@ retry_share:
goto err_lock;
}
- mysql_mutex_lock(&LOCK_open);
/* Add table to the share's used tables list. */
+ mysql_mutex_lock(&LOCK_open);
table_def_add_used_table(thd, table);
- }
-
- mysql_mutex_unlock(&LOCK_open);
-
- /* Call rebind_psi outside of the LOCK_open critical section. */
- if (recycled_free_table)
- {
- DBUG_ASSERT(table->file != NULL);
- table->file->rebind_psi();
+ mysql_mutex_unlock(&LOCK_open);
}
table->mdl_ticket= mdl_ticket;
@@ -3263,7 +3130,6 @@ retry_share:
err_lock:
mysql_mutex_lock(&LOCK_open);
-err_unlock:
release_table_share(share);
mysql_mutex_unlock(&LOCK_open);
@@ -3284,7 +3150,7 @@ err_unlock:
TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name)
{
char key[MAX_DBKEY_LENGTH];
- uint key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
+ uint key_length= create_table_def_key(key, db, table_name);
for (TABLE *table= list; table ; table=table->next)
{
@@ -3892,38 +3758,25 @@ bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
MEM_ROOT *mem_root, uint flags)
{
TABLE not_used;
- int error;
- my_hash_value_type hash_value;
TABLE_SHARE *share;
- hash_value= my_calc_hash(&table_def_cache, (uchar*) cache_key,
- cache_key_length);
- mysql_mutex_lock(&LOCK_open);
+ if (!(share= get_table_share(thd, table_list->db, table_list->table_name,
+ cache_key, cache_key_length, GTS_VIEW)))
+ return TRUE;
- if (!(share= get_table_share(thd, table_list, cache_key,
- cache_key_length,
- OPEN_VIEW, &error,
- hash_value)))
- goto err;
+ DBUG_ASSERT(share->is_view);
- if (share->is_view &&
- !open_new_frm(thd, share, alias,
- (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
- HA_GET_INDEX | HA_TRY_READ_ONLY),
- READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD |
- flags, thd->open_options, &not_used, table_list,
- mem_root))
- {
- release_table_share(share);
- mysql_mutex_unlock(&LOCK_open);
- return FALSE;
- }
+ bool err= open_new_frm(thd, share, alias,
+ (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
+ HA_GET_INDEX | HA_TRY_READ_ONLY),
+ READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD | flags,
+ thd->open_options, &not_used, table_list, mem_root);
- my_error(ER_WRONG_OBJECT, MYF(0), share->db.str, share->table_name.str, "VIEW");
+ mysql_mutex_lock(&LOCK_open);
release_table_share(share);
-err:
mysql_mutex_unlock(&LOCK_open);
- return TRUE;
+
+ return err;
}
@@ -3977,40 +3830,20 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry)
static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
{
- char cache_key[MAX_DBKEY_LENGTH];
- uint cache_key_length;
TABLE_SHARE *share;
TABLE *entry;
- int not_used;
bool result= TRUE;
- my_hash_value_type hash_value;
-
- cache_key_length= create_table_def_key(thd, cache_key, table_list, 0);
thd->clear_error();
- hash_value= my_calc_hash(&table_def_cache, (uchar*) cache_key,
- cache_key_length);
- mysql_mutex_lock(&LOCK_open);
+ if (!(entry= (TABLE*)my_malloc(sizeof(TABLE), MYF(MY_WME))))
+ return result;
- if (!(share= get_table_share(thd, table_list, cache_key,
- cache_key_length,
- OPEN_VIEW, &not_used,
- hash_value)))
- goto end_unlock;
+ if (!(share= get_table_share(thd, table_list->db, table_list->table_name,
+ GTS_TABLE)))
+ goto end_free;
- if (share->is_view)
- {
- release_table_share(share);
- goto end_unlock;
- }
-
- if (!(entry= (TABLE*)my_malloc(sizeof(TABLE), MYF(MY_WME))))
- {
- release_table_share(share);
- goto end_unlock;
- }
- mysql_mutex_unlock(&LOCK_open);
+ DBUG_ASSERT(! share->is_view);
if (open_table_from_share(thd, share, table_list->alias,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
@@ -4035,7 +3868,6 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
closefrm(entry, 0);
result= FALSE;
}
- my_free(entry);
mysql_mutex_lock(&LOCK_open);
release_table_share(share);
@@ -4043,8 +3875,9 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list)
tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
table_list->db, table_list->table_name,
TRUE);
-end_unlock:
mysql_mutex_unlock(&LOCK_open);
+end_free:
+ my_free(entry);
return result;
}
@@ -4185,8 +4018,12 @@ recover_from_failed_open(THD *thd)
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, m_failed_table->db,
m_failed_table->table_name, FALSE);
- ha_create_table_from_engine(thd, m_failed_table->db,
- m_failed_table->table_name);
+ if ((result=
+ !get_table_share(thd, m_failed_table->db,
+ m_failed_table->table_name,
+ GTS_TABLE | GTS_FORCE_DISCOVERY | GTS_NOLOCK)))
+ break;
+
thd->warning_info->clear_warning_info(thd->query_id);
thd->clear_error(); // Clear error message
@@ -4814,7 +4651,7 @@ lock_table_names(THD *thd,
if (mdl_requests.is_empty())
DBUG_RETURN(FALSE);
- /* Check if CREATE TABLE IF NOT EXISTS was used */
+ /* Check if CREATE TABLE was used */
create_table= (tables_start && tables_start->open_strategy ==
TABLE_LIST::OPEN_IF_EXISTS);
@@ -4853,12 +4690,9 @@ lock_table_names(THD *thd,
for (;;)
{
- bool exists= TRUE;
- bool res;
-
if (create_table)
thd->push_internal_handler(&error_handler); // Avoid warnings & errors
- res= thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout);
+ bool res= thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout);
if (create_table)
thd->pop_internal_handler();
if (!res)
@@ -4868,13 +4702,10 @@ lock_table_names(THD *thd,
DBUG_RETURN(TRUE); // Return original error
/*
- We come here in the case of lock timeout when executing
- CREATE TABLE IF NOT EXISTS.
- Verify that table really exists (it should as we got a lock conflict)
+ We come here in the case of lock timeout when executing CREATE TABLE.
+ Verify that table does exist (it usually does, as we got a lock conflict)
*/
- if (check_if_table_exists(thd, tables_start, 1, &exists))
- DBUG_RETURN(TRUE); // Should never happen
- if (exists)
+ if (ha_table_exists(thd, tables_start->db, tables_start->table_name))
{
if (thd->lex->create_info.options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
@@ -4886,17 +4717,16 @@ lock_table_names(THD *thd,
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), tables_start->table_name);
DBUG_RETURN(TRUE);
}
- /* purecov: begin inspected */
/*
- We got error from acquire_locks but table didn't exists.
- In theory this should never happen, except maybe in
- CREATE or DROP DATABASE scenario.
+ We got error from acquire_locks, but the table didn't exists.
+ This could happen if another connection runs a statement
+ involving this non-existent table, and this statement took the mdl,
+ but didn't error out with ER_NO_SUCH_TABLE yet (yes, a race condition).
We play safe and restart the original acquire_locks with the
- original timeout
+ original timeout.
*/
create_table= 0;
lock_wait_timeout= org_lock_wait_timeout;
- /* purecov: end */
}
}
@@ -6119,6 +5949,8 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
the opened TABLE instance will be addded to THD::temporary_tables list.
@param thd Thread context.
+ @param hton Storage engine of the table, if known,
+ or NULL otherwise.
@param path Path (without .frm)
@param db Database name.
@param table_name Table name.
@@ -6134,7 +5966,8 @@ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
@retval NULL on error.
*/
-TABLE *open_table_uncached(THD *thd, const char *path, const char *db,
+TABLE *open_table_uncached(THD *thd, handlerton *hton,
+ const char *path, const char *db,
const char *table_name,
bool add_to_temporary_tables_list)
{
@@ -6142,7 +5975,6 @@ TABLE *open_table_uncached(THD *thd, const char *path, const char *db,
TABLE_SHARE *share;
char cache_key[MAX_DBKEY_LENGTH], *saved_cache_key, *tmp_path;
uint key_length;
- TABLE_LIST table_list;
DBUG_ENTER("open_table_uncached");
DBUG_PRINT("enter",
("table: '%s'.'%s' path: '%s' server_id: %u "
@@ -6150,10 +5982,8 @@ TABLE *open_table_uncached(THD *thd, const char *path, const char *db,
db, table_name, path,
(uint) thd->server_id, (ulong) thd->variables.pseudo_thread_id));
- table_list.db= (char*) db;
- table_list.table_name= (char*) table_name;
/* Create the cache_key for temporary tables */
- key_length= create_table_def_key(thd, cache_key, &table_list, 1);
+ key_length= create_tmp_table_def_key(thd, cache_key, db, table_name);
if (!(tmp_table= (TABLE*) my_malloc(sizeof(*tmp_table) + sizeof(*share) +
strlen(path)+1 + key_length,
@@ -6167,8 +5997,9 @@ TABLE *open_table_uncached(THD *thd, const char *path, const char *db,
init_tmp_table_share(thd, share, saved_cache_key, key_length,
strend(saved_cache_key)+1, tmp_path);
+ share->db_plugin= ha_lock_engine(thd, hton);
- if (open_table_def(thd, share, 0))
+ if (open_table_def(thd, share, GTS_TABLE | GTS_FORCE_DISCOVERY))
{
/* No need to lock share->mutex as this is not needed for tmp tables */
free_table_share(share);
@@ -6217,17 +6048,27 @@ TABLE *open_table_uncached(THD *thd, const char *path, const char *db,
}
-bool rm_temporary_table(handlerton *base, char *path)
+/**
+ Delete a temporary table.
+
+ @param base Handlerton for table to be deleted.
+ @param path Path to the table to be deleted (i.e. path
+ to its .frm without an extension).
+
+ @retval false - success.
+ @retval true - failure.
+*/
+
+bool rm_temporary_table(handlerton *base, const char *path)
{
bool error=0;
handler *file;
- char *ext;
+ char frm_path[FN_REFLEN + 1];
DBUG_ENTER("rm_temporary_table");
- strmov(ext= strend(path), reg_ext);
- if (mysql_file_delete(key_file_frm, path, MYF(0)))
+ strxnmov(frm_path, sizeof(frm_path) - 1, path, reg_ext, NullS);
+ if (mysql_file_delete(key_file_frm, frm_path, MYF(0)))
error=1; /* purecov: inspected */
- *ext= 0; // remove extension
file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base);
if (file && file->ha_delete_table(path))
{
@@ -8173,7 +8014,8 @@ bool setup_fields(THD *thd, Item **ref_pointer_array,
thd->mark_used_columns= mark_used_columns;
DBUG_PRINT("info", ("thd->mark_used_columns: %d", thd->mark_used_columns));
if (allow_sum_func)
- thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
+ thd->lex->allow_sum_func|=
+ (nesting_map)1 << thd->lex->current_select->nest_level;
thd->where= THD::DEFAULT_WHERE;
save_is_item_list_lookup= thd->lex->current_select->is_item_list_lookup;
thd->lex->current_select->is_item_list_lookup= 0;
@@ -9283,15 +9125,10 @@ my_bool mysql_rm_tmp_tables(void)
/* Remove all SQLxxx tables from directory */
- for (idx=0 ; idx < (uint) dirp->number_off_files ; idx++)
+ for (idx=0 ; idx < (uint) dirp->number_of_files ; idx++)
{
file=dirp->dir_entry+idx;
- /* skiping . and .. */
- if (file->name[0] == '.' && (!file->name[1] ||
- (file->name[1] == '.' && !file->name[2])))
- continue;
-
if (!memcmp(file->name, tmp_file_prefix,
tmp_file_prefix_length))
{
@@ -9307,7 +9144,7 @@ my_bool mysql_rm_tmp_tables(void)
memcpy(filePathCopy, filePath, filePath_len - ext_len);
filePathCopy[filePath_len - ext_len]= 0;
init_tmp_table_share(thd, &share, "", 0, "", filePathCopy);
- if (!open_table_def(thd, &share, 0) &&
+ if (!open_table_def(thd, &share) &&
((handler_file= get_new_handler(&share, thd->mem_root,
share.db_type()))))
{
@@ -9462,6 +9299,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
TABLE *table;
TABLE_SHARE *share;
DBUG_ENTER("tdc_remove_table");
+ DBUG_PRINT("enter",("name: %s remove_type: %d", table_name, remove_type));
if (! has_lock)
mysql_mutex_lock(&LOCK_open);
@@ -9474,7 +9312,7 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
MDL_EXCLUSIVE));
- key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
+ key_length= create_table_def_key(key, db, table_name);
if ((share= (TABLE_SHARE*) my_hash_search(&table_def_cache,(uchar*) key,
key_length)))
@@ -9487,7 +9325,8 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
{
DBUG_ASSERT(share->used_tables.is_empty());
}
- else if (remove_type == TDC_RT_REMOVE_NOT_OWN)
+ else if (remove_type == TDC_RT_REMOVE_NOT_OWN ||
+ remove_type == TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE)
{
I_P_List_iterator<TABLE, TABLE_share> it2(share->used_tables);
while ((table= it2++))
@@ -9498,8 +9337,8 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
}
#endif
/*
- Set share's version to zero in order to ensure that it gets
- automatically deleted once it is no longer referenced.
+ Mark share to ensure that it gets automatically deleted once
+ it is no longer referenced.
Note that code in TABLE_SHARE::wait_for_old_version() assumes
that marking share as old and removal of its unused tables
@@ -9508,7 +9347,13 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
TDC does not contain old shares which don't have any tables
used.
*/
- share->version= 0;
+ if (remove_type == TDC_RT_REMOVE_NOT_OWN)
+ share->remove_from_cache_at_close();
+ else
+ {
+ /* Ensure that no can open the table while it's used */
+ share->protect_against_usage();
+ }
while ((table= it++))
free_cache_entry(table);
@@ -9552,7 +9397,6 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
List_iterator<Item_func_match> li(*(select_lex->ftfunc_list));
Item_func_match *ifm;
DBUG_PRINT("info",("Performing FULLTEXT search"));
- THD_STAGE_INFO(thd, stage_fulltext_initialization);
while ((ifm=li++))
ifm->init_search(no_order);
@@ -9588,12 +9432,14 @@ open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
{
LEX_STRING pathstr;
File_parser *parser;
- char path[FN_REFLEN];
+ char path[FN_REFLEN+1];
DBUG_ENTER("open_new_frm");
/* Create path with extension */
- pathstr.length= (uint) (strxmov(path, share->normalized_path.str, reg_ext,
- NullS)- path);
+ pathstr.length= (uint) (strxnmov(path, sizeof(path) - 1,
+ share->normalized_path.str,
+ reg_ext,
+ NullS) - path);
pathstr.str= path;
if ((parser= sql_parse_prepare(&pathstr, mem_root, 1)))
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 78ab8c7df24..95d9bf21fe8 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -60,7 +60,8 @@ enum find_item_error_report_type {REPORT_ALL_ERRORS, REPORT_EXCEPT_NOT_FOUND,
IGNORE_EXCEPT_NON_UNIQUE};
enum enum_tdc_remove_table_type {TDC_RT_REMOVE_ALL, TDC_RT_REMOVE_NOT_OWN,
- TDC_RT_REMOVE_UNUSED};
+ TDC_RT_REMOVE_UNUSED,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE};
/* bits for last argument to remove_table_from_cache() */
#define RTFC_NO_FLAG 0x0000
@@ -68,6 +69,8 @@ enum enum_tdc_remove_table_type {TDC_RT_REMOVE_ALL, TDC_RT_REMOVE_NOT_OWN,
#define RTFC_WAIT_OTHER_THREAD_FLAG 0x0002
#define RTFC_CHECK_KILLED_FLAG 0x0004
+extern HASH table_def_cache;
+
bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
extern mysql_mutex_t LOCK_open;
bool table_cache_init(void);
@@ -78,15 +81,59 @@ void table_def_start_shutdown(void);
void assign_new_table_id(TABLE_SHARE *share);
uint cached_open_tables(void);
uint cached_table_definitions(void);
-uint create_table_def_key(THD *thd, char *key,
- const TABLE_LIST *table_list,
- bool tmp_table);
-TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
- uint key_length, uint db_flags, int *error,
+
+/**
+ Create a table cache key for non-temporary table.
+
+ @param key Buffer for key (must be at least NAME_LEN*2+2 bytes).
+ @param db Database name.
+ @param table_name Table name.
+
+ @return Length of key.
+
+ @sa create_table_def_key(thd, char *, table_list, bool)
+*/
+
+inline uint
+create_table_def_key(char *key, const char *db, const char *table_name)
+{
+ /*
+ In theory caller should ensure that both db and table_name are
+ not longer than NAME_LEN bytes. In practice we play safe to avoid
+ buffer overruns.
+ */
+ return (uint)(strmake(strmake(key, db, NAME_LEN) + 1, table_name,
+ NAME_LEN) - key + 1);
+}
+
+uint create_tmp_table_def_key(THD *thd, char *key, const char *db,
+ const char *table_name);
+TABLE_SHARE *get_table_share(THD *thd, const char *db, const char *table_name,
+ char *key, uint key_length, uint flags,
my_hash_value_type hash_value);
void release_table_share(TABLE_SHARE *share);
TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name);
+// convenience helper: call get_table_share() without precomputed hash_value
+static inline TABLE_SHARE *get_table_share(THD *thd, const char *db,
+ const char *table_name,
+ char *key, uint key_length,
+ uint flags)
+{
+ return get_table_share(thd, db, table_name, key, key_length, flags,
+ my_calc_hash(&table_def_cache, (uchar*) key, key_length));
+}
+
+// convenience helper: call get_table_share() without precomputed cache key
+static inline TABLE_SHARE *get_table_share(THD *thd, const char *db,
+ const char *table_name, uint flags)
+{
+ char key[MAX_DBKEY_LENGTH];
+ uint key_length;
+ key_length= create_table_def_key(key, db, table_name);
+ return get_table_share(thd, db, table_name, key, key_length, flags);
+}
+
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
uint lock_flags);
@@ -128,6 +175,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update,
*/
#define MYSQL_OPEN_SKIP_SCOPED_MDL_LOCK 0x1000
#define MYSQL_LOCK_NOT_TEMPORARY 0x2000
+#define MYSQL_OPEN_FOR_REPAIR 0x4000
/** Please refer to the internals manual. */
#define MYSQL_OPEN_REOPEN (MYSQL_OPEN_IGNORE_FLUSH |\
@@ -147,8 +195,8 @@ bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
bool get_key_map_from_key_list(key_map *map, TABLE *table,
List<String> *index_list);
-TABLE *open_table_uncached(THD *thd, const char *path, const char *db,
- const char *table_name,
+TABLE *open_table_uncached(THD *thd, handlerton *hton, const char *path,
+ const char *db, const char *table_name,
bool add_to_temporary_tables_list);
TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name);
TABLE *find_write_locked_table(TABLE *list, const char *db,
@@ -158,7 +206,7 @@ thr_lock_type read_lock_type_for_table(THD *thd,
TABLE_LIST *table_list);
my_bool mysql_rm_tmp_tables(void);
-bool rm_temporary_table(handlerton *base, char *path);
+bool rm_temporary_table(handlerton *base, const char *path);
void close_tables_for_reopen(THD *thd, TABLE_LIST **tables,
const MDL_savepoint &start_of_statement_svp);
TABLE_LIST *find_table_in_list(TABLE_LIST *table,
@@ -229,7 +277,9 @@ bool setup_tables_and_check_access(THD *thd,
ulong want_access,
bool full_table_list);
bool wait_while_table_is_used(THD *thd, TABLE *table,
- enum ha_extra_function function);
+ enum ha_extra_function function,
+ enum_tdc_remove_table_type remove_type=
+ TDC_RT_REMOVE_NOT_OWN);
void drop_open_table(THD *thd, TABLE *table, const char *db_name,
const char *table_name);
@@ -298,13 +348,23 @@ void tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias,
char *cache_key, uint cache_key_length,
MEM_ROOT *mem_root, uint flags);
+
+static inline bool tdc_open_view(THD *thd, TABLE_LIST *table_list,
+ const char *alias, MEM_ROOT *mem_root,
+ uint flags)
+{
+ char key[MAX_DBKEY_LENGTH];
+ uint key_length;
+ key_length= create_table_def_key(key, table_list->db, table_list->table_name);
+ return tdc_open_view(thd, table_list, alias, key, key_length, mem_root, flags);
+}
+
void tdc_flush_unused_tables();
TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db,
const char *table_name,
bool no_error);
void mark_tmp_table_for_reuse(TABLE *table);
-bool check_if_table_exists(THD *thd, TABLE_LIST *table, bool fast_check,
- bool *exists);
+
int update_virtual_fields(THD *thd, TABLE *table,
enum enum_vcol_update_mode vcol_update_mode= VCOL_UPDATE_FOR_READ);
int dynamic_column_error_message(enum_dyncol_func_result rc);
@@ -321,7 +381,6 @@ extern TABLE *unused_tables;
extern Item **not_found_item;
extern Field *not_found_field;
extern Field *view_ref_found;
-extern HASH table_def_cache;
/**
clean/setup table fields and map.
diff --git a/sql/sql_bitmap.h b/sql/sql_bitmap.h
index db4c7110ac7..5e86a889053 100644
--- a/sql/sql_bitmap.h
+++ b/sql/sql_bitmap.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2003, 2010, Oracle and/or its affiliates
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -60,7 +61,7 @@ public:
intersect(map2buff);
if (map.n_bits > sizeof(ulonglong) * 8)
bitmap_set_above(&map, sizeof(ulonglong),
- test(map2buff & (LL(1) << (sizeof(ulonglong) * 8 - 1))));
+ test(map2buff & (1LL << (sizeof(ulonglong) * 8 - 1))));
}
void subtract(Bitmap& map2) { bitmap_subtract(&map, &map2.map); }
void merge(Bitmap& map2) { bitmap_union(&map, &map2.map); }
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index f5e1deab546..ba204f48978 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -834,18 +834,18 @@ void Query_cache_block::destroy()
DBUG_VOID_RETURN;
}
-inline uint Query_cache_block::headers_len()
+uint Query_cache_block::headers_len()
{
return (ALIGN_SIZE(sizeof(Query_cache_block_table)*n_tables) +
ALIGN_SIZE(sizeof(Query_cache_block)));
}
-inline uchar* Query_cache_block::data(void)
+uchar* Query_cache_block::data(void)
{
return (uchar*)( ((uchar*)this) + headers_len() );
}
-inline Query_cache_query * Query_cache_block::query()
+Query_cache_query * Query_cache_block::query()
{
#ifndef DBUG_OFF
if (type != QUERY)
@@ -854,7 +854,7 @@ inline Query_cache_query * Query_cache_block::query()
return (Query_cache_query *) data();
}
-inline Query_cache_table * Query_cache_block::table()
+Query_cache_table * Query_cache_block::table()
{
#ifndef DBUG_OFF
if (type != TABLE)
@@ -863,7 +863,7 @@ inline Query_cache_table * Query_cache_block::table()
return (Query_cache_table *) data();
}
-inline Query_cache_result * Query_cache_block::result()
+Query_cache_result * Query_cache_block::result()
{
#ifndef DBUG_OFF
if (type != RESULT && type != RES_CONT && type != RES_BEG &&
@@ -873,7 +873,7 @@ inline Query_cache_result * Query_cache_block::result()
return (Query_cache_result *) data();
}
-inline Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n)
+Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n)
{
return ((Query_cache_block_table *)
(((uchar*)this)+ALIGN_SIZE(sizeof(Query_cache_block)) +
@@ -3132,8 +3132,8 @@ void Query_cache::invalidate_table(THD *thd, TABLE_LIST *table_list)
char key[MAX_DBKEY_LENGTH];
uint key_length;
- key_length=(uint) (strmov(strmov(key,table_list->db)+1,
- table_list->table_name) -key)+ 1;
+ key_length= create_table_def_key(key, table_list->db,
+ table_list->table_name);
// We don't store temporary tables => no key_length+=4 ...
invalidate_table(thd, (uchar *)key, key_length);
@@ -3251,8 +3251,8 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
DBUG_PRINT("qcache", ("view: %s db: %s",
tables_used->view_name.str,
tables_used->view_db.str));
- key_length= (uint) (strmov(strmov(key, tables_used->view_db.str) + 1,
- tables_used->view_name.str) - key) + 1;
+ key_length= create_table_def_key(key, tables_used->view_db.str,
+ tables_used->view_name.str);
/*
There are not callback function for for VIEWs
*/
@@ -4297,14 +4297,13 @@ my_bool Query_cache::move_by_type(uchar **border,
case Query_cache_block::RESULT:
{
DBUG_PRINT("qcache", ("block 0x%lx RES* (%d)", (ulong) block,
- (int) block->type));
+ (int) block->type));
if (*border == 0)
break;
- Query_cache_block *query_block = block->result()->parent(),
- *next = block->next,
- *prev = block->prev;
- Query_cache_block::block_type type = block->type;
+ Query_cache_block *query_block= block->result()->parent();
BLOCK_LOCK_WR(query_block);
+ Query_cache_block *next= block->next, *prev= block->prev;
+ Query_cache_block::block_type type= block->type;
ulong len = block->length, used = block->used;
Query_cache_block *pprev = block->pprev,
*pnext = block->pnext,
@@ -4466,8 +4465,9 @@ uint Query_cache::filename_2_table_key (char *key, const char *path,
*db_length= (filename - dbname) - 1;
DBUG_PRINT("qcache", ("table '%-.*s.%s'", *db_length, dbname, filename));
- DBUG_RETURN((uint) (strmov(strmake(key, dbname, *db_length) + 1,
- filename) -key) + 1);
+ DBUG_RETURN((uint) (strmake(strmake(key, dbname,
+ min(*db_length, NAME_LEN)) + 1,
+ filename, NAME_LEN) - key) + 1);
}
/****************************************************************************
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 7444d444cf9..f35ac889b23 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -141,12 +141,12 @@ struct Query_cache_block
inline bool is_free(void) { return type == FREE; }
void init(ulong length);
void destroy();
- inline uint headers_len();
- inline uchar* data(void);
- inline Query_cache_query *query();
- inline Query_cache_table *table();
- inline Query_cache_result *result();
- inline Query_cache_block_table *table(TABLE_COUNTER_TYPE n);
+ uint headers_len();
+ uchar* data(void);
+ Query_cache_query *query();
+ Query_cache_table *table();
+ Query_cache_result *result();
+ Query_cache_block_table *table(TABLE_COUNTER_TYPE n);
};
struct Query_cache_query
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index a068cdc8f88..240c4e4d627 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+ Copyright (c) 2008, 2013, Monty Program Ab
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
@@ -112,7 +112,8 @@ Key::Key(const Key &rhs, MEM_ROOT *mem_root)
columns(rhs.columns, mem_root),
name(rhs.name),
option_list(rhs.option_list),
- generated(rhs.generated)
+ generated(rhs.generated),
+ create_if_not_exists(rhs.create_if_not_exists)
{
list_copy_and_replace_each_value(columns, mem_root);
}
@@ -350,29 +351,6 @@ void thd_set_thread_stack(THD *thd, char *stack_start)
}
/**
- Lock connection data for the set of connections this connection
- belongs to
-
- @param thd THD object
-*/
-void thd_lock_thread_count(THD *)
-{
- mysql_mutex_lock(&LOCK_thread_count);
-}
-
-/**
- Lock connection data for the set of connections this connection
- belongs to
-
- @param thd THD object
-*/
-void thd_unlock_thread_count(THD *)
-{
- mysql_cond_broadcast(&COND_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
-}
-
-/**
Close the socket used by this connection
@param thd THD object
@@ -908,6 +886,7 @@ THD::THD()
col_access=0;
is_slave_error= thread_specific_used= FALSE;
my_hash_clear(&handler_tables_hash);
+ my_hash_clear(&ull_hash);
tmp_table=0;
cuted_fields= 0L;
m_sent_row_count= 0L;
@@ -947,7 +926,6 @@ THD::THD()
net.vio=0;
net.buff= 0;
client_capabilities= 0; // minimalistic client
- ull=0;
system_thread= NON_SYSTEM_THREAD;
cleanup_done= abort_on_warning= 0;
peer_port= 0; // For SHOW PROCESSLIST
@@ -1005,7 +983,14 @@ THD::THD()
protocol_binary.init(this);
tablespace_op=FALSE;
- tmp= sql_rnd_with_mutex();
+
+ /*
+ Initialize the random generator. We call my_rnd() without a lock as
+ it's not really critical if two threads modifies the structure at the
+ same time. We ensure that we have an unique number foreach thread
+ by adding the address of the stack.
+ */
+ tmp= (ulong) (my_rnd(&sql_rand) * 0xffffffff);
my_rnd_init(&rand, tmp + (ulong) &rand, tmp + (ulong) ::global_query_id);
substitute_null_with_insert_id = FALSE;
thr_lock_info_init(&lock_info); /* safety: will be reset after start */
@@ -1260,8 +1245,8 @@ LEX_STRING *thd_make_lex_string(THD *thd, LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string)
{
- return thd->make_lex_string(lex_str, str, size,
- (bool) allocate_lex_string);
+ return allocate_lex_string ? thd->make_lex_string(str, size)
+ : thd->make_lex_string(lex_str, str, size);
}
extern "C"
@@ -1452,11 +1437,12 @@ void THD::cleanup(void)
#error xid_state in the cache should be replaced by the allocated value
}
#endif
- {
- transaction.xid_state.xa_state= XA_NOTR;
- trans_rollback(this);
- xid_cache_delete(&transaction.xid_state);
- }
+
+ close_temporary_tables(this);
+
+ transaction.xid_state.xa_state= XA_NOTR;
+ trans_rollback(this);
+ xid_cache_delete(&transaction.xid_state);
locked_tables_list.unlock_locked_tables(this);
mysql_ha_cleanup(this);
@@ -1474,8 +1460,6 @@ void THD::cleanup(void)
if (global_read_lock.is_acquired())
global_read_lock.unlock_global_read_lock(this);
- /* All metadata locks must have been released by now. */
- DBUG_ASSERT(!mdl_context.has_locks());
if (user_connect)
{
decrease_user_connections(user_connect);
@@ -1490,17 +1474,12 @@ void THD::cleanup(void)
delete_dynamic(&user_var_events);
my_hash_free(&user_vars);
- close_temporary_tables(this);
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);
- if (ull)
- {
- mysql_mutex_lock(&LOCK_user_locks);
- item_user_lock_release(ull);
- mysql_mutex_unlock(&LOCK_user_locks);
- ull= NULL;
- }
+ mysql_ull_cleanup(this);
+ /* All metadata locks must have been released by now. */
+ DBUG_ASSERT(!mdl_context.has_locks());
apc_target.destroy();
cleanup_done=1;
@@ -1935,6 +1914,19 @@ void THD::cleanup_after_query()
stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
auto_inc_intervals_in_cur_stmt_for_binlog.empty();
rand_used= 0;
+#ifndef EMBEDDED_LIBRARY
+ /*
+ Clean possible unused INSERT_ID events by current statement.
+ is_update_query() is needed to ignore SET statements:
+ Statements that don't update anything directly and don't
+ used stored functions. This is mostly necessary to ignore
+ statements in binlog between SET INSERT_ID and DML statement
+ which is intended to consume its event (there can be other
+ SET statements between them).
+ */
+ if ((rli_slave || rli_fake) && is_update_query(lex->sql_command))
+ auto_inc_intervals_forced.empty();
+#endif
}
if (first_successful_insert_id_in_cur_stmt > 0)
{
@@ -1962,30 +1954,6 @@ void THD::cleanup_after_query()
}
-/**
- Create a LEX_STRING in this connection.
-
- @param lex_str pointer to LEX_STRING object to be initialized
- @param str initializer to be copied into lex_str
- @param length length of str, in bytes
- @param allocate_lex_string if TRUE, allocate new LEX_STRING object,
- instead of using lex_str value
- @return NULL on failure, or pointer to the LEX_STRING object
-*/
-LEX_STRING *THD::make_lex_string(LEX_STRING *lex_str,
- const char* str, uint length,
- bool allocate_lex_string)
-{
- if (allocate_lex_string)
- if (!(lex_str= (LEX_STRING *)alloc_root(mem_root, sizeof(LEX_STRING))))
- return 0;
- if (!(lex_str->str= strmake_root(mem_root, str, length)))
- return 0;
- lex_str->length= length;
- return lex_str;
-}
-
-
/*
Convert a string to another character set
@@ -3196,42 +3164,13 @@ int select_exists_subselect::send_data(List<Item> &items)
int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
{
unit= u;
- List_iterator_fast<my_var> var_li(var_list);
- List_iterator_fast<Item> it(list);
- Item *item;
- my_var *mv;
- Item_func_set_user_var **suv;
if (var_list.elements != list.elements)
{
my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
return 1;
- }
-
- /*
- Iterate over the destination variables and mark them as being
- updated in this query.
- We need to do this at JOIN::prepare time to ensure proper
- const detection of Item_func_get_user_var that is determined
- by the presence of Item_func_set_user_vars
- */
-
- suv= set_var_items= (Item_func_set_user_var **)
- sql_alloc(sizeof(Item_func_set_user_var *) * list.elements);
-
- while ((mv= var_li++) && (item= it++))
- {
- if (!mv->local)
- {
- *suv= new Item_func_set_user_var(mv->s, item);
- (*suv)->fix_fields(thd, 0);
- }
- else
- *suv= NULL;
- suv++;
- }
-
+ }
return 0;
}
@@ -3561,7 +3500,6 @@ int select_dumpvar::send_data(List<Item> &items)
List_iterator<Item> it(items);
Item *item;
my_var *mv;
- Item_func_set_user_var **suv;
DBUG_ENTER("select_dumpvar::send_data");
if (unit->offset_limit_cnt)
@@ -3574,19 +3512,20 @@ int select_dumpvar::send_data(List<Item> &items)
my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
DBUG_RETURN(1);
}
- for (suv= set_var_items; ((mv= var_li++) && (item= it++)); suv++)
+ while ((mv= var_li++) && (item= it++))
{
if (mv->local)
{
- DBUG_ASSERT(!*suv);
if (thd->spcont->set_variable(thd, mv->offset, &item))
DBUG_RETURN(1);
}
else
{
- DBUG_ASSERT(*suv);
- (*suv)->save_item_result(item);
- if ((*suv)->update())
+ Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
+ suv->save_item_result(item);
+ if (suv->fix_fields(thd, 0))
+ DBUG_RETURN (1);
+ if (suv->update())
DBUG_RETURN (1);
}
}
@@ -4117,6 +4056,15 @@ extern "C" unsigned long thd_get_thread_id(const MYSQL_THD thd)
}
+/**
+ Check if THD socket is still connected.
+ */
+extern "C" int thd_is_connected(MYSQL_THD thd)
+{
+ return thd->is_connected();
+}
+
+
#ifdef INNODB_COMPATIBILITY_HOOKS
extern "C" const struct charset_info_st *thd_charset(MYSQL_THD thd)
{
@@ -4541,17 +4489,8 @@ void THD::set_query_and_id(char *query_arg, uint32 query_length_arg,
{
mysql_mutex_lock(&LOCK_thd_data);
set_query_inner(query_arg, query_length_arg, cs);
- query_id= new_query_id;
mysql_mutex_unlock(&LOCK_thd_data);
-}
-
-/** Assign a new value to thd->query_id. */
-
-void THD::set_query_id(query_id_t new_query_id)
-{
- mysql_mutex_lock(&LOCK_thd_data);
query_id= new_query_id;
- mysql_mutex_unlock(&LOCK_thd_data);
}
/** Assign a new value to thd->mysys_var. */
@@ -4585,6 +4524,8 @@ void THD::leave_locked_tables_mode()
/* Also ensure that we don't release metadata locks for open HANDLERs. */
if (handler_tables_hash.records)
mysql_ha_set_explicit_lock_duration(this);
+ if (ull_hash.records)
+ mysql_ull_set_explicit_lock_duration(this);
}
locked_tables_mode= LTM_NONE;
}
@@ -4721,9 +4662,14 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
bool xid_cache_insert(XID_STATE *xid_state)
{
mysql_mutex_lock(&LOCK_xid_cache);
- DBUG_ASSERT(my_hash_search(&xid_cache, xid_state->xid.key(),
- xid_state->xid.key_length())==0);
- my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state);
+ if (my_hash_search(&xid_cache, xid_state->xid.key(),
+ xid_state->xid.key_length()))
+ {
+ mysql_mutex_unlock(&LOCK_xid_cache);
+ my_error(ER_XAER_DUPID, MYF(0));
+ return true;
+ }
+ bool res= my_hash_insert(&xid_cache, (uchar*)xid_state);
mysql_mutex_unlock(&LOCK_xid_cache);
return res;
}
@@ -4838,7 +4784,7 @@ void xid_cache_delete(XID_STATE *xid_state)
int THD::decide_logging_format(TABLE_LIST *tables)
{
DBUG_ENTER("THD::decide_logging_format");
- DBUG_PRINT("info", ("query: %s", query()));
+ DBUG_PRINT("info", ("Query: %s", query()));
DBUG_PRINT("info", ("variables.binlog_format: %lu",
variables.binlog_format));
DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x",
diff --git a/sql/sql_class.h b/sql/sql_class.h
index fccca9e8cbf..afe6b831466 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009, 2012, Monty Program Ab
+ Copyright (c) 2009, 2013, Monty Program Ab
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
@@ -69,7 +69,6 @@ class Lex_input_stream;
class Parser_state;
class Rows_log_event;
class Sroutine_hash_entry;
-class User_level_lock;
class user_var_entry;
enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
@@ -87,38 +86,38 @@ enum enum_mark_columns
enum enum_filetype { FILETYPE_CSV, FILETYPE_XML };
/* Bits for different SQL modes modes (including ANSI mode) */
-#define MODE_REAL_AS_FLOAT 1
-#define MODE_PIPES_AS_CONCAT 2
-#define MODE_ANSI_QUOTES 4
-#define MODE_IGNORE_SPACE 8
-#define MODE_IGNORE_BAD_TABLE_OPTIONS 16
-#define MODE_ONLY_FULL_GROUP_BY 32
-#define MODE_NO_UNSIGNED_SUBTRACTION 64
-#define MODE_NO_DIR_IN_CREATE 128
-#define MODE_POSTGRESQL 256
-#define MODE_ORACLE 512
-#define MODE_MSSQL 1024
-#define MODE_DB2 2048
-#define MODE_MAXDB 4096
-#define MODE_NO_KEY_OPTIONS 8192
-#define MODE_NO_TABLE_OPTIONS 16384
-#define MODE_NO_FIELD_OPTIONS 32768
-#define MODE_MYSQL323 65536L
-#define MODE_MYSQL40 (MODE_MYSQL323*2)
-#define MODE_ANSI (MODE_MYSQL40*2)
-#define MODE_NO_AUTO_VALUE_ON_ZERO (MODE_ANSI*2)
-#define MODE_NO_BACKSLASH_ESCAPES (MODE_NO_AUTO_VALUE_ON_ZERO*2)
-#define MODE_STRICT_TRANS_TABLES (MODE_NO_BACKSLASH_ESCAPES*2)
-#define MODE_STRICT_ALL_TABLES (MODE_STRICT_TRANS_TABLES*2)
-#define MODE_NO_ZERO_IN_DATE (MODE_STRICT_ALL_TABLES*2)
-#define MODE_NO_ZERO_DATE (MODE_NO_ZERO_IN_DATE*2)
-#define MODE_INVALID_DATES (MODE_NO_ZERO_DATE*2)
-#define MODE_ERROR_FOR_DIVISION_BY_ZERO (MODE_INVALID_DATES*2)
-#define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
-#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
-#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
-#define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2)
-#define MODE_PAD_CHAR_TO_FULL_LENGTH (ULL(1) << 31)
+#define MODE_REAL_AS_FLOAT (1ULL << 0)
+#define MODE_PIPES_AS_CONCAT (1ULL << 1)
+#define MODE_ANSI_QUOTES (1ULL << 2)
+#define MODE_IGNORE_SPACE (1ULL << 3)
+#define MODE_IGNORE_BAD_TABLE_OPTIONS (1ULL << 4)
+#define MODE_ONLY_FULL_GROUP_BY (1ULL << 5)
+#define MODE_NO_UNSIGNED_SUBTRACTION (1ULL << 6)
+#define MODE_NO_DIR_IN_CREATE (1ULL << 7)
+#define MODE_POSTGRESQL (1ULL << 8)
+#define MODE_ORACLE (1ULL << 9)
+#define MODE_MSSQL (1ULL << 10)
+#define MODE_DB2 (1ULL << 11)
+#define MODE_MAXDB (1ULL << 12)
+#define MODE_NO_KEY_OPTIONS (1ULL << 13)
+#define MODE_NO_TABLE_OPTIONS (1ULL << 14)
+#define MODE_NO_FIELD_OPTIONS (1ULL << 15)
+#define MODE_MYSQL323 (1ULL << 16)
+#define MODE_MYSQL40 (1ULL << 17)
+#define MODE_ANSI (1ULL << 18)
+#define MODE_NO_AUTO_VALUE_ON_ZERO (1ULL << 19)
+#define MODE_NO_BACKSLASH_ESCAPES (1ULL << 20)
+#define MODE_STRICT_TRANS_TABLES (1ULL << 21)
+#define MODE_STRICT_ALL_TABLES (1ULL << 22)
+#define MODE_NO_ZERO_IN_DATE (1ULL << 23)
+#define MODE_NO_ZERO_DATE (1ULL << 24)
+#define MODE_INVALID_DATES (1ULL << 25)
+#define MODE_ERROR_FOR_DIVISION_BY_ZERO (1ULL << 26)
+#define MODE_TRADITIONAL (1ULL << 27)
+#define MODE_NO_AUTO_CREATE_USER (1ULL << 28)
+#define MODE_HIGH_NOT_PRECEDENCE (1ULL << 29)
+#define MODE_NO_ENGINE_SUBSTITUTION (1ULL << 30)
+#define MODE_PAD_CHAR_TO_FULL_LENGTH (1ULL << 31)
extern char internal_table_name[2];
extern char empty_c_string[1];
@@ -235,8 +234,9 @@ public:
enum drop_type {KEY, COLUMN };
const char *name;
enum drop_type type;
- Alter_drop(enum drop_type par_type,const char *par_name)
- :name(par_name), type(par_type) {}
+ bool drop_if_exists;
+ Alter_drop(enum drop_type par_type,const char *par_name, bool par_exists)
+ :name(par_name), type(par_type), drop_if_exists(par_exists) {}
/**
Used to make a clone of this object for ALTER/CREATE TABLE
@sa comment for Key_part_spec::clone
@@ -270,20 +270,23 @@ public:
LEX_STRING name;
engine_option_value *option_list;
bool generated;
+ bool create_if_not_exists;
Key(enum Keytype type_par, const LEX_STRING &name_arg,
KEY_CREATE_INFO *key_info_arg,
bool generated_arg, List<Key_part_spec> &cols,
- engine_option_value *create_opt)
+ engine_option_value *create_opt, bool if_not_exists_opt)
:type(type_par), key_create_info(*key_info_arg), columns(cols),
- name(name_arg), option_list(create_opt), generated(generated_arg)
+ name(name_arg), option_list(create_opt), generated(generated_arg),
+ create_if_not_exists(if_not_exists_opt)
{}
Key(enum Keytype type_par, const char *name_arg, size_t name_len_arg,
KEY_CREATE_INFO *key_info_arg, bool generated_arg,
List<Key_part_spec> &cols,
- engine_option_value *create_opt)
+ engine_option_value *create_opt, bool if_not_exists_opt)
:type(type_par), key_create_info(*key_info_arg), columns(cols),
- option_list(create_opt), generated(generated_arg)
+ option_list(create_opt), generated(generated_arg),
+ create_if_not_exists(if_not_exists_opt)
{
name.str= (char *)name_arg;
name.length= name_len_arg;
@@ -314,8 +317,10 @@ public:
uint delete_opt, update_opt, match_opt;
Foreign_key(const LEX_STRING &name_arg, List<Key_part_spec> &cols,
Table_ident *table, List<Key_part_spec> &ref_cols,
- uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg)
- :Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols, NULL),
+ uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg,
+ bool if_not_exists_opt)
+ :Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols, NULL,
+ if_not_exists_opt),
ref_table(table), ref_columns(ref_cols),
delete_opt(delete_opt_arg), update_opt(update_opt_arg),
match_opt(match_opt_arg)
@@ -597,6 +602,9 @@ typedef struct system_variables
ulong wt_timeout_long, wt_deadlock_search_depth_long;
double long_query_time_double;
+
+ my_bool pseudo_slave_mode;
+
} SV;
/**
@@ -1711,11 +1719,11 @@ public:
HASH handler_tables_hash;
/*
- One thread can hold up to one named user-level lock. This variable
- points to a lock object if the lock is present. See item_func.cc and
+ A thread can hold named user-level locks. This variable
+ contains granted tickets if a lock is present. See item_func.cc and
chapter 'Miscellaneous functions', for functions GET_LOCK, RELEASE_LOCK.
*/
- User_level_lock *ull;
+ HASH ull_hash;
#ifndef DBUG_OFF
uint dbug_sentry; // watch out for memory corruption
#endif
@@ -2719,9 +2727,21 @@ public:
return alloc_root(&transaction.mem_root,size);
}
- LEX_STRING *make_lex_string(LEX_STRING *lex_str,
- const char* str, uint length,
- bool allocate_lex_string);
+ LEX_STRING *make_lex_string(LEX_STRING *lex_str, const char* str, uint length)
+ {
+ if (!(lex_str->str= strmake_root(mem_root, str, length)))
+ return 0;
+ lex_str->length= length;
+ return lex_str;
+ }
+
+ LEX_STRING *make_lex_string(const char* str, uint length)
+ {
+ LEX_STRING *lex_str;
+ if (!(lex_str= (LEX_STRING *)alloc_root(mem_root, sizeof(LEX_STRING))))
+ return 0;
+ return make_lex_string(lex_str, str, length);
+ }
bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
const char *from, uint from_length,
@@ -3193,7 +3213,10 @@ public:
{ set_query(CSET_STRING()); }
void set_query_and_id(char *query_arg, uint32 query_length_arg,
CHARSET_INFO *cs, query_id_t new_query_id);
- void set_query_id(query_id_t new_query_id);
+ void set_query_id(query_id_t new_query_id)
+ {
+ query_id= new_query_id;
+ }
void set_open_tables(TABLE *open_tables_arg)
{
mysql_mutex_lock(&LOCK_thd_data);
@@ -3480,6 +3503,7 @@ public:
#else
void begin_dataset() {}
#endif
+ virtual void update_used_tables() {}
};
@@ -4253,6 +4277,7 @@ public:
return updated;
}
virtual void abort_result_set();
+ void update_used_tables();
};
class my_var : public Sql_alloc {
@@ -4276,7 +4301,6 @@ public:
class select_dumpvar :public select_result_interceptor {
ha_rows row_count;
- Item_func_set_user_var **set_var_items;
public:
List<my_var> var_list;
select_dumpvar() { var_list.empty(); row_count= 0;}
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 59aa51916fb..c3f2bb0ca11 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2007, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+ Copyright (c) 2008, 2013, Monty Program Ab
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
@@ -226,7 +226,7 @@ void time_out_user_resource_limits(THD *thd, USER_CONN *uc)
DBUG_ENTER("time_out_user_resource_limits");
/* If more than a hour since last check, reset resource checking */
- if (check_time - uc->reset_utime >= LL(3600000000))
+ if (check_time - uc->reset_utime >= 3600000000ULL)
{
uc->questions=0;
uc->updates=0;
@@ -1187,7 +1187,7 @@ bool thd_prepare_connection(THD *thd)
bool rc;
lex_start(thd);
rc= login_connection(thd);
- MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd);
+ mysql_audit_notify_connection_connect(thd);
if (rc)
return rc;
diff --git a/sql/sql_const.h b/sql/sql_const.h
index c6aa52197d5..7dadbb7b8b4 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -93,7 +93,7 @@
#define FIELD_NR_MASK 16383 /* To get fieldnumber */
#define FERR -1 /* Error from my_functions */
#define CREATE_MODE 0 /* Default mode on new files */
-#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
+#define NAMES_SEP_CHAR 255 /* Char to sep. names */
#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */
#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 87650e643f2..d4f8431beec 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -52,11 +52,9 @@ const char *del_exts[]= {".frm", ".BAK", ".TMD",".opt", NullS};
static TYPELIB deletable_extentions=
{array_elements(del_exts)-1,"del_exts", del_exts, NULL};
-static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
- const char *db,
- const char *path,
- TABLE_LIST **tables,
- bool *found_other_files);
+static bool find_db_tables_and_rm_known_files(THD *, MY_DIR *, const char *,
+ const char *, TABLE_LIST **,
+ bool *);
long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path);
static my_bool rm_dir_w_symlink(const char *org_path, my_bool send_error);
@@ -834,11 +832,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
mysql_ha_rm_tables(thd, tables);
for (table= tables; table; table= table->next_local)
- {
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name,
- false);
deleted_tables++;
- }
thd->push_internal_handler(&err_handler);
if (!thd->killed &&
@@ -936,16 +930,10 @@ update_binlog:
for (tbl= tables; tbl; tbl= tbl->next_local)
{
uint tbl_name_len;
- bool exists;
char quoted_name[FN_REFLEN+3];
// Only write drop table to the binlog for tables that no longer exist.
- if (check_if_table_exists(thd, tbl, 0, &exists))
- {
- error= true;
- goto exit;
- }
- if (exists)
+ if (ha_table_exists(thd, tbl->db, tbl->table_name))
continue;
my_snprintf(quoted_name, sizeof(quoted_name), "%`s", tbl->table_name);
@@ -1010,18 +998,13 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
tot_list_next_local= tot_list_next_global= &tot_list;
for (uint idx=0 ;
- idx < (uint) dirp->number_off_files && !thd->killed ;
+ idx < (uint) dirp->number_of_files && !thd->killed ;
idx++)
{
FILEINFO *file=dirp->dir_entry+idx;
char *extension;
DBUG_PRINT("info",("Examining: %s", file->name));
- /* skiping . and .. */
- if (file->name[0] == '.' && (!file->name[1] ||
- (file->name[1] == '.' && !file->name[2])))
- continue;
-
if (file->name[0] == 'a' && file->name[1] == 'r' &&
file->name[2] == 'c' && file->name[3] == '\0')
{
@@ -1189,18 +1172,13 @@ long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
DBUG_PRINT("enter", ("path: %s", org_path));
for (uint idx=0 ;
- idx < (uint) dirp->number_off_files && !thd->killed ;
+ idx < (uint) dirp->number_of_files && !thd->killed ;
idx++)
{
FILEINFO *file=dirp->dir_entry+idx;
char *extension, *revision;
DBUG_PRINT("info",("Examining: %s", file->name));
- /* skiping . and .. */
- if (file->name[0] == '.' && (!file->name[1] ||
- (file->name[1] == '.' && !file->name[2])))
- continue;
-
extension= fn_ext(file->name);
if (extension[0] != '.' ||
extension[1] != 'f' || extension[2] != 'r' ||
@@ -1687,7 +1665,7 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
/* Step2: Move tables to the new database */
if ((dirp = my_dir(path,MYF(MY_DONT_SORT))))
{
- uint nfiles= (uint) dirp->number_off_files;
+ uint nfiles= (uint) dirp->number_of_files;
for (uint idx=0 ; idx < nfiles && !thd->killed ; idx++)
{
FILEINFO *file= dirp->dir_entry + idx;
@@ -1778,17 +1756,15 @@ bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db)
if ((dirp = my_dir(path,MYF(MY_DONT_SORT))))
{
- uint nfiles= (uint) dirp->number_off_files;
+ uint nfiles= (uint) dirp->number_of_files;
for (uint idx=0 ; idx < nfiles ; idx++)
{
FILEINFO *file= dirp->dir_entry + idx;
char oldname[FN_REFLEN + 1], newname[FN_REFLEN + 1];
DBUG_PRINT("info",("Examining: %s", file->name));
- /* skiping . and .. and MY_DB_OPT_FILE */
- if ((file->name[0] == '.' &&
- (!file->name[1] || (file->name[1] == '.' && !file->name[2]))) ||
- !my_strcasecmp(files_charset_info, file->name, MY_DB_OPT_FILE))
+ /* skiping MY_DB_OPT_FILE */
+ if (!my_strcasecmp(files_charset_info, file->name, MY_DB_OPT_FILE))
continue;
/* pass empty file name, and file->name as extension to avoid encoding */
diff --git a/sql/sql_db.h b/sql/sql_db.h
index 1f447c11a52..62d379c515d 100644
--- a/sql/sql_db.h
+++ b/sql/sql_db.h
@@ -19,7 +19,6 @@
#include "hash.h" /* HASH */
class THD;
-typedef struct st_ha_create_information HA_CREATE_INFO;
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 1c93a59904c..d1e5d731183 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -304,7 +304,8 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, SQL_HANDLER *reopen)
/* There can be only one table in '*tables'. */
if (! (table->file->ha_table_flags() & HA_CAN_SQL_HANDLER))
{
- my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
+ my_error(ER_ILLEGAL_HA, MYF(0), table->file->table_type(),
+ table->s->db.str, table->s->table_name.str);
goto err;
}
@@ -901,7 +902,8 @@ retry:
break;
}
default:
- my_message(ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), MYF(0));
+ my_error(ER_ILLEGAL_HA, MYF(0), table->file->table_type(),
+ table->s->db.str, table->s->table_name.str);
goto err;
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 09e4953cdc4..4f025c7c335 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2041,9 +2041,9 @@ public:
thd.unlink(); // Must be unlinked under lock
my_free(thd.query());
thd.security_ctx->user= thd.security_ctx->host=0;
- thread_count--;
delayed_insert_threads--;
mysql_mutex_unlock(&LOCK_thread_count);
+ thread_safe_decrement32(&thread_count, &thread_count_lock);
mysql_cond_broadcast(&COND_thread_count); /* Tell main we are ready */
}
@@ -2178,9 +2178,9 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
{
if (!(di= new Delayed_insert()))
goto end_create;
- mysql_mutex_lock(&LOCK_thread_count);
- thread_count++;
- mysql_mutex_unlock(&LOCK_thread_count);
+
+ thread_safe_increment32(&thread_count, &thread_count_lock);
+
/*
Annotating delayed inserts is not supported.
*/
@@ -3891,8 +3891,8 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
{
if (!mysql_create_table_no_lock(thd, create_table->db,
create_table->table_name,
- create_info, alter_info, 0,
- select_field_count, NULL))
+ create_info, alter_info, NULL,
+ select_field_count))
{
DEBUG_SYNC(thd,"create_table_select_before_open");
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index fde9f70fa79..6b0882bda80 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -775,7 +775,7 @@ ulong JOIN_CACHE::get_min_join_buffer_size()
tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
{
len+= tab->get_max_used_fieldlength();
- len_last=+ tab->get_used_fieldlength();
+ len_last+= tab->get_used_fieldlength();
}
size_t len_addon= get_record_max_affix_length() +
get_max_key_addon_space_per_record();
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 82cdd4ead7b..fbe5bcd57f2 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -507,6 +507,7 @@ void lex_start(THD *thd)
lex->expr_allows_subselect= TRUE;
lex->use_only_table_context= FALSE;
lex->parse_vcol_expr= FALSE;
+ lex->check_exists= FALSE;
lex->verbose= 0;
lex->name.str= 0;
@@ -1883,6 +1884,7 @@ void st_select_lex::init_query()
max_equal_elems= 0;
ref_pointer_array= 0;
select_n_where_fields= 0;
+ select_n_reserved= 0;
select_n_having_items= 0;
n_child_sum_items= 0;
subquery_in_having= explicit_limit= 0;
@@ -2328,6 +2330,7 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
ref_pointer_array=
(Item **)thd->stmt_arena->alloc(sizeof(Item*) * (n_child_sum_items +
item_list.elements +
+ select_n_reserved +
select_n_having_items +
select_n_where_fields +
order_group_num)*5);
@@ -2883,7 +2886,7 @@ void st_select_lex_unit::set_limit(st_select_lex *sl)
val= fix_fields_successful ? item->val_uint() : 0;
}
else
- val= ULL(0);
+ val= 0;
offset_limit_cnt= (ha_rows)val;
#ifndef BIG_TABLES
@@ -3877,7 +3880,8 @@ void SELECT_LEX::update_used_tables()
{
for (ORDER *order= order_list.first; order; order= order->next)
(*order->item)->update_used_tables();
- }
+ }
+ join->result->update_used_tables();
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index cc117e18d1e..363b0d77e41 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -740,6 +740,8 @@ public:
and all inner subselects.
*/
uint select_n_where_fields;
+ /* reserved for exists 2 in */
+ uint select_n_reserved;
enum_parsing_place parsing_place; /* where we are parsing expression */
bool with_sum_func; /* sum function indicator */
@@ -2433,7 +2435,8 @@ struct LEX: public Query_tables_list
uint16 create_view_algorithm;
uint8 create_view_check;
uint8 context_analysis_only;
- bool drop_if_exists, drop_temporary, local_file, one_shot_set;
+ bool drop_temporary, local_file, one_shot_set;
+ bool check_exists;
bool autocommit;
bool verbose, no_write_to_binlog;
diff --git a/sql/sql_list.h b/sql/sql_list.h
index b4e0ab84aab..aef2f8d5f25 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -287,13 +287,15 @@ public:
if (node == &end_of_list)
return;
}
- *prev= *last;
+ *prev= &end_of_list;
last= prev;
}
inline void prepand(base_list *list)
{
if (!list->is_empty())
{
+ if (is_empty())
+ last= list->last;
*list->last= first;
first= list->first;
elements+= list->elements;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index d805597898b..e8268f42cc7 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+ Copyright (c) 2008, 2013, Monty Program Ab
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
@@ -804,9 +804,10 @@ end:
delete thd;
#ifndef EMBEDDED_LIBRARY
- mysql_mutex_lock(&LOCK_thread_count);
- thread_count--;
+ thread_safe_decrement32(&thread_count, &thread_count_lock);
in_bootstrap= FALSE;
+
+ mysql_mutex_lock(&LOCK_thread_count);
mysql_cond_broadcast(&COND_thread_count);
mysql_mutex_unlock(&LOCK_thread_count);
my_thread_end();
@@ -1110,9 +1111,16 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->query_plan_flags= QPLAN_INIT;
thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
thd->set_time();
- thd->set_query_id(get_query_id());
if (!(server_command_flags[command] & CF_SKIP_QUERY_ID))
- next_query_id();
+ thd->set_query_id(next_query_id());
+ else
+ {
+ /*
+ ping, get statistics or similar stateless command.
+ No reason to increase query id here.
+ */
+ thd->set_query_id(get_query_id());
+ }
inc_thread_running();
if (!(server_command_flags[command] & CF_SKIP_QUESTIONS))
@@ -1183,7 +1191,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
else
rc= acl_authenticate(thd, 0, packet_length);
- MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER(thd);
+ mysql_audit_notify_connection_change_user(thd);
if (rc)
{
/* Free user if allocated by acl_authenticate */
@@ -1569,7 +1577,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (!(uptime= (ulong) (thd->start_time - server_start_time)))
queries_per_second1000= 0;
else
- queries_per_second1000= thd->query_id * LL(1000) / uptime;
+ queries_per_second1000= thd->query_id * 1000 / uptime;
length= my_snprintf(buff, buff_len - 1,
"Uptime: %lu Threads: %d Questions: %lu "
@@ -1851,7 +1859,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
break;
case SCH_USER_STATS:
case SCH_CLIENT_STATS:
- if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
+ if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true))
DBUG_RETURN(1);
case SCH_TABLE_STATS:
case SCH_INDEX_STATS:
@@ -2026,7 +2034,7 @@ bool sp_process_definer(THD *thd)
if ((strcmp(lex->definer->user.str, thd->security_ctx->priv_user) ||
my_strcasecmp(system_charset_info, lex->definer->host.str,
thd->security_ctx->priv_host)) &&
- check_global_access(thd, SUPER_ACL))
+ check_global_access(thd, SUPER_ACL, true))
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
DBUG_RETURN(TRUE);
@@ -2277,7 +2285,7 @@ mysql_execute_command(THD *thd)
if (!(lex->sql_command == SQLCOM_UPDATE_MULTI) &&
!(lex->sql_command == SQLCOM_SET_OPTION) &&
!(lex->sql_command == SQLCOM_DROP_TABLE &&
- lex->drop_temporary && lex->drop_if_exists) &&
+ lex->drop_temporary && lex->check_exists) &&
all_tables_not_ok(thd, all_tables))
{
/* we warn the slave SQL thread */
@@ -3301,6 +3309,7 @@ end_with_restore_list:
thd->first_successful_insert_id_in_cur_stmt=
thd->first_successful_insert_id_in_prev_stmt;
+#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("after_mysql_insert",
{
const char act1[]=
@@ -3316,6 +3325,7 @@ end_with_restore_list:
STRING_WITH_LEN(act2)));
};);
DEBUG_SYNC(thd, "after_mysql_insert");
+#endif
break;
}
case SQLCOM_REPLACE_SELECT:
@@ -3489,7 +3499,7 @@ end_with_restore_list:
thd->variables.option_bits|= OPTION_KEEP_LOG;
}
/* DDL and binlog write order are protected by metadata locks. */
- res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
+ res= mysql_rm_table(thd, first_table, lex->check_exists,
lex->drop_temporary);
}
break;
@@ -3703,7 +3713,7 @@ end_with_restore_list:
#endif
if (check_access(thd, DROP_ACL, lex->name.str, NULL, NULL, 1, 0))
break;
- res= mysql_rm_db(thd, lex->name.str, lex->drop_if_exists, 0);
+ res= mysql_rm_db(thd, lex->name.str, lex->check_exists, 0);
break;
}
case SQLCOM_ALTER_DB_UPGRADE:
@@ -3831,7 +3841,7 @@ end_with_restore_list:
case SQLCOM_DROP_EVENT:
if (!(res= Events::drop_event(thd,
lex->spname->m_db, lex->spname->m_name,
- lex->drop_if_exists)))
+ lex->check_exists)))
my_ok(thd);
break;
#else
@@ -4520,7 +4530,7 @@ create_sp_error:
if (lex->spname->m_db.str == NULL)
{
- if (lex->drop_if_exists)
+ if (lex->check_exists)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_SP_DOES_NOT_EXIST, ER(ER_SP_DOES_NOT_EXIST),
@@ -4589,7 +4599,7 @@ create_sp_error:
my_ok(thd);
break;
case SP_KEY_NOT_FOUND:
- if (lex->drop_if_exists)
+ if (lex->check_exists)
{
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
@@ -4804,7 +4814,7 @@ create_sp_error:
if ((err_code= drop_server(thd, &lex->server_options)))
{
- if (! lex->drop_if_exists && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST)
+ if (! lex->check_exists && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST)
{
DBUG_PRINT("info", ("problem dropping server %s",
lex->server_options.server_name));
@@ -5238,6 +5248,10 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
if ((db != NULL) && (db != any_db))
{
+ /*
+ Check if this is reserved database, like information schema or
+ performance schema
+ */
const ACL_internal_schema_access *access;
access= get_cached_schema_access(grant_internal_info, db);
if (access)
@@ -5680,14 +5694,17 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
1 Access denied. In this case an error is sent to the client
*/
-bool check_global_access(THD *thd, ulong want_access)
+bool check_global_access(THD *thd, ulong want_access, bool no_errors)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
char command[128];
if ((thd->security_ctx->master_access & want_access))
return 0;
- get_privilege_desc(command, sizeof(command), want_access);
- my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
+ if (!no_errors)
+ {
+ get_privilege_desc(command, sizeof(command), want_access);
+ my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
+ }
status_var_increment(thd->status_var.access_denied_errors);
return 1;
#else
@@ -6227,7 +6244,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
lex->col_list.push_back(new Key_part_spec(*field_name, 0));
key= new Key(Key::PRIMARY, null_lex_str,
&default_key_create_info,
- 0, lex->col_list, NULL);
+ 0, lex->col_list, NULL, lex->check_exists);
lex->alter_info.key_list.push_back(key);
lex->col_list.empty();
}
@@ -6237,7 +6254,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
lex->col_list.push_back(new Key_part_spec(*field_name, 0));
key= new Key(Key::UNIQUE, null_lex_str,
&default_key_create_info, 0,
- lex->col_list, NULL);
+ lex->col_list, NULL, lex->check_exists);
lex->alter_info.key_list.push_back(key);
lex->col_list.empty();
}
@@ -6289,7 +6306,7 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
new_field->init(thd, field_name->str, type, length, decimals, type_modifier,
default_value, on_update_value, comment, change,
interval_list, cs, uint_geom_type, vcol_info,
- create_options))
+ create_options, lex->check_exists))
DBUG_RETURN(1);
lex->alter_info.create_list.push_back(new_field);
@@ -7894,6 +7911,7 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
return TRUE;
}
+C_MODE_START
/*
Check if path does not contain mysql data home directory
@@ -7906,7 +7924,6 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
0 ok
1 error ; Given path contains data directory
*/
-C_MODE_START
int test_if_data_home_dir(const char *dir)
{
@@ -7917,6 +7934,22 @@ int test_if_data_home_dir(const char *dir)
if (!dir)
DBUG_RETURN(0);
+ /*
+ data_file_name and index_file_name include the table name without
+ extension. Mostly this does not refer to an existing file. When
+ comparing data_file_name or index_file_name against the data
+ directory, we try to resolve all symbolic links. On some systems,
+ we use realpath(3) for the resolution. This returns ENOENT if the
+ resolved path does not refer to an existing file. my_realpath()
+ does then copy the requested path verbatim, without symlink
+ resolution. Thereafter the comparison can fail even if the
+ requested path is within the data directory. E.g. if symlinks to
+ another file system are used. To make realpath(3) return the
+ resolved path, we strip the table name and compare the directory
+ path only. If the directory doesn't exist either, table creation
+ will fail anyway.
+ */
+
(void) fn_format(path, dir, "", "",
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
dir_len= strlen(path);
@@ -7950,6 +7983,22 @@ int test_if_data_home_dir(const char *dir)
C_MODE_END
+int error_if_data_home_dir(const char *path, const char *what)
+{
+ size_t dirlen;
+ char dirpath[FN_REFLEN];
+ if (path)
+ {
+ dirname_part(dirpath, path, &dirlen);
+ if (test_if_data_home_dir(dirpath))
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), what);
+ return 1;
+ }
+ }
+ return 0;
+}
+
/**
Check that host name string is valid.
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 4510ebe94e2..25c41cc624c 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -34,6 +34,7 @@ enum enum_mysql_completiontype {
};
extern "C" int test_if_data_home_dir(const char *dir);
+int error_if_data_home_dir(const char *path, const char *what);
bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
@@ -196,7 +197,7 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
/* These were under the INNODB_COMPATIBILITY_HOOKS */
-bool check_global_access(THD *thd, ulong want_access);
+bool check_global_access(THD *thd, ulong want_access, bool no_errors= false);
inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index f042f028450..b2e2016b47d 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2011, Monty Program Ab
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -4536,7 +4536,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
*/
DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, db, table_name,
MDL_INTENTION_EXCLUSIVE));
- new_table= open_table_uncached(thd, path, db, table_name, 0);
+ new_table= open_table_uncached(thd, old_db_type, path, db, table_name, 0);
if (!new_table)
DBUG_RETURN(TRUE);
@@ -4717,8 +4717,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
}
alt_part_info->part_type= tab_part_info->part_type;
alt_part_info->subpart_type= tab_part_info->subpart_type;
- if (alt_part_info->set_up_defaults_for_partitioning(new_table->file,
- ULL(0),
+ if (alt_part_info->set_up_defaults_for_partitioning(new_table->file, 0,
tab_part_info->num_parts))
{
goto err;
@@ -5134,8 +5133,7 @@ state of p1.
alt_part_info->num_subparts= tab_part_info->num_subparts;
DBUG_ASSERT(!alt_part_info->use_default_partitions);
if (alt_part_info->set_up_defaults_for_partitioning(new_table->file,
- ULL(0),
- 0))
+ 0, 0))
{
goto err;
}
@@ -5268,7 +5266,7 @@ the generated partition syntax in a correct manner.
tab_part_info->use_default_num_subpartitions= FALSE;
}
if (tab_part_info->check_partition_info(thd, (handlerton**)NULL,
- new_table->file, ULL(0), TRUE))
+ new_table->file, 0, TRUE))
{
goto err;
}
diff --git a/sql/sql_partition.h b/sql/sql_partition.h
index 2fd9b4c3d75..8db07f836b0 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -32,7 +32,6 @@ class partition_info;
struct TABLE;
struct TABLE_LIST;
typedef struct st_bitmap MY_BITMAP;
-typedef struct st_ha_create_information HA_CREATE_INFO;
typedef struct st_key KEY;
typedef struct st_key_range key_range;
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 8778713d7e7..72f16ba7837 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -35,6 +35,8 @@
#include <mysql/plugin_auth.h>
#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
#include <mysql/plugin_auth.h>
+#include "sql_plugin_compat.h"
+
#define REPORT_TO_LOG 1
#define REPORT_TO_USER 2
@@ -135,7 +137,7 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION,
MYSQL_AUDIT_INTERFACE_VERSION,
MYSQL_REPLICATION_INTERFACE_VERSION,
- MYSQL_AUTHENTICATION_INTERFACE_VERSION
+ MIN_AUTHENTICATION_INTERFACE_VERSION
};
static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
@@ -195,6 +197,8 @@ static bool reap_needed= false;
static int plugin_array_version=0;
static bool initialized= 0;
+ulong dlopen_count;
+
/*
write-lock on LOCK_system_variables_hash is required before modifying
@@ -306,10 +310,6 @@ static void unlock_variables(THD *thd, struct system_variables *vars);
static void cleanup_variables(THD *thd, struct system_variables *vars);
static void plugin_vars_free_values(sys_var *vars);
static void restore_pluginvar_names(sys_var *first);
-static void plugin_opt_set_limits(struct my_option *,
- const struct st_mysql_sys_var *);
-#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B)
-#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B)
static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin);
static void intern_plugin_unlock(LEX *lex, plugin_ref plugin);
static void reap_plugins(void);
@@ -507,7 +507,6 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
/* Determine interface version */
if (!sym)
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_CANT_FIND_DL_ENTRY, plugin_interface_version_sym);
DBUG_RETURN(TRUE);
}
@@ -517,7 +516,6 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
if (plugin_dl->mysqlversion < min_plugin_interface_version ||
(plugin_dl->mysqlversion >> 8) > (MYSQL_PLUGIN_INTERFACE_VERSION >> 8))
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, 0,
"plugin interface version mismatch");
DBUG_RETURN(TRUE);
@@ -525,7 +523,6 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
/* Find plugin declarations */
if (!(sym= dlsym(plugin_dl->handle, plugin_declarations_sym)))
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_CANT_FIND_DL_ENTRY, plugin_declarations_sym);
DBUG_RETURN(TRUE);
}
@@ -556,7 +553,6 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
MYF(MY_ZEROFILL|MY_WME));
if (!cur)
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_OUTOFMEMORY,
static_cast<int>(plugin_dl->dl.length));
DBUG_RETURN(TRUE);
@@ -631,7 +627,6 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
Actually this branch impossible because in case of absence of maria
version we try mysql version.
*/
- free_plugin_mem(plugin_dl);
report_error(report, ER_CANT_FIND_DL_ENTRY,
maria_plugin_interface_version_sym);
DBUG_RETURN(TRUE);
@@ -642,7 +637,6 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
if (plugin_dl->mariaversion < min_maria_plugin_interface_version ||
(plugin_dl->mariaversion >> 8) > (MARIA_PLUGIN_INTERFACE_VERSION >> 8))
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, 0,
"plugin interface version mismatch");
DBUG_RETURN(TRUE);
@@ -650,7 +644,6 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
/* Find plugin declarations */
if (!(sym= dlsym(plugin_dl->handle, maria_plugin_declarations_sym)))
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_CANT_FIND_DL_ENTRY, maria_plugin_declarations_sym);
DBUG_RETURN(TRUE);
}
@@ -664,7 +657,6 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
sizeof_st_plugin= *(int *)sym;
else
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_CANT_FIND_DL_ENTRY, maria_sizeof_st_plugin_sym);
DBUG_RETURN(TRUE);
}
@@ -682,7 +674,6 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
MYF(MY_ZEROFILL|MY_WME));
if (!cur)
{
- free_plugin_mem(plugin_dl);
report_error(report, ER_OUTOFMEMORY,
static_cast<int>(plugin_dl->dl.length));
DBUG_RETURN(TRUE);
@@ -712,11 +703,12 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
#ifdef HAVE_DLOPEN
char dlpath[FN_REFLEN];
uint plugin_dir_len, dummy_errors, dlpathlen, i;
- struct st_plugin_dl *tmp, plugin_dl;
+ struct st_plugin_dl *tmp= 0, plugin_dl;
void *sym;
DBUG_ENTER("plugin_dl_add");
DBUG_PRINT("enter", ("dl->str: '%s', dl->length: %d",
dl->str, (int) dl->length));
+ mysql_mutex_assert_owner(&LOCK_plugin);
plugin_dir_len= strlen(opt_plugin_dir);
/*
Ensure that the dll doesn't have a path.
@@ -754,8 +746,9 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
if (*errmsg == ' ') errmsg++;
}
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, errno, errmsg);
- DBUG_RETURN(0);
+ goto ret;
}
+ dlopen_count++;
/* Checks which plugin interface present and reads info */
if (!(sym= dlsym(plugin_dl.handle, maria_plugin_interface_version_sym)))
@@ -765,12 +758,12 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
plugin_interface_version_sym),
dlpath,
report))
- DBUG_RETURN(0);
+ goto ret;
}
else
{
if (read_maria_plugin_info(&plugin_dl, sym, dlpath, report))
- DBUG_RETURN(0);
+ goto ret;
}
/* link the services in */
@@ -787,7 +780,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
"service '%s' interface version mismatch",
list_of_services[i].name);
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, 0, buf);
- DBUG_RETURN(0);
+ goto ret;
}
*(void**)sym= list_of_services[i].service;
}
@@ -797,10 +790,9 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1;
if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0))))
{
- free_plugin_mem(&plugin_dl);
report_error(report, ER_OUTOFMEMORY,
static_cast<int>(plugin_dl.dl.length));
- DBUG_RETURN(0);
+ goto ret;
}
plugin_dl.dl.length= copy_and_convert(plugin_dl.dl.str, plugin_dl.dl.length,
files_charset_info, dl->str, dl->length, system_charset_info,
@@ -809,12 +801,17 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
/* Add this dll to array */
if (! (tmp= plugin_dl_insert_or_reuse(&plugin_dl)))
{
- free_plugin_mem(&plugin_dl);
report_error(report, ER_OUTOFMEMORY,
static_cast<int>(sizeof(struct st_plugin_dl)));
- DBUG_RETURN(0);
+ goto ret;
}
+
+ret:
+ if (!tmp)
+ free_plugin_mem(&plugin_dl);
+
DBUG_RETURN(tmp);
+
#else
DBUG_ENTER("plugin_dl_add");
report_error(report, ER_FEATURE_DISABLED, "plugin", "HAVE_DLOPEN");
@@ -823,34 +820,23 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
}
-static void plugin_dl_del(const LEX_STRING *dl)
+static void plugin_dl_del(struct st_plugin_dl *plugin_dl)
{
-#ifdef HAVE_DLOPEN
- uint i;
DBUG_ENTER("plugin_dl_del");
+ if (!plugin_dl)
+ DBUG_VOID_RETURN;
+
mysql_mutex_assert_owner(&LOCK_plugin);
- for (i= 0; i < plugin_dl_array.elements; i++)
+ /* Do not remove this element, unless no other plugin uses this dll. */
+ if (! --plugin_dl->ref_count)
{
- struct st_plugin_dl *tmp= *dynamic_element(&plugin_dl_array, i,
- struct st_plugin_dl **);
- if (tmp->ref_count &&
- ! my_strnncoll(files_charset_info,
- (const uchar *)dl->str, dl->length,
- (const uchar *)tmp->dl.str, tmp->dl.length))
- {
- /* Do not remove this element, unless no other plugin uses this dll. */
- if (! --tmp->ref_count)
- {
- free_plugin_mem(tmp);
- bzero(tmp, sizeof(struct st_plugin_dl));
- }
- break;
- }
+ free_plugin_mem(plugin_dl);
+ bzero(plugin_dl, sizeof(struct st_plugin_dl));
}
+
DBUG_VOID_RETURN;
-#endif
}
@@ -921,7 +907,8 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc)
mysql_mutex_assert_owner(&LOCK_plugin);
- if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED))
+ if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED |
+ PLUGIN_IS_DELETED))
{
plugin_ref plugin;
#ifdef DBUG_OFF
@@ -986,7 +973,7 @@ plugin_ref plugin_lock(THD *thd, plugin_ref ptr)
#endif
mysql_mutex_lock(&LOCK_plugin);
plugin_ref_to_int(ptr)->locks_total++;
- rc= my_intern_plugin_lock_ci(lex, ptr);
+ rc= intern_plugin_lock(lex, ptr);
mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(rc);
}
@@ -1000,7 +987,7 @@ plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type)
DBUG_ENTER("plugin_lock_by_name");
mysql_mutex_lock(&LOCK_plugin);
if ((plugin= plugin_find_internal(name, type)))
- rc= my_intern_plugin_lock_ci(lex, plugin_int_to_ref(plugin));
+ rc= intern_plugin_lock(lex, plugin_int_to_ref(plugin));
mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(rc);
}
@@ -1136,7 +1123,7 @@ err:
if (errs == 0 && oks == 0 && !dupes) // no plugin was found
report_error(report, ER_CANT_FIND_DL_ENTRY, name->str);
- plugin_dl_del(dl);
+ plugin_dl_del(tmp.plugin_dl);
DBUG_RETURN(errs > 0 || oks + dupes == 0);
}
@@ -1152,22 +1139,21 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
if (plugin->plugin->status_vars)
{
-#ifdef FIX_LATER
- /**
- @todo
- unfortunately, status variables were introduced without a
- pluginname_ namespace, that is pluginname_ was not added automatically
- to status variable names. It should be fixed together with the next
- incompatible API change.
+ /*
+ historical ndb behavior caused MySQL plugins to specify
+ status var names in full, with the plugin name prefix.
+ this was never fixed in MySQL.
+ MariaDB fixes that but support MySQL style too.
*/
- SHOW_VAR array[2]= {
+ SHOW_VAR *show_vars= plugin->plugin->status_vars;
+ SHOW_VAR tmp_array[2]= {
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
{0, 0, SHOW_UNDEF}
};
- remove_status_vars(array);
-#else
- remove_status_vars(plugin->plugin->status_vars);
-#endif /* FIX_LATER */
+ if (strncasecmp(show_vars->name, plugin->name.str, plugin->name.length))
+ show_vars= tmp_array;
+
+ remove_status_vars(show_vars);
}
if (plugin_type_deinitialize[plugin->plugin->type])
@@ -1213,8 +1199,7 @@ static void plugin_del(struct st_plugin_int *plugin)
restore_pluginvar_names(plugin->system_vars);
plugin_vars_free_values(plugin->system_vars);
my_hash_delete(&plugin_hash[plugin->plugin->type], (uchar*)plugin);
- if (plugin->plugin_dl)
- plugin_dl_del(&plugin->plugin_dl->dl);
+ plugin_dl_del(plugin->plugin_dl);
plugin->state= PLUGIN_IS_FREED;
plugin_array_version++;
free_root(&plugin->mem_root, MYF(0));
@@ -1378,24 +1363,22 @@ static int plugin_initialize(struct st_plugin_int *plugin)
if (plugin->plugin->status_vars)
{
-#ifdef FIX_LATER
/*
- We have a problem right now where we can not prepend without
- breaking backwards compatibility. We will fix this shortly so
- that engines have "use names" and we wil use those for
- CREATE TABLE, and use the plugin name then for adding automatic
- variable names.
+ historical ndb behavior caused MySQL plugins to specify
+ status var names in full, with the plugin name prefix.
+ this was never fixed in MySQL.
+ MariaDB fixes that, but supports MySQL style too.
*/
- SHOW_VAR array[2]= {
+ SHOW_VAR *show_vars= plugin->plugin->status_vars;
+ SHOW_VAR tmp_array[2]= {
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
{0, 0, SHOW_UNDEF}
};
- if (add_status_vars(array)) // add_status_vars makes a copy
- goto err;
-#else
- if (add_status_vars(plugin->plugin->status_vars))
+ if (strncasecmp(show_vars->name, plugin->name.str, plugin->name.length))
+ show_vars= tmp_array;
+
+ if (add_status_vars(show_vars))
goto err;
-#endif /* FIX_LATER */
}
/*
@@ -1507,6 +1490,8 @@ int plugin_init(int *argc, char **argv, int flags)
if (initialized)
DBUG_RETURN(0);
+ dlopen_count =0;
+
#ifdef HAVE_PSI_INTERFACE
init_plugin_psi_keys();
#endif
@@ -1535,8 +1520,8 @@ int plugin_init(int *argc, char **argv, int flags)
}
/* prepare debug_sync service */
- DBUG_ASSERT(strcmp(list_of_services[5].name, "debug_sync_service") == 0);
- list_of_services[5].service= *(void**)&debug_sync_C_callback_ptr;
+ DBUG_ASSERT(strcmp(list_of_services[4].name, "debug_sync_service") == 0);
+ list_of_services[4].service= *(void**)&debug_sync_C_callback_ptr;
mysql_mutex_lock(&LOCK_plugin);
@@ -1616,7 +1601,7 @@ int plugin_init(int *argc, char **argv, int flags)
{
DBUG_ASSERT(!global_system_variables.table_plugin);
global_system_variables.table_plugin=
- my_intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr));
+ intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr));
DBUG_ASSERT(plugin_ptr->ref_count == 1);
}
}
@@ -1729,9 +1714,6 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
int error;
THD *new_thd= new THD;
bool result;
-#ifdef EMBEDDED_LIBRARY
- No_such_table_error_handler error_handler;
-#endif /* EMBEDDED_LIBRARY */
DBUG_ENTER("plugin_load");
new_thd->thread_stack= (char*) &tables;
@@ -1740,22 +1722,13 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
new_thd->db_length= 5;
bzero((char*) &new_thd->net, sizeof(new_thd->net));
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_READ);
-
-#ifdef EMBEDDED_LIBRARY
- /*
- When building an embedded library, if the mysql.plugin table
- does not exist, we silently ignore the missing table
- */
- new_thd->push_internal_handler(&error_handler);
-#endif /* EMBEDDED_LIBRARY */
+ tables.open_strategy= TABLE_LIST:: IF_EMBEDDED(OPEN_IF_EXISTS, OPEN_NORMAL);
result= open_and_lock_tables(new_thd, &tables, FALSE, MYSQL_LOCK_IGNORE_TIMEOUT);
-#ifdef EMBEDDED_LIBRARY
- new_thd->pop_internal_handler();
- if (error_handler.safely_trapped_errors())
+ table= tables.table;
+ if (IF_EMBEDDED(!table, false))
goto end;
-#endif /* EMBEDDED_LIBRARY */
if (result)
{
@@ -1767,7 +1740,7 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
sql_print_warning("Could not open mysql.plugin table. Some options may be missing from the help text");
goto end;
}
- table= tables.table;
+
if (init_read_record(&read_record_info, new_thd, table, NULL, 1, 0, FALSE))
{
sql_print_error("Could not initialize init_read_record; Plugins not "
@@ -1799,7 +1772,7 @@ static void plugin_load(MEM_ROOT *tmp_root, int *argc, char **argv)
mysql_mutex_unlock(&LOCK_plugin);
}
if (error > 0)
- sql_print_error(ER(ER_GET_ERRNO), my_errno);
+ sql_print_error(ER(ER_GET_ERRNO), my_errno, table->file->table_type());
end_read_record(&read_record_info);
table->m_needs_reopen= TRUE; // Force close to free memory
close_mysql_tables(new_thd);
@@ -2370,14 +2343,88 @@ err:
}
+static bool plugin_dl_foreach_internal(THD *thd, st_plugin_dl *plugin_dl,
+ st_maria_plugin *plug,
+ plugin_foreach_func *func, void *arg)
+{
+ for (; plug->name; plug++)
+ {
+ st_plugin_int tmp, *plugin;
+
+ tmp.name.str= const_cast<char*>(plug->name);
+ tmp.name.length= strlen(plug->name);
+ tmp.plugin= plug;
+ tmp.plugin_dl= plugin_dl;
+
+ mysql_mutex_lock(&LOCK_plugin);
+ if ((plugin= plugin_find_internal(&tmp.name, MYSQL_ANY_PLUGIN)) &&
+ plugin->plugin == plug)
+
+ {
+ tmp.state= plugin->state;
+ tmp.load_option= plugin->load_option;
+ }
+ else
+ {
+ tmp.state= PLUGIN_IS_FREED;
+ tmp.load_option= PLUGIN_OFF;
+ }
+ mysql_mutex_unlock(&LOCK_plugin);
+
+ plugin= &tmp;
+ if (func(thd, plugin_int_to_ref(plugin), arg))
+ return 1;
+ }
+ return 0;
+}
+
+bool plugin_dl_foreach(THD *thd, const LEX_STRING *dl,
+ plugin_foreach_func *func, void *arg)
+{
+ bool err= 0;
+
+ if (dl)
+ {
+ mysql_mutex_lock(&LOCK_plugin);
+ st_plugin_dl *plugin_dl= plugin_dl_add(dl, REPORT_TO_USER);
+ mysql_mutex_unlock(&LOCK_plugin);
+
+ if (!plugin_dl)
+ return 1;
+
+ err= plugin_dl_foreach_internal(thd, plugin_dl, plugin_dl->plugins,
+ func, arg);
+
+ mysql_mutex_lock(&LOCK_plugin);
+ plugin_dl_del(plugin_dl);
+ mysql_mutex_unlock(&LOCK_plugin);
+ }
+ else
+ {
+ struct st_maria_plugin **builtins;
+ for (builtins= mysql_mandatory_plugins; !err && *builtins; builtins++)
+ err= plugin_dl_foreach_internal(thd, 0, *builtins, func, arg);
+ for (builtins= mysql_optional_plugins; !err && *builtins; builtins++)
+ err= plugin_dl_foreach_internal(thd, 0, *builtins, func, arg);
+ }
+ return err;
+}
+
+
/****************************************************************************
Internal type declarations for variables support
****************************************************************************/
#undef MYSQL_SYSVAR_NAME
#define MYSQL_SYSVAR_NAME(name) name
-#define PLUGIN_VAR_TYPEMASK 0x007f
-#define PLUGIN_VAR_BOOKMARK_KEY (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_MEMALLOC)
+#define PLUGIN_VAR_TYPEMASK 0x7f
+#define BOOKMARK_MEMALLOC 0x80
+
+static inline char plugin_var_bookmark_key(uint flags)
+{
+ return (flags & PLUGIN_VAR_TYPEMASK) |
+ (flags & PLUGIN_VAR_MEMALLOC ? BOOKMARK_MEMALLOC : 0);
+}
#define EXTRA_OPTIONS 3 /* options for: 'foo', 'plugin-foo' and NULL */
@@ -2680,7 +2727,7 @@ sys_var *find_sys_var(THD *thd, const char *str, uint length)
{
mysql_rwlock_unlock(&LOCK_system_variables_hash);
LEX *lex= thd ? thd->lex : 0;
- if (!(plugin= my_intern_plugin_lock(lex, plugin_int_to_ref(pi->plugin))))
+ if (!(plugin= intern_plugin_lock(lex, plugin_int_to_ref(pi->plugin))))
var= NULL; /* failed to lock it, it must be uninstalling */
else
if (!(plugin_state(plugin) & PLUGIN_IS_READY))
@@ -2731,7 +2778,7 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name,
else
memcpy(varname + 1, name, namelen + 1);
- varname[0]= flags & PLUGIN_VAR_BOOKMARK_KEY;
+ varname[0]= plugin_var_bookmark_key(flags);
result= (st_bookmark*) my_hash_search(&bookmark_hash,
(const uchar*) varname, length - 1);
@@ -2789,7 +2836,7 @@ static st_bookmark *register_var(const char *plugin, const char *name,
{
result= (st_bookmark*) alloc_root(&plugin_mem_root,
sizeof(struct st_bookmark) + length-1);
- varname[0]= flags & PLUGIN_VAR_BOOKMARK_KEY;
+ varname[0]= plugin_var_bookmark_key(flags);
memcpy(result->key, varname, length);
result->name_len= length - 2;
result->offset= -1;
@@ -2911,7 +2958,7 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock)
if (!(var= intern_find_sys_var(v->key + 1, v->name_len)) ||
!(pi= var->cast_pluginvar()) ||
- v->key[0] != (pi->plugin_var->flags & PLUGIN_VAR_BOOKMARK_KEY))
+ v->key[0] != plugin_var_bookmark_key(pi->plugin_var->flags))
continue;
/* Here we do anything special that may be required of the data types */
@@ -3004,7 +3051,7 @@ void plugin_thdvar_init(THD *thd)
mysql_mutex_lock(&LOCK_plugin);
thd->variables.table_plugin=
- my_intern_plugin_lock(NULL, global_system_variables.table_plugin);
+ intern_plugin_lock(NULL, global_system_variables.table_plugin);
intern_plugin_unlock(NULL, old_table_plugin);
mysql_mutex_unlock(&LOCK_plugin);
DBUG_VOID_RETURN;
@@ -3043,7 +3090,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars)
DBUG_ASSERT((uint)v->offset <= vars->dynamic_variables_head);
if ((v->key[0] & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR &&
- v->key[0] & PLUGIN_VAR_MEMALLOC)
+ v->key[0] & BOOKMARK_MEMALLOC)
{
char **ptr= (char**)(vars->dynamic_variables_ptr + v->offset);
my_free(*ptr);
@@ -3315,8 +3362,8 @@ bool sys_var_pluginvar::global_update(THD *thd, set_var *var)
options->block_size= (long) (opt)->blk_sz
-static void plugin_opt_set_limits(struct my_option *options,
- const struct st_mysql_sys_var *opt)
+void plugin_opt_set_limits(struct my_option *options,
+ const struct st_mysql_sys_var *opt)
{
options->sub_size= 0;
@@ -3416,17 +3463,6 @@ static void plugin_opt_set_limits(struct my_option *options,
options->arg_type= OPT_ARG;
}
-extern "C" my_bool get_one_plugin_option(int optid, const struct my_option *,
- char *);
-
-my_bool get_one_plugin_option(int optid __attribute__((unused)),
- const struct my_option *opt,
- char *argument)
-{
- return 0;
-}
-
-
/**
Creates a set of my_option objects associated with a specified plugin-
handle.
@@ -3906,3 +3942,18 @@ void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root)
}
}
+
+/**
+ Returns a sys_var corresponding to a particular MYSQL_SYSVAR(...)
+*/
+sys_var *find_plugin_sysvar(st_plugin_int *plugin, st_mysql_sys_var *plugin_var)
+{
+ for (sys_var *var= plugin->system_vars; var; var= var->next)
+ {
+ sys_var_pluginvar *pvar=var->cast_pluginvar();
+ if (pvar->plugin_var == plugin_var)
+ return var;
+ }
+ return 0;
+}
+
diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h
index dc713826fe2..906ff20ddb7 100644
--- a/sql/sql_plugin.h
+++ b/sql/sql_plugin.h
@@ -39,6 +39,8 @@ enum enum_plugin_load_option { PLUGIN_OFF, PLUGIN_ON, PLUGIN_FORCE,
PLUGIN_FORCE_PLUS_PERMANENT };
extern const char *global_plugin_typelib_names[];
+extern ulong dlopen_count;
+
#include <my_sys.h>
#include "sql_list.h"
@@ -151,9 +153,7 @@ extern void plugin_shutdown(void);
void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root);
extern bool plugin_is_ready(const LEX_STRING *name, int type);
#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C)
-#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C)
#define my_plugin_lock(A,B) plugin_lock(A,B)
-#define my_plugin_lock_ci(A,B) plugin_lock(A,B)
extern plugin_ref plugin_lock(THD *thd, plugin_ref ptr);
extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name,
int type);
@@ -166,6 +166,8 @@ extern bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
extern bool plugin_register_builtin(struct st_mysql_plugin *plugin);
extern void plugin_thdvar_init(THD *thd);
extern void plugin_thdvar_cleanup(THD *thd);
+sys_var *find_plugin_sysvar(st_plugin_int *plugin, st_mysql_sys_var *var);
+void plugin_opt_set_limits(struct my_option *, const struct st_mysql_sys_var *);
extern SHOW_COMP_OPTION plugin_status(const char *name, size_t len, int type);
extern bool check_valid_path(const char *path, size_t length);
@@ -175,4 +177,6 @@ typedef my_bool (plugin_foreach_func)(THD *thd,
#define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D)
extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
int type, uint state_mask, void *arg);
+extern bool plugin_dl_foreach(THD *thd, const LEX_STRING *dl,
+ plugin_foreach_func *func, void *arg);
#endif
diff --git a/sql/sql_plugin_compat.h b/sql/sql_plugin_compat.h
new file mode 100644
index 00000000000..8c6014f8dc6
--- /dev/null
+++ b/sql/sql_plugin_compat.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 2013 Sergei Golubchik and Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/* old plugin api structures, used for backward compatibility */
+
+#define upgrade_var(X) latest->X= X
+#define upgrade_str(X) strmake(latest->X, X, sizeof(X))
+#define downgrade_var(X) X= latest->X
+#define downgrade_str(X) strmake(X, latest->X, sizeof(X)-1)
+
+/**************************************************************/
+/* Authentication API, version 0x0100 *************************/
+#define MIN_AUTHENTICATION_INTERFACE_VERSION 0x0100
+
+struct MYSQL_SERVER_AUTH_INFO_0x0100 {
+ char *user_name;
+ unsigned int user_name_length;
+ const char *auth_string;
+ unsigned long auth_string_length;
+ char authenticated_as[49];
+ char external_user[512];
+ int password_used;
+ const char *host_or_ip;
+ unsigned int host_or_ip_length;
+
+ void upgrade(MYSQL_SERVER_AUTH_INFO *latest)
+ {
+ upgrade_var(user_name);
+ upgrade_var(user_name_length);
+ upgrade_var(auth_string);
+ upgrade_var(auth_string_length);
+ upgrade_str(authenticated_as);
+ upgrade_str(external_user);
+ upgrade_var(password_used);
+ upgrade_var(host_or_ip);
+ upgrade_var(host_or_ip_length);
+ }
+ void downgrade(MYSQL_SERVER_AUTH_INFO *latest)
+ {
+ downgrade_var(user_name);
+ downgrade_var(user_name_length);
+ downgrade_var(auth_string);
+ downgrade_var(auth_string_length);
+ downgrade_str(authenticated_as);
+ downgrade_str(external_user);
+ downgrade_var(password_used);
+ downgrade_var(host_or_ip);
+ downgrade_var(host_or_ip_length);
+ }
+};
+
+/**************************************************************/
+
diff --git a/sql/sql_plugin_services.h b/sql/sql_plugin_services.h
index e3ef338eaad..d2f60a6e08c 100644
--- a/sql/sql_plugin_services.h
+++ b/sql/sql_plugin_services.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2013, Monty Program Ab
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
@@ -41,11 +42,6 @@ static struct thd_wait_service_st thd_wait_handler= {
thd_wait_end
};
-static struct my_thread_scheduler_service my_thread_scheduler_handler= {
- my_thread_scheduler_set,
- my_thread_scheduler_reset,
-};
-
static struct progress_report_service_st progress_report_handler= {
thd_progress_init,
thd_progress_report,
@@ -63,7 +59,6 @@ static struct st_service_ref list_of_services[]=
{ "my_snprintf_service", VERSION_my_snprintf, &my_snprintf_handler },
{ "thd_alloc_service", VERSION_thd_alloc, &thd_alloc_handler },
{ "thd_wait_service", VERSION_thd_wait, &thd_wait_handler },
- { "my_thread_scheduler_service", VERSION_my_thread_scheduler, &my_thread_scheduler_handler },
{ "progress_report_service", VERSION_progress_report, &progress_report_handler },
{ "debug_sync_service", VERSION_debug_sync, 0 }, // updated in plugin_init()
{ "thd_kill_statement_service", VERSION_kill_statement, &thd_kill_statement_handler }
diff --git a/sql/sql_priv.h b/sql/sql_priv.h
index 345556a0b7f..7ff13bf06c3 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010-2011 Monty Program Ab
+ Copyright (c) 2010, 2013, Monty Program Ab.
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
@@ -143,15 +143,15 @@
however, needs to rollback the effects of the
succeeded statement to keep replication consistent.
*/
-#define OPTION_MASTER_SQL_ERROR (1ULL << 35)
+#define OPTION_MASTER_SQL_ERROR (1ULL << 35)
/*
Dont report errors for individual rows,
But just report error on commit (or read ofcourse)
Note! Reserved for use in MySQL Cluster
*/
-#define OPTION_ALLOW_BATCH (ULL(1) << 36) // THD, intern (slave)
-#define OPTION_SKIP_REPLICATION (ULL(1) << 37) // THD, user
+#define OPTION_ALLOW_BATCH (1ULL << 36) // THD, intern (slave)
+#define OPTION_SKIP_REPLICATION (1ULL << 37) // THD, user
/*
Check how many bytes are available on buffer.
@@ -227,7 +227,7 @@ template <class T> bool valid_buffer_range(T jump,
#define OPTIMIZER_SWITCH_OPTIMIZE_JOIN_BUFFER_SIZE (1ULL << 25)
#define OPTIMIZER_SWITCH_TABLE_ELIMINATION (1ULL << 26)
#define OPTIMIZER_SWITCH_EXTENDED_KEYS (1ULL << 27)
-#define OPTIMIZER_SWITCH_LAST (1ULL << 27)
+#define OPTIMIZER_SWITCH_EXISTS_TO_IN (1ULL << 28)
#define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \
OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \
diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 2720dc7cd74..e9c9dc86e41 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -205,6 +205,7 @@ bool reload_acl_and_cache(THD *thd, unsigned long options,
DBUG_ASSERT(!thd || thd->locked_tables_mode ||
!thd->mdl_context.has_locks() ||
thd->handler_tables_hash.records ||
+ thd->ull_hash.records ||
thd->global_read_lock.is_acquired());
/*
diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc
index c91623cee6e..c957076ac4f 100644
--- a/sql/sql_rename.cc
+++ b/sql/sql_rename.cc
@@ -29,10 +29,12 @@
#include "sql_base.h" // tdc_remove_table, lock_table_names,
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sql_statistics.h"
-#include "datadict.h"
static TABLE_LIST *rename_tables(THD *thd, TABLE_LIST *table_list,
bool skip_error);
+static bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
+ char *new_table_name, char *new_table_alias,
+ bool skip_error);
static TABLE_LIST *reverse_table_list(TABLE_LIST *table_list);
@@ -145,10 +147,6 @@ bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent)
MYSQL_OPEN_SKIP_TEMPORARY))
goto err;
- for (ren_table= table_list; ren_table; ren_table= ren_table->next_local)
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, ren_table->db,
- ren_table->table_name, FALSE);
-
error=0;
/*
An exclusive lock on table names is satisfactory to ensure
@@ -236,16 +234,14 @@ static TABLE_LIST *reverse_table_list(TABLE_LIST *table_list)
true rename failed
*/
-bool
+static bool
do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
char *new_table_alias, bool skip_error)
{
int rc= 1;
- char new_name[FN_REFLEN + 1], old_name[FN_REFLEN + 1];
+ handlerton *hton;
+ bool new_exists, old_exists;
const char *new_alias, *old_alias;
- frm_type_enum frm_type;
- enum legacy_db_type table_type;
-
DBUG_ENTER("do_rename");
if (lower_case_table_names == 2)
@@ -260,53 +256,52 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
}
DBUG_ASSERT(new_alias);
- build_table_filename(new_name, sizeof(new_name) - 1,
- new_db, new_alias, reg_ext, 0);
- build_table_filename(old_name, sizeof(old_name) - 1,
- ren_table->db, old_alias, reg_ext, 0);
- if (check_table_file_presence(old_name,
- new_name, new_db, new_alias, new_alias, TRUE))
+ new_exists= ha_table_exists(thd, new_db, new_alias);
+
+ if (new_exists)
{
- DBUG_RETURN(1); // This can't be skipped
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
+ DBUG_RETURN(1); // This can't be skipped
}
- frm_type= dd_frm_type(thd, old_name, &table_type);
- switch (frm_type)
+ old_exists= ha_table_exists(thd, ren_table->db, old_alias, &hton);
+
+ if (old_exists)
{
- case FRMTYPE_TABLE:
+ DBUG_ASSERT(!thd->locked_tables_mode);
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL,
+ ren_table->db, ren_table->table_name, false);
+
+ if (hton != view_pseudo_hton)
+ {
+ if (!(rc= mysql_rename_table(hton, ren_table->db, old_alias,
+ new_db, new_alias, 0)))
{
- if (!(rc= mysql_rename_table(ha_resolve_by_legacy_type(thd,
- table_type),
- ren_table->db, old_alias,
- new_db, new_alias, 0)))
+ LEX_STRING db_name= { ren_table->db, ren_table->db_length };
+ LEX_STRING table_name= { ren_table->table_name,
+ ren_table->table_name_length };
+ LEX_STRING new_table= { (char *) new_alias, strlen(new_alias) };
+ (void) rename_table_in_stat_tables(thd, &db_name, &table_name,
+ &db_name, &new_table);
+ if ((rc= Table_triggers_list::change_table_name(thd, ren_table->db,
+ old_alias,
+ ren_table->table_name,
+ new_db,
+ new_alias)))
{
- LEX_STRING db_name= { ren_table->db, ren_table->db_length };
- LEX_STRING table_name= { ren_table->table_name,
- ren_table->table_name_length };
- LEX_STRING new_table= { (char *) new_alias, strlen(new_alias) };
- (void) rename_table_in_stat_tables(thd, &db_name, &table_name,
- &db_name, &new_table);
- if ((rc= Table_triggers_list::change_table_name(thd, ren_table->db,
- old_alias,
- ren_table->table_name,
- new_db,
- new_alias)))
- {
- /*
- We've succeeded in renaming table's .frm and in updating
- corresponding handler data, but have failed to update table's
- triggers appropriately. So let us revert operations on .frm
- and handler's data and report about failure to rename table.
- */
- (void) mysql_rename_table(ha_resolve_by_legacy_type(thd,
- table_type),
- new_db, new_alias,
- ren_table->db, old_alias, 0);
- }
+ /*
+ We've succeeded in renaming table's .frm and in updating
+ corresponding handler data, but have failed to update table's
+ triggers appropriately. So let us revert operations on .frm
+ and handler's data and report about failure to rename table.
+ */
+ (void) mysql_rename_table(hton, new_db, new_alias,
+ ren_table->db, old_alias, 0);
}
}
- break;
- case FRMTYPE_VIEW:
+ }
+ else
+ {
/*
change of schema is not allowed
except of ALTER ...UPGRADE DATA DIRECTORY NAME command
@@ -314,22 +309,19 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
*/
if (thd->lex->sql_command != SQLCOM_ALTER_DB_UPGRADE &&
strcmp(ren_table->db, new_db))
- my_error(ER_FORBID_SCHEMA_CHANGE, MYF(0), ren_table->db,
- new_db);
+ my_error(ER_FORBID_SCHEMA_CHANGE, MYF(0), ren_table->db, new_db);
else
rc= mysql_rename_view(thd, new_db, new_alias, ren_table);
- break;
- default:
- DBUG_ASSERT(0); // should never happen
- case FRMTYPE_ERROR:
- my_error(ER_FILE_NOT_FOUND, MYF(0), old_name, my_errno);
- break;
+ }
+ }
+ else
+ {
+ my_error(ER_NO_SUCH_TABLE, MYF(0), ren_table->db, old_alias);
}
if (rc && !skip_error)
DBUG_RETURN(1);
DBUG_RETURN(0);
-
}
/*
Rename all tables in list; Return pointer to wrong entry if something goes
diff --git a/sql/sql_rename.h b/sql/sql_rename.h
index 039a3b8b4a1..aaf09a8d030 100644
--- a/sql/sql_rename.h
+++ b/sql/sql_rename.h
@@ -20,8 +20,5 @@ class THD;
struct TABLE_LIST;
bool mysql_rename_tables(THD *thd, TABLE_LIST *table_list, bool silent);
-bool do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db,
- char *new_table_name, char *new_table_alias,
- bool skip_error);
#endif /* SQL_RENAME_INCLUDED */
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 917f4ea1a80..0bae99c2a27 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+ Copyright (c) 2008, 2013, Monty Program Ab
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
@@ -716,7 +716,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
*p_start_coord= &start_coord;
LOG_POS_COORD coord_buf= { log_file_name, BIN_LOG_HEADER_SIZE },
*p_coord= &coord_buf;
- if (heartbeat_period != LL(0))
+ if (heartbeat_period != 0)
{
heartbeat_ts= &heartbeat_buf;
set_timespec_nsec(*heartbeat_ts, 0);
@@ -966,6 +966,7 @@ impossible position";
event_type=
(Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
+#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("dump_thread_wait_before_send_xid",
{
if (event_type == XID_EVENT)
@@ -984,6 +985,7 @@ impossible position";
STRING_WITH_LEN(act2)));
}
});
+#endif
if (event_type == FORMAT_DESCRIPTION_EVENT)
{
current_checksum_alg= get_checksum_alg(packet->ptr() + ev_offset,
@@ -1348,6 +1350,8 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
if (thd->lex->mi.pos)
{
+ if (thd->lex->mi.relay_log_pos)
+ slave_errno=ER_BAD_SLAVE_UNTIL_COND;
mi->rli.until_condition= Relay_log_info::UNTIL_MASTER_POS;
mi->rli.until_log_pos= thd->lex->mi.pos;
/*
@@ -1359,6 +1363,8 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
}
else if (thd->lex->mi.relay_log_pos)
{
+ if (thd->lex->mi.pos)
+ slave_errno=ER_BAD_SLAVE_UNTIL_COND;
mi->rli.until_condition= Relay_log_info::UNTIL_RELAY_POS;
mi->rli.until_log_pos= thd->lex->mi.relay_log_pos;
strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name,
@@ -1820,7 +1826,7 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
else
mi->heartbeat_period= (float) min(SLAVE_MAX_HEARTBEAT_PERIOD,
(slave_net_timeout/2.0));
- mi->received_heartbeats= LL(0); // counter lives until master is CHANGEd
+ mi->received_heartbeats= 0; // counter lives until master is CHANGEd
/*
reset the last time server_id list if the current CHANGE MASTER
is mentioning IGNORE_SERVER_IDS= (...)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 27b93cff189..fa82a55a8c7 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2012 Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2013 Oracle and/or its affiliates.
Copyright (c) 2009, 2013 Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -128,9 +128,10 @@ static int return_zero_rows(JOIN *join, select_result *res,
List<Item> &fields, bool send_row,
ulonglong select_options, const char *info,
Item *having, List<Item> &all_fields);
-static COND *build_equal_items(THD *thd, COND *cond,
+static COND *build_equal_items(JOIN *join, COND *cond,
COND_EQUAL *inherited,
List<TABLE_LIST> *join_list,
+ bool ignore_on_conds,
COND_EQUAL **cond_equal_ref);
static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
COND *cond,
@@ -146,7 +147,8 @@ static uint build_bitmap_for_nested_joins(List<TABLE_LIST> *join_list,
static COND *optimize_cond(JOIN *join, COND *conds,
List<TABLE_LIST> *join_list,
- Item::cond_result *cond_value,
+ bool ignore_on_conds,
+ Item::cond_result *cond_value,
COND_EQUAL **cond_equal);
bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
static int do_select(JOIN *join,List<Item> *fields,TABLE *tmp_table,
@@ -597,28 +599,37 @@ inline int setup_without_group(THD *thd, Item **ref_pointer_array,
List<Item> &all_fields,
COND **conds,
ORDER *order,
- ORDER *group, bool *hidden_group_fields)
+ ORDER *group,
+ bool *hidden_group_fields,
+ uint *reserved)
{
int res;
- nesting_map save_allow_sum_func=thd->lex->allow_sum_func ;
+ st_select_lex *const select= thd->lex->current_select;
+ nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
/*
Need to save the value, so we can turn off only any new non_agg_field_used
additions coming from the WHERE
*/
- const bool saved_non_agg_field_used=
- thd->lex->current_select->non_agg_field_used();
+ const bool saved_non_agg_field_used= select->non_agg_field_used();
DBUG_ENTER("setup_without_group");
- thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
+ thd->lex->allow_sum_func&= ~((nesting_map)1 << select->nest_level);
res= setup_conds(thd, tables, leaves, conds);
+ if (thd->lex->current_select->first_cond_optimization)
+ {
+ if (!res && *conds)
+ (*reserved)= (*conds)->exists2in_reserved_items();
+ else
+ (*reserved)= 0;
+ }
/* it's not wrong to have non-aggregated columns in a WHERE */
- thd->lex->current_select->set_non_agg_field_used(saved_non_agg_field_used);
+ select->set_non_agg_field_used(saved_non_agg_field_used);
- thd->lex->allow_sum_func|= 1 << thd->lex->current_select->nest_level;
+ thd->lex->allow_sum_func|= (nesting_map)1 << select->nest_level;
res= res || setup_order(thd, ref_pointer_array, tables, fields, all_fields,
order);
- thd->lex->allow_sum_func&= ~(1 << thd->lex->current_select->nest_level);
+ thd->lex->allow_sum_func&= ~((nesting_map)1 << select->nest_level);
res= res || setup_group(thd, ref_pointer_array, tables, fields, all_fields,
group, hidden_group_fields);
thd->lex->allow_sum_func= save_allow_sum_func;
@@ -758,7 +769,7 @@ JOIN::prepare(Item ***rref_pointer_array,
setup_without_group(thd, (*rref_pointer_array), tables_list,
select_lex->leaf_tables, fields_list,
all_fields, &conds, order, group_list,
- &hidden_group_fields))
+ &hidden_group_fields, &select_lex->select_n_reserved))
DBUG_RETURN(-1); /* purecov: inspected */
ref_pointer_array= *rref_pointer_array;
@@ -767,7 +778,7 @@ JOIN::prepare(Item ***rref_pointer_array,
{
nesting_map save_allow_sum_func= thd->lex->allow_sum_func;
thd->where="having clause";
- thd->lex->allow_sum_func|= 1 << select_lex_arg->nest_level;
+ thd->lex->allow_sum_func|= (nesting_map)1 << select_lex_arg->nest_level;
select_lex->having_fix_field= 1;
/*
Wrap alone field in HAVING clause in case it will be outer field of subquery
@@ -1038,6 +1049,23 @@ JOIN::optimize_inner()
table_count= select_lex->leaf_tables.elements;
select_lex->update_used_tables();
}
+ /*
+ In fact we transform underlying subqueries after their 'prepare' phase and
+ before 'optimize' from upper query 'optimize' to allow semijoin
+ conversion happened (which done in the same way.
+ */
+ if(select_lex->first_cond_optimization &&
+ conds && conds->walk(&Item::exists2in_processor, 0, (uchar *)thd))
+ DBUG_RETURN(1);
+ /*
+TODO: make view to decide if it is possible to write to WHERE directly or make Semi-Joins able to process ON condition if it is possible
+ for (TABLE_LIST *tbl= tables_list; tbl; tbl= tbl->next_local)
+ {
+ if (tbl->on_expr &&
+ tbl->on_expr->walk(&Item::exists2in_processor, 0, (uchar *)thd))
+ DBUG_RETURN(1);
+ }
+ */
if (transform_max_min_subquery())
DBUG_RETURN(1); /* purecov: inspected */
@@ -1124,7 +1152,8 @@ JOIN::optimize_inner()
if (setup_jtbm_semi_joins(this, join_list, &conds))
DBUG_RETURN(1);
- conds= optimize_cond(this, conds, join_list, &cond_value, &cond_equal);
+ conds= optimize_cond(this, conds, join_list, FALSE,
+ &cond_value, &cond_equal);
if (thd->is_error())
{
@@ -1134,7 +1163,9 @@ JOIN::optimize_inner()
}
{
- having= optimize_cond(this, having, join_list, &having_value, &having_equal);
+ having= optimize_cond(this, having, join_list, TRUE,
+ &having_value, &having_equal);
+
if (thd->is_error())
{
error= 1;
@@ -2140,8 +2171,7 @@ JOIN::reinit()
DBUG_ENTER("JOIN::reinit");
unit->offset_limit_cnt= (ha_rows)(select_lex->offset_limit ?
- select_lex->offset_limit->val_uint() :
- ULL(0));
+ select_lex->offset_limit->val_uint() : 0);
first_record= 0;
cleaned= false;
@@ -2281,6 +2311,7 @@ void JOIN::exec_inner()
{
List<Item> *columns_list= &fields_list;
int tmp_error;
+
DBUG_ENTER("JOIN::exec");
const bool has_group_by= this->group;
@@ -3813,6 +3844,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
DBUG_RETURN(TRUE);
join->join_tab=stat;
+ join->top_join_tab_count= table_count;
join->map2table=stat_ref;
join->table= table_vector;
join->const_tables=const_count;
@@ -3860,6 +3892,8 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (join->choose_subquery_plan(all_table_map & ~join->const_table_map))
goto error;
+ DEBUG_SYNC(join->thd, "inside_make_join_statistics");
+
/* Generate an execution plan from the found optimal join order. */
DBUG_RETURN(join->thd->check_killed() || get_best_combination(join));
@@ -4153,7 +4187,7 @@ add_key_field(JOIN *join,
!(field->table->pos_in_table_list->is_materialized_derived() &&
field->table->created)) ||
(field->table->pos_in_table_list->is_materialized_derived() &&
- !field->table->created)))
+ !field->table->created && !(field->flags & BLOB_FLAG))))
{
optimize= KEY_OPTIMIZE_EQ;
}
@@ -5130,6 +5164,7 @@ static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
}
+
/**
Check for the presence of AGGFN(DISTINCT a) queries that may be subject
to loose index scan.
@@ -5456,6 +5491,8 @@ best_access_path(JOIN *join,
2. we won't get two ref-or-null's
*/
if (!(remaining_tables & keyuse->used_tables) &&
+ s->access_from_tables_is_allowed(keyuse->used_tables,
+ join->sjm_lookup_tables) &&
!(ref_or_null_part && (keyuse->optimize &
KEY_OPTIMIZE_REF_OR_NULL)))
{
@@ -5576,7 +5613,8 @@ best_access_path(JOIN *join,
in ReuseRangeEstimateForRef-3.
*/
if (table->quick_keys.is_set(key) &&
- (const_part & ((1 << table->quick_key_parts[key])-1)) ==
+ (const_part &
+ (((key_part_map)1 << table->quick_key_parts[key])-1)) ==
(((key_part_map)1 << table->quick_key_parts[key])-1) &&
table->quick_n_ranges[key] == 1 &&
records > (double) table->quick_rows[key])
@@ -5740,7 +5778,8 @@ best_access_path(JOIN *join,
*/
if (table->quick_keys.is_set(key) &&
table->quick_key_parts[key] <= max_key_part &&
- const_part & (1 << table->quick_key_parts[key]) &&
+ const_part &
+ ((key_part_map)1 << table->quick_key_parts[key]) &&
table->quick_n_ranges[key] == 1 + test(ref_or_null_part &
const_part) &&
records > (double) table->quick_rows[key])
@@ -6000,6 +6039,7 @@ static void choose_initial_table_order(JOIN *join)
TABLE_LIST *emb_subq;
JOIN_TAB **tab= join->best_ref + join->const_tables;
JOIN_TAB **tabs_end= tab + join->table_count - join->const_tables;
+ DBUG_ENTER("choose_initial_table_order");
/* Find where the top-level JOIN_TABs end and subquery JOIN_TABs start */
for (; tab != tabs_end; tab++)
{
@@ -6009,7 +6049,7 @@ static void choose_initial_table_order(JOIN *join)
uint n_subquery_tabs= tabs_end - tab;
if (!n_subquery_tabs)
- return;
+ DBUG_VOID_RETURN;
/* Copy the subquery JOIN_TABs to a separate array */
JOIN_TAB *subquery_tabs[MAX_TABLES];
@@ -6064,6 +6104,7 @@ static void choose_initial_table_order(JOIN *join)
subq_tab += n_subquery_tables - 1;
}
}
+ DBUG_VOID_RETURN;
}
@@ -7993,7 +8034,9 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
*/
do
{
- if (!(~used_tables & keyuse->used_tables))
+ if (!(~used_tables & keyuse->used_tables) &&
+ j->access_from_tables_is_allowed(keyuse->used_tables,
+ join->sjm_lookup_tables))
{
if (are_tables_local(j, keyuse->val->used_tables()))
{
@@ -8062,7 +8105,9 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
uint i;
for (i=0 ; i < keyparts ; keyuse++,i++)
{
- while (((~used_tables) & keyuse->used_tables) ||
+ while (((~used_tables) & keyuse->used_tables) ||
+ !j->access_from_tables_is_allowed(keyuse->used_tables,
+ join->sjm_lookup_tables) ||
keyuse->keypart == NO_KEYPART ||
(keyuse->keypart !=
(is_hash_join_key_no(key) ?
@@ -8074,7 +8119,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
j->ref.items[i]=keyuse->val; // Save for cond removal
j->ref.cond_guards[i]= keyuse->cond_guard;
if (keyuse->null_rejecting)
- j->ref.null_rejecting |= 1 << i;
+ j->ref.null_rejecting|= (key_part_map)1 << i;
keyuse_uses_no_tables= keyuse_uses_no_tables && !keyuse->used_tables;
/*
Todo: we should remove this check for thd->lex->describe on the next
@@ -8121,20 +8166,17 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
ulong key_flags= j->table->actual_key_flags(keyinfo);
if (j->type == JT_CONST)
j->table->const_table= 1;
- else if (((key_flags & (HA_NOSAME | HA_NULL_PART_KEY))!= HA_NOSAME) ||
- keyparts != j->table->actual_n_key_parts(keyinfo) ||
- null_ref_key)
- {
- if (test(key_flags & HA_EXT_NOSAME) && keyparts == keyinfo->ext_key_parts &&
- !null_ref_key)
- j->type= JT_EQ_REF;
- else
- {
- /* Must read with repeat */
- j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF;
- j->ref.null_ref_key= null_ref_key;
- j->ref.null_ref_part= null_ref_part;
- }
+ else if (!((keyparts == keyinfo->key_parts &&
+ ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) ||
+ (keyparts > keyinfo->key_parts && // true only for extended keys
+ test(key_flags & HA_EXT_NOSAME) &&
+ keyparts == keyinfo->ext_key_parts)) ||
+ null_ref_key)
+ {
+ /* Must read with repeat */
+ j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF;
+ j->ref.null_ref_key= null_ref_key;
+ j->ref.null_ref_part= null_ref_part;
}
else if (keyuse_uses_no_tables)
{
@@ -8285,9 +8327,9 @@ inline void add_cond_and_fix(THD *thd, Item **e1, Item *e2)
Item *res;
if ((res= new Item_cond_and(*e1, e2)))
{
- *e1= res;
res->fix_fields(thd, 0);
res->update_used_tables();
+ *e1= res;
}
}
else
@@ -8359,7 +8401,7 @@ static void add_not_null_conds(JOIN *join)
{
for (uint keypart= 0; keypart < tab->ref.key_parts; keypart++)
{
- if (tab->ref.null_rejecting & (1 << keypart))
+ if (tab->ref.null_rejecting & ((key_part_map)1 << keypart))
{
Item *item= tab->ref.items[keypart];
Item *notnull;
@@ -10543,11 +10585,14 @@ bool JOIN_TAB::preread_init()
dbug_serve_apcs(join->thd, 1);
);
+ /* init ftfuns for just initialized derived table */
+ if (table->fulltext_searched)
+ init_ftfuncs(join->thd, join->select_lex, test(join->order));
+
return FALSE;
}
-
/**
Build a TABLE_REF structure for index lookup in the temporary table
@@ -11800,7 +11845,9 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
item_equal->n_field_items());
}
- ((Item_cond_and*)cond)->cond_equal= cond_equal;
+ ((Item_cond_and*)cond)->cond_equal.copy(cond_equal);
+ cond_equal.current_level=
+ ((Item_cond_and*)cond)->cond_equal.current_level;
inherited= &(((Item_cond_and*)cond)->cond_equal);
}
/*
@@ -11855,6 +11902,7 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
item_equal->update_used_tables();
set_if_bigger(thd->lex->current_select->max_equal_elems,
item_equal->n_field_items());
+ item_equal->upper_levels= inherited;
return item_equal;
}
@@ -11877,7 +11925,8 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
set_if_bigger(thd->lex->current_select->max_equal_elems,
item_equal->n_field_items());
}
- and_cond->cond_equal= cond_equal;
+ and_cond->cond_equal.copy(cond_equal);
+ cond_equal.current_level= and_cond->cond_equal.current_level;
args->concat((List<Item> *)&cond_equal.current_level);
return and_cond;
@@ -11959,6 +12008,8 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
@param inherited path to all inherited multiple equality items
@param join_list list of join tables to which the condition
refers to
+ @ignore_on_conds TRUE <-> do not build multiple equalities
+ for on expressions
@param[out] cond_equal_ref pointer to the structure to place built
equalities in
@@ -11966,10 +12017,13 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
pointer to the transformed condition containing multiple equalities
*/
-static COND *build_equal_items(THD *thd, COND *cond, COND_EQUAL *inherited,
+static COND *build_equal_items(JOIN *join, COND *cond,
+ COND_EQUAL *inherited,
List<TABLE_LIST> *join_list,
+ bool ignore_on_conds,
COND_EQUAL **cond_equal_ref)
{
+ THD *thd= join->thd;
COND_EQUAL *cond_equal= 0;
if (cond)
@@ -11994,7 +12048,7 @@ static COND *build_equal_items(THD *thd, COND *cond, COND_EQUAL *inherited,
}
*cond_equal_ref= cond_equal;
- if (join_list)
+ if (join_list && !ignore_on_conds)
{
TABLE_LIST *table;
List_iterator<TABLE_LIST> li(*join_list);
@@ -12009,8 +12063,8 @@ static COND *build_equal_items(THD *thd, COND *cond, COND_EQUAL *inherited,
We can modify table->on_expr because its old value will
be restored before re-execution of PS/SP.
*/
- table->on_expr= build_equal_items(thd, table->on_expr, inherited,
- nested_join_list,
+ table->on_expr= build_equal_items(join, table->on_expr, inherited,
+ nested_join_list, ignore_on_conds,
&table->cond_equal);
}
}
@@ -12207,11 +12261,16 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
Item *item_const= item_equal->get_const();
Item_equal_fields_iterator it(*item_equal);
Item *head;
- DBUG_ASSERT(!cond || cond->type() == Item::COND_ITEM);
-
TABLE_LIST *current_sjm= NULL;
Item *current_sjm_head= NULL;
+ DBUG_ASSERT(!cond ||
+ cond->type() == Item::INT_ITEM ||
+ (cond->type() == Item::FUNC_ITEM &&
+ ((Item_func *) cond)->functype() == Item_func::EQ_FUNC) ||
+ (cond->type() == Item::COND_ITEM &&
+ ((Item_func *) cond)->functype() == Item_func::COND_AND_FUNC));
+
/*
Pick the "head" item: the constant one or the first in the join order
(if the first in the join order happends to be inside an SJM nest, that's
@@ -12286,8 +12345,8 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
if (produce_equality)
{
- if (eq_item)
- eq_list.push_back(eq_item);
+ if (eq_item && eq_list.push_back(eq_item))
+ return 0;
/*
If we're inside an SJM-nest (current_sjm!=NULL), and the multi-equality
@@ -12311,31 +12370,61 @@ Item *eliminate_item_equal(COND *cond, COND_EQUAL *upper_levels,
current_sjm= field_sjm;
}
- if (!cond)
+ /*
+ We have produced zero, one, or more pair-wise equalities eq_i. We want to
+ return an expression in form:
+
+ cond AND eq_1 AND eq_2 AND eq_3 AND ...
+
+ 'cond' is a parameter for this function, which may be NULL, an Item_int(1),
+ or an Item_func_eq or an Item_cond_and.
+
+ We want to return a well-formed condition: no nested Item_cond_and objects,
+ or Item_cond_and with a single child:
+ - if 'cond' is an Item_cond_and, we add eq_i as its tail
+ - if 'cond' is Item_int(1), we return eq_i
+ - otherwise, we create our own Item_cond_and and put 'cond' at the front of
+ it.
+ - if we have only one condition to return, we don't create an Item_cond_and
+ */
+
+ if (eq_item && eq_list.push_back(eq_item))
+ return 0;
+ COND *res= 0;
+ switch (eq_list.elements)
+ {
+ case 0:
+ res= cond ? cond : new Item_int((longlong) 1, 1);
+ break;
+ case 1:
+ if (!cond || cond->type() == Item::INT_ITEM)
+ res= eq_item;
+ break;
+ default:
+ break;
+ }
+ if (!res)
{
- if (eq_list.is_empty())
+ if (cond)
{
- if (eq_item)
- return eq_item;
- return new Item_int((longlong) 1, 1);
+ if (cond->type() == Item::COND_ITEM)
+ {
+ res= cond;
+ ((Item_cond *) res)->add_at_end(&eq_list);
+ }
+ else if (eq_list.push_front(cond))
+ return 0;
}
- /* eq_item is always set if list is not empty */
- DBUG_ASSERT(eq_item);
- eq_list.push_back(eq_item);
- if (!(cond= new Item_cond_and(eq_list)))
- return 0; // Error
- }
- else
+ }
+ if (!res)
+ res= new Item_cond_and(eq_list);
+ if (res)
{
- if (eq_item)
- eq_list.push_back(eq_item);
- if (!eq_list.is_empty())
- ((Item_cond *) cond)->add_at_head(&eq_list);
+ res->quick_fix_field();
+ res->update_used_tables();
}
- cond->quick_fix_field();
- cond->update_used_tables();
-
- return cond;
+
+ return res;
}
@@ -12438,31 +12527,68 @@ static COND* substitute_for_best_equal_field(JOIN_TAB *context_tab,
if (and_level)
{
+ COND *eq_cond= 0;
List_iterator_fast<Item_equal> it(cond_equal->current_level);
+ bool false_eq_cond= FALSE;
while ((item_equal= it++))
{
- cond= eliminate_item_equal(cond, cond_equal->upper_levels, item_equal);
- // This occurs when eliminate_item_equal() founds that cond is
- // always false and substitutes it with Item_int 0.
- // Due to this, value of item_equal will be 0, so just return it.
- if (!cond)
- return org_cond; // Error
- if (cond->type() != Item::COND_ITEM)
+ eq_cond= eliminate_item_equal(eq_cond, cond_equal->upper_levels,
+ item_equal);
+ if (!eq_cond)
+ {
+ eq_cond= 0;
+ break;
+ }
+ else if (eq_cond->type() == Item::INT_ITEM && !eq_cond->val_bool())
+ {
+ /*
+ This occurs when eliminate_item_equal() founds that cond is
+ always false and substitutes it with Item_int 0.
+ Due to this, value of item_equal will be 0, so just return it.
+ */
+ cond= eq_cond;
+ false_eq_cond= TRUE;
break;
+ }
}
- }
- if (cond->type() == Item::COND_ITEM &&
- !((Item_cond*)cond)->argument_list()->elements)
- cond= new Item_int((int32)cond->val_bool());
-
+ if (eq_cond && !false_eq_cond)
+ {
+ /* Insert the generated equalities before all other conditions */
+ if (eq_cond->type() == Item::COND_ITEM)
+ ((Item_cond *) cond)->add_at_head(
+ ((Item_cond *) eq_cond)->argument_list());
+ else
+ {
+ if (cond_list->is_empty())
+ cond= eq_cond;
+ else
+ {
+ /* Do not add an equality condition if it's always true */
+ if (eq_cond->type() != Item::INT_ITEM &&
+ cond_list->push_front(eq_cond))
+ eq_cond= 0;
+ }
+ }
+ }
+ if (!eq_cond)
+ {
+ /*
+ We are out of memory doing the transformation.
+ This is a fatal error now. However we bail out by returning the
+ original condition that we had before we started the transformation.
+ */
+ cond_list->concat((List<Item> *) &cond_equal->current_level);
+ }
+ }
}
else if (cond->type() == Item::FUNC_ITEM &&
((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
{
item_equal= (Item_equal *) cond;
item_equal->sort(&compare_fields_by_table_order, table_join_idx);
+ cond_equal= item_equal->upper_levels;
if (cond_equal && cond_equal->current_level.head() == item_equal)
- cond_equal= 0;
+ cond_equal= cond_equal->upper_levels;
cond= eliminate_item_equal(0, cond_equal, item_equal);
return cond ? cond : org_cond;
}
@@ -12913,9 +13039,6 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
table->prep_on_expr= table->on_expr= 0;
}
}
-
- if (!top)
- continue;
/*
Only inner tables of non-convertible outer joins
@@ -13421,7 +13544,8 @@ void optimize_wo_join_buffering(JOIN *join, uint first_tab, uint last_tab,
static COND *
-optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list,
+optimize_cond(JOIN *join, COND *conds,
+ List<TABLE_LIST> *join_list, bool ignore_on_conds,
Item::cond_result *cond_value, COND_EQUAL **cond_equal)
{
THD *thd= join->thd;
@@ -13430,7 +13554,9 @@ optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list,
if (!conds)
{
*cond_value= Item::COND_TRUE;
- build_equal_items(join->thd, NULL, NULL, join_list, cond_equal);
+ if (!ignore_on_conds)
+ build_equal_items(join, NULL, NULL, join_list, ignore_on_conds,
+ cond_equal);
}
else
{
@@ -13443,7 +13569,8 @@ optimize_cond(JOIN *join, COND *conds, List<TABLE_LIST> *join_list,
multiple equality contains a constant.
*/
DBUG_EXECUTE("where", print_where(conds, "original", QT_ORDINARY););
- conds= build_equal_items(join->thd, conds, NULL, join_list, cond_equal);
+ conds= build_equal_items(join, conds, NULL, join_list, ignore_on_conds,
+ cond_equal);
DBUG_EXECUTE("where",print_where(conds,"after equal_items", QT_ORDINARY););
/* change field = field to field = const for each found field = const */
@@ -13499,7 +13626,61 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
li.remove();
else if (item != new_item)
{
- (void) li.replace(new_item);
+ if (and_level)
+ {
+ /*
+ Take a special care of multiple equality predicates
+ that may be part of 'cond' and 'new_item'.
+ Those multiple equalities that have common members
+ must be merged.
+ */
+ Item_cond_and *cond_and= (Item_cond_and *) cond;
+ List<Item_equal> *cond_equal_items=
+ &cond_and->cond_equal.current_level;
+ List<Item> *cond_and_list= cond_and->argument_list();
+
+ if (new_item->type() == Item::COND_ITEM &&
+ ((Item_cond*) new_item)->functype() == Item_func::COND_AND_FUNC)
+ {
+ Item_cond_and *new_item_and= (Item_cond_and *) new_item;
+ List<Item_equal> *new_item_equal_items=
+ &new_item_and->cond_equal.current_level;
+ List<Item> *new_item_and_list= new_item_and->argument_list();
+ cond_and_list->disjoin((List<Item>*) cond_equal_items);
+ new_item_and_list->disjoin((List<Item>*) new_item_equal_items);
+ Item_equal *equal_item;
+ List_iterator<Item_equal> it(*new_item_equal_items);
+ while ((equal_item= it++))
+ {
+ equal_item->merge_into_list(cond_equal_items);
+ }
+ if (new_item_and_list->is_empty())
+ li.remove();
+ else
+ li.replace(*new_item_and_list);
+ cond_and_list->concat((List<Item>*) cond_equal_items);
+ }
+ else if (new_item->type() == Item::FUNC_ITEM &&
+ ((Item_cond*) new_item)->functype() ==
+ Item_func::MULT_EQUAL_FUNC)
+ {
+ cond_and_list->disjoin((List<Item>*) cond_equal_items);
+ ((Item_equal *) new_item)->merge_into_list(cond_equal_items);
+ li.remove();
+ cond_and_list->concat((List<Item>*) cond_equal_items);
+ }
+ else
+ li.replace(new_item);
+ }
+ else
+ {
+ if (new_item->type() == Item::COND_ITEM &&
+ ((Item_cond*) new_item)->functype() ==
+ ((Item_cond*) cond)->functype())
+ li.replace(*((Item_cond*) new_item)->argument_list());
+ else
+ li.replace(new_item);
+ }
should_fix_fields=1;
}
if (*cond_value == Item::COND_UNDEF)
@@ -14078,6 +14259,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
}
case Item::FIELD_ITEM:
case Item::DEFAULT_VALUE_ITEM:
+ case Item::INSERT_VALUE_ITEM:
{
Item_field *field= (Item_field*) item;
bool orig_modify= modify_item;
@@ -14756,11 +14938,11 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
}
else
{
- recinfo->null_bit= 1 << (null_count & 7);
+ recinfo->null_bit= (uint8)1 << (null_count & 7);
recinfo->null_pos= null_count/8;
}
field->move_field(pos,null_flags+null_count/8,
- 1 << (null_count & 7));
+ (uint8)1 << (null_count & 7));
null_count++;
}
else
@@ -15214,7 +15396,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
{
cur_field->move_field(field_pos, (uchar*) null_pos, null_bit);
null_bit<<= 1;
- if (null_bit == (1 << 8))
+ if (null_bit == (uint)1 << 8)
{
++null_pos;
null_bit= 1;
@@ -16335,7 +16517,9 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
DBUG_ENTER("evaluate_join_record");
DBUG_PRINT("enter",
("evaluate_join_record join: %p join_tab: %p"
- " cond: %p error: %d", join, join_tab, select_cond, error));
+ " cond: %p error: %d alias %s",
+ join, join_tab, select_cond, error,
+ join_tab->table->alias.ptr()));
if (error > 0 || (join->thd->is_error())) // Fatal error
DBUG_RETURN(NESTED_LOOP_ERROR);
if (error < 0)
@@ -16448,6 +16632,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
if (join_tab->check_weed_out_table && found)
{
int res= join_tab->check_weed_out_table->sj_weedout_check_row(join->thd);
+ DBUG_PRINT("info", ("weedout_check: %d", res));
if (res == -1)
DBUG_RETURN(NESTED_LOOP_ERROR);
else if (res == 1)
@@ -16468,8 +16653,8 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
(See above join->return_tab= tab).
*/
join->examined_rows++;
- DBUG_PRINT("counts", ("join->examined_rows++: %lu",
- (ulong) join->examined_rows));
+ DBUG_PRINT("counts", ("join->examined_rows++: %lu found: %d",
+ (ulong) join->examined_rows, (int) found));
if (found)
{
@@ -19237,7 +19422,6 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
*(join->pre_sort_join_tab)= *tab;
-
tab->select=NULL;
tab->set_select_cond(NULL, __LINE__);
tab->type=JT_ALL; // Read with normal read_record
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 54aca3c4829..c748a4f5101 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1,8 +1,8 @@
#ifndef SQL_SELECT_INCLUDED
#define SQL_SELECT_INCLUDED
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2013, Monty Program Ab.
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
@@ -514,6 +514,16 @@ typedef struct st_join_table {
bool preread_init();
bool is_sjm_nest() { return test(bush_children); }
+
+ bool access_from_tables_is_allowed(table_map used_tables,
+ table_map sjm_lookup_tables)
+ {
+ table_map used_sjm_lookup_tables= used_tables & sjm_lookup_tables;
+ return !used_sjm_lookup_tables ||
+ (emb_sj_nest &&
+ !(used_sjm_lookup_tables & ~emb_sj_nest->sj_inner_tables));
+ }
+
} JOIN_TAB;
@@ -964,6 +974,11 @@ public:
bool hash_join;
bool do_send_rows;
table_map const_table_map;
+ /**
+ Bitmap of semijoin tables that the current partial plan decided
+ to materialize and access by lookups
+ */
+ table_map sjm_lookup_tables;
/*
Constant tables for which we have found a row (as opposed to those for
which we didn't).
@@ -1295,8 +1310,9 @@ public:
outer_ref_cond= pseudo_bits_cond= NULL;
in_to_exists_where= NULL;
in_to_exists_having= NULL;
-
pre_sort_join_tab= NULL;
+ emb_sjm_nest= NULL;
+ sjm_lookup_tables= 0;
}
int prepare(Item ***rref_pointer_array, TABLE_LIST *tables, uint wind_num,
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 1f860fe23db..84da93a2131 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009, 2012, Monty Program Ab
+ Copyright (c) 2009, 2013, Monty Program Ab
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
@@ -57,11 +57,8 @@
#include <my_dir.h>
#include "lock.h" // MYSQL_OPEN_IGNORE_FLUSH
#include "debug_sync.h"
-#include "datadict.h" // dd_frm_type()
#include "keycaches.h"
-#define STR_OR_NIL(S) ((S) ? (S) : "<nil>")
-
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
#endif
@@ -122,6 +119,14 @@ append_algorithm(TABLE_LIST *table, String *buff);
static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table);
+typedef struct st_lookup_field_values
+{
+ LEX_STRING db_value, table_value;
+ bool wild_db_value, wild_table_value;
+} LOOKUP_FIELD_VALUES;
+
+bool get_lookup_field_values(THD *, COND *, TABLE_LIST *, LOOKUP_FIELD_VALUES *);
+
/***************************************************************************
** List all table types supported
***************************************************************************/
@@ -160,7 +165,6 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin,
cs);
switch (plugin_state(plugin)) {
- /* case PLUGIN_IS_FREED: does not happen */
case PLUGIN_IS_DELETED:
table->field[2]->store(STRING_WITH_LEN("DELETED"), cs);
break;
@@ -173,6 +177,9 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin,
case PLUGIN_IS_DISABLED:
table->field[2]->store(STRING_WITH_LEN("DISABLED"), cs);
break;
+ case PLUGIN_IS_FREED: // filtered in fill_plugins, used in fill_all_plugins
+ table->field[2]->store(STRING_WITH_LEN("NOT INSTALLED"), cs);
+ break;
default:
DBUG_ASSERT(0);
}
@@ -270,6 +277,65 @@ int fill_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
}
+int fill_all_plugins(THD *thd, TABLE_LIST *tables, COND *cond)
+{
+ DBUG_ENTER("fill_all_plugins");
+ TABLE *table= tables->table;
+ LOOKUP_FIELD_VALUES lookup;
+
+ if (get_lookup_field_values(thd, cond, tables, &lookup))
+ DBUG_RETURN(0);
+
+ if (lookup.db_value.str && !lookup.db_value.str[0])
+ DBUG_RETURN(0); // empty string never matches a valid SONAME
+
+ MY_DIR *dirp= my_dir(opt_plugin_dir, MY_THREAD_SPECIFIC);
+ if (!dirp)
+ {
+ my_error(ER_CANT_READ_DIR, MYF(0), opt_plugin_dir, my_errno);
+ DBUG_RETURN(1);
+ }
+
+ if (!lookup.db_value.str)
+ plugin_dl_foreach(thd, 0, show_plugins, table);
+
+ const char *wstr= lookup.db_value.str, *wend= wstr + lookup.db_value.length;
+ for (uint i=0; i < (uint) dirp->number_of_files; i++)
+ {
+ FILEINFO *file= dirp->dir_entry+i;
+ LEX_STRING dl= { file->name, strlen(file->name) };
+ const char *dlend= dl.str + dl.length;
+ const size_t so_ext_len= sizeof(SO_EXT) - 1;
+
+ if (strcasecmp(dlend - so_ext_len, SO_EXT))
+ continue;
+
+ if (lookup.db_value.str)
+ {
+ if (lookup.wild_db_value)
+ {
+ if (my_wildcmp(files_charset_info, dl.str, dlend, wstr, wend,
+ wild_prefix, wild_one, wild_many))
+ continue;
+ }
+ else
+ {
+ if (my_strnncoll(files_charset_info,
+ (uchar*)dl.str, dl.length,
+ (uchar*)lookup.db_value.str, lookup.db_value.length))
+ continue;
+ }
+ }
+
+ plugin_dl_foreach(thd, &dl, show_plugins, table);
+ thd->clear_error();
+ }
+
+ my_dirend(dirp);
+ DBUG_RETURN(0);
+}
+
+
/***************************************************************************
** List all Authors.
** If you can update it, you get to be in it :)
@@ -689,6 +755,11 @@ db_name_is_in_ignore_db_dirs_list(const char *directory)
return my_hash_search(&ignore_db_dirs_hash, (uchar *) buff, buff_len)!=NULL;
}
+enum find_files_result {
+ FIND_FILES_OK,
+ FIND_FILES_OOM,
+ FIND_FILES_DIR
+};
/*
find_files() - find files in a given directory.
@@ -697,11 +768,10 @@ db_name_is_in_ignore_db_dirs_list(const char *directory)
find_files()
thd thread handler
files put found files in this list
- db database name to set in TABLE_LIST structure
+ db database name to search tables in
+ or NULL to search for databases
path path to database
wild filter for found files
- dir read databases in path if TRUE, read .frm files in
- database otherwise
RETURN
FIND_FILES_OK success
@@ -710,65 +780,40 @@ db_name_is_in_ignore_db_dirs_list(const char *directory)
*/
-find_files_result
-find_files(THD *thd, List<LEX_STRING> *files, const char *db,
- const char *path, const char *wild, bool dir)
+static find_files_result
+find_files(THD *thd, Dynamic_array<LEX_STRING*> *files, LEX_STRING *db,
+ const char *path, const LEX_STRING *wild)
{
- uint i;
- char *ext;
MY_DIR *dirp;
- FILEINFO *file;
- LEX_STRING *file_name= 0;
- uint file_name_len;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- uint col_access=thd->col_access;
-#endif
- uint wild_length= 0;
- TABLE_LIST table_list;
+ Discovered_table_list tl(thd, files, wild);
DBUG_ENTER("find_files");
- if (wild)
- {
- if (!wild[0])
- wild= 0;
- else
- wild_length= strlen(wild);
- }
-
- bzero((char*) &table_list,sizeof(table_list));
-
- if (!(dirp = my_dir(path,MYF((dir ? MY_WANT_STAT : 0) |
- MY_THREAD_SPECIFIC))))
+ if (!(dirp = my_dir(path, MY_THREAD_SPECIFIC | (db ? 0 : MY_WANT_STAT))))
{
if (my_errno == ENOENT)
- my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db);
+ my_error(ER_BAD_DB_ERROR, MYF(ME_BELL | ME_WAITTANG), db->str);
else
- my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno);
+ my_error(ER_CANT_READ_DIR, MYF(ME_BELL | ME_WAITTANG), path, my_errno);
DBUG_RETURN(FIND_FILES_DIR);
}
- for (i=0 ; i < (uint) dirp->number_off_files ; i++)
+ if (!db) /* Return databases */
{
- char uname[SAFE_NAME_LEN + 1]; /* Unencoded name */
- file=dirp->dir_entry+i;
- if (dir)
- { /* Return databases */
- if ((file->name[0] == '.' &&
- ((file->name[1] == '.' && file->name[2] == '\0') ||
- file->name[1] == '\0')))
- continue; /* . or .. */
+ for (uint i=0; i < (uint) dirp->number_of_files; i++)
+ {
+ FILEINFO *file= dirp->dir_entry+i;
#ifdef USE_SYMDIR
char *ext;
char buff[FN_REFLEN];
if (my_use_symdir && !strcmp(ext=fn_ext(file->name), ".sym"))
{
- /* Only show the sym file if it points to a directory */
- char *end;
+ /* Only show the sym file if it points to a directory */
+ char *end;
*ext=0; /* Remove extension */
- unpack_dirname(buff, file->name);
- end= strend(buff);
- if (end != buff && end[-1] == FN_LIBCHAR)
- end[-1]= 0; // Remove end FN_LIBCHAR
+ unpack_dirname(buff, file->name);
+ end= strend(buff);
+ if (end != buff && end[-1] == FN_LIBCHAR)
+ end[-1]= 0; // Remove end FN_LIBCHAR
if (!mysql_file_stat(key_file_misc, buff, file->mystat, MYF(0)))
continue;
}
@@ -779,70 +824,25 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db,
if (is_in_ignore_db_dirs_list(file->name))
continue;
- file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
- if (wild)
- {
- if (lower_case_table_names)
- {
- if (my_wildcmp(files_charset_info,
- uname, uname + file_name_len,
- wild, wild + wild_length,
- wild_prefix, wild_one, wild_many))
- continue;
- }
- else if (wild_compare(uname, wild, 0))
- continue;
- }
- }
- else
- {
- // Return only .frm files which aren't temp files.
- if (my_strcasecmp(system_charset_info, ext=fn_rext(file->name),reg_ext) ||
- is_prefix(file->name, tmp_file_prefix))
- continue;
- *ext=0;
- file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
- if (wild)
- {
- if (lower_case_table_names)
- {
- if (my_wildcmp(files_charset_info,
- uname, uname + file_name_len,
- wild, wild + wild_length,
- wild_prefix, wild_one,wild_many))
- continue;
- }
- else if (wild_compare(uname, wild, 0))
- continue;
- }
- }
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- /* Don't show tables where we don't have any privileges */
- if (db && !(col_access & TABLE_ACLS))
- {
- table_list.db= (char*) db;
- table_list.db_length= strlen(db);
- table_list.table_name= uname;
- table_list.table_name_length= file_name_len;
- table_list.grant.privilege=col_access;
- if (check_grant(thd, TABLE_ACLS, &table_list, TRUE, 1, TRUE))
- continue;
- }
-#endif
- if (!(file_name=
- thd->make_lex_string(file_name, uname, file_name_len, TRUE)) ||
- files->push_back(file_name))
- {
- my_dirend(dirp);
- DBUG_RETURN(FIND_FILES_OOM);
+ if (tl.add_file(file->name))
+ goto err;
}
+ tl.sort();
+ }
+ else
+ {
+ if (ha_discover_table_names(thd, db, dirp, &tl))
+ goto err;
}
- DBUG_PRINT("info",("found: %d files", files->elements));
- my_dirend(dirp);
- (void) ha_find_files(thd, db, path, wild, dir, files);
+ DBUG_PRINT("info",("found: %zu files", files->elements()));
+ my_dirend(dirp);
DBUG_RETURN(FIND_FILES_OK);
+
+err:
+ my_dirend(dirp);
+ DBUG_RETURN(FIND_FILES_OOM);
}
@@ -2626,7 +2626,7 @@ static bool status_vars_inited= 0;
C_MODE_START
static int show_var_cmp(const void *var1, const void *var2)
{
- return strcmp(((SHOW_VAR*)var1)->name, ((SHOW_VAR*)var2)->name);
+ return strcasecmp(((SHOW_VAR*)var1)->name, ((SHOW_VAR*)var2)->name);
}
C_MODE_END
@@ -2831,6 +2831,17 @@ static bool show_status_array(THD *thd, const char *wild,
name_buffer[sizeof(name_buffer)-1]=0; /* Safety */
if (ucase_names)
my_caseup_str(system_charset_info, name_buffer);
+ else
+ {
+ my_casedn_str(system_charset_info, name_buffer);
+ DBUG_ASSERT(name_buffer[0] >= 'a');
+ DBUG_ASSERT(name_buffer[0] <= 'z');
+
+ /* traditionally status variables have a first letter uppercased */
+ if (status_var)
+ name_buffer[0]-= 'a' - 'A';
+ }
+
restore_record(table, s->default_values);
table->field[0]->store(name_buffer, strlen(name_buffer),
@@ -3152,8 +3163,8 @@ int fill_schema_user_stats(THD* thd, TABLE_LIST* tables, COND* cond)
int result;
DBUG_ENTER("fill_schema_user_stats");
- if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
- DBUG_RETURN(1);
+ if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true))
+ DBUG_RETURN(0);
/*
Iterates through all the global stats and sends them to the client.
@@ -3187,8 +3198,8 @@ int fill_schema_client_stats(THD* thd, TABLE_LIST* tables, COND* cond)
int result;
DBUG_ENTER("fill_schema_client_stats");
- if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
- DBUG_RETURN(1);
+ if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true))
+ DBUG_RETURN(0);
/*
Iterates through all the global stats and sends them to the client.
@@ -3329,13 +3340,6 @@ void calc_sum_of_all_status(STATUS_VAR *to)
/* This is only used internally, but we need it here as a forward reference */
extern ST_SCHEMA_TABLE schema_tables[];
-typedef struct st_lookup_field_values
-{
- LEX_STRING db_value, table_value;
- bool wild_db_value, wild_table_value;
-} LOOKUP_FIELD_VALUES;
-
-
/*
Store record to I_S table, convert HEAP table
to MyISAM if necessary
@@ -3443,8 +3447,8 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
(uchar *) item_field->field_name,
strlen(item_field->field_name), 0))
{
- thd->make_lex_string(&lookup_field_vals->db_value, tmp_str->ptr(),
- tmp_str->length(), FALSE);
+ thd->make_lex_string(&lookup_field_vals->db_value,
+ tmp_str->ptr(), tmp_str->length());
}
/* Lookup value is table name */
else if (!cs->coll->strnncollsp(cs, (uchar *) field_name2,
@@ -3452,8 +3456,8 @@ bool get_lookup_value(THD *thd, Item_func *item_func,
(uchar *) item_field->field_name,
strlen(item_field->field_name), 0))
{
- thd->make_lex_string(&lookup_field_vals->table_value, tmp_str->ptr(),
- tmp_str->length(), FALSE);
+ thd->make_lex_string(&lookup_field_vals->table_value,
+ tmp_str->ptr(), tmp_str->length());
}
}
return 0;
@@ -3630,7 +3634,7 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
LOOKUP_FIELD_VALUES *lookup_field_values)
{
LEX *lex= thd->lex;
- const char *wild= lex->wild ? lex->wild->ptr() : NullS;
+ String *wild= lex->wild;
bool rc= 0;
bzero((char*) lookup_field_values, sizeof(LOOKUP_FIELD_VALUES));
@@ -3638,8 +3642,8 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
case SQLCOM_SHOW_DATABASES:
if (wild)
{
- thd->make_lex_string(&lookup_field_values->db_value,
- wild, strlen(wild), 0);
+ thd->make_lex_string(&lookup_field_values->db_value,
+ wild->ptr(), wild->length());
lookup_field_values->wild_db_value= 1;
}
break;
@@ -3648,14 +3652,25 @@ bool get_lookup_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
case SQLCOM_SHOW_TRIGGERS:
case SQLCOM_SHOW_EVENTS:
thd->make_lex_string(&lookup_field_values->db_value,
- lex->select_lex.db, strlen(lex->select_lex.db), 0);
+ lex->select_lex.db, strlen(lex->select_lex.db));
if (wild)
{
thd->make_lex_string(&lookup_field_values->table_value,
- wild, strlen(wild), 0);
+ wild->ptr(), wild->length());
lookup_field_values->wild_table_value= 1;
}
break;
+ case SQLCOM_SHOW_PLUGINS:
+ if (lex->ident.str)
+ thd->make_lex_string(&lookup_field_values->db_value,
+ lex->ident.str, lex->ident.length);
+ else if (lex->wild)
+ {
+ thd->make_lex_string(&lookup_field_values->db_value,
+ lex->wild->ptr(), lex->wild->length());
+ lookup_field_values->wild_db_value= 1;
+ }
+ break;
default:
/*
The "default" is for queries over I_S.
@@ -3698,23 +3713,15 @@ enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
wild wild string
idx_field_vals idx_field_vals->db_name contains db name or
wild string
- with_i_schema returns 1 if we added 'IS' name to list
- otherwise returns 0
RETURN
zero success
non-zero error
*/
-int make_db_list(THD *thd, List<LEX_STRING> *files,
- LOOKUP_FIELD_VALUES *lookup_field_vals,
- bool *with_i_schema)
+int make_db_list(THD *thd, Dynamic_array<LEX_STRING*> *files,
+ LOOKUP_FIELD_VALUES *lookup_field_vals)
{
- LEX_STRING *i_s_name_copy= 0;
- i_s_name_copy= thd->make_lex_string(i_s_name_copy,
- INFORMATION_SCHEMA_NAME.str,
- INFORMATION_SCHEMA_NAME.length, TRUE);
- *with_i_schema= 0;
if (lookup_field_vals->wild_db_value)
{
/*
@@ -3727,12 +3734,11 @@ int make_db_list(THD *thd, List<LEX_STRING> *files,
INFORMATION_SCHEMA_NAME.str,
lookup_field_vals->db_value.str))
{
- *with_i_schema= 1;
- if (files->push_back(i_s_name_copy))
+ if (files->append_val(&INFORMATION_SCHEMA_NAME))
return 1;
}
- return (find_files(thd, files, NullS, mysql_data_home,
- lookup_field_vals->db_value.str, 1) != FIND_FILES_OK);
+ return find_files(thd, files, 0, mysql_data_home,
+ &lookup_field_vals->db_value);
}
@@ -3748,12 +3754,11 @@ int make_db_list(THD *thd, List<LEX_STRING> *files,
if (is_infoschema_db(lookup_field_vals->db_value.str,
lookup_field_vals->db_value.length))
{
- *with_i_schema= 1;
- if (files->push_back(i_s_name_copy))
+ if (files->append_val(&INFORMATION_SCHEMA_NAME))
return 1;
return 0;
}
- if (files->push_back(&lookup_field_vals->db_value))
+ if (files->append_val(&lookup_field_vals->db_value))
return 1;
return 0;
}
@@ -3762,17 +3767,15 @@ int make_db_list(THD *thd, List<LEX_STRING> *files,
Create list of existing databases. It is used in case
of select from information schema table
*/
- if (files->push_back(i_s_name_copy))
+ if (files->append_val(&INFORMATION_SCHEMA_NAME))
return 1;
- *with_i_schema= 1;
- return (find_files(thd, files, NullS,
- mysql_data_home, NullS, 1) != FIND_FILES_OK);
+ return find_files(thd, files, 0, mysql_data_home, &null_lex_str);
}
struct st_add_schema_table
{
- List<LEX_STRING> *files;
+ Dynamic_array<LEX_STRING*> *files;
const char *wild;
};
@@ -3782,7 +3785,7 @@ static my_bool add_schema_table(THD *thd, plugin_ref plugin,
{
LEX_STRING *file_name= 0;
st_add_schema_table *data= (st_add_schema_table *)p_data;
- List<LEX_STRING> *file_list= data->files;
+ Dynamic_array<LEX_STRING*> *file_list= data->files;
const char *wild= data->wild;
ST_SCHEMA_TABLE *schema_table= plugin_data(plugin, ST_SCHEMA_TABLE *);
DBUG_ENTER("add_schema_table");
@@ -3802,16 +3805,16 @@ static my_bool add_schema_table(THD *thd, plugin_ref plugin,
DBUG_RETURN(0);
}
- if ((file_name= thd->make_lex_string(file_name, schema_table->table_name,
- strlen(schema_table->table_name),
- TRUE)) &&
- !file_list->push_back(file_name))
+ if ((file_name= thd->make_lex_string(schema_table->table_name,
+ strlen(schema_table->table_name))) &&
+ !file_list->append(file_name))
DBUG_RETURN(0);
DBUG_RETURN(1);
}
-int schema_tables_add(THD *thd, List<LEX_STRING> *files, const char *wild)
+int schema_tables_add(THD *thd, Dynamic_array<LEX_STRING*> *files,
+ const char *wild)
{
LEX_STRING *file_name= 0;
ST_SCHEMA_TABLE *tmp_schema_table= schema_tables;
@@ -3835,9 +3838,9 @@ int schema_tables_add(THD *thd, List<LEX_STRING> *files, const char *wild)
continue;
}
if ((file_name=
- thd->make_lex_string(file_name, tmp_schema_table->table_name,
- strlen(tmp_schema_table->table_name), TRUE)) &&
- !files->push_back(file_name))
+ thd->make_lex_string(tmp_schema_table->table_name,
+ strlen(tmp_schema_table->table_name))) &&
+ !files->append(file_name))
continue;
DBUG_RETURN(1);
}
@@ -3862,7 +3865,6 @@ int schema_tables_add(THD *thd, List<LEX_STRING> *files, const char *wild)
@param[in] table_names List of table names in database
@param[in] lex pointer to LEX struct
@param[in] lookup_field_vals pointer to LOOKUP_FIELD_VALUE struct
- @param[in] with_i_schema TRUE means that we add I_S tables to list
@param[in] db_name database name
@return Operation status
@@ -3872,40 +3874,32 @@ int schema_tables_add(THD *thd, List<LEX_STRING> *files, const char *wild)
*/
static int
-make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
- LOOKUP_FIELD_VALUES *lookup_field_vals,
- bool with_i_schema, LEX_STRING *db_name)
+make_table_name_list(THD *thd, Dynamic_array<LEX_STRING*> *table_names,
+ LEX *lex, LOOKUP_FIELD_VALUES *lookup_field_vals,
+ LEX_STRING *db_name)
{
char path[FN_REFLEN + 1];
build_table_filename(path, sizeof(path) - 1, db_name->str, "", "", 0);
if (!lookup_field_vals->wild_table_value &&
lookup_field_vals->table_value.str)
{
- if (with_i_schema)
+ if (db_name == &INFORMATION_SCHEMA_NAME)
{
LEX_STRING *name;
ST_SCHEMA_TABLE *schema_table=
find_schema_table(thd, lookup_field_vals->table_value.str);
if (schema_table && !schema_table->hidden)
{
- if (!(name=
- thd->make_lex_string(NULL, schema_table->table_name,
- strlen(schema_table->table_name), TRUE)) ||
- table_names->push_back(name))
+ if (!(name= thd->make_lex_string(schema_table->table_name,
+ strlen(schema_table->table_name))) ||
+ table_names->append(name))
return 1;
}
}
else
{
- if (table_names->push_back(&lookup_field_vals->table_value))
+ if (table_names->append_val(&lookup_field_vals->table_value))
return 1;
- /*
- Check that table is relevant in current transaction.
- (used for ndb engine, see ndbcluster_find_files(), ha_ndbcluster.cc)
- */
- (void) ha_find_files(thd, db_name->str, path,
- lookup_field_vals->table_value.str, 0,
- table_names);
}
return 0;
}
@@ -3914,12 +3908,12 @@ make_table_name_list(THD *thd, List<LEX_STRING> *table_names, LEX *lex,
This call will add all matching the wildcards (if specified) IS tables
to the list
*/
- if (with_i_schema)
+ if (db_name == &INFORMATION_SCHEMA_NAME)
return (schema_tables_add(thd, table_names,
lookup_field_vals->table_value.str));
- find_files_result res= find_files(thd, table_names, db_name->str, path,
- lookup_field_vals->table_value.str, 0);
+ find_files_result res= find_files(thd, table_names, db_name, path,
+ &lookup_field_vals->table_value);
if (res != FIND_FILES_OK)
{
/*
@@ -4015,10 +4009,10 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
These copies are used for make_table_list() while unaltered values
are passed to process_table() functions.
*/
- if (!thd->make_lex_string(&db_name, orig_db_name->str,
- orig_db_name->length, FALSE) ||
- !thd->make_lex_string(&table_name, orig_table_name->str,
- orig_table_name->length, FALSE))
+ if (!thd->make_lex_string(&db_name,
+ orig_db_name->str, orig_db_name->length) ||
+ !thd->make_lex_string(&table_name,
+ orig_table_name->str, orig_table_name->length))
goto end;
/*
@@ -4085,12 +4079,14 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
of backward compatibility.
*/
if (!is_show_fields_or_keys && result && thd->is_error() &&
- thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+ (thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE ||
+ thd->stmt_da->sql_errno() == ER_WRONG_OBJECT))
{
/*
Hide error for a non-existing table.
For example, this error can occur when we use a where condition
- with a db name and table, but the table does not exist.
+ with a db name and table, but the table does not exist or
+ there is a view with the same name.
*/
result= false;
thd->clear_error();
@@ -4142,7 +4138,6 @@ end:
@param[in] table TABLE struct for I_S table
@param[in] db_name database name
@param[in] table_name table name
- @param[in] with_i_schema I_S table if TRUE
@return Operation status
@retval 0 success
@@ -4150,37 +4145,28 @@ end:
*/
static int fill_schema_table_names(THD *thd, TABLE_LIST *tables,
- LEX_STRING *db_name, LEX_STRING *table_name,
- bool with_i_schema)
+ LEX_STRING *db_name, LEX_STRING *table_name)
{
TABLE *table= tables->table;
- if (with_i_schema)
+ if (db_name == &INFORMATION_SCHEMA_NAME)
{
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
system_charset_info);
}
else if (tables->table_open_method != SKIP_OPEN_TABLE)
{
- 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);
+ CHARSET_INFO *cs= system_charset_info;
+ handlerton *hton;
+ if (ha_table_exists(thd, db_name->str, table_name->str, &hton))
+ {
+ if (hton == view_pseudo_hton)
+ table->field[3]->store(STRING_WITH_LEN("VIEW"), cs);
+ else
+ table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs);
}
+ else
+ table->field[3]->store(STRING_WITH_LEN("ERROR"), cs);
+
if (thd->is_error() && thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
{
thd->clear_error();
@@ -4335,10 +4321,6 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
TABLE tbl;
TABLE_LIST table_list;
uint res= 0;
- int not_used;
- my_hash_value_type hash_value;
- char key[MAX_DBKEY_LENGTH];
- uint key_length;
char db_name_buff[NAME_LEN + 1], table_name_buff[NAME_LEN + 1];
bzero((char*) &table_list, sizeof(TABLE_LIST));
@@ -4410,15 +4392,12 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
goto end;
}
- key_length= create_table_def_key(thd, key, &table_list, 0);
- hash_value= my_calc_hash(&table_def_cache, (uchar*) key, key_length);
- mysql_mutex_lock(&LOCK_open);
- share= get_table_share(thd, &table_list, key,
- key_length, OPEN_VIEW, &not_used, hash_value);
+ share= get_table_share(thd, table_list.db, table_list.table_name,
+ GTS_TABLE | GTS_VIEW);
if (!share)
{
res= 0;
- goto end_unlock;
+ goto end;
}
if (share->is_view)
@@ -4438,10 +4417,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
res= 1;
goto end_share;
}
- }
- if (share->is_view)
- {
if (open_new_frm(thd, share, table_name->str,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
HA_GET_INDEX | HA_TRY_READ_ONLY),
@@ -4467,10 +4443,10 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables,
free_root(&tbl.mem_root, MYF(0));
}
+
end_share:
+ mysql_mutex_lock(&LOCK_open);
release_table_share(share);
-
-end_unlock:
mysql_mutex_unlock(&LOCK_open);
end:
@@ -4560,14 +4536,12 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
{
LEX *lex= thd->lex;
TABLE *table= tables->table;
+ TABLE_LIST table_acl_check;
SELECT_LEX *lsel= tables->schema_select_lex;
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
LOOKUP_FIELD_VALUES lookup_field_vals;
- LEX_STRING *db_name, *table_name;
- bool with_i_schema;
enum enum_schema_tables schema_table_idx;
- List<LEX_STRING> db_names;
- List_iterator_fast<LEX_STRING> it(db_names);
+ Dynamic_array<LEX_STRING*> db_names;
COND *partial_cond= 0;
int error= 1;
Open_tables_backup open_tables_state_backup;
@@ -4630,9 +4604,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
goto err;
}
- DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
- STR_OR_NIL(lookup_field_vals.db_value.str),
- STR_OR_NIL(lookup_field_vals.table_value.str)));
+ DBUG_PRINT("info",("db_name='%s', table_name='%s'",
+ lookup_field_vals.db_value.str,
+ lookup_field_vals.table_value.str));
if (!lookup_field_vals.wild_db_value && !lookup_field_vals.wild_table_value)
{
@@ -4669,11 +4643,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
goto err;
}
- if (make_db_list(thd, &db_names, &lookup_field_vals, &with_i_schema))
+ bzero((char*) &table_acl_check, sizeof(table_acl_check));
+
+ if (make_db_list(thd, &db_names, &lookup_field_vals))
goto err;
- it.rewind(); /* To get access to new elements in basis list */
- while ((db_name= it++))
+ for (size_t i=0; i < db_names.elements(); i++)
{
+ LEX_STRING *db_name= db_names.at(i);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!(check_access(thd, SELECT_ACL, db_name->str,
&thd->col_access, NULL, 0, 1) ||
@@ -4682,18 +4658,30 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, 0))
#endif
{
- List<LEX_STRING> table_names;
+ Dynamic_array<LEX_STRING*> table_names;
int res= make_table_name_list(thd, &table_names, lex,
- &lookup_field_vals,
- with_i_schema, db_name);
+ &lookup_field_vals, db_name);
if (res == 2) /* Not fatal error, continue */
continue;
if (res)
goto err;
- List_iterator_fast<LEX_STRING> it_files(table_names);
- while ((table_name= it_files++))
+ for (size_t i=0; i < table_names.elements(); i++)
{
+ LEX_STRING *table_name= table_names.at(i);
+
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (!(thd->col_access & TABLE_ACLS))
+ {
+ table_acl_check.db= db_name->str;
+ table_acl_check.db_length= db_name->length;
+ table_acl_check.table_name= table_name->str;
+ table_acl_check.table_name_length= table_name->length;
+ table_acl_check.grant.privilege= thd->col_access;
+ if (check_grant(thd, TABLE_ACLS, &table_acl_check, TRUE, 1, TRUE))
+ continue;
+ }
+#endif
restore_record(table, s->default_values);
table->field[schema_table->idx_field1]->
store(db_name->str, db_name->length, system_charset_info);
@@ -4721,14 +4709,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
/* SHOW TABLE NAMES command */
if (schema_table_idx == SCH_TABLE_NAMES)
{
- if (fill_schema_table_names(thd, tables, db_name,
- table_name, with_i_schema))
+ if (fill_schema_table_names(thd, tables, db_name, table_name))
continue;
}
else
{
if (!(table_open_method & ~OPEN_FRM_ONLY) &&
- !with_i_schema)
+ db_name != &INFORMATION_SCHEMA_NAME)
{
/*
Here we need to filter out warnings, which can happen
@@ -4762,11 +4749,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
}
}
}
- /*
- If we have information schema its always the first table and only
- the first table. Reset for other tables.
- */
- with_i_schema= 0;
}
}
@@ -4798,9 +4780,7 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
*/
LOOKUP_FIELD_VALUES lookup_field_vals;
- List<LEX_STRING> db_names;
- LEX_STRING *db_name;
- bool with_i_schema;
+ Dynamic_array<LEX_STRING*> db_names;
HA_CREATE_INFO create;
TABLE *table= tables->table;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -4813,15 +4793,14 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_PRINT("INDEX VALUES",("db_name: %s table_name: %s",
lookup_field_vals.db_value.str,
lookup_field_vals.table_value.str));
- if (make_db_list(thd, &db_names, &lookup_field_vals,
- &with_i_schema))
+ if (make_db_list(thd, &db_names, &lookup_field_vals))
DBUG_RETURN(1);
/*
If we have lookup db value we should check that the database exists
*/
if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value &&
- !with_i_schema)
+ db_names.at(0) != &INFORMATION_SCHEMA_NAME)
{
char path[FN_REFLEN+16];
uint path_len;
@@ -4835,15 +4814,14 @@ int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(0);
}
- List_iterator_fast<LEX_STRING> it(db_names);
- while ((db_name=it++))
+ for (size_t i=0; i < db_names.elements(); i++)
{
- if (with_i_schema) // information schema name is always first in list
+ LEX_STRING *db_name= db_names.at(i);
+ if (db_name == &INFORMATION_SCHEMA_NAME)
{
if (store_schema_shemata(thd, table, db_name,
system_charset_info))
DBUG_RETURN(1);
- with_i_schema= 0;
continue;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -7473,20 +7451,20 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
break;
case MYSQL_TYPE_DATE:
if (!(item=new Item_return_date_time(fields_info->field_name,
- MAX_DATE_WIDTH,
+ strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIME:
if (!(item=new Item_return_date_time(fields_info->field_name,
- MAX_TIME_FULL_WIDTH,
+ strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
if (!(item=new Item_return_date_time(fields_info->field_name,
- MAX_DATETIME_WIDTH,
+ strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
@@ -7860,9 +7838,9 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
because of lower_case_table_names
*/
thd->make_lex_string(&db, INFORMATION_SCHEMA_NAME.str,
- INFORMATION_SCHEMA_NAME.length, 0);
+ INFORMATION_SCHEMA_NAME.length);
thd->make_lex_string(&table, schema_table->table_name,
- strlen(schema_table->table_name), 0);
+ strlen(schema_table->table_name));
if (schema_table->old_format(thd, schema_table) || /* Handle old syntax */
!sel->add_table_to_list(thd, new Table_ident(thd, db, table, 0),
0, 0, TL_READ, MDL_SHARED_READ))
@@ -8664,7 +8642,7 @@ ST_FIELD_INFO plugin_fields_info[]=
{"PLUGIN_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Name",
SKIP_OPEN_TABLE},
{"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
- {"PLUGIN_STATUS", 10, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE},
+ {"PLUGIN_STATUS", 16, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN_TABLE},
{"PLUGIN_TYPE", 80, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN_TABLE},
{"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
{"PLUGIN_LIBRARY", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Library",
@@ -8925,6 +8903,8 @@ ST_SCHEMA_TABLE schema_tables[]=
OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
{"PLUGINS", plugin_fields_info, create_schema_table,
fill_plugins, make_old_format, 0, -1, -1, 0, 0},
+ {"ALL_PLUGINS", plugin_fields_info, create_schema_table,
+ fill_all_plugins, make_old_format, 0, 5, -1, 0, 0},
{"PROCESSLIST", processlist_fields_info, create_schema_table,
fill_schema_processlist, make_old_format, 0, -1, -1, 0, 0},
{"PROFILING", query_profile_statistics_info, create_schema_table,
diff --git a/sql/sql_show.h b/sql/sql_show.h
index 03d8af3aabd..ec4d6a2b7c9 100644
--- a/sql/sql_show.h
+++ b/sql/sql_show.h
@@ -27,21 +27,13 @@ class String;
class THD;
class sp_name;
struct TABLE_LIST;
-struct st_ha_create_information;
typedef class st_select_lex SELECT_LEX;
-typedef st_ha_create_information HA_CREATE_INFO;
struct LEX;
typedef struct st_mysql_show_var SHOW_VAR;
typedef struct st_schema_table ST_SCHEMA_TABLE;
struct TABLE;
typedef struct system_status_var STATUS_VAR;
-enum find_files_result {
- FIND_FILES_OK,
- FIND_FILES_OOM,
- FIND_FILES_DIR
-};
-
/* Used by handlers to store things in schema tables */
#define IS_FILES_FILE_ID 0
#define IS_FILES_FILE_NAME 1
@@ -82,9 +74,6 @@ enum find_files_result {
#define IS_FILES_STATUS 36
#define IS_FILES_EXTRA 37
-find_files_result find_files(THD *thd, List<LEX_STRING> *files, const char *db,
- const char *path, const char *wild, bool dir);
-
int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
HA_CREATE_INFO *create_info_arg, bool show_database);
int view_store_create_info(THD *thd, TABLE_LIST *table, String *buff);
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 9d11677666f..095c557c531 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -796,7 +796,7 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
uint32 length= min(to_length, from_length), length2= length;
-#if defined(__i386__)
+#if defined(__i386__) || defined(__x86_64__)
/*
Special loop for i386, it allows to refer to a
non-aligned memory block as UINT32, which makes
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3c094e1740e..3ff20c52092 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2011, Monty Program Ab
+ Copyright (c) 2010, 2013, Monty Program Ab.
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
@@ -22,7 +22,6 @@
#include "unireg.h"
#include "debug_sync.h"
#include "sql_table.h"
-#include "sql_rename.h" // do_rename
#include "sql_parse.h" // test_if_data_home_dir
#include "sql_cache.h" // query_cache_*
#include "sql_base.h" // open_table_uncached, lock_table_names
@@ -54,7 +53,6 @@
#include "sql_parse.h"
#include "sql_show.h"
#include "transaction.h"
-#include "datadict.h" // dd_frm_type()
#ifdef __WIN__
#include <io.h>
@@ -72,8 +70,7 @@ static int copy_data_between_tables(THD *thd, TABLE *,TABLE *,
static bool prepare_blob_field(THD *thd, Create_field *sql_field);
static bool check_engine(THD *, const char *, const char *, HA_CREATE_INFO *);
static int mysql_prepare_create_table(THD *, HA_CREATE_INFO *, Alter_info *,
- bool, uint *, handler *, KEY **, uint *,
- int);
+ uint *, handler *, KEY **, uint *, int);
/**
@brief Helper function for explain_filename
@@ -649,13 +646,6 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen)
struct st_global_ddl_log
{
- /*
- We need to adjust buffer size to be able to handle downgrades/upgrades
- where IO_SIZE has changed. We'll set the buffer size such that we can
- handle that the buffer size was upto 4 times bigger in the version
- that wrote the DDL log.
- */
- char file_entry_buf[4*IO_SIZE];
char file_name_str[FN_REFLEN];
char *file_name;
DDL_LOG_MEMORY_ENTRY *first_free;
@@ -683,51 +673,60 @@ mysql_mutex_t LOCK_gdl;
#define DDL_LOG_NUM_ENTRY_POS 0
#define DDL_LOG_NAME_LEN_POS 4
#define DDL_LOG_IO_SIZE_POS 8
+#define DDL_LOG_HEADER_SIZE 12
-/*
- Read one entry from ddl log file
- SYNOPSIS
- read_ddl_log_file_entry()
- entry_no Entry number to read
- RETURN VALUES
- TRUE Error
- FALSE Success
+/**
+ Read one entry from ddl log file.
+ @param[out] file_entry_buf Buffer to read into
+ @param entry_no Entry number to read
+ @param size Number of bytes of the entry to read
+
+ @return Operation status
+ @retval true Error
+ @retval false Success
*/
-static bool read_ddl_log_file_entry(uint entry_no)
+static bool read_ddl_log_file_entry(uchar *file_entry_buf,
+ uint entry_no,
+ uint size)
{
bool error= FALSE;
File file_id= global_ddl_log.file_id;
- uchar *file_entry_buf= (uchar*)global_ddl_log.file_entry_buf;
uint io_size= global_ddl_log.io_size;
DBUG_ENTER("read_ddl_log_file_entry");
+ DBUG_ASSERT(io_size >= size);
- if (mysql_file_pread(file_id, file_entry_buf, io_size, io_size * entry_no,
- MYF(MY_WME)) != io_size)
+ if (mysql_file_pread(file_id, file_entry_buf, size, io_size * entry_no,
+ MYF(MY_WME)) != size)
error= TRUE;
DBUG_RETURN(error);
}
-/*
- Write one entry from ddl log file
- SYNOPSIS
- write_ddl_log_file_entry()
- entry_no Entry number to write
- RETURN VALUES
- TRUE Error
- FALSE Success
+/**
+ Write one entry to ddl log file.
+
+ @param file_entry_buf Buffer to write
+ @param entry_no Entry number to write
+ @param size Number of bytes of the entry to write
+
+ @return Operation status
+ @retval true Error
+ @retval false Success
*/
-static bool write_ddl_log_file_entry(uint entry_no)
+static bool write_ddl_log_file_entry(uchar *file_entry_buf,
+ uint entry_no,
+ uint size)
{
bool error= FALSE;
File file_id= global_ddl_log.file_id;
- char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
+ uint io_size= global_ddl_log.io_size;
DBUG_ENTER("write_ddl_log_file_entry");
+ DBUG_ASSERT(io_size >= size);
- if (mysql_file_pwrite(file_id, (uchar*)file_entry_buf,
- IO_SIZE, IO_SIZE * entry_no, MYF(MY_WME)) != IO_SIZE)
+ if (mysql_file_pwrite(file_id, file_entry_buf, size,
+ io_size * entry_no, MYF(MY_WME)) != size)
error= TRUE;
DBUG_RETURN(error);
}
@@ -746,17 +745,20 @@ static bool write_ddl_log_header()
{
uint16 const_var;
bool error= FALSE;
+ uchar file_entry_buf[DDL_LOG_HEADER_SIZE];
DBUG_ENTER("write_ddl_log_header");
+ DBUG_ASSERT((DDL_LOG_NAME_POS + 3 * global_ddl_log.name_len)
+ <= global_ddl_log.io_size);
- int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NUM_ENTRY_POS],
+ int4store(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS],
global_ddl_log.num_entries);
- const_var= FN_LEN;
- int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_LEN_POS],
+ const_var= global_ddl_log.name_len;
+ int4store(&file_entry_buf[DDL_LOG_NAME_LEN_POS],
(ulong) const_var);
- const_var= IO_SIZE;
- int4store(&global_ddl_log.file_entry_buf[DDL_LOG_IO_SIZE_POS],
+ const_var= global_ddl_log.io_size;
+ int4store(&file_entry_buf[DDL_LOG_IO_SIZE_POS],
(ulong) const_var);
- if (write_ddl_log_file_entry(0UL))
+ if (write_ddl_log_file_entry(file_entry_buf, 0UL, DDL_LOG_HEADER_SIZE))
{
sql_print_error("Error writing ddl log header");
DBUG_RETURN(TRUE);
@@ -796,18 +798,20 @@ static inline void create_ddl_log_file_name(char *file_name)
static uint read_ddl_log_header()
{
- char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
+ char file_entry_buf[DDL_LOG_HEADER_SIZE];
char file_name[FN_REFLEN];
uint entry_no;
bool successful_open= FALSE;
DBUG_ENTER("read_ddl_log_header");
+ DBUG_ASSERT(global_ddl_log.io_size <= IO_SIZE);
create_ddl_log_file_name(file_name);
if ((global_ddl_log.file_id= mysql_file_open(key_file_global_ddl_log,
file_name,
O_RDWR | O_BINARY, MYF(0))) >= 0)
{
- if (read_ddl_log_file_entry(0UL))
+ if (read_ddl_log_file_entry((uchar *) file_entry_buf, 0UL,
+ DDL_LOG_HEADER_SIZE))
{
/* Write message into error log */
sql_print_error("Failed to read ddl log file in recovery");
@@ -820,8 +824,6 @@ static uint read_ddl_log_header()
entry_no= uint4korr(&file_entry_buf[DDL_LOG_NUM_ENTRY_POS]);
global_ddl_log.name_len= uint4korr(&file_entry_buf[DDL_LOG_NAME_LEN_POS]);
global_ddl_log.io_size= uint4korr(&file_entry_buf[DDL_LOG_IO_SIZE_POS]);
- DBUG_ASSERT(global_ddl_log.io_size <=
- sizeof(global_ddl_log.file_entry_buf));
}
else
{
@@ -836,30 +838,22 @@ static uint read_ddl_log_header()
}
-/*
- Read a ddl log entry
- SYNOPSIS
- read_ddl_log_entry()
- read_entry Number of entry to read
- out:entry_info Information from entry
- RETURN VALUES
- TRUE Error
- FALSE Success
- DESCRIPTION
- Read a specified entry in the ddl log
+/**
+ Set ddl log entry struct from buffer
+ @param read_entry Entry number
+ @param file_entry_buf Buffer to use
+ @param ddl_log_entry Entry to be set
+
+ @note Pointers in ddl_log_entry will point into file_entry_buf!
*/
-bool read_ddl_log_entry(uint read_entry, DDL_LOG_ENTRY *ddl_log_entry)
+static void set_ddl_log_entry_from_buf(uint read_entry,
+ uchar *file_entry_buf,
+ DDL_LOG_ENTRY *ddl_log_entry)
{
- char *file_entry_buf= (char*)&global_ddl_log.file_entry_buf;
uint inx;
uchar single_char;
- DBUG_ENTER("read_ddl_log_entry");
-
- if (read_ddl_log_file_entry(read_entry))
- {
- DBUG_RETURN(TRUE);
- }
+ DBUG_ENTER("set_ddl_log_entry_from_buf");
ddl_log_entry->entry_pos= read_entry;
single_char= file_entry_buf[DDL_LOG_ENTRY_TYPE_POS];
ddl_log_entry->entry_type= (enum ddl_log_entry_code)single_char;
@@ -867,14 +861,14 @@ bool read_ddl_log_entry(uint read_entry, DDL_LOG_ENTRY *ddl_log_entry)
ddl_log_entry->action_type= (enum ddl_log_action_code)single_char;
ddl_log_entry->phase= file_entry_buf[DDL_LOG_PHASE_POS];
ddl_log_entry->next_entry= uint4korr(&file_entry_buf[DDL_LOG_NEXT_ENTRY_POS]);
- ddl_log_entry->name= &file_entry_buf[DDL_LOG_NAME_POS];
+ ddl_log_entry->name= (char*) &file_entry_buf[DDL_LOG_NAME_POS];
inx= DDL_LOG_NAME_POS + global_ddl_log.name_len;
- ddl_log_entry->from_name= &file_entry_buf[inx];
+ ddl_log_entry->from_name= (char*) &file_entry_buf[inx];
inx+= global_ddl_log.name_len;
- ddl_log_entry->handler_name= &file_entry_buf[inx];
- DBUG_RETURN(FALSE);
+ ddl_log_entry->handler_name= (char*) &file_entry_buf[inx];
+ DBUG_VOID_RETURN;
}
-
+
/*
Initialise ddl log
@@ -969,7 +963,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry)
plugin_ref plugin= ha_resolve_by_name(thd, &handler_name);
if (!plugin)
{
- my_error(ER_ILLEGAL_HA, MYF(0), ddl_log_entry->handler_name);
+ my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), ddl_log_entry->handler_name);
goto error;
}
hton= plugin_data(plugin, handlerton*);
@@ -1077,6 +1071,7 @@ static bool get_free_ddl_log_entry(DDL_LOG_MEMORY_ENTRY **active_entry,
DDL_LOG_MEMORY_ENTRY *first_used= global_ddl_log.first_used;
DBUG_ENTER("get_free_ddl_log_entry");
+ mysql_mutex_assert_owner(&LOCK_gdl);
if (global_ddl_log.first_free == NULL)
{
if (!(used_entry= (DDL_LOG_MEMORY_ENTRY*)my_malloc(
@@ -1134,34 +1129,36 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
DDL_LOG_MEMORY_ENTRY **active_entry)
{
bool error, write_header;
+ char file_entry_buf[IO_SIZE];
DBUG_ENTER("write_ddl_log_entry");
if (init_ddl_log())
{
DBUG_RETURN(TRUE);
}
- global_ddl_log.file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]=
+ memset(file_entry_buf, 0, sizeof(file_entry_buf));
+ file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]=
(char)DDL_LOG_ENTRY_CODE;
- global_ddl_log.file_entry_buf[DDL_LOG_ACTION_TYPE_POS]=
+ file_entry_buf[DDL_LOG_ACTION_TYPE_POS]=
(char)ddl_log_entry->action_type;
- global_ddl_log.file_entry_buf[DDL_LOG_PHASE_POS]= 0;
- int4store(&global_ddl_log.file_entry_buf[DDL_LOG_NEXT_ENTRY_POS],
+ file_entry_buf[DDL_LOG_PHASE_POS]= 0;
+ int4store(&file_entry_buf[DDL_LOG_NEXT_ENTRY_POS],
ddl_log_entry->next_entry);
- DBUG_ASSERT(strlen(ddl_log_entry->name) < FN_LEN);
- strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS],
- ddl_log_entry->name, FN_LEN - 1);
+ DBUG_ASSERT(strlen(ddl_log_entry->name) < global_ddl_log.name_len);
+ strmake(&file_entry_buf[DDL_LOG_NAME_POS], ddl_log_entry->name,
+ global_ddl_log.name_len - 1);
if (ddl_log_entry->action_type == DDL_LOG_RENAME_ACTION ||
ddl_log_entry->action_type == DDL_LOG_REPLACE_ACTION)
{
- DBUG_ASSERT(strlen(ddl_log_entry->from_name) < FN_LEN);
- strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + FN_LEN],
- ddl_log_entry->from_name, FN_LEN - 1);
+ DBUG_ASSERT(strlen(ddl_log_entry->from_name) < global_ddl_log.name_len);
+ strmake(&file_entry_buf[DDL_LOG_NAME_POS + global_ddl_log.name_len],
+ ddl_log_entry->from_name, global_ddl_log.name_len - 1);
}
else
- global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + FN_LEN]= 0;
- DBUG_ASSERT(strlen(ddl_log_entry->handler_name) < FN_LEN);
- strmake(&global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS + (2*FN_LEN)],
- ddl_log_entry->handler_name, FN_LEN - 1);
+ file_entry_buf[DDL_LOG_NAME_POS + global_ddl_log.name_len]= 0;
+ DBUG_ASSERT(strlen(ddl_log_entry->handler_name) < global_ddl_log.name_len);
+ strmake(&file_entry_buf[DDL_LOG_NAME_POS + (2*global_ddl_log.name_len)],
+ ddl_log_entry->handler_name, global_ddl_log.name_len - 1);
if (get_free_ddl_log_entry(active_entry, &write_header))
{
DBUG_RETURN(TRUE);
@@ -1169,14 +1166,15 @@ bool write_ddl_log_entry(DDL_LOG_ENTRY *ddl_log_entry,
error= FALSE;
DBUG_PRINT("ddl_log",
("write type %c next %u name '%s' from_name '%s' handler '%s'",
- (char) global_ddl_log.file_entry_buf[DDL_LOG_ACTION_TYPE_POS],
+ (char) file_entry_buf[DDL_LOG_ACTION_TYPE_POS],
ddl_log_entry->next_entry,
- (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS],
- (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS
- + FN_LEN],
- (char*) &global_ddl_log.file_entry_buf[DDL_LOG_NAME_POS
- + (2*FN_LEN)]));
- if (write_ddl_log_file_entry((*active_entry)->entry_pos))
+ (char*) &file_entry_buf[DDL_LOG_NAME_POS],
+ (char*) &file_entry_buf[DDL_LOG_NAME_POS +
+ global_ddl_log.name_len],
+ (char*) &file_entry_buf[DDL_LOG_NAME_POS +
+ (2*global_ddl_log.name_len)]));
+ if (write_ddl_log_file_entry((uchar*) file_entry_buf,
+ (*active_entry)->entry_pos, IO_SIZE))
{
error= TRUE;
sql_print_error("Failed to write entry_no = %u",
@@ -1226,13 +1224,14 @@ bool write_execute_ddl_log_entry(uint first_entry,
DDL_LOG_MEMORY_ENTRY **active_entry)
{
bool write_header= FALSE;
- char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
+ char file_entry_buf[IO_SIZE];
DBUG_ENTER("write_execute_ddl_log_entry");
if (init_ddl_log())
{
DBUG_RETURN(TRUE);
}
+ memset(file_entry_buf, 0, sizeof(file_entry_buf));
if (!complete)
{
/*
@@ -1246,12 +1245,7 @@ bool write_execute_ddl_log_entry(uint first_entry,
}
else
file_entry_buf[DDL_LOG_ENTRY_TYPE_POS]= (char)DDL_IGNORE_LOG_ENTRY_CODE;
- file_entry_buf[DDL_LOG_ACTION_TYPE_POS]= 0; /* Ignored for execute entries */
- file_entry_buf[DDL_LOG_PHASE_POS]= 0;
int4store(&file_entry_buf[DDL_LOG_NEXT_ENTRY_POS], first_entry);
- file_entry_buf[DDL_LOG_NAME_POS]= 0;
- file_entry_buf[DDL_LOG_NAME_POS + FN_LEN]= 0;
- file_entry_buf[DDL_LOG_NAME_POS + 2*FN_LEN]= 0;
if (!(*active_entry))
{
if (get_free_ddl_log_entry(active_entry, &write_header))
@@ -1259,7 +1253,9 @@ bool write_execute_ddl_log_entry(uint first_entry,
DBUG_RETURN(TRUE);
}
}
- if (write_ddl_log_file_entry((*active_entry)->entry_pos))
+ if (write_ddl_log_file_entry((uchar*) file_entry_buf,
+ (*active_entry)->entry_pos,
+ IO_SIZE))
{
sql_print_error("Error writing execute entry in ddl log");
release_ddl_log_memory_entry(*active_entry);
@@ -1304,10 +1300,16 @@ bool write_execute_ddl_log_entry(uint first_entry,
bool deactivate_ddl_log_entry(uint entry_no)
{
- char *file_entry_buf= (char*)global_ddl_log.file_entry_buf;
+ uchar file_entry_buf[DDL_LOG_NAME_POS];
DBUG_ENTER("deactivate_ddl_log_entry");
- if (!read_ddl_log_file_entry(entry_no))
+
+ /*
+ Only need to read and write the first bytes of the entry, where
+ ENTRY_TYPE, ACTION_TYPE and PHASE reside. Using DDL_LOG_NAME_POS
+ to include all info except for the names.
+ */
+ if (!read_ddl_log_file_entry(file_entry_buf, entry_no, DDL_LOG_NAME_POS))
{
if (file_entry_buf[DDL_LOG_ENTRY_TYPE_POS] == DDL_LOG_ENTRY_CODE)
{
@@ -1325,7 +1327,7 @@ bool deactivate_ddl_log_entry(uint entry_no)
{
DBUG_ASSERT(0);
}
- if (write_ddl_log_file_entry(entry_no))
+ if (write_ddl_log_file_entry(file_entry_buf, entry_no, DDL_LOG_NAME_POS))
{
sql_print_error("Error in deactivating log entry. Position = %u",
entry_no);
@@ -1386,6 +1388,7 @@ void release_ddl_log_memory_entry(DDL_LOG_MEMORY_ENTRY *log_entry)
DDL_LOG_MEMORY_ENTRY *next_log_entry= log_entry->next_log_entry;
DDL_LOG_MEMORY_ENTRY *prev_log_entry= log_entry->prev_log_entry;
DBUG_ENTER("release_ddl_log_memory_entry");
+ mysql_mutex_assert_owner(&LOCK_gdl);
global_ddl_log.first_free= log_entry;
log_entry->next_log_entry= first_free;
@@ -1415,24 +1418,26 @@ bool execute_ddl_log_entry(THD *thd, uint first_entry)
{
DDL_LOG_ENTRY ddl_log_entry;
uint read_entry= first_entry;
+ uchar file_entry_buf[IO_SIZE];
DBUG_ENTER("execute_ddl_log_entry");
mysql_mutex_lock(&LOCK_gdl);
do
{
- if (read_ddl_log_entry(read_entry, &ddl_log_entry))
+ if (read_ddl_log_file_entry(file_entry_buf, read_entry, IO_SIZE))
{
- /* Write to error log and continue with next log entry */
+ /* Print the error to the log and continue with next log entry */
sql_print_error("Failed to read entry = %u from ddl log",
read_entry);
break;
}
+ set_ddl_log_entry_from_buf(read_entry, file_entry_buf, &ddl_log_entry);
DBUG_ASSERT(ddl_log_entry.entry_type == DDL_LOG_ENTRY_CODE ||
ddl_log_entry.entry_type == DDL_IGNORE_LOG_ENTRY_CODE);
if (execute_ddl_log_action(thd, &ddl_log_entry))
{
- /* Write to error log and continue with next log entry */
+ /* Print the error to the log and continue with next log entry */
sql_print_error("Failed to execute action for entry = %u from ddl log",
read_entry);
break;
@@ -1477,6 +1482,8 @@ void execute_ddl_log_recovery()
uint num_entries, i;
THD *thd;
DDL_LOG_ENTRY ddl_log_entry;
+ uchar *file_entry_buf;
+ uint io_size;
char file_name[FN_REFLEN];
static char recover_query_string[]= "INTERNAL DDL LOG RECOVER IN PROGRESS";
DBUG_ENTER("execute_ddl_log_recovery");
@@ -1484,7 +1491,6 @@ void execute_ddl_log_recovery()
/*
Initialise global_ddl_log struct
*/
- bzero(global_ddl_log.file_entry_buf, sizeof(global_ddl_log.file_entry_buf));
global_ddl_log.inited= FALSE;
global_ddl_log.recovery_phase= TRUE;
global_ddl_log.io_size= IO_SIZE;
@@ -1502,14 +1508,23 @@ void execute_ddl_log_recovery()
/* this also initialize LOCK_gdl */
num_entries= read_ddl_log_header();
+ io_size= global_ddl_log.io_size;
+ file_entry_buf= (uchar*) my_malloc(io_size, MYF(0));
+ if (!file_entry_buf)
+ {
+ sql_print_error("Failed to allocate buffer for recover ddl log");
+ DBUG_VOID_RETURN;
+ }
for (i= 1; i < num_entries + 1; i++)
{
- if (read_ddl_log_entry(i, &ddl_log_entry))
+ if (read_ddl_log_file_entry(file_entry_buf, i, io_size))
{
sql_print_error("Failed to read entry no = %u from ddl log",
i);
continue;
}
+
+ set_ddl_log_entry_from_buf(i, file_entry_buf, &ddl_log_entry);
if (ddl_log_entry.entry_type == DDL_LOG_EXECUTE_CODE)
{
if (execute_ddl_log_entry(thd, ddl_log_entry.next_entry))
@@ -1524,6 +1539,7 @@ void execute_ddl_log_recovery()
(void) mysql_file_delete(key_file_global_ddl_log, file_name, MYF(0));
global_ddl_log.recovery_phase= FALSE;
delete thd;
+ my_free(file_entry_buf);
/* Remember that we don't have a THD */
set_current_thd(0);
DBUG_VOID_RETURN;
@@ -1540,14 +1556,16 @@ void execute_ddl_log_recovery()
void release_ddl_log()
{
- DDL_LOG_MEMORY_ENTRY *free_list= global_ddl_log.first_free;
- DDL_LOG_MEMORY_ENTRY *used_list= global_ddl_log.first_used;
+ DDL_LOG_MEMORY_ENTRY *free_list;
+ DDL_LOG_MEMORY_ENTRY *used_list;
DBUG_ENTER("release_ddl_log");
if (!global_ddl_log.do_release)
DBUG_VOID_RETURN;
mysql_mutex_lock(&LOCK_gdl);
+ free_list= global_ddl_log.first_free;
+ used_list= global_ddl_log.first_used;
while (used_list)
{
DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry;
@@ -1656,14 +1674,10 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
strxmov(shadow_frm_name, shadow_path, reg_ext, NullS);
if (flags & WFRM_WRITE_SHADOW)
{
- if (mysql_prepare_create_table(lpt->thd, lpt->create_info,
- lpt->alter_info,
- /*tmp_table*/ 1,
- &lpt->db_options,
- lpt->table->file,
- &lpt->key_info_buffer,
- &lpt->key_count,
- /*select_field_count*/ 0))
+ if (mysql_prepare_create_table(lpt->thd, lpt->create_info, lpt->alter_info,
+ &lpt->db_options, lpt->table->file,
+ &lpt->key_info_buffer, &lpt->key_count,
+ C_ALTER_TABLE))
{
DBUG_RETURN(TRUE);
}
@@ -1687,13 +1701,23 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
#endif
/* Write shadow frm file */
lpt->create_info->table_options= lpt->db_options;
- if ((mysql_create_frm(lpt->thd, shadow_frm_name, lpt->db,
- lpt->table_name, lpt->create_info,
- lpt->alter_info->create_list, lpt->key_count,
- lpt->key_info_buffer, lpt->table->file)) ||
- lpt->table->file->ha_create_handler_files(shadow_path, NULL,
- CHF_CREATE_FLAG,
- lpt->create_info))
+ LEX_CUSTRING frm= build_frm_image(lpt->thd, lpt->table_name,
+ lpt->create_info,
+ lpt->alter_info->create_list,
+ lpt->key_count, lpt->key_info_buffer,
+ lpt->table->file);
+ if (!frm.str)
+ {
+ error= 1;
+ goto end;
+ }
+
+ int error= writefrm(shadow_path, lpt->db, lpt->table_name,
+ lpt->create_info->tmp_table(), frm.str, frm.length);
+ my_free(const_cast<uchar*>(frm.str));
+
+ if (error || lpt->table->file->ha_create_partitioning_metadata(shadow_path,
+ NULL, CHF_CREATE_FLAG))
{
mysql_file_delete(key_file_frm, shadow_frm_name, MYF(0));
error= 1;
@@ -1708,12 +1732,12 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
handlers that have the main version of the frm file stored in the
handler.
*/
- uchar *data;
+ const uchar *data;
size_t length;
if (readfrm(shadow_path, &data, &length) ||
packfrm(data, length, &lpt->pack_frm_data, &lpt->pack_frm_len))
{
- my_free(data);
+ my_free(const_cast<uchar*>(data));
my_free(lpt->pack_frm_data);
mem_alloc_error(length);
error= 1;
@@ -1731,7 +1755,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
*/
build_table_filename(path, sizeof(path) - 1, lpt->db,
lpt->table_name, "", 0);
- strxmov(frm_name, path, reg_ext, NullS);
+ strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
/*
When we are changing to use new frm file we need to ensure that we
don't collide with another thread in process to open the frm file.
@@ -1744,14 +1768,14 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
*/
if (mysql_file_delete(key_file_frm, frm_name, MYF(MY_WME)) ||
#ifdef WITH_PARTITION_STORAGE_ENGINE
- lpt->table->file->ha_create_handler_files(path, shadow_path,
- CHF_DELETE_FLAG, NULL) ||
+ lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
+ CHF_DELETE_FLAG) ||
deactivate_ddl_log_entry(part_info->frm_log_entry->entry_pos) ||
(sync_ddl_log(), FALSE) ||
mysql_file_rename(key_file_frm,
shadow_frm_name, frm_name, MYF(MY_WME)) ||
- lpt->table->file->ha_create_handler_files(path, shadow_path,
- CHF_RENAME_FLAG, NULL))
+ lpt->table->file->ha_create_partitioning_metadata(path, shadow_path,
+ CHF_RENAME_FLAG))
#else
mysql_file_rename(key_file_frm,
shadow_frm_name, frm_name, MYF(MY_WME)))
@@ -1911,10 +1935,6 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
if (lock_table_names(thd, tables, NULL, thd->variables.lock_wait_timeout,
MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(true);
- for (table= tables; table; table= table->next_local)
-
- tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name,
- false);
}
else
{
@@ -2124,8 +2144,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
bool is_trans;
char *db=table->db;
size_t db_length= table->db_length;
- handlerton *table_type;
- enum legacy_db_type frm_db_type= DB_TYPE_UNKNOWN;
+ handlerton *table_type= 0;
DBUG_PRINT("table", ("table_l: '%s'.'%s' table: 0x%lx s: 0x%lx",
table->db, table->table_name, (long) table->table,
@@ -2205,22 +2224,9 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
{
non_temp_tables_count++;
- if (thd->locked_tables_mode)
- {
- if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED))
- {
- error= -1;
- goto err;
- }
- close_all_tables_for_name(thd, table->table->s,
- HA_EXTRA_PREPARE_FOR_DROP);
- table->table= 0;
- }
-
- /* Check that we have an exclusive lock on the table to be dropped. */
DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
table->table_name,
- MDL_EXCLUSIVE));
+ MDL_SHARED));
alias= (lower_case_table_names == 2) ? table->alias : table->table_name;
/* remove .frm file and engine files */
@@ -2260,14 +2266,10 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
}
}
DEBUG_SYNC(thd, "rm_table_no_locks_before_delete_table");
- DBUG_EXECUTE_IF("sleep_before_no_locks_delete_table",
- my_sleep(100000););
error= 0;
- if (drop_temporary ||
- ((access(path, F_OK) &&
- ha_create_table_from_engine(thd, db, alias)) ||
- (!drop_view &&
- dd_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
+ if (!table->internal_tmp_table &&
+ (drop_temporary || !ha_table_exists(thd, db, alias, &table_type) ||
+ (!drop_view && table_type == view_pseudo_hton)))
{
/*
One of the following cases happened:
@@ -2275,6 +2277,10 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
. "DROP" but table was not found on disk and table can't be
created from engine.
. ./sql/datadict.cc +32 /Alfranio - TODO: We need to test this.
+
+ Table->internal_tmp_table is set when one of the #sql-xxx files
+ was left in the datadir after a crash during ALTER TABLE.
+ See Bug#30152.
*/
if (if_exists)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
@@ -2289,30 +2295,48 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
else
{
char *end;
+
/*
- Cannot use the db_type from the table, since that might have changed
- while waiting for the exclusive name lock.
+ It could happen that table's share in the table_def_cache
+ is the only thing that keeps the engine plugin loaded
+ (if it is uninstalled and waits for the ref counter to drop to 0).
+
+ In this case, the tdc_remove_table() below will release and unload
+ the plugin. And ha_delete_table() will get a dangling pointer.
+
+ Let's lock the plugin till the end of the statement.
*/
- if (frm_db_type == DB_TYPE_UNKNOWN)
+ if (table_type && table_type != view_pseudo_hton)
+ ha_lock_engine(thd, table_type);
+
+ if (thd->locked_tables_mode)
{
- dd_frm_type(thd, path, &frm_db_type);
- DBUG_PRINT("info", ("frm_db_type %d from %s", frm_db_type, path));
+ if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
+ {
+ error= -1;
+ goto err;
+ }
+ /* the following internally does TDC_RT_REMOVE_ALL */
+ close_all_tables_for_name(thd, table->table->s,
+ HA_EXTRA_PREPARE_FOR_DROP);
+ table->table= 0;
}
- table_type= ha_resolve_by_legacy_type(thd, frm_db_type);
+ else
+ tdc_remove_table(thd, TDC_RT_REMOVE_ALL, table->db, table->table_name,
+ false);
+
+ /* Check that we have an exclusive lock on the table to be dropped. */
+ DBUG_ASSERT(thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
+ table->table_name,
+ MDL_EXCLUSIVE));
+
// Remove extension for delete
*(end= path + path_length - reg_ext_length)= '\0';
- DBUG_PRINT("info", ("deleting table of type %d",
- (table_type ? table_type->db_type : 0)));
+
error= ha_delete_table(thd, table_type, path, db, table->table_name,
!dont_log_query);
- /* No error if non existent table and 'IF EXIST' clause or view */
- if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) &&
- (if_exists || table_type == NULL))
- {
- error= 0;
- thd->clear_error();
- }
if (error == HA_ERR_ROW_IS_REFERENCED)
{
/* the table is referenced by a foreign key constraint */
@@ -2320,18 +2344,29 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
}
if (!error || error == ENOENT || error == HA_ERR_NO_SUCH_TABLE)
{
- int new_error;
+ int frm_delete_error, trigger_drop_error= 0;
/* Delete the table definition file */
strmov(end,reg_ext);
- if (!(new_error= mysql_file_delete(key_file_frm, path, MYF(MY_WME))))
+ frm_delete_error= mysql_file_delete(key_file_frm, path, MYF(MY_WME));
+ if (frm_delete_error)
+ frm_delete_error= my_errno;
+ else
{
non_tmp_table_deleted= TRUE;
- new_error= Table_triggers_list::drop_all_triggers(thd, db,
- table->table_name);
+ trigger_drop_error=
+ Table_triggers_list::drop_all_triggers(thd, db, table->table_name);
+ }
+
+ if (trigger_drop_error ||
+ (frm_delete_error && frm_delete_error != ENOENT))
+ error= 1;
+ else if (!frm_delete_error || !error || if_exists)
+ {
+ error= 0;
+ thd->clear_error();
}
- error|= new_error;
}
- non_tmp_error= error ? TRUE : non_tmp_error;
+ non_tmp_error= error ? TRUE : non_tmp_error;
}
if (error)
{
@@ -2870,12 +2905,12 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
thd Thread object.
create_info Create information (like MAX_ROWS).
alter_info List of columns and indexes to create
- tmp_table If a temporary table is to be created.
db_options INOUT Table options (like HA_OPTION_PACK_RECORD).
file The handler for the new table.
key_info_buffer OUT An array of KEY structs for the indexes.
key_count OUT The number of elements in the array.
- select_field_count The number of fields coming from a select table.
+ create_table_mode C_ORDINARY_CREATE, C_ALTER_TABLE,
+ C_CREATE_SELECT, C_ASSISTED_DISCOVERY
DESCRIPTION
Prepares the table and key structures for table creation.
@@ -2890,11 +2925,9 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
static int
mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
- Alter_info *alter_info,
- bool tmp_table,
- uint *db_options,
+ Alter_info *alter_info, uint *db_options,
handler *file, KEY **key_info_buffer,
- uint *key_count, int select_field_count)
+ uint *key_count, int create_table_mode)
{
const char *key_name;
Create_field *sql_field,*dup_field;
@@ -2907,6 +2940,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
List_iterator<Create_field> it(alter_info->create_list);
List_iterator<Create_field> it2(alter_info->create_list);
uint total_uneven_bit_length= 0;
+ int select_field_count= C_CREATE_SELECT(create_table_mode);
+ bool tmp_table= create_table_mode == C_ALTER_TABLE;
DBUG_ENTER("mysql_prepare_create_table");
select_field_pos= alter_info->create_list.elements - select_field_count;
@@ -3192,8 +3227,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->offset= record_offset;
if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
auto_increment++;
- if (parse_option_list(thd, &sql_field->option_struct,
- sql_field->option_list,
+ if (parse_option_list(thd, create_info->db_type, &sql_field->option_struct,
+ &sql_field->option_list,
create_info->db_type->field_options, FALSE,
thd->mem_root))
DBUG_RETURN(TRUE);
@@ -3223,15 +3258,13 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (auto_increment &&
(file->ha_table_flags() & HA_NO_AUTO_INCREMENT))
{
- my_message(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT,
- ER(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT), MYF(0));
+ my_error(ER_TABLE_CANT_HANDLE_AUTO_INCREMENT, MYF(0), file->table_type());
DBUG_RETURN(TRUE);
}
if (blob_columns && (file->ha_table_flags() & HA_NO_BLOBS))
{
- my_message(ER_TABLE_CANT_HANDLE_BLOB, ER(ER_TABLE_CANT_HANDLE_BLOB),
- MYF(0));
+ my_error(ER_TABLE_CANT_HANDLE_BLOB, MYF(0), file->table_type());
DBUG_RETURN(TRUE);
}
@@ -3397,8 +3430,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
key_info->usable_key_parts= key_number;
key_info->algorithm= key->key_create_info.algorithm;
key_info->option_list= key->option_list;
- if (parse_option_list(thd, &key_info->option_struct,
- key_info->option_list,
+ if (parse_option_list(thd, create_info->db_type, &key_info->option_struct,
+ &key_info->option_list,
create_info->db_type->index_options, FALSE,
thd->mem_root))
DBUG_RETURN(TRUE);
@@ -3407,8 +3440,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
if (!(file->ha_table_flags() & HA_CAN_FULLTEXT))
{
- my_message(ER_TABLE_CANT_HANDLE_FT, ER(ER_TABLE_CANT_HANDLE_FT),
- MYF(0));
+ my_error(ER_TABLE_CANT_HANDLE_FT, MYF(0), file->table_type());
DBUG_RETURN(TRUE);
}
}
@@ -3425,8 +3457,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
if (!(file->ha_table_flags() & HA_CAN_RTREEKEYS))
{
- my_message(ER_TABLE_CANT_HANDLE_SPKEYS, ER(ER_TABLE_CANT_HANDLE_SPKEYS),
- MYF(0));
+ my_error(ER_TABLE_CANT_HANDLE_SPKEYS, MYF(0), file->table_type());
DBUG_RETURN(TRUE);
}
if (key_info->key_parts != 1)
@@ -3541,7 +3572,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
{
if (!(file->ha_table_flags() & HA_CAN_INDEX_BLOBS))
{
- my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name.str);
+ my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name.str,
+ file->table_type());
DBUG_RETURN(TRUE);
}
if (f_is_geom(sql_field->pack_flag) && sql_field->geom_type ==
@@ -3663,7 +3695,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
else if (length == 0 && (sql_field->flags & NOT_NULL_FLAG))
{
- my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name.str);
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0), file->table_type(),
+ column->field_name.str);
DBUG_RETURN(TRUE);
}
if (length > file->max_key_part_length() && key->type != Key::FULLTEXT)
@@ -3828,8 +3861,23 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
}
- if (parse_option_list(thd, &create_info->option_struct,
- create_info->option_list,
+ if (create_info->tmp_table())
+ create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE;
+
+ /* Give warnings for not supported table options */
+#if defined(WITH_ARIA_STORAGE_ENGINE)
+ extern handlerton *maria_hton;
+ if (file->ht != maria_hton)
+#endif
+ if (create_info->transactional)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_ILLEGAL_HA_CREATE_OPTION,
+ ER(ER_ILLEGAL_HA_CREATE_OPTION),
+ file->engine_name()->str,
+ "TRANSACTIONAL=1");
+
+ if (parse_option_list(thd, file->partition_ht(), &create_info->option_struct,
+ &create_info->option_list,
file->partition_ht()->table_options, FALSE,
thd->mem_root))
DBUG_RETURN(TRUE);
@@ -3999,164 +4047,58 @@ static bool check_if_created_table_can_be_opened(THD *thd,
/*
It is impossible to open definition of partitioned table without .par file.
*/
- if (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG, create_info))
+ if (file->ha_create_partitioning_metadata(path, NULL, CHF_CREATE_FLAG))
return TRUE;
init_tmp_table_share(thd, &share, db, 0, table_name, path);
+ share.db_plugin= ha_lock_engine(thd, file->ht);
- result= (open_table_def(thd, &share, 0) ||
+ result= (open_table_def(thd, &share) ||
open_table_from_share(thd, &share, "", 0, (uint) READ_ALL,
0, &table, TRUE));
if (! result)
(void) closefrm(&table, 0);
free_table_share(&share);
- (void) file->ha_create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info);
+ (void) file->ha_create_partitioning_metadata(path, NULL, CHF_DELETE_FLAG);
return result;
}
#endif
-/**
- Check that there is no frm file for given table
-
- @param old_path path to the old frm file
- @param path path to the frm file in new encoding
- @param db database name
- @param table_name table name
- @param alias table name for error message (for new encoding)
- @param issue_error should we issue error messages
-
- @retval FALSE there is no frm file
- @retval TRUE there is frm file
-*/
-
-bool check_table_file_presence(char *old_path,
- char *path,
- const char *db,
- const char *table_name,
- const char *alias,
- bool issue_error)
-{
- if (!access(path,F_OK))
- {
- if (issue_error)
- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),alias);
- return TRUE;
- }
- {
- /*
- Check if file of the table in 5.0 file name encoding exists.
-
- Except case when it is the same table.
- */
- char tbl50[FN_REFLEN];
-#ifdef _WIN32
- if (check_if_legal_tablename(table_name) != 0)
- {
- /*
- Check for reserved device names for which access() returns 0
- (CON, AUX etc).
- */
- return FALSE;
- }
-#endif
- strxmov(tbl50, mysql_data_home, "/", db, "/", table_name, NullS);
- fn_format(tbl50, tbl50, "", reg_ext, MY_UNPACK_FILENAME);
- if (!access(tbl50, F_OK) &&
- (old_path == NULL ||
- strcmp(old_path, tbl50) != 0))
- {
- if (issue_error)
- {
- strxmov(tbl50, MYSQL50_TABLE_NAME_PREFIX, table_name, NullS);
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), tbl50);
- }
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-/*
- Create a table
-
- SYNOPSIS
- mysql_create_table_no_lock()
- thd Thread object
- db Database
- table_name Table name
- create_info Create information (like MAX_ROWS)
- fields List of fields to create
- keys List of keys to create
- internal_tmp_table Set to 1 if this is an internal temporary table
- (From ALTER TABLE)
- select_field_count
- is_trans identifies the type of engine where the table
- was created: either trans or non-trans.
-
- DESCRIPTION
- If one creates a temporary table, this is automatically opened
-
- Note that this function assumes that caller already have taken
- exclusive metadata lock on table being created or used some other
- way to ensure that concurrent operations won't intervene.
- mysql_create_table() is a wrapper that can be used for this.
-
- no_log is needed for the case of CREATE ... SELECT,
- as the logging will be done later in sql_insert.cc
- select_field_count is also used for CREATE ... SELECT,
- and must be zero for standard create of table.
-
- RETURN VALUES
- FALSE OK
- TRUE error
-*/
-
-bool mysql_create_table_no_lock(THD *thd,
+handler *mysql_create_frm_image(THD *thd,
const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
- Alter_info *alter_info,
- bool internal_tmp_table,
- uint select_field_count,
- bool *is_trans)
+ Alter_info *alter_info, int create_table_mode,
+ LEX_CUSTRING *frm)
{
- char path[FN_REFLEN + 1];
- uint path_length;
- const char *alias;
uint db_options, key_count;
KEY *key_info_buffer;
- handler *file;
- bool error= TRUE;
- DBUG_ENTER("mysql_create_table_no_lock");
- DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d",
- db, table_name, internal_tmp_table));
+ handler *file;
+ DBUG_ENTER("mysql_create_frm_image");
-
- /* Check for duplicate fields and check type of table to create */
if (!alter_info->create_list.elements)
{
my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
MYF(0));
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(NULL);
}
+
if (check_engine(thd, db, table_name, create_info))
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(NULL);
set_table_default_charset(thd, create_info, (char*) db);
db_options= create_info->table_options;
- if (!create_info->frm_only &&
+ if (create_table_mode != C_ALTER_TABLE_FRM_ONLY &&
create_info->row_type != ROW_TYPE_FIXED &&
create_info->row_type != ROW_TYPE_DEFAULT)
db_options|= HA_OPTION_PACK_RECORD;
- alias= table_case_name(create_info, table_name);
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
create_info->db_type)))
{
mem_alloc_error(sizeof(handler));
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(NULL);
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info= thd->work_part_info;
@@ -4173,7 +4115,7 @@ bool mysql_create_table_no_lock(THD *thd,
if (!part_info)
{
mem_alloc_error(sizeof(partition_info));
- DBUG_RETURN(TRUE);
+ goto err;
}
file->set_auto_partitions(part_info);
part_info->default_engine_type= create_info->db_type;
@@ -4198,7 +4140,7 @@ bool mysql_create_table_no_lock(THD *thd,
char *part_syntax_buf;
uint syntax_len;
handlerton *engine_type;
- if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ if (create_info->tmp_table())
{
my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
goto err;
@@ -4270,9 +4212,8 @@ bool mysql_create_table_no_lock(THD *thd,
delete file;
create_info->db_type= partition_hton;
if (!(file= get_ha_partition(part_info)))
- {
- DBUG_RETURN(TRUE);
- }
+ DBUG_RETURN(NULL);
+
/*
If we have default number of partitions or subpartitions we
might require to set-up the part_info object such that it
@@ -4314,193 +4255,188 @@ bool mysql_create_table_no_lock(THD *thd,
engine_type)))
{
mem_alloc_error(sizeof(handler));
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(NULL);
}
}
}
#endif
- if (mysql_prepare_create_table(thd, create_info, alter_info,
- internal_tmp_table,
- &db_options, file,
- &key_info_buffer, &key_count,
- select_field_count))
+ if (mysql_prepare_create_table(thd, create_info, alter_info, &db_options,
+ file, &key_info_buffer, &key_count,
+ create_table_mode))
goto err;
+ create_info->table_options=db_options;
- /* Check if table exists */
- if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
- {
- path_length= build_tmptable_filename(thd, path, sizeof(path));
- create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE;
- }
- else
- {
- path_length= build_table_filename(path, sizeof(path) - 1, db, alias, reg_ext,
- internal_tmp_table ? FN_IS_TMP : 0);
- }
+ *frm= build_frm_image(thd, table_name, create_info,
+ alter_info->create_list, key_count,
+ key_info_buffer, file);
+
+ if (frm->str)
+ DBUG_RETURN(file);
+
+err:
+ delete file;
+ DBUG_RETURN(NULL);
+}
+
+
+/*
+ Create a table
+
+ SYNOPSIS
+ mysql_create_table_no_lock()
+ thd Thread object
+ db Database
+ table_name Table name
+ create_info Create information (like MAX_ROWS)
+ fields List of fields to create
+ keys List of keys to create
+ is_trans identifies the type of engine where the table
+ was created: either trans or non-trans.
+ create_table_mode C_ORDINARY_CREATE, C_ALTER_TABLE, C_ASSISTED_DISCOVERY
+ or any positive number (for C_CREATE_SELECT).
- /* Check if table already exists */
- if ((create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
- find_temporary_table(thd, db, table_name))
+ DESCRIPTION
+ If one creates a temporary table, this is automatically opened
+
+ Note that this function assumes that caller already have taken
+ exclusive metadata lock on table being created or used some other
+ way to ensure that concurrent operations won't intervene.
+ mysql_create_table() is a wrapper that can be used for this.
+
+ select_field_count is also used for CREATE ... SELECT,
+ and must be zero for standard create of table.
+
+ RETURN VALUES
+ FALSE OK
+ TRUE error
+*/
+
+bool mysql_create_table_no_lock(THD *thd,
+ const char *db, const char *table_name,
+ HA_CREATE_INFO *create_info,
+ Alter_info *alter_info, bool *is_trans,
+ int create_table_mode)
+{
+ char path[FN_REFLEN + 1];
+ uint path_length;
+ const char *alias;
+ handler *file= 0;
+ LEX_CUSTRING frm= {0,0};
+ bool error= TRUE;
+ bool internal_tmp_table= create_table_mode == C_ALTER_TABLE ||
+ create_table_mode == C_ALTER_TABLE_FRM_ONLY;
+ DBUG_ENTER("mysql_create_table_no_lock");
+ DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d",
+ db, table_name, internal_tmp_table));
+
+ if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
{
- if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
- goto warn;
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
- goto err;
+ if (create_info->data_file_name)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "DATA DIRECTORY");
+ if (create_info->index_file_name)
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
+ "INDEX DIRECTORY");
+ create_info->data_file_name= create_info->index_file_name= 0;
}
+ else
+ if (error_if_data_home_dir(create_info->data_file_name, "DATA DIRECTORY") ||
+ error_if_data_home_dir(create_info->index_file_name, "INDEX DIRECTORY")||
+ check_partition_dirs(thd->lex->part_info))
+ goto err;
- /* Give warnings for not supported table options */
-#if defined(WITH_ARIA_STORAGE_ENGINE)
- extern handlerton *maria_hton;
- if (file->ht != maria_hton)
-#endif
- if (create_info->transactional)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA_CREATE_OPTION,
- ER(ER_ILLEGAL_HA_CREATE_OPTION),
- file->engine_name()->str,
- "TRANSACTIONAL=1");
+ alias= table_case_name(create_info, table_name);
- if (!internal_tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ /* Check if table exists */
+ if (create_info->tmp_table())
{
- if (check_table_file_presence(NULL, path, db, table_name, table_name,
- !(create_info->options &
- HA_LEX_CREATE_IF_NOT_EXISTS)))
+ path_length= build_tmptable_filename(thd, path, sizeof(path));
+ path[path_length - reg_ext_length]= '\0'; // Remove .frm extension
+
+ if (find_temporary_table(thd, db, table_name))
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
goto warn;
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
goto err;
}
- /*
- We don't assert here, but check the result, because the table could be
- in the table definition cache and in the same time the .frm could be
- missing from the disk, in case of manual intervention which deletes
- the .frm file. The user has to use FLUSH TABLES; to clear the cache.
- Then she could create the table. This case is pretty obscure and
- therefore we don't introduce a new error message only for it.
- */
- mysql_mutex_lock(&LOCK_open);
- if (get_cached_table_share(db, table_name))
- {
- mysql_mutex_unlock(&LOCK_open);
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
- goto err;
- }
- mysql_mutex_unlock(&LOCK_open);
}
-
- /*
- Check that table with given name does not already
- exist in any storage engine. In such a case it should
- be discovered and the error ER_TABLE_EXISTS_ERROR be returned
- unless user specified CREATE TABLE IF EXISTS
- An exclusive metadata lock ensures that no
- one else is attempting to discover the table. Since
- it's not on disk as a frm file, no one could be using it!
- */
- if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ else
{
- bool create_if_not_exists =
- create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
- int retcode = ha_table_exists_in_engine(thd, db, table_name);
- DBUG_PRINT("info", ("exists_in_engine: %u",retcode));
- switch (retcode)
- {
- case HA_ERR_NO_SUCH_TABLE:
- /* Normal case, no table exists. we can go and create it */
- break;
- case HA_ERR_TABLE_EXIST:
- DBUG_PRINT("info", ("Table existed in handler"));
+ path_length= build_table_filename(path, sizeof(path) - 1, db, alias, "",
+ internal_tmp_table ? FN_IS_TMP : 0);
- if (create_if_not_exists)
- goto warn;
- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
- goto err;
- default:
- DBUG_PRINT("info", ("error: %u from storage engine", retcode));
- my_error(retcode, MYF(0),table_name);
- goto err;
+ if (!internal_tmp_table && ha_table_exists(thd, db, table_name))
+ {
+ if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
+ goto warn;
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+ goto err;
}
}
THD_STAGE_INFO(thd, stage_creating_table);
-#ifdef HAVE_READLINK
+ if (create_table_mode == C_ASSISTED_DISCOVERY)
{
- size_t dirlen;
- char dirpath[FN_REFLEN];
+ /* check that it's used correctly */
+ DBUG_ASSERT(alter_info->create_list.elements == 0);
+ DBUG_ASSERT(alter_info->key_list.elements == 0);
- /*
- data_file_name and index_file_name include the table name without
- extension. Mostly this does not refer to an existing file. When
- comparing data_file_name or index_file_name against the data
- directory, we try to resolve all symbolic links. On some systems,
- we use realpath(3) for the resolution. This returns ENOENT if the
- resolved path does not refer to an existing file. my_realpath()
- does then copy the requested path verbatim, without symlink
- resolution. Thereafter the comparison can fail even if the
- requested path is within the data directory. E.g. if symlinks to
- another file system are used. To make realpath(3) return the
- resolved path, we strip the table name and compare the directory
- path only. If the directory doesn't exist either, table creation
- will fail anyway.
- */
- if (create_info->data_file_name)
+ TABLE_SHARE share;
+ handlerton *hton= create_info->db_type;
+ int ha_err;
+ Field *no_fields= 0;
+
+ if (!hton->discover_table_structure)
{
- dirname_part(dirpath, create_info->data_file_name, &dirlen);
- if (test_if_data_home_dir(dirpath))
- {
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATA DIRECTORY");
- goto err;
- }
+ my_error(ER_ILLEGAL_HA, MYF(0), hton_name(hton)->str, db, table_name);
+ goto err;
}
- if (create_info->index_file_name)
+
+ init_tmp_table_share(thd, &share, db, 0, table_name, path);
+
+ /* prepare everything for discovery */
+ share.field= &no_fields;
+ share.db_plugin= ha_lock_engine(thd, hton);
+ share.option_list= create_info->option_list;
+ share.connect_string= create_info->connect_string;
+
+ if (parse_engine_table_options(thd, hton, &share))
+ goto err;
+
+ ha_err= hton->discover_table_structure(hton, thd, &share, create_info);
+ free_table_share(&share);
+
+ if (ha_err)
{
- dirname_part(dirpath, create_info->index_file_name, &dirlen);
- if (test_if_data_home_dir(dirpath))
- {
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "INDEX DIRECTORY");
- goto err;
- }
+ my_error(ER_GET_ERRNO, MYF(0), ha_err, hton_name(hton)->str);
+ goto err;
}
}
-
-#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (check_partition_dirs(thd->lex->part_info))
- {
- goto err;
- }
-#endif /* WITH_PARTITION_STORAGE_ENGINE */
-
- if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
-#endif /* HAVE_READLINK */
+ else
{
- if (create_info->data_file_name)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
- "DATA DIRECTORY");
- if (create_info->index_file_name)
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED),
- "INDEX DIRECTORY");
- create_info->data_file_name= create_info->index_file_name= 0;
+ file= mysql_create_frm_image(thd, db, table_name, create_info, alter_info,
+ create_table_mode, &frm);
+ if (!file)
+ goto err;
+ if (rea_create_table(thd, &frm, path, db, table_name, create_info,
+ create_table_mode == C_ALTER_TABLE_FRM_ONLY ? 0 : file))
+ goto err;
}
- create_info->table_options=db_options;
- path[path_length - reg_ext_length]= '\0'; // Remove .frm extension
- if (rea_create_table(thd, path, db, table_name,
- create_info, alter_info->create_list,
- key_count, key_info_buffer, file))
- goto err;
-
- if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ if (create_info->tmp_table())
{
/*
Open a table (skipping table cache) and add it into
THD::temporary_tables list.
*/
- TABLE *table= open_table_uncached(thd, path, db, table_name, TRUE);
+ TABLE *table= open_table_uncached(thd, create_info->db_type, path,
+ db, table_name, TRUE);
if (!table)
{
@@ -4514,7 +4450,7 @@ bool mysql_create_table_no_lock(THD *thd,
thd->thread_specific_used= TRUE;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
- else if (part_info && create_info->frm_only)
+ else if (thd->work_part_info && create_table_mode == C_ALTER_TABLE_FRM_ONLY)
{
/*
For partitioned tables we can't find some problems with table
@@ -4530,7 +4466,7 @@ bool mysql_create_table_no_lock(THD *thd,
create_info, file))
{
char frm_name[FN_REFLEN];
- strxmov(frm_name, path, reg_ext, NullS);
+ strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
(void) mysql_file_delete(key_file_frm, frm_name, MYF(0));
goto err;
}
@@ -4540,6 +4476,7 @@ bool mysql_create_table_no_lock(THD *thd,
error= FALSE;
err:
THD_STAGE_INFO(thd, stage_after_create);
+ my_free(const_cast<uchar*>(frm.str));
delete file;
DBUG_RETURN(error);
@@ -4551,7 +4488,6 @@ warn:
goto err;
}
-
/**
Implementation of SQLCOM_CREATE_TABLE.
@@ -4566,41 +4502,38 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
HA_CREATE_INFO *create_info,
Alter_info *alter_info)
{
- bool result;
+ const char *db= create_table->db;
+ const char *table_name= create_table->table_name;
bool is_trans= FALSE;
+ int create_table_mode;
DBUG_ENTER("mysql_create_table");
- /*
- Open or obtain an exclusive metadata lock on table being created.
- */
+ /* Open or obtain an exclusive metadata lock on table being created */
if (open_and_lock_tables(thd, thd->lex->query_tables, FALSE, 0))
{
/* is_error() may be 0 if table existed and we generated a warning */
- result= thd->is_error();
- goto end;
+ DBUG_RETURN(thd->is_error());
}
/* Got lock. */
DEBUG_SYNC(thd, "locked_table_name");
+ if (alter_info->create_list.elements || alter_info->key_list.elements)
+ create_table_mode= C_ORDINARY_CREATE;
+ else
+ create_table_mode= C_ASSISTED_DISCOVERY;
+
promote_first_timestamp_column(&alter_info->create_list);
- result= mysql_create_table_no_lock(thd, create_table->db,
- create_table->table_name, create_info,
- alter_info, FALSE, 0, &is_trans);
+ if (mysql_create_table_no_lock(thd, db, table_name, create_info, alter_info,
+ &is_trans, create_table_mode))
+ DBUG_RETURN(1);
- /*
- Don't write statement if:
- - Table creation has failed
- - Row-based logging is used and we are creating a temporary table
- Otherwise, the statement shall be binlogged.
- */
- if (!result &&
- (!thd->is_current_stmt_binlog_format_row() ||
- (thd->is_current_stmt_binlog_format_row() &&
- !(create_info->options & HA_LEX_CREATE_TMP_TABLE))))
- result= write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans);
+ /* In RBR we don't need to log CREATE TEMPORARY TABLE */
+ if (thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
+ DBUG_RETURN(0);
-end:
+ bool result;
+ result= write_bin_log(thd, TRUE, thd->query(), thd->query_length(), is_trans);
DBUG_RETURN(result);
}
@@ -4720,9 +4653,13 @@ mysql_rename_table(handlerton *base, const char *old_db,
if (!(flags & NO_FRM_RENAME) && rename_file_ext(from,to,reg_ext))
{
error=my_errno;
- /* Restore old file name */
if (file)
- file->ha_rename_table(to_base, from_base);
+ {
+ if (error == ENOENT)
+ error= 0; // this is ok if file->ha_rename_table() succeeded
+ else
+ file->ha_rename_table(to_base, from_base); // Restore old file name
+ }
}
}
delete file;
@@ -4820,7 +4757,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
local_create_info.options|= create_info->options&HA_LEX_CREATE_IF_NOT_EXISTS;
/* Replace type of source table with one specified in the statement. */
local_create_info.options&= ~HA_LEX_CREATE_TMP_TABLE;
- local_create_info.options|= create_info->options & HA_LEX_CREATE_TMP_TABLE;
+ local_create_info.options|= create_info->tmp_table();
/* Reset auto-increment counter for the new table. */
local_create_info.auto_increment_value= 0;
/*
@@ -4831,14 +4768,14 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
if ((res= mysql_create_table_no_lock(thd, table->db, table->table_name,
&local_create_info, &local_alter_info,
- FALSE, 0, &is_trans)))
+ &is_trans, C_ORDINARY_CREATE)))
goto err;
/*
Ensure that we have an exclusive lock on target table if we are creating
non-temporary table.
*/
- DBUG_ASSERT((create_info->options & HA_LEX_CREATE_TMP_TABLE) ||
+ DBUG_ASSERT((create_info->tmp_table()) ||
thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->db,
table->table_name,
MDL_EXCLUSIVE));
@@ -4865,7 +4802,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
4 temporary temporary Nothing
==== ========= ========= ==============================
*/
- if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
+ if (!(create_info->tmp_table()))
{
if (src_table->table->s->tmp_table) // Case 2
{
@@ -5032,6 +4969,246 @@ is_index_maintenance_unique (TABLE *table, Alter_info *alter_info)
/*
+ Preparation for table creation
+
+ SYNOPSIS
+ handle_if_exists_option()
+ thd Thread object.
+ table The altered table.
+ alter_info List of columns and indexes to create
+
+ DESCRIPTION
+ Looks for the IF [NOT] EXISTS options, checks the states and remove items
+ from the list if existing found.
+
+ RETURN VALUES
+ NONE
+*/
+
+static void
+handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info)
+{
+ Field **f_ptr;
+ DBUG_ENTER("handle_if_exists_option");
+
+ /* Handle ADD COLUMN IF NOT EXISTS. */
+ {
+ List_iterator<Create_field> it(alter_info->create_list);
+ Create_field *sql_field;
+
+ while ((sql_field=it++))
+ {
+ if (!sql_field->create_if_not_exists || sql_field->change)
+ continue;
+ /*
+ If there is a field with the same name in the table already,
+ remove the sql_field from the list.
+ */
+ for (f_ptr=table->field; *f_ptr; f_ptr++)
+ {
+ if (my_strcasecmp(system_charset_info,
+ sql_field->field_name, (*f_ptr)->field_name) == 0)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME),
+ sql_field->field_name);
+ it.remove();
+ if (alter_info->create_list.is_empty())
+ {
+ alter_info->flags&= ~ALTER_ADD_COLUMN;
+ if (alter_info->key_list.is_empty())
+ alter_info->flags&= ~ALTER_ADD_INDEX;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ /* Handle MODIFY COLUMN IF EXISTS. */
+ {
+ List_iterator<Create_field> it(alter_info->create_list);
+ Create_field *sql_field;
+
+ while ((sql_field=it++))
+ {
+ if (!sql_field->create_if_not_exists || !sql_field->change)
+ continue;
+ /*
+ If there is NO field with the same name in the table already,
+ remove the sql_field from the list.
+ */
+ for (f_ptr=table->field; *f_ptr; f_ptr++)
+ {
+ if (my_strcasecmp(system_charset_info,
+ sql_field->field_name, (*f_ptr)->field_name) == 0)
+ {
+ break;
+ }
+ }
+ if (*f_ptr == NULL)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_BAD_FIELD_ERROR, ER(ER_BAD_FIELD_ERROR),
+ sql_field->change, table->s->table_name.str);
+ it.remove();
+ if (alter_info->create_list.is_empty())
+ {
+ alter_info->flags&= ~(ALTER_ADD_COLUMN | ALTER_CHANGE_COLUMN);
+ if (alter_info->key_list.is_empty())
+ alter_info->flags&= ~ALTER_ADD_INDEX;
+ }
+ }
+ }
+ }
+
+ /* Handle DROP COLUMN/KEY IF EXISTS. */
+ {
+ List_iterator<Alter_drop> drop_it(alter_info->drop_list);
+ Alter_drop *drop;
+ bool remove_drop;
+ while ((drop= drop_it++))
+ {
+ if (!drop->drop_if_exists)
+ continue;
+ remove_drop= TRUE;
+ if (drop->type == Alter_drop::COLUMN)
+ {
+ /*
+ If there is NO field with that name in the table,
+ remove the 'drop' from the list.
+ */
+ for (f_ptr=table->field; *f_ptr; f_ptr++)
+ {
+ if (my_strcasecmp(system_charset_info,
+ drop->name, (*f_ptr)->field_name) == 0)
+ {
+ remove_drop= FALSE;
+ break;
+ }
+ }
+ }
+ else /* Alter_drop::KEY */
+ {
+ uint n_key;
+ for (n_key=0; n_key < table->s->keys; n_key++)
+ {
+ if (my_strcasecmp(system_charset_info,
+ drop->name, table->key_info[n_key].name) == 0)
+ {
+ remove_drop= FALSE;
+ break;
+ }
+ }
+ }
+ if (remove_drop)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_CANT_DROP_FIELD_OR_KEY, ER(ER_CANT_DROP_FIELD_OR_KEY),
+ drop->name);
+ drop_it.remove();
+ if (alter_info->drop_list.is_empty())
+ alter_info->flags&= ~(ALTER_DROP_COLUMN | ALTER_DROP_INDEX);
+ }
+ }
+ }
+
+ /* ALTER TABLE ADD KEY IF NOT EXISTS */
+ /* ALTER TABLE ADD FOREIGN KEY IF NOT EXISTS */
+ {
+ Key *key;
+ List_iterator<Key> key_it(alter_info->key_list);
+ uint n_key;
+ while ((key=key_it++))
+ {
+ if (!key->create_if_not_exists)
+ continue;
+ for (n_key=0; n_key < table->s->keys; n_key++)
+ {
+ if (my_strcasecmp(system_charset_info,
+ key->name.str, table->key_info[n_key].name) == 0)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_DUP_KEYNAME, ER(ER_DUP_KEYNAME), key->name.str);
+ key_it.remove();
+ if (key->type == Key::FOREIGN_KEY)
+ {
+ /* ADD FOREIGN KEY appends two items. */
+ key_it.remove();
+ }
+ if (alter_info->key_list.is_empty())
+ alter_info->flags&= ~ALTER_ADD_INDEX;
+ break;
+ }
+ }
+ }
+ }
+
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ partition_info *tab_part_info= table->part_info;
+ if (tab_part_info && thd->lex->check_exists)
+ {
+ /* ALTER TABLE ADD PARTITION IF NOT EXISTS */
+ if (alter_info->flags & ALTER_ADD_PARTITION)
+ {
+ partition_info *alt_part_info= thd->lex->part_info;
+ if (alt_part_info)
+ {
+ List_iterator<partition_element> new_part_it(alt_part_info->partitions);
+ partition_element *pe;
+ while ((pe= new_part_it++))
+ {
+ if (!tab_part_info->has_unique_name(pe))
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_SAME_NAME_PARTITION, ER(ER_SAME_NAME_PARTITION),
+ pe->partition_name);
+ alter_info->flags&= ~ALTER_ADD_PARTITION;
+ thd->lex->part_info= NULL;
+ break;
+ }
+ }
+ }
+ }
+ /* ALTER TABLE DROP PARTITION IF EXISTS */
+ if (alter_info->flags & ALTER_DROP_PARTITION)
+ {
+ List_iterator<char> names_it(alter_info->partition_names);
+ char *name;
+
+ while ((name= names_it++))
+ {
+ List_iterator<partition_element> part_it(tab_part_info->partitions);
+ partition_element *part_elem;
+ while ((part_elem= part_it++))
+ {
+ if (my_strcasecmp(system_charset_info,
+ part_elem->partition_name, name) == 0)
+ break;
+ }
+ if (!part_elem)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_DROP_PARTITION_NON_EXISTENT,
+ ER(ER_DROP_PARTITION_NON_EXISTENT), "DROP");
+ names_it.remove();
+ }
+ }
+ if (alter_info->partition_names.elements == 0)
+ alter_info->flags&= ~ALTER_DROP_PARTITION;
+ }
+ }
+#endif /*WITH_PARTITION_STORAGE_ENGINE*/
+
+ /* Clear the ALTER_FOREIGN_KEY flag if nothing other than that set. */
+ if (alter_info->flags == ALTER_FOREIGN_KEY)
+ alter_info->flags= 0;
+
+ DBUG_VOID_RETURN;
+}
+
+
+/*
SYNOPSIS
mysql_compare_tables()
table The original table.
@@ -5123,12 +5300,11 @@ mysql_compare_tables(TABLE *table,
*need_copy_table= ALTER_TABLE_DATA_CHANGED;
/* Create the prepared information. */
- if (mysql_prepare_create_table(thd, create_info,
- &tmp_alter_info,
- (table->s->tmp_table != NO_TMP_TABLE),
- &db_options,
- table->file, key_info_buffer,
- &key_count, 0))
+ int create_table_mode= table->s->tmp_table == NO_TMP_TABLE ?
+ C_ORDINARY_CREATE : C_ALTER_TABLE;
+ if (mysql_prepare_create_table(thd, create_info, &tmp_alter_info,
+ &db_options, table->file, key_info_buffer,
+ &key_count, create_table_mode))
DBUG_RETURN(1);
/* Allocate result buffers. */
if (! (*index_drop_buffer=
@@ -5494,6 +5670,7 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
switch (keys_onoff) {
case ENABLE:
+ DEBUG_SYNC(table->in_use, "alter_table_enable_indexes");
error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
break;
case LEAVE_AS_IS:
@@ -5508,7 +5685,8 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled,
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
- table->s->table_name.str);
+ table->file->table_type(),
+ table->s->db.str, table->s->table_name.str);
error= 0;
} else if (error)
table->file->print_error(error, MYF(0));
@@ -5950,7 +6128,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
key= new Key(key_type, key_name, strlen(key_name),
&key_create_info,
test(key_info->flags & HA_GENERATED_KEY),
- key_parts, key_info->option_list);
+ key_parts, key_info->option_list, FALSE);
new_key_list.push_back(key);
}
}
@@ -6069,13 +6247,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
TABLE *table, *new_table= 0;
MDL_ticket *mdl_ticket;
MDL_request target_mdl_request;
- int error= 0;
+ int error= 0, create_table_mode= C_ALTER_TABLE;
char tmp_name[80],old_name[32],new_name_buff[FN_REFLEN + 1];
- char old_name_buff[FN_REFLEN + 1];
char new_alias_buff[FN_REFLEN], *table_name, *db, *new_alias, *alias;
char index_file[FN_REFLEN], data_file[FN_REFLEN];
char path[FN_REFLEN + 1];
- char reg_path[FN_REFLEN+1];
ha_rows copied,deleted;
handlerton *old_db_type, *new_db_type, *save_old_db_type;
enum_alter_table_change_level need_copy_table= ALTER_TABLE_METADATA_ONLY;
@@ -6130,7 +6306,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
(!create_info->db_type || /* unknown engine */
!(create_info->db_type->flags & HTON_SUPPORT_LOG_TABLES)))
{
- my_error(ER_UNSUPORTED_LOG_ENGINE, MYF(0));
+ my_error(ER_UNSUPORTED_LOG_ENGINE, MYF(0),
+ hton_name(create_info->db_type)->str);
DBUG_RETURN(TRUE);
}
@@ -6145,7 +6322,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
/*
- Assign variables table_name, new_name, db, new_db, path, reg_path
+ Assign variables table_name, new_name, db, new_db, path,
to simplify further comparisions: we want to see if it's a RENAME
later just by comparing the pointers, avoiding the need for strcmp.
*/
@@ -6155,7 +6332,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
db=table_list->db;
if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db))
new_db= db;
- build_table_filename(reg_path, sizeof(reg_path) - 1, db, table_name, reg_ext, 0);
build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0);
mysql_ha_rm_tables(thd, table_list);
@@ -6278,12 +6454,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
*/
build_table_filename(new_name_buff, sizeof(new_name_buff) - 1,
new_db, new_name_buff, reg_ext, 0);
- build_table_filename(old_name_buff, sizeof(old_name_buff) - 1,
- db, table_name, reg_ext, 0);
- if (check_table_file_presence(old_name_buff, new_name_buff, new_db,
- new_name, new_alias, TRUE))
+ if (!access(new_name_buff, F_OK))
{
/* Table will be closed in do_command() */
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
goto err;
}
}
@@ -6349,11 +6523,19 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_PRINT("info", ("old type: %s new type: %s",
ha_resolve_storage_engine_name(old_db_type),
ha_resolve_storage_engine_name(new_db_type)));
- if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED) ||
- ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED))
+ if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED))
+ {
+ DBUG_PRINT("info", ("doesn't support alter"));
+ my_error(ER_ILLEGAL_HA, MYF(0), hton_name(old_db_type)->str,
+ db, table_name);
+ goto err;
+ }
+
+ if (ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED))
{
DBUG_PRINT("info", ("doesn't support alter"));
- my_error(ER_ILLEGAL_HA, MYF(0), table_name);
+ my_error(ER_ILLEGAL_HA, MYF(0), hton_name(new_db_type)->str,
+ new_db, new_name);
goto err;
}
@@ -6361,31 +6543,13 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) &&
!table->s->tmp_table) // no need to touch frm
{
- switch (alter_info->keys_onoff) {
- case LEAVE_AS_IS:
- break;
- case ENABLE:
- if (wait_while_table_is_used(thd, table, extra_func))
- goto err;
- DEBUG_SYNC(thd,"alter_table_enable_indexes");
- error= table->file->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
- break;
- case DISABLE:
- if (wait_while_table_is_used(thd, table, extra_func))
- goto err;
- error=table->file->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
- break;
- default:
- DBUG_ASSERT(FALSE);
- error= 0;
- break;
- }
- if (error == HA_ERR_WRONG_COMMAND)
+ if (alter_info->keys_onoff != LEAVE_AS_IS)
{
- error= 0;
- push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
- ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
- table->alias.c_ptr());
+ if (wait_while_table_is_used(thd, table, extra_func,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
+ goto err;
+ error= alter_table_manage_keys(table, 0, alter_info->keys_onoff);
+ table->s->allow_access_to_protected_table();
}
if (!error && (new_name != table_name || new_db != db))
@@ -6399,7 +6563,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
simple rename did nothing and therefore we can safely return
without additional clean-up.
*/
- if (wait_while_table_is_used(thd, table, extra_func))
+ if (wait_while_table_is_used(thd, table, extra_func,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
goto err;
close_all_tables_for_name(thd, table->s, HA_EXTRA_PREPARE_FOR_RENAME);
/*
@@ -6442,7 +6607,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error= 0;
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
- table->alias.c_ptr());
+ table->file->table_type(),
+ table->s->db.str, table->s->table_name.str);
}
if (!error)
@@ -6475,6 +6641,17 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(error);
}
+ handle_if_exists_options(thd, table, alter_info);
+
+ /* Look if we have to do anything at all. */
+ /* Normally ALTER can become NOOP only after handling */
+ /* the IF (NOT) EXISTS options. */
+ if (alter_info->flags == 0)
+ {
+ copied= deleted= 0;
+ goto end_temporary;
+ }
+
/* We have to do full alter table. */
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -6735,13 +6912,17 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
need_copy_table, need_lock_for_indexes));
}
- /*
- better have a negative test here, instead of positive, like
- alter_info->flags & ALTER_ADD_COLUMN|ALTER_ADD_INDEX|...
- so that ALTER TABLE won't break when somebody will add new flag
- */
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
- create_info->frm_only= 1;
+ {
+ char frm_name[FN_REFLEN+1];
+ strxnmov(frm_name, sizeof(frm_name), path, reg_ext, NullS);
+ /*
+ C_ALTER_TABLE_FRM_ONLY can only be used if old frm exists.
+ discovering frm-less engines cannot enjoy this optimization.
+ */
+ if (!my_access(frm_name, F_OK))
+ create_table_mode= C_ALTER_TABLE_FRM_ONLY;
+ }
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (table_for_fast_alter_partition)
@@ -6810,13 +6991,13 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_sleep(100000););
/*
Create a table with a temporary name.
- With create_info->frm_only == 1 this creates a .frm file only and
+ With C_ALTER_TABLE_FRM_ONLY this creates a .frm file only and
we keep the original row format.
We don't log the statement, it will be logged later.
*/
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
{
- DBUG_ASSERT(create_info->frm_only);
+ DBUG_ASSERT(create_table_mode == C_ALTER_TABLE_FRM_ONLY);
/* Ensure we keep the original table format */
create_info->table_options= ((create_info->table_options &
~HA_OPTION_PACK_RECORD) |
@@ -6824,10 +7005,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
HA_OPTION_PACK_RECORD));
}
tmp_disable_binlog(thd);
- error= mysql_create_table_no_lock(thd, new_db, tmp_name,
- create_info,
- alter_info,
- 1, 0, NULL);
+ error= mysql_create_table_no_lock(thd, new_db, tmp_name, create_info,
+ alter_info, NULL, create_table_mode);
reenable_binlog(thd);
if (error)
goto err;
@@ -6839,6 +7018,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (table->s->tmp_table)
{
Open_table_context ot_ctx(thd, (MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_OPEN_FOR_REPAIR |
MYSQL_LOCK_IGNORE_TIMEOUT));
TABLE_LIST tbl;
bzero((void*) &tbl, sizeof(tbl));
@@ -6855,7 +7035,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
build_table_filename(path, sizeof(path) - 1, new_db, tmp_name, "",
FN_IS_TMP);
/* Open our intermediate table. */
- new_table= open_table_uncached(thd, path, new_db, tmp_name, TRUE);
+ new_table= open_table_uncached(thd, new_db_type, path,
+ new_db, tmp_name, TRUE);
}
if (!new_table)
goto err_new_table_cleanup;
@@ -6909,7 +7090,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
table->file->indexes_are_disabled())
need_lock_for_indexes= true;
if (!table->s->tmp_table && need_lock_for_indexes &&
- wait_while_table_is_used(thd, table, extra_func))
+ wait_while_table_is_used(thd, table, extra_func,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
goto err_new_table_cleanup;
THD_STAGE_INFO(thd, stage_manage_keys);
DEBUG_SYNC(thd, "alter_table_manage_keys");
@@ -6918,6 +7100,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error= trans_commit_stmt(thd);
if (trans_commit_implicit(thd))
error= 1;
+ /*
+ If the table was locked, allow one to still run SHOW commands against it
+ */
+ if (table->s->protected_against_usage())
+ table->s->allow_access_to_protected_table();
}
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
@@ -7129,7 +7316,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (lower_case_table_names)
my_casedn_str(files_charset_info, old_name);
- if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME))
+ if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_RENAME,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
{
if (pending_inplace_add_index)
{
@@ -7284,9 +7472,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
/* Tell the handler that a new frm file is in place. */
- error= t_table_list->table->file->ha_create_handler_files(path, NULL,
- CHF_INDEX_FLAG,
- create_info);
+ error= t_table_list->table->file->ha_create_partitioning_metadata(path, NULL,
+ CHF_INDEX_FLAG);
DBUG_ASSERT(thd->open_tables == t_table_list->table);
close_thread_table(thd, &thd->open_tables);
@@ -7309,7 +7496,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_ASSERT(!(mysql_bin_log.is_open() &&
thd->is_current_stmt_binlog_format_row() &&
- (create_info->options & HA_LEX_CREATE_TMP_TABLE)));
+ (create_info->tmp_table())));
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
DBUG_RETURN(TRUE);
@@ -7340,7 +7527,8 @@ err_new_table_cleanup:
}
else
(void) quick_rm_table(new_db_type, new_db, tmp_name,
- create_info->frm_only ? FN_IS_TMP | FRM_ONLY : FN_IS_TMP);
+ create_table_mode == C_ALTER_TABLE_FRM_ONLY ?
+ FN_IS_TMP | FRM_ONLY : FN_IS_TMP);
err:
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -7486,11 +7674,11 @@ copy_data_between_tables(THD *thd, TABLE *from,TABLE *to,
if (!(copy= new Copy_field[to->s->fields]))
goto err; /* purecov: inspected */
+ /* We need external lock before we can disable/enable keys */
if (to->file->ha_external_lock(thd, F_WRLCK))
goto err;
errpos= 2;
- /* We need external lock before we can disable/enable keys */
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
/* We can abort alter table for any table type */
@@ -7932,7 +8120,7 @@ static bool check_engine(THD *thd, const char *db_name,
ha_resolve_storage_engine_name(*new_engine),
table_name);
}
- if (create_info->options & HA_LEX_CREATE_TMP_TABLE &&
+ if (create_info->tmp_table() &&
ha_check_storage_engine_flag(*new_engine, HTON_TEMPORARY_NOT_SUPPORTED))
{
if (create_info->used_fields & HA_CREATE_USED_ENGINE)
diff --git a/sql/sql_table.h b/sql/sql_table.h
index 9d5e768a5a3..8bc6865decd 100644
--- a/sql/sql_table.h
+++ b/sql/sql_table.h
@@ -1,4 +1,5 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,8 +26,9 @@ struct TABLE_LIST;
class THD;
struct TABLE;
struct handlerton;
+class handler;
typedef struct st_ha_check_opt HA_CHECK_OPT;
-typedef struct st_ha_create_information HA_CREATE_INFO;
+struct HA_CREATE_INFO;
typedef struct st_key KEY;
typedef struct st_key_cache KEY_CACHE;
typedef struct st_lock_param_type ALTER_PARTITION_PARAM_TYPE;
@@ -131,18 +133,57 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext, uint flags);
uint build_table_shadow_filename(char *buff, size_t bufflen,
ALTER_PARTITION_PARAM_TYPE *lpt);
-bool check_table_file_presence(char *old_path, char *path, const char *db,
- const char *table_name, const char *alias,
- bool issue_error);
bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
HA_CREATE_INFO *create_info,
Alter_info *alter_info);
+
+/*
+ mysql_create_table_no_lock can be called in one of the following
+ mutually exclusive situations:
+
+ - Just a normal ordinary CREATE TABLE statement that explicitly
+ defines the table structure.
+
+ - CREATE TABLE ... SELECT. It is special, because only in this case,
+ the list of fields is allowed to have duplicates, as long as one of the
+ duplicates comes from the select list, and the other doesn't. For
+ example in
+
+ CREATE TABLE t1 (a int(5) NOT NUL) SELECT b+10 as a FROM t2;
+
+ the list in alter_info->create_list will have two fields `a`.
+
+ - ALTER TABLE, that creates a temporary table #sql-xxx, which will be later
+ renamed to replace the original table.
+
+ - ALTER TABLE as above, but which only modifies the frm file, it only
+ creates an frm file for the #sql-xxx, the table in the engine is not
+ created.
+
+ - Assisted discovery, CREATE TABLE statement without the table structure.
+
+ These situations are distinguished by the following "create table mode"
+ values, where a CREATE ... SELECT is denoted by any non-negative number
+ (which should be the number of fields in the SELECT ... part), and other
+ cases use constants as defined below.
+*/
+#define C_CREATE_SELECT(X) ((X) > 0 ? (X) : 0)
+#define C_ORDINARY_CREATE 0
+#define C_ALTER_TABLE -1
+#define C_ALTER_TABLE_FRM_ONLY -2
+#define C_ASSISTED_DISCOVERY -3
+
bool mysql_create_table_no_lock(THD *thd, const char *db,
const char *table_name,
HA_CREATE_INFO *create_info,
+ Alter_info *alter_info, bool *is_trans,
+ int create_table_mode);
+
+handler *mysql_create_frm_image(THD *thd,
+ const char *db, const char *table_name,
+ HA_CREATE_INFO *create_info,
Alter_info *alter_info,
- bool tmp_table, uint select_field_count,
- bool *is_trans);
+ int create_table_mode, LEX_CUSTRING *frm);
bool mysql_prepare_alter_table(THD *thd, TABLE *table,
HA_CREATE_INFO *create_info,
Alter_info *alter_info);
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 57dbd979933..89c2e3b7086 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -302,6 +302,9 @@ str_to_datetime_with_warn(CHARSET_INFO *cs,
make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
str, length, flags & TIME_TIME_ONLY ?
MYSQL_TIMESTAMP_TIME : ts_type, NullS);
+ DBUG_EXECUTE_IF("str_to_datetime_warn",
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_YES, str););
return ts_type;
}
@@ -1014,13 +1017,13 @@ calc_time_diff(MYSQL_TIME *l_time1, MYSQL_TIME *l_time2, int l_sign, longlong *s
(uint) l_time2->day);
}
- microseconds= ((longlong)days*LL(86400) +
+ microseconds= ((longlong)days*86400LL +
(longlong)(l_time1->hour*3600L +
l_time1->minute*60L +
l_time1->second) -
l_sign*(longlong)(l_time2->hour*3600L +
l_time2->minute*60L +
- l_time2->second)) * LL(1000000) +
+ l_time2->second)) * 1000000LL +
(longlong)l_time1->second_part -
l_sign*(longlong)l_time2->second_part;
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index d7d902bc6b0..35a4464b9e2 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -443,7 +443,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if (!create)
{
- bool if_exists= thd->lex->drop_if_exists;
+ bool if_exists= thd->lex->check_exists;
/*
Protect the query table list from the temporary and potentially
@@ -701,10 +701,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
thd->security_ctx->priv_host)))
{
if (check_global_access(thd, SUPER_ACL))
- {
- my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
return TRUE;
- }
}
/*
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 4b77344c042..19ce553f5ce 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -258,27 +258,18 @@ static bool recreate_temporary_table(THD *thd, TABLE *table)
{
bool error= TRUE;
TABLE_SHARE *share= table->s;
- HA_CREATE_INFO create_info;
handlerton *table_type= table->s->db_type();
DBUG_ENTER("recreate_temporary_table");
- memset(&create_info, 0, sizeof(create_info));
- create_info.options|= HA_LEX_CREATE_TMP_TABLE;
-
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
/* Don't free share. */
close_temporary_table(thd, table, FALSE, FALSE);
- /*
- We must use share->normalized_path.str since for temporary tables it
- differs from what dd_recreate_table() would generate based
- on table and schema names.
- */
- ha_create_table(thd, share->normalized_path.str, share->db.str,
- share->table_name.str, &create_info, 1);
+ dd_recreate_table(thd, share->db.str, share->table_name.str,
+ share->normalized_path.str);
- if (open_table_uncached(thd, share->path.str, share->db.str,
+ if (open_table_uncached(thd, table_type, share->path.str, share->db.str,
share->table_name.str, TRUE))
{
error= FALSE;
@@ -350,9 +341,27 @@ bool Truncate_statement::lock_table(THD *thd, TABLE_LIST *table_ref,
MYSQL_OPEN_SKIP_TEMPORARY))
DBUG_RETURN(TRUE);
- if (dd_check_storage_engine_flag(thd, table_ref->db, table_ref->table_name,
- HTON_CAN_RECREATE, hton_can_recreate))
+ handlerton *hton;
+ if (!ha_table_exists(thd, table_ref->db, table_ref->table_name, &hton) ||
+ hton == view_pseudo_hton)
+ {
+ my_error(ER_NO_SUCH_TABLE, MYF(0), table_ref->db, table_ref->table_name);
DBUG_RETURN(TRUE);
+ }
+
+ if (!hton)
+ {
+ /*
+ The table exists, but its storage engine is unknown, perhaps not
+ loaded at the moment. We need to open and parse the frm to know the
+ storage engine in question, so let's proceed with the truncation and
+ try to open the table. This will produce the correct error message
+ about unknown engine.
+ */
+ *hton_can_recreate= false;
+ }
+ else
+ *hton_can_recreate= hton->flags & HTON_CAN_RECREATE;
}
/*
@@ -364,7 +373,8 @@ bool Truncate_statement::lock_table(THD *thd, TABLE_LIST *table_ref,
{
DEBUG_SYNC(thd, "upgrade_lock_for_truncate");
/* To remove the table from the cache we need an exclusive lock. */
- if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DROP))
+ if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DROP,
+ TDC_RT_REMOVE_NOT_OWN_AND_MARK_NOT_USABLE))
DBUG_RETURN(TRUE);
m_ticket_downgrade= table->mdl_ticket;
/* Close if table is going to be recreated. */
diff --git a/sql/sql_udf.h b/sql/sql_udf.h
index cdb15b9e0f5..4aa055b9858 100644
--- a/sql/sql_udf.h
+++ b/sql/sql_udf.h
@@ -103,14 +103,14 @@ class udf_handler :public Sql_alloc
if (get_arguments())
{
*null_value=1;
- return LL(0);
+ return 0;
}
Udf_func_longlong func= (Udf_func_longlong) u_d->func;
longlong tmp=func(&initid, &f_args, &is_null, &error);
if (is_null || error)
{
*null_value=1;
- return LL(0);
+ return 0;
}
*null_value=0;
return tmp;
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 0d1cb7de5f2..8413f612111 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1573,6 +1573,15 @@ int multi_update::prepare(List<Item> &not_used_values,
DBUG_RETURN(thd->is_fatal_error != 0);
}
+void multi_update::update_used_tables()
+{
+ Item *item;
+ List_iterator_fast<Item> it(*values);
+ while ((item= it++))
+ {
+ item->update_used_tables();
+ }
+}
/*
Check if table is safe to update on fly
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 02f70c12ad2..5b5bd0ed2fc 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
- Copyright (c) 2011 Monty Program Ab
+ Copyright (c) 2011, 2013, Monty Program Ab
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
@@ -33,7 +33,7 @@
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
-#include "datadict.h" // dd_frm_type()
+#include "datadict.h" // dd_frm_is_view()
#define MD5_BUFF_LENGTH 33
@@ -211,16 +211,12 @@ static void make_valid_column_names(List<Item> &item_list)
static bool
fill_defined_view_parts (THD *thd, TABLE_LIST *view)
{
- char key[MAX_DBKEY_LENGTH];
- uint key_length;
LEX *lex= thd->lex;
TABLE_LIST decoy;
memcpy (&decoy, view, sizeof (TABLE_LIST));
- key_length= create_table_def_key(thd, key, view, 0);
-
- if (tdc_open_view(thd, &decoy, decoy.alias, key, key_length,
- thd->mem_root, OPEN_VIEW_NO_PARSE))
+ if (tdc_open_view(thd, &decoy, decoy.alias, thd->mem_root,
+ OPEN_VIEW_NO_PARSE))
return TRUE;
if (!lex->definer)
@@ -871,7 +867,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view->source= thd->lex->create_view_select;
if (!thd->make_lex_string(&view->select_stmt, view_query.ptr(),
- view_query.length(), false))
+ view_query.length()))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
error= -1;
@@ -1004,7 +1000,7 @@ loop_out:
view->view_creation_ctx->get_connection_cl()->name);
if (!thd->make_lex_string(&view->view_body_utf8, is_query.ptr(),
- is_query.length(), false))
+ is_query.length()))
{
my_error(ER_OUT_OF_RESOURCES, MYF(0));
error= -1;
@@ -1646,7 +1642,6 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
String non_existant_views;
char *wrong_object_db= NULL, *wrong_object_name= NULL;
bool error= FALSE;
- enum legacy_db_type not_used;
bool some_views_deleted= FALSE;
bool something_wrong= FALSE;
DBUG_ENTER("mysql_drop_view");
@@ -1669,23 +1664,28 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
for (view= views; view; view= view->next_local)
{
- frm_type_enum type= FRMTYPE_ERROR;
+ bool not_exist;
build_table_filename(path, sizeof(path) - 1,
view->db, view->table_name, reg_ext, 0);
- if (access(path, F_OK) ||
- FRMTYPE_VIEW != (type= dd_frm_type(thd, path, &not_used)))
+ if ((not_exist= my_access(path, F_OK)) || !dd_frm_is_view(thd, path))
{
char name[FN_REFLEN];
my_snprintf(name, sizeof(name), "%s.%s", view->db, view->table_name);
- if (thd->lex->drop_if_exists)
+ if (thd->lex->check_exists)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
name);
continue;
}
- if (type == FRMTYPE_TABLE)
+ if (not_exist)
+ {
+ if (non_existant_views.length())
+ non_existant_views.append(',');
+ non_existant_views.append(String(view->table_name,system_charset_info));
+ }
+ else
{
if (!wrong_object_name)
{
@@ -1693,12 +1693,6 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
wrong_object_name= view->table_name;
}
}
- else
- {
- if (non_existant_views.length())
- non_existant_views.append(',');
- non_existant_views.append(String(view->table_name,system_charset_info));
- }
continue;
}
if (mysql_file_delete(key_file_frm, path, MYF(MY_WME)))
@@ -1707,9 +1701,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
some_views_deleted= TRUE;
/*
- For a view, there is a TABLE_SHARE object, but its
- ref_count never goes above 1. Remove it from the table
- definition cache, in case the view was cached.
+ For a view, there is a TABLE_SHARE object.
+ Remove it from the table definition cache, in case the view was cached.
*/
tdc_remove_table(thd, TDC_RT_REMOVE_ALL, view->db, view->table_name,
FALSE);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 56e7db96a1a..fdd90d95b2d 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -722,7 +722,7 @@ static bool add_create_index (LEX *lex, Key::Keytype type,
{
Key *key;
key= new Key(type, name, info ? info : &lex->key_create_info, generated,
- lex->col_list, lex->option_list);
+ lex->col_list, lex->option_list, lex->check_exists);
if (key == NULL)
return TRUE;
@@ -899,10 +899,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%pure_parser /* We have threads */
/*
- Currently there are 171 shift/reduce conflicts.
+ Currently there are 170 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 171
+%expect 170
/*
Comments for TOKENS.
@@ -1566,14 +1566,14 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name
sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty
- opt_constraint constraint opt_ident
+ opt_constraint constraint opt_ident opt_if_not_exists_ident
%type <lex_str_ptr>
opt_table_alias
%type <table>
table_ident table_ident_nodb references xid
- table_ident_opt_wild
+ table_ident_opt_wild create_like
%type <simple_string>
remember_name remember_end opt_db text_or_password
@@ -1583,7 +1583,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <num>
type type_with_opt_collate int_type real_type order_dir lock_option
- udf_type if_exists opt_local opt_table_options table_options
+ udf_type opt_if_exists opt_local opt_table_options table_options
table_option opt_if_not_exists opt_no_write_to_binlog
opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options spatial_type union_option
@@ -1742,7 +1742,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
clear_privileges flush_options flush_option
opt_with_read_lock flush_options_list
equal optional_braces
- opt_mi_check_type opt_to mi_check_types normal_join
+ opt_mi_check_type opt_to mi_check_types
table_to_table_list table_to_table opt_table_list opt_as
handler_rkey_function handler_read_or_scan
single_multi table_wild_list table_wild_one opt_wild
@@ -1799,8 +1799,12 @@ END_OF_INPUT
'-' '+' '*' '/' '%' '(' ')'
',' '!' '{' '}' '&' '|' AND_SYM OR_SYM OR_OR_SYM BETWEEN_SYM CASE_SYM
THEN_SYM WHEN_SYM DIV_SYM MOD_SYM OR2_SYM AND_AND_SYM DELETE_SYM
+
+%type <num> normal_join inner_join
+
%%
+
/*
Indentation of grammar rules:
@@ -2238,7 +2242,7 @@ create:
lex->name.length= 0;
lex->create_last_non_select_table= lex->last_table();
}
- create2
+ create_body
{
LEX *lex= YYTHD->lex;
lex->current_select= &lex->select_lex;
@@ -2254,36 +2258,36 @@ create:
}
create_table_set_open_action_and_adjust_tables(lex);
}
- | CREATE opt_unique INDEX_SYM ident key_alg ON table_ident
+ | CREATE opt_unique INDEX_SYM opt_if_not_exists ident key_alg ON table_ident
{
- if (add_create_index_prepare(Lex, $7))
+ if (add_create_index_prepare(Lex, $8))
MYSQL_YYABORT;
}
'(' key_list ')' normal_key_options
{
- if (add_create_index(Lex, $2, $4))
+ if (add_create_index(Lex, $2, $5))
MYSQL_YYABORT;
}
- | CREATE fulltext INDEX_SYM ident init_key_options ON
+ | CREATE fulltext INDEX_SYM opt_if_not_exists ident init_key_options ON
table_ident
{
- if (add_create_index_prepare(Lex, $7))
+ if (add_create_index_prepare(Lex, $8))
MYSQL_YYABORT;
}
'(' key_list ')' fulltext_key_options
{
- if (add_create_index(Lex, $2, $4))
+ if (add_create_index(Lex, $2, $5))
MYSQL_YYABORT;
}
- | CREATE spatial INDEX_SYM ident init_key_options ON
+ | CREATE spatial INDEX_SYM opt_if_not_exists ident init_key_options ON
table_ident
{
- if (add_create_index_prepare(Lex, $7))
+ if (add_create_index_prepare(Lex, $8))
MYSQL_YYABORT;
}
'(' key_list ')' spatial_key_options
{
- if (add_create_index(Lex, $2, $4))
+ if (add_create_index(Lex, $2, $5))
MYSQL_YYABORT;
}
| CREATE DATABASE opt_if_not_exists ident
@@ -4413,36 +4417,23 @@ size_number:
End tablespace part
*/
-create2:
- '(' create2a {}
- | opt_create_table_options
- opt_create_partitioning
- create3 {}
- | LIKE table_ident
- {
- THD *thd= YYTHD;
- TABLE_LIST *src_table;
- LEX *lex= thd->lex;
-
- lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
- src_table= lex->select_lex.add_table_to_list(thd, $2, NULL, 0,
- TL_READ,
- MDL_SHARED_READ);
- if (! src_table)
- MYSQL_YYABORT;
- /* CREATE TABLE ... LIKE is not allowed for views. */
- src_table->required_type= FRMTYPE_TABLE;
- }
- | '(' LIKE table_ident ')'
+create_body:
+ '(' create_field_list ')'
+ { Lex->create_info.option_list= NULL; }
+ opt_create_table_options opt_create_partitioning opt_create_select {}
+ | opt_create_table_options opt_create_partitioning opt_create_select {}
+ /*
+ the following rule is redundant, but there's a shift/reduce
+ conflict that prevents the rule above from parsing a syntax like
+ CREATE TABLE t1 (SELECT 1);
+ */
+ | '(' create_select ')' { Select->set_braces(1);} union_opt {}
+ | create_like
{
- THD *thd= YYTHD;
- TABLE_LIST *src_table;
- LEX *lex= thd->lex;
- lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
- src_table= lex->select_lex.add_table_to_list(thd, $3, NULL, 0,
- TL_READ,
- MDL_SHARED_READ);
+ Lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE;
+ TABLE_LIST *src_table= Lex->select_lex.add_table_to_list(YYTHD,
+ $1, NULL, 0, TL_READ, MDL_SHARED_READ);
if (! src_table)
MYSQL_YYABORT;
/* CREATE TABLE ... LIKE is not allowed for views. */
@@ -4450,21 +4441,12 @@ create2:
}
;
-create2a:
- create_field_list ')'
- {
- Lex->create_info.option_list= NULL;
- }
- opt_create_table_options
- opt_create_partitioning
- create3 {}
- | opt_create_partitioning
- create_select ')'
- { Select->set_braces(1);}
- union_opt {}
+create_like:
+ LIKE table_ident { $$= $2; }
+ | '(' LIKE table_ident ')' { $$= $3; }
;
-create3:
+opt_create_select:
/* empty */ {}
| opt_duplicate opt_as create_select
{ Select->set_braces(0);}
@@ -5224,9 +5206,17 @@ table_option:
;
opt_if_not_exists:
- /* empty */ { $$= 0; }
- | IF not EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }
- ;
+ /* empty */
+ {
+ Lex->check_exists= FALSE;
+ $$= 0;
+ }
+ | IF not EXISTS
+ {
+ Lex->check_exists= TRUE;
+ $$=HA_LEX_CREATE_IF_NOT_EXISTS;
+ }
+ ;
opt_create_table_options:
/* empty */
@@ -5544,14 +5534,14 @@ column_def:
;
key_def:
- normal_key_type opt_ident key_alg '(' key_list ')'
+ normal_key_type opt_if_not_exists_ident key_alg '(' key_list ')'
{ Lex->option_list= NULL; }
normal_key_options
{
if (add_create_index (Lex, $1, $2))
MYSQL_YYABORT;
}
- | fulltext opt_key_or_index opt_ident init_key_options
+ | fulltext opt_key_or_index opt_if_not_exists_ident init_key_options
'(' key_list ')'
{ Lex->option_list= NULL; }
fulltext_key_options
@@ -5559,7 +5549,7 @@ key_def:
if (add_create_index (Lex, $1, $3))
MYSQL_YYABORT;
}
- | spatial opt_key_or_index opt_ident init_key_options
+ | spatial opt_key_or_index opt_if_not_exists_ident init_key_options
'(' key_list ')'
{ Lex->option_list= NULL; }
spatial_key_options
@@ -5575,7 +5565,7 @@ key_def:
if (add_create_index (Lex, $2, $3.str ? $3 : $1))
MYSQL_YYABORT;
}
- | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
+ | opt_constraint FOREIGN KEY_SYM opt_if_not_exists_ident '(' key_list ')' references
{
LEX *lex=Lex;
Key *key= new Foreign_key($4.str ? $4 : $1, lex->col_list,
@@ -5583,7 +5573,8 @@ key_def:
lex->ref_list,
lex->fk_delete_opt,
lex->fk_update_opt,
- lex->fk_match_option);
+ lex->fk_match_option,
+ lex->check_exists);
if (key == NULL)
MYSQL_YYABORT;
lex->alter_info.key_list.push_back(key);
@@ -6552,6 +6543,18 @@ opt_ident:
| field_ident { $$= $1; }
;
+opt_if_not_exists_ident:
+ opt_if_not_exists opt_ident
+ {
+ LEX *lex= Lex;
+ if (lex->check_exists && lex->sql_command != SQLCOM_ALTER_TABLE)
+ {
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+ $$= $2;
+ };
+
opt_component:
/* empty */ { $$= null_lex_str; }
| '.' ident { $$= $2; }
@@ -6808,7 +6811,7 @@ alter_commands:
new table and so forth.
*/
| add_partition_rule
- | DROP PARTITION_SYM alt_part_name_list
+ | DROP PARTITION_SYM opt_if_exists alt_part_name_list
{
Lex->alter_info.flags|= ALTER_DROP_PARTITION;
}
@@ -6909,7 +6912,7 @@ all_or_alt_part_name_list:
;
add_partition_rule:
- ADD PARTITION_SYM opt_no_write_to_binlog
+ ADD PARTITION_SYM opt_if_not_exists opt_no_write_to_binlog
{
LEX *lex= Lex;
lex->part_info= new partition_info();
@@ -6919,7 +6922,7 @@ add_partition_rule:
MYSQL_YYABORT;
}
lex->alter_info.flags|= ALTER_ADD_PARTITION;
- lex->no_write_to_binlog= $3;
+ lex->no_write_to_binlog= $4;
}
add_part_extra
{}
@@ -6995,7 +6998,7 @@ alter_list:
;
add_column:
- ADD opt_column
+ ADD opt_column opt_if_not_exists
{
LEX *lex=Lex;
lex->change=0;
@@ -7017,10 +7020,10 @@ alter_list_item:
{
Lex->alter_info.flags|= ALTER_ADD_COLUMN | ALTER_ADD_INDEX;
}
- | CHANGE opt_column field_ident
+ | CHANGE opt_column opt_if_exists field_ident
{
LEX *lex=Lex;
- lex->change= $3.str;
+ lex->change= $4.str;
lex->alter_info.flags|= ALTER_CHANGE_COLUMN;
lex->option_list= NULL;
}
@@ -7028,7 +7031,7 @@ alter_list_item:
{
Lex->create_last_non_select_table= Lex->last_table();
}
- | MODIFY_SYM opt_column field_ident
+ | MODIFY_SYM opt_column opt_if_exists field_ident
{
LEX *lex=Lex;
lex->length=lex->dec=0; lex->type=0;
@@ -7042,12 +7045,12 @@ alter_list_item:
field_def
{
LEX *lex=Lex;
- if (add_field_to_list(lex->thd,&$3,
- (enum enum_field_types) $5,
+ if (add_field_to_list(lex->thd,&$4,
+ (enum enum_field_types) $6,
lex->length,lex->dec,lex->type,
lex->default_value, lex->on_update_value,
&lex->comment,
- $3.str, &lex->interval_list, lex->charset,
+ $4.str, &lex->interval_list, lex->charset,
lex->uint_geom_type,
lex->vcol_info, lex->option_list))
MYSQL_YYABORT;
@@ -7056,32 +7059,33 @@ alter_list_item:
{
Lex->create_last_non_select_table= Lex->last_table();
}
- | DROP opt_column field_ident opt_restrict
+ | DROP opt_column opt_if_exists field_ident opt_restrict
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::COLUMN, $3.str);
+ Alter_drop *ad= new Alter_drop(Alter_drop::COLUMN, $4.str, $3);
if (ad == NULL)
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad);
lex->alter_info.flags|= ALTER_DROP_COLUMN;
}
- | DROP FOREIGN KEY_SYM opt_ident
+ | DROP FOREIGN KEY_SYM opt_if_exists opt_ident
{
Lex->alter_info.flags|= ALTER_DROP_INDEX | ALTER_FOREIGN_KEY;
}
| DROP PRIMARY_SYM KEY_SYM
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::KEY, primary_key_name);
+ Alter_drop *ad= new Alter_drop(Alter_drop::KEY, primary_key_name,
+ FALSE);
if (ad == NULL)
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad);
lex->alter_info.flags|= ALTER_DROP_INDEX;
}
- | DROP key_or_index field_ident
+ | DROP key_or_index opt_if_exists field_ident
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $3.str);
+ Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $4.str, $3);
if (ad == NULL)
MYSQL_YYABORT;
lex->alter_info.drop_list.push_back(ad);
@@ -9915,9 +9919,7 @@ join_table:
left-associative joins.
*/
table_ref normal_join table_ref %prec TABLE_REF_PRIORITY
- { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); }
- | table_ref STRAIGHT_JOIN table_factor
- { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; }
+ { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=$2; }
| table_ref normal_join table_ref
ON
{
@@ -9929,22 +9931,7 @@ join_table:
}
expr
{
- add_join_on($3,$6);
- Lex->pop_context();
- Select->parsing_place= NO_MATTER;
- }
- | table_ref STRAIGHT_JOIN table_factor
- ON
- {
- MYSQL_YYABORT_UNLESS($1 && $3);
- /* Change the current name resolution context to a local context. */
- if (push_new_name_resolution_context(YYTHD, $1, $3))
- MYSQL_YYABORT;
- Select->parsing_place= IN_ON;
- }
- expr
- {
- $3->straight=1;
+ $3->straight=$2;
add_join_on($3,$6);
Lex->pop_context();
Select->parsing_place= NO_MATTER;
@@ -9955,10 +9942,15 @@ join_table:
MYSQL_YYABORT_UNLESS($1 && $3);
}
'(' using_list ')'
- { add_join_natural($1,$3,$7,Select); $$=$3; }
- | table_ref NATURAL JOIN_SYM table_factor
+ {
+ $3->straight=$2;
+ add_join_natural($1,$3,$7,Select);
+ $$=$3;
+ }
+ | table_ref NATURAL inner_join table_factor
{
MYSQL_YYABORT_UNLESS($1 && ($$=$4));
+ $4->straight=$3;
add_join_natural($1,$4,NULL,Select);
}
@@ -10038,10 +10030,16 @@ join_table:
}
;
+
+inner_join: /* $$ set if using STRAIGHT_JOIN, false otherwise */
+ JOIN_SYM { $$ = 0; }
+ | INNER_SYM JOIN_SYM { $$ = 0; }
+ | STRAIGHT_JOIN { $$ = 1; }
+ ;
+
normal_join:
- JOIN_SYM {}
- | INNER_SYM JOIN_SYM {}
- | CROSS JOIN_SYM {}
+ inner_join { $$ = $1; }
+ | CROSS JOIN_SYM { $$ = 0; }
;
/*
@@ -11002,41 +11000,41 @@ do:
*/
drop:
- DROP opt_temporary table_or_tables if_exists
+ DROP opt_temporary table_or_tables opt_if_exists
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_DROP_TABLE;
lex->drop_temporary= $2;
- lex->drop_if_exists= $4;
+ lex->check_exists= $4;
YYPS->m_lock_type= TL_UNLOCK;
YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
table_list opt_restrict
{}
- | DROP INDEX_SYM ident ON table_ident {}
+ | DROP INDEX_SYM opt_if_exists ident ON table_ident {}
{
LEX *lex=Lex;
- Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $3.str);
+ Alter_drop *ad= new Alter_drop(Alter_drop::KEY, $4.str, $3);
if (ad == NULL)
MYSQL_YYABORT;
lex->sql_command= SQLCOM_DROP_INDEX;
lex->alter_info.reset();
lex->alter_info.flags= ALTER_DROP_INDEX;
lex->alter_info.drop_list.push_back(ad);
- if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
+ if (!lex->current_select->add_table_to_list(lex->thd, $6, NULL,
TL_OPTION_UPDATING,
TL_READ_NO_INSERT,
MDL_SHARED_NO_WRITE))
MYSQL_YYABORT;
}
- | DROP DATABASE if_exists ident
+ | DROP DATABASE opt_if_exists ident
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_DROP_DB;
- lex->drop_if_exists=$3;
+ lex->check_exists=$3;
lex->name= $4;
}
- | DROP FUNCTION_SYM if_exists ident '.' ident
+ | DROP FUNCTION_SYM opt_if_exists ident '.' ident
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
@@ -11052,14 +11050,14 @@ drop:
MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_DROP_FUNCTION;
- lex->drop_if_exists= $3;
+ lex->check_exists= $3;
spname= new sp_name($4, $6, true);
if (spname == NULL)
MYSQL_YYABORT;
spname->init_qname(thd);
lex->spname= spname;
}
- | DROP FUNCTION_SYM if_exists ident
+ | DROP FUNCTION_SYM opt_if_exists ident
{
THD *thd= YYTHD;
LEX *lex= thd->lex;
@@ -11073,14 +11071,14 @@ drop:
if (thd->db && lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
lex->sql_command = SQLCOM_DROP_FUNCTION;
- lex->drop_if_exists= $3;
+ lex->check_exists= $3;
spname= new sp_name(db, $4, false);
if (spname == NULL)
MYSQL_YYABORT;
spname->init_qname(thd);
lex->spname= spname;
}
- | DROP PROCEDURE_SYM if_exists sp_name
+ | DROP PROCEDURE_SYM opt_if_exists sp_name
{
LEX *lex=Lex;
if (lex->sphead)
@@ -11089,34 +11087,34 @@ drop:
MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_DROP_PROCEDURE;
- lex->drop_if_exists= $3;
+ lex->check_exists= $3;
lex->spname= $4;
}
| DROP USER clear_privileges user_list
{
Lex->sql_command = SQLCOM_DROP_USER;
}
- | DROP VIEW_SYM if_exists
+ | DROP VIEW_SYM opt_if_exists
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_DROP_VIEW;
- lex->drop_if_exists= $3;
+ lex->check_exists= $3;
YYPS->m_lock_type= TL_UNLOCK;
YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
table_list opt_restrict
{}
- | DROP EVENT_SYM if_exists sp_name
+ | DROP EVENT_SYM opt_if_exists sp_name
{
- Lex->drop_if_exists= $3;
+ Lex->check_exists= $3;
Lex->spname= $4;
Lex->sql_command = SQLCOM_DROP_EVENT;
}
- | DROP TRIGGER_SYM if_exists sp_name
+ | DROP TRIGGER_SYM opt_if_exists sp_name
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_DROP_TRIGGER;
- lex->drop_if_exists= $3;
+ lex->check_exists= $3;
lex->spname= $4;
}
| DROP TABLESPACE tablespace_name opt_ts_engine opt_ts_wait
@@ -11129,10 +11127,10 @@ drop:
LEX *lex= Lex;
lex->alter_tablespace_info->ts_cmd_type= DROP_LOGFILE_GROUP;
}
- | DROP SERVER_SYM if_exists ident_or_text
+ | DROP SERVER_SYM opt_if_exists ident_or_text
{
Lex->sql_command = SQLCOM_DROP_SERVER;
- Lex->drop_if_exists= $3;
+ Lex->check_exists= $3;
Lex->server_options.server_name= $4.str;
Lex->server_options.server_name_length= $4.length;
}
@@ -11170,9 +11168,17 @@ table_alias_ref:
}
;
-if_exists:
- /* empty */ { $$= 0; }
- | IF EXISTS { $$= 1; }
+opt_if_exists:
+ /* empty */
+ {
+ Lex->check_exists= FALSE;
+ $$= 0;
+ }
+ | IF EXISTS
+ {
+ Lex->check_exists= TRUE;
+ $$= 1;
+ }
;
opt_temporary:
@@ -11636,6 +11642,7 @@ show:
{
LEX *lex=Lex;
lex->wild=0;
+ lex->ident=null_lex_str;
mysql_init_select(lex);
lex->current_select->parsing_place= SELECT_LIST;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
@@ -11699,6 +11706,19 @@ show_param:
if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS))
MYSQL_YYABORT;
}
+ | PLUGINS_SYM SONAME_SYM TEXT_STRING_sys
+ {
+ Lex->ident= $3;
+ Lex->sql_command= SQLCOM_SHOW_PLUGINS;
+ if (prepare_schema_table(YYTHD, Lex, 0, SCH_ALL_PLUGINS))
+ MYSQL_YYABORT;
+ }
+ | PLUGINS_SYM SONAME_SYM wild_and_where
+ {
+ Lex->sql_command= SQLCOM_SHOW_PLUGINS;
+ if (prepare_schema_table(YYTHD, Lex, 0, SCH_ALL_PLUGINS))
+ MYSQL_YYABORT;
+ }
| ENGINE_SYM known_storage_engines show_engine_param
{ Lex->create_info.db_type= $2; }
| ENGINE_SYM ALL show_engine_param
@@ -13297,6 +13317,7 @@ keyword:
| LANGUAGE_SYM {}
| NO_SYM {}
| OPEN_SYM {}
+ | OPTION {}
| OPTIONS_SYM {}
| OWNER_SYM {}
| PARSER_SYM {}
diff --git a/sql/strfunc.cc b/sql/strfunc.cc
index 9603ca30cfa..aa6d2535b0d 100644
--- a/sql/strfunc.cc
+++ b/sql/strfunc.cc
@@ -86,7 +86,7 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs,
*set_warning= 1;
}
else
- found|= ((longlong) 1 << (find - 1));
+ found|= 1ULL << (find - 1);
if (pos >= end)
break;
start= pos + mblen;
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 433be2f6e22..6d5d92081a9 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1222,7 +1222,7 @@ static Sys_var_ulonglong Sys_max_binlog_cache_size(
"Sets the total size of the transactional cache",
GLOBAL_VAR(max_binlog_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
- DEFAULT((UINT_MAX/IO_SIZE)*IO_SIZE),
+ DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
BLOCK_SIZE(IO_SIZE));
static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size(
@@ -1230,7 +1230,7 @@ static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size(
"Sets the total size of the statement cache",
GLOBAL_VAR(max_binlog_stmt_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
- DEFAULT((UINT_MAX/IO_SIZE)*IO_SIZE),
+ DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
BLOCK_SIZE(IO_SIZE));
static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
@@ -1603,6 +1603,7 @@ export const char *optimizer_switch_names[]=
"optimize_join_buffer_size",
"table_elimination",
"extended_keys",
+ "exists_to_in",
"default", NullS
};
/** propagates changes to @@engine_condition_pushdown */
@@ -1644,7 +1645,8 @@ static Sys_var_flagset Sys_optimizer_switch(
"semijoin_with_cache, "
"subquery_cache, "
"table_elimination, "
- "extended_keys "
+ "extended_keys, "
+ "exists_to_in "
"} and val is one of {on, off, default}",
SESSION_VAR(optimizer_switch), CMD_LINE(REQUIRED_ARG),
optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT),
@@ -3960,9 +3962,67 @@ static Sys_var_ulong Sys_debug_binlog_fsync_sleep(
CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
#endif
+
static Sys_var_harows Sys_expensive_subquery_limit(
"expensive_subquery_limit",
"The maximum number of rows a subquery may examine in order to be "
"executed during optimization and used for constant optimization",
SESSION_VAR(expensive_subquery_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, HA_POS_ERROR), DEFAULT(100), BLOCK_SIZE(1));
+
+static bool check_pseudo_slave_mode(sys_var *self, THD *thd, set_var *var)
+{
+ longlong previous_val= thd->variables.pseudo_slave_mode;
+ longlong val= (longlong) var->save_result.ulonglong_value;
+ bool rli_fake= false;
+
+#ifndef EMBEDDED_LIBRARY
+ rli_fake= thd->rli_fake ? true : false;
+#endif
+
+ if (rli_fake)
+ {
+ if (!val)
+ {
+#ifndef EMBEDDED_LIBRARY
+ delete thd->rli_fake;
+ thd->rli_fake= NULL;
+#endif
+ }
+ else if (previous_val && val)
+ goto ineffective;
+ else if (!previous_val && val)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_VAR,
+ "'pseudo_slave_mode' is already ON.");
+ }
+ else
+ {
+ if (!previous_val && !val)
+ goto ineffective;
+ else if (previous_val && !val)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_VAR,
+ "Slave applier execution mode not active, "
+ "statement ineffective.");
+ }
+ goto end;
+
+ineffective:
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WRONG_VALUE_FOR_VAR,
+ "'pseudo_slave_mode' change was ineffective.");
+
+end:
+ return FALSE;
+}
+static Sys_var_mybool Sys_pseudo_slave_mode(
+ "pseudo_slave_mode",
+ "SET pseudo_slave_mode= 0,1 are commands that mysqlbinlog "
+ "adds to beginning and end of binary log dumps. While zero "
+ "value indeed disables, the actual enabling of the slave "
+ "applier execution mode is done implicitly when a "
+ "Format_description_event is sent through the session.",
+ SESSION_ONLY(pseudo_slave_mode), NO_CMD_LINE, DEFAULT(FALSE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_pseudo_slave_mode));
+
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index ffa7de118c8..9d91c4175f8 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -548,8 +548,7 @@ public:
protected:
virtual uchar *session_value_ptr(THD *thd, LEX_STRING *base)
{
- return thd->security_ctx->proxy_user[0] ?
- (uchar *) &(thd->security_ctx->proxy_user[0]) : NULL;
+ return (uchar*)thd->security_ctx->external_user;
}
};
diff --git a/sql/table.cc b/sql/table.cc
index c8dc2b4ed5a..b8732a78afc 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+ Copyright (c) 2008, 2013, Monty Program Ab.
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
@@ -22,7 +22,6 @@
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "table.h"
-#include "frm_crypt.h" // get_crypt_for_frm
#include "key.h" // find_ref_key
#include "sql_table.h" // build_table_filename,
// primary_key_name
@@ -40,6 +39,7 @@
#include "sql_select.h"
#include "sql_derived.h"
#include "sql_statistics.h"
+#include "discover.h"
#include "mdl.h" // MDL_wait_for_graph_visitor
/* INFORMATION_SCHEMA name */
@@ -65,18 +65,12 @@ LEX_STRING parse_vcol_keyword= { C_STRING_WITH_LEN("PARSE_VCOL_EXPR ") };
/* Functions defined in this file */
-void open_table_error(TABLE_SHARE *share, int error, int db_errno,
- myf errortype, int errarg);
-static int open_binary_frm(THD *thd, TABLE_SHARE *share,
- uchar *head, File file);
static void fix_type_pointers(const char ***array, TYPELIB *point_to_type,
uint types, char **names);
static uint find_field(Field **fields, uchar *record, uint start, uint length);
inline bool is_system_table_name(const char *name, uint length);
-static ulong get_form_pos(File file, uchar *head);
-
/**************************************************************************
Object_creation_ctx implementation.
**************************************************************************/
@@ -292,8 +286,8 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, const LEX_STRING *name)
# Share
*/
-TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
- uint key_length)
+TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
+ char *key, uint key_length)
{
MEM_ROOT mem_root;
TABLE_SHARE *share;
@@ -301,12 +295,10 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
char path[FN_REFLEN];
uint path_length;
DBUG_ENTER("alloc_table_share");
- DBUG_PRINT("enter", ("table: '%s'.'%s'",
- table_list->db, table_list->table_name));
+ DBUG_PRINT("enter", ("table: '%s'.'%s'", db, table_name));
path_length= build_table_filename(path, sizeof(path) - 1,
- table_list->db,
- table_list->table_name, "", 0);
+ db, table_name, "", 0);
init_sql_alloc(&mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, MYF(0));
if (multi_alloc_root(&mem_root,
&share, sizeof(*share),
@@ -323,8 +315,9 @@ TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
strmov(share->path.str, path);
share->normalized_path.str= share->path.str;
share->normalized_path.length= path_length;
-
- share->version= refresh_version;
+ share->table_category= get_table_category(& share->db, & share->table_name);
+ share->set_refresh_version();
+ share->open_errno= ENOENT;
/*
Since alloc_table_share() can be called without any locking (for
@@ -579,27 +572,6 @@ inline bool is_system_table_name(const char *name, uint length)
}
-/**
- Check if a string contains path elements
-*/
-
-static bool has_disabled_path_chars(const char *str)
-{
- for (; *str; str++)
- {
- switch (*str) {
- case FN_EXTCHAR:
- case '/':
- case '\\':
- case '~':
- case '@':
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
/*
Read table definition from a binary / text based .frm file
@@ -614,175 +586,138 @@ static bool has_disabled_path_chars(const char *str)
table_def_cache
The data is returned in 'share', which is alloced by
alloc_table_share().. The code assumes that share is initialized.
-
- RETURN VALUES
- 0 ok
- 1 Error (see open_table_error)
- 2 Error (see open_table_error)
- 3 Wrong data in .frm file
- 4 Error (see open_table_error)
- 5 Error (see open_table_error: charset unavailable)
- 6 Unknown .frm version
*/
-int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
+enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
{
- int error, table_type;
- bool error_given;
+ bool error_given= false;
File file;
- uchar head[64];
+ uchar *buf;
+ uchar head[FRM_HEADER_SIZE];
char path[FN_REFLEN];
- MEM_ROOT **root_ptr, *old_root;
+ size_t frmlen, read_length;
DBUG_ENTER("open_table_def");
DBUG_PRINT("enter", ("table: '%s'.'%s' path: '%s'", share->db.str,
share->table_name.str, share->normalized_path.str));
- error= 1;
- error_given= 0;
+ share->error= OPEN_FRM_OPEN_ERROR;
strxmov(path, share->normalized_path.str, reg_ext, NullS);
- if ((file= mysql_file_open(key_file_frm,
- path, O_RDONLY | O_SHARE, MYF(0))) < 0)
+ file= mysql_file_open(key_file_frm, path, O_RDONLY | O_SHARE, MYF(0));
+ if (file < 0)
{
- /*
- We don't try to open 5.0 unencoded name, if
- - non-encoded name contains '@' signs,
- because '@' can be misinterpreted.
- It is not clear if '@' is escape character in 5.1,
- or a normal character in 5.0.
-
- - non-encoded db or table name contain "#mysql50#" prefix.
- This kind of tables must have been opened only by the
- mysql_file_open() above.
- */
- if (has_disabled_path_chars(share->table_name.str) ||
- has_disabled_path_chars(share->db.str) ||
- !strncmp(share->db.str, MYSQL50_TABLE_NAME_PREFIX,
- MYSQL50_TABLE_NAME_PREFIX_LENGTH) ||
- !strncmp(share->table_name.str, MYSQL50_TABLE_NAME_PREFIX,
- MYSQL50_TABLE_NAME_PREFIX_LENGTH))
- goto err_not_open;
-
- /* Try unencoded 5.0 name */
- uint length;
- strxnmov(path, sizeof(path)-1,
- mysql_data_home, "/", share->db.str, "/",
- share->table_name.str, reg_ext, NullS);
- length= unpack_filename(path, path) - reg_ext_length;
- /*
- The following is a safety test and should never fail
- as the old file name should never be longer than the new one.
- */
- DBUG_ASSERT(length <= share->normalized_path.length);
- /*
- If the old and the new names have the same length,
- then table name does not have tricky characters,
- so no need to check the old file name.
- */
- if (length == share->normalized_path.length ||
- ((file= mysql_file_open(key_file_frm,
- path, O_RDONLY | O_SHARE, MYF(0))) < 0))
- goto err_not_open;
-
- /* Unencoded 5.0 table name found */
- path[length]= '\0'; // Remove .frm extension
- strmov(share->normalized_path.str, path);
- share->normalized_path.length= length;
+ if ((flags & GTS_TABLE) && (flags & GTS_FORCE_DISCOVERY))
+ {
+ ha_discover_table(thd, share);
+ error_given= true;
+ }
+ goto err_not_open;
}
- error= 4;
- if (mysql_file_read(file, head, 64, MYF(MY_NABP)))
+ if (mysql_file_read(file, head, sizeof(head), MYF(MY_NABP)))
+ {
+ share->error = my_errno == HA_ERR_FILE_TOO_SHORT
+ ? OPEN_FRM_CORRUPTED : OPEN_FRM_READ_ERROR;
goto err;
+ }
- if (head[0] == (uchar) 254 && head[1] == 1)
+ if (memcmp(head, STRING_WITH_LEN("TYPE=VIEW\n")) == 0)
{
- if (head[2] == FRM_VER || head[2] == FRM_VER+1 ||
- (head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4))
- {
- /* Open view only */
- if (db_flags & OPEN_VIEW_ONLY)
- {
- error_given= 1;
- goto err;
- }
- table_type= 1;
- }
- else
- {
- error= 6; // Unkown .frm version
- goto err;
- }
+ share->is_view= 1;
+ share->error= flags & GTS_VIEW ? OPEN_FRM_OK : OPEN_FRM_NOT_A_TABLE;
+ goto err;
}
- else if (memcmp(head, STRING_WITH_LEN("TYPE=")) == 0)
+ if (!is_binary_frm_header(head))
{
- error= 5;
- if (memcmp(head+5,"VIEW",4) == 0)
- {
- share->is_view= 1;
- if (db_flags & OPEN_VIEW)
- error= 0;
- }
+ /* No handling of text based files yet */
+ share->error = OPEN_FRM_CORRUPTED;
goto err;
}
- else
+ if (!(flags & GTS_TABLE))
+ {
+ share->error = OPEN_FRM_NOT_A_VIEW;
goto err;
+ }
- /* No handling of text based files yet */
- if (table_type == 1)
+ frmlen= uint4korr(head+10);
+ set_if_smaller(frmlen, FRM_MAX_SIZE); // safety
+
+ if (!(buf= (uchar*)my_malloc(frmlen, MYF(MY_THREAD_SPECIFIC|MY_WME))))
+ goto err;
+
+ memcpy(buf, head, sizeof(head));
+
+ read_length= mysql_file_read(file, buf + sizeof(head),
+ frmlen - sizeof(head), MYF(MY_WME));
+ if (read_length == 0 || read_length == (size_t)-1)
{
- root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC);
- old_root= *root_ptr;
- *root_ptr= &share->mem_root;
- error= open_binary_frm(thd, share, head, file);
- *root_ptr= old_root;
- error_given= 1;
+ share->error = OPEN_FRM_READ_ERROR;
+ my_free(buf);
+ goto err;
}
+ mysql_file_close(file, MYF(MY_WME));
- share->table_category= get_table_category(& share->db, & share->table_name);
+ frmlen= read_length + sizeof(head);
- if (!error)
- thd->status_var.opened_shares++;
+ share->init_from_binary_frm_image(thd, false, buf, frmlen);
+ error_given= true; // init_from_binary_frm_image has already called my_error()
+ my_free(buf);
+
+ goto err_not_open;
err:
mysql_file_close(file, MYF(MY_WME));
err_not_open:
- if (error && !error_given)
+ if (share->error && !error_given)
{
- share->error= error;
- open_table_error(share, error, (share->open_errno= my_errno), 0);
+ share->open_errno= my_errno;
+ open_table_error(share, share->error, share->open_errno);
}
- DBUG_RETURN(error);
+ DBUG_RETURN(share->error);
}
-/*
- Read data from a binary .frm file from MySQL 3.23 - 5.0 into TABLE_SHARE
+/**
+ Read data from a binary .frm file image into a TABLE_SHARE
+
+ @note
+ frm bytes at the following offsets are unused in MariaDB 10.0:
+
+ 8..9 (used to be the number of "form names")
+ 28..29 (used to be key_info_length)
+
+ They're still set, for compatibility reasons, but never read.
+
+ 42..46 are unused since 5.0 (were for RAID support)
+ Also, there're few unused bytes in forminfo.
+
*/
-static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
- File file)
+int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
+ const uchar *frm_image,
+ size_t frm_length)
{
- int error, errarg= 0;
+ TABLE_SHARE *share= this;
uint new_frm_ver, field_pack_length, new_field_pack_flag;
uint interval_count, interval_parts, read_length, int_length;
uint db_create_options, keys, key_parts, n_length;
- uint key_info_length, com_length, null_bit_pos;
+ uint com_length, null_bit_pos;
uint extra_rec_buf_length;
uint i,j;
bool use_hash;
char *keynames, *names, *comment_pos;
- uchar forminfo[288];
- uchar *record;
- uchar *disk_buff, *strpos, *null_flags, *null_pos;
+ const uchar *forminfo, *extra2;
+ const uchar *frm_image_end = frm_image + frm_length;
+ uchar *record, *null_flags, *null_pos;
+ const uchar *disk_buff, *strpos;
ulong pos, record_offset;
ulong *rec_per_key= NULL;
ulong rec_buff_length;
handler *handler_file= 0;
KEY *keyinfo;
KEY_PART_INFO *key_part= NULL;
- SQL_CRYPT *crypted=0;
Field **field_ptr, *reg_field;
const char **interval_array;
enum legacy_db_type legacy_db_type;
@@ -790,74 +725,138 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
bool null_bits_are_used;
uint vcol_screen_length, UNINIT_VAR(options_len);
char *vcol_screen_pos;
- uchar *UNINIT_VAR(options);
- uchar *extra_segment_buff= 0;
+ const uchar *options= 0;
KEY first_keyinfo;
uint len;
KEY_PART_INFO *first_key_part= NULL;
uint ext_key_parts= 0;
uint first_key_parts= 0;
+ plugin_ref se_plugin= 0;
keyinfo= &first_keyinfo;
share->ext_key_parts= 0;
- DBUG_ENTER("open_binary_frm");
+ MEM_ROOT **root_ptr, *old_root;
+ DBUG_ENTER("TABLE_SHARE::init_from_binary_frm_image");
+
+ root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC);
+ old_root= *root_ptr;
+ *root_ptr= &share->mem_root;
- new_field_pack_flag= head[27];
- new_frm_ver= (head[2] - FRM_VER);
+ if (write && write_frm_image(frm_image, frm_length))
+ goto err;
+
+ if (frm_length < FRM_HEADER_SIZE + FRM_FORMINFO_SIZE)
+ goto err;
+
+ new_field_pack_flag= frm_image[27];
+ new_frm_ver= (frm_image[2] - FRM_VER);
field_pack_length= new_frm_ver < 2 ? 11 : 17;
- disk_buff= 0;
- error= 3;
- /* Position of the form in the form file. */
- if (!(pos= get_form_pos(file, head)))
- goto err; /* purecov: inspected */
+ /* Length of the MariaDB extra2 segment in the form file. */
+ len = uint2korr(frm_image+4);
+ extra2= frm_image + 64;
+
+ if (*extra2 != '/') // old frm had '/' there
+ {
+ const uchar *e2end= extra2 + len;
+ while (extra2 + 3 < e2end)
+ {
+ uchar type= *extra2++;
+ size_t length= *extra2++;
+ if (!length)
+ {
+ if (extra2 + 258 >= e2end)
+ goto err;
+ length= uint2korr(extra2);
+ extra2+=2;
+ if (length < 256)
+ goto err;
+ }
+ if (extra2 + length > e2end)
+ goto err;
+ switch (type) {
+ case EXTRA2_TABLEDEF_VERSION:
+ if (tabledef_version.str) // see init_from_sql_statement_string()
+ {
+ if (length != tabledef_version.length ||
+ memcmp(extra2, tabledef_version.str, length))
+ goto err;
+ }
+ else
+ {
+ tabledef_version.length= length;
+ tabledef_version.str= (uchar*)memdup_root(&mem_root, extra2, length);
+ if (!tabledef_version.str)
+ goto err;
+ }
+ break;
+ case EXTRA2_ENGINE_TABLEOPTS:
+ if (options)
+ goto err;
+ /* remember but delay parsing until we have read fields and keys */
+ options= extra2;
+ options_len= length;
+ break;
+ default:
+ /* abort frm parsing if it's an unknown but important extra2 value */
+ if (type >= EXTRA2_ENGINE_IMPORTANT)
+ goto err;
+ }
+ extra2+= length;
+ }
+ if (extra2 != e2end)
+ goto err;
+ }
- mysql_file_seek(file,pos,MY_SEEK_SET,MYF(0));
- if (mysql_file_read(file, forminfo,288,MYF(MY_NABP)))
+ if (frm_length < FRM_HEADER_SIZE + len ||
+ !(pos= uint4korr(frm_image + FRM_HEADER_SIZE + len)))
goto err;
- share->frm_version= head[2];
+
+ forminfo= frm_image + pos;
+ if (forminfo + FRM_FORMINFO_SIZE >= frm_image_end)
+ goto err;
+
+ share->frm_version= frm_image[2];
/*
Check if .frm file created by MySQL 5.0. In this case we want to
display CHAR fields as CHAR and not as VARCHAR.
We do it this way as we want to keep the old frm version to enable
MySQL 4.1 to read these files.
*/
- if (share->frm_version == FRM_VER_TRUE_VARCHAR -1 && head[33] == 5)
+ if (share->frm_version == FRM_VER_TRUE_VARCHAR -1 && frm_image[33] == 5)
share->frm_version= FRM_VER_TRUE_VARCHAR;
#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (*(head+61) &&
+ if (frm_image[61] &&
!(share->default_part_db_type=
- ha_checktype(thd, (enum legacy_db_type) (uint) *(head+61), 1, 0)))
+ ha_checktype(thd, (enum legacy_db_type) (uint) frm_image[61], 1, 0)))
goto err;
- DBUG_PRINT("info", ("default_part_db_type = %u", head[61]));
+ DBUG_PRINT("info", ("default_part_db_type = %u", frm_image[61]));
#endif
- legacy_db_type= (enum legacy_db_type) (uint) *(head+3);
- DBUG_ASSERT(share->db_plugin == NULL);
+ legacy_db_type= (enum legacy_db_type) (uint) frm_image[3];
/*
if the storage engine is dynamic, no point in resolving it by its
dynamically allocated legacy_db_type. We will resolve it later by name.
*/
if (legacy_db_type > DB_TYPE_UNKNOWN &&
legacy_db_type < DB_TYPE_FIRST_DYNAMIC)
- share->db_plugin= ha_lock_engine(NULL,
- ha_checktype(thd, legacy_db_type, 0, 0));
- share->db_create_options= db_create_options= uint2korr(head+30);
+ se_plugin= ha_lock_engine(NULL, ha_checktype(thd, legacy_db_type, 0, 0));
+ share->db_create_options= db_create_options= uint2korr(frm_image+30);
share->db_options_in_use= share->db_create_options;
- share->mysql_version= uint4korr(head+51);
+ share->mysql_version= uint4korr(frm_image+51);
share->null_field_first= 0;
- if (!head[32]) // New frm file in 3.23
- {
- share->avg_row_length= uint4korr(head+34);
- share->transactional= (ha_choice) (head[39] & 3);
- share->page_checksum= (ha_choice) ((head[39] >> 2) & 3);
- share->row_type= (row_type) head[40];
- share->table_charset= get_charset((((uint) head[41]) << 8) +
- (uint) head[38],MYF(0));
+ if (!frm_image[32]) // New frm file in 3.23
+ {
+ share->avg_row_length= uint4korr(frm_image+34);
+ share->transactional= (ha_choice) (frm_image[39] & 3);
+ share->page_checksum= (ha_choice) ((frm_image[39] >> 2) & 3);
+ share->row_type= (enum row_type) frm_image[40];
+ share->table_charset= get_charset((((uint) frm_image[41]) << 8) +
+ (uint) frm_image[38],MYF(0));
share->null_field_first= 1;
}
if (!share->table_charset)
{
- /* unknown charset in head[38] or pre-3.23 frm */
+ /* unknown charset in frm_image[38] or pre-3.23 frm */
if (use_mb(default_charset_info))
{
/* Warn that we may be changing the size of character columns */
@@ -871,15 +870,15 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->db_record_offset= 1;
if (db_create_options & HA_OPTION_LONG_BLOB_PTR)
share->blob_ptr_size= portable_sizeof_char_ptr;
- error=4;
- share->max_rows= uint4korr(head+18);
- share->min_rows= uint4korr(head+22);
+ share->max_rows= uint4korr(frm_image+18);
+ share->min_rows= uint4korr(frm_image+22);
/* Read keyinformation */
- key_info_length= (uint) uint2korr(head+28);
- mysql_file_seek(file, (ulong) uint2korr(head+6), MY_SEEK_SET, MYF(0));
- if (read_string(file,(uchar**) &disk_buff,key_info_length))
- goto err; /* purecov: inspected */
+ disk_buff= frm_image + uint2korr(frm_image+6);
+
+ if (disk_buff + 6 >= frm_image_end)
+ goto err;
+
if (disk_buff[0] & 0x80)
{
share->keys= keys= (disk_buff[1] << 7) | (disk_buff[0] & 0x7f);
@@ -929,6 +928,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
{
if (new_frm_ver >= 3)
{
+ if (strpos + 8 >= frm_image_end)
+ goto err;
keyinfo->flags= (uint) uint2korr(strpos) ^ HA_NOSAME;
keyinfo->key_length= (uint) uint2korr(strpos+2);
keyinfo->key_parts= (uint) strpos[4];
@@ -938,6 +939,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
}
else
{
+ if (strpos + 4 >= frm_image_end)
+ goto err;
keyinfo->flags= ((uint) strpos[0]) ^ HA_NOSAME;
keyinfo->key_length= (uint) uint2korr(strpos+1);
keyinfo->key_parts= (uint) strpos[3];
@@ -975,6 +978,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
keyinfo->rec_per_key= rec_per_key;
for (j=keyinfo->key_parts ; j-- ; key_part++)
{
+ if (strpos + (new_frm_ver >= 1 ? 9 : 7) >= frm_image_end)
+ goto err;
*rec_per_key++=0;
key_part->fieldnr= (uint16) (uint2korr(strpos) & FIELD_NR_MASK);
key_part->offset= (uint) uint2korr(strpos+2)-1;
@@ -1026,57 +1031,58 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
}
}
if (j == first_key_parts)
- keyinfo->ext_key_flags= keyinfo->flags | HA_NOSAME | HA_EXT_NOSAME;
+ keyinfo->ext_key_flags= keyinfo->flags | HA_EXT_NOSAME;
}
share->ext_key_parts+= keyinfo->ext_key_parts;
}
keynames=(char*) key_part;
- strpos+= (strmov(keynames, (char *) strpos) - keynames)+1;
+ strpos+= strnmov(keynames, (char *) strpos, frm_image_end - strpos) - keynames;
+ if (*strpos++) // key names are \0-terminated
+ goto err;
//reading index comments
for (keyinfo= share->key_info, i=0; i < keys; i++, keyinfo++)
{
if (keyinfo->flags & HA_USES_COMMENT)
{
+ if (strpos + 2 >= frm_image_end)
+ goto err;
keyinfo->comment.length= uint2korr(strpos);
- keyinfo->comment.str= strmake_root(&share->mem_root, (char*) strpos+2,
+ strpos+= 2;
+
+ if (strpos + keyinfo->comment.length >= frm_image_end)
+ goto err;
+ keyinfo->comment.str= strmake_root(&share->mem_root, (char*) strpos,
keyinfo->comment.length);
- strpos+= 2 + keyinfo->comment.length;
+ strpos+= keyinfo->comment.length;
}
DBUG_ASSERT(test(keyinfo->flags & HA_USES_COMMENT) ==
(keyinfo->comment.length > 0));
}
- share->reclength = uint2korr((head+16));
+ share->reclength = uint2korr((frm_image+16));
share->stored_rec_length= share->reclength;
- if (*(head+26) == 1)
+ if (frm_image[26] == 1)
share->system= 1; /* one-record-database */
-#ifdef HAVE_CRYPTED_FRM
- else if (*(head+26) == 2)
- {
- crypted= get_crypt_for_frm();
- share->crypted= 1;
- }
-#endif
- record_offset= (ulong) (uint2korr(head+6)+
- ((uint2korr(head+14) == 0xffff ?
- uint4korr(head+47) : uint2korr(head+14))));
+ record_offset= (ulong) (uint2korr(frm_image+6)+
+ ((uint2korr(frm_image+14) == 0xffff ?
+ uint4korr(frm_image+47) : uint2korr(frm_image+14))));
+
+ if (record_offset + share->reclength >= frm_length)
+ goto err;
- if ((n_length= uint4korr(head+55)))
+ if ((n_length= uint4korr(frm_image+55)))
{
/* Read extra data segment */
- uchar *next_chunk, *buff_end;
+ const uchar *next_chunk, *buff_end;
DBUG_PRINT("info", ("extra segment size is %u bytes", n_length));
- if (!(extra_segment_buff= (uchar*) my_malloc(n_length + 1, MYF(MY_WME))))
- goto err;
- next_chunk= extra_segment_buff;
- if (mysql_file_pread(file, extra_segment_buff,
- n_length, record_offset + share->reclength,
- MYF(MY_NABP)))
- {
+ next_chunk= frm_image + record_offset + share->reclength;
+ buff_end= next_chunk + n_length;
+
+ if (buff_end >= frm_image_end)
goto err;
- }
+
share->connect_string.length= uint2korr(next_chunk);
if (!(share->connect_string.str= strmake_root(&share->mem_root,
(char*) next_chunk + 2,
@@ -1086,7 +1092,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
goto err;
}
next_chunk+= share->connect_string.length + 2;
- buff_end= extra_segment_buff + n_length;
if (next_chunk + 2 < buff_end)
{
uint str_db_type_length= uint2korr(next_chunk);
@@ -1095,26 +1100,20 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
name.length= str_db_type_length;
plugin_ref tmp_plugin= ha_resolve_by_name(thd, &name);
- if (tmp_plugin != NULL && !plugin_equals(tmp_plugin, share->db_plugin))
+ if (tmp_plugin != NULL && !plugin_equals(tmp_plugin, se_plugin))
{
- if (legacy_db_type > DB_TYPE_UNKNOWN &&
- legacy_db_type < DB_TYPE_FIRST_DYNAMIC &&
- legacy_db_type != ha_legacy_type(
- plugin_data(tmp_plugin, handlerton *)))
+ if (se_plugin)
{
/* bad file, legacy_db_type did not match the name */
goto err;
}
/*
tmp_plugin is locked with a local lock.
- we unlock the old value of share->db_plugin before
+ we unlock the old value of se_plugin before
replacing it with a globally locked version of tmp_plugin
*/
- plugin_unlock(NULL, share->db_plugin);
- share->db_plugin= my_plugin_lock(NULL, tmp_plugin);
- DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
- str_db_type_length, next_chunk + 2,
- ha_legacy_type(share->db_type())));
+ plugin_unlock(NULL, se_plugin);
+ se_plugin= plugin_lock(NULL, tmp_plugin);
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
else if (str_db_type_length == 9 &&
@@ -1123,28 +1122,23 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
/*
Use partition handler
tmp_plugin is locked with a local lock.
- we unlock the old value of share->db_plugin before
+ we unlock the old value of se_plugin before
replacing it with a globally locked version of tmp_plugin
*/
/* Check if the partitioning engine is ready */
if (!plugin_is_ready(&name, MYSQL_STORAGE_ENGINE_PLUGIN))
{
- error= 8;
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--skip-partition");
goto err;
}
- plugin_unlock(NULL, share->db_plugin);
- share->db_plugin= ha_lock_engine(NULL, partition_hton);
- DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)",
- str_db_type_length, next_chunk + 2,
- ha_legacy_type(share->db_type())));
+ plugin_unlock(NULL, se_plugin);
+ se_plugin= ha_lock_engine(NULL, partition_hton);
}
#endif
else if (!tmp_plugin)
{
/* purecov: begin inspected */
- error= 8;
name.str[name.length]=0;
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str);
goto err;
@@ -1228,41 +1222,31 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
DBUG_ASSERT(next_chunk <= buff_end);
- if (share->db_create_options & HA_OPTION_TEXT_CREATE_OPTIONS)
+ if (share->db_create_options & HA_OPTION_TEXT_CREATE_OPTIONS_legacy)
{
- /*
- store options position, but skip till the time we will
- know number of fields
- */
+ if (options)
+ goto err;
options_len= uint4korr(next_chunk);
options= next_chunk + 4;
next_chunk+= options_len + 4;
}
DBUG_ASSERT(next_chunk <= buff_end);
}
- share->key_block_size= uint2korr(head+62);
+ share->key_block_size= uint2korr(frm_image+62);
- error=4;
- extra_rec_buf_length= uint2korr(head+59);
+ if (share->db_plugin && !plugin_equals(share->db_plugin, se_plugin))
+ goto err; // wrong engine (someone changed the frm under our feet?)
+
+ extra_rec_buf_length= uint2korr(frm_image+59);
rec_buff_length= ALIGN_SIZE(share->reclength + 1 + extra_rec_buf_length);
share->rec_buff_length= rec_buff_length;
if (!(record= (uchar *) alloc_root(&share->mem_root,
rec_buff_length)))
goto err; /* purecov: inspected */
share->default_values= record;
- if (mysql_file_pread(file, record, (size_t) share->reclength,
- record_offset, MYF(MY_NABP)))
- goto err; /* purecov: inspected */
+ memcpy(record, frm_image + record_offset, share->reclength);
- mysql_file_seek(file, pos+288, MY_SEEK_SET, MYF(0));
-#ifdef HAVE_CRYPTED_FRM
- if (crypted)
- {
- crypted->decode((char*) forminfo+256,288-256);
- if (sint2korr(forminfo+284) != 0) // Should be 0
- goto err; // Wrong password
- }
-#endif
+ disk_buff= frm_image + pos + FRM_FORMINFO_SIZE;
share->fields= uint2korr(forminfo+258);
pos= uint2korr(forminfo+260); /* Length of all screens */
@@ -1300,16 +1284,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
read_length=(uint) (share->fields * field_pack_length +
pos+ (uint) (n_length+int_length+com_length+
vcol_screen_length));
- if (read_string(file,(uchar**) &disk_buff,read_length))
- goto err; /* purecov: inspected */
-#ifdef HAVE_CRYPTED_FRM
- if (crypted)
- {
- crypted->decode((char*) disk_buff,read_length);
- delete crypted;
- crypted=0;
- }
-#endif
strpos= disk_buff+pos;
share->intervals= (TYPELIB*) (field_ptr+share->fields+1);
@@ -1357,14 +1331,14 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
/* Allocate handler */
if (!(handler_file= get_new_handler(share, thd->mem_root,
- share->db_type())))
+ plugin_data(se_plugin, handlerton *))))
goto err;
record= share->default_values-1; /* Fieldstart = 1 */
null_bits_are_used= share->null_fields != 0;
if (share->null_field_first)
{
- null_flags= null_pos= (uchar*) record+1;
+ null_flags= null_pos= record+1;
null_bit_pos= (db_create_options & HA_OPTION_PACK_RECORD) ? 0 : 1;
/*
null_bytes below is only correct under the condition that
@@ -1377,8 +1351,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
else
{
share->null_bytes= (share->null_fields+7)/8;
- null_flags= null_pos= (uchar*) (record + 1 +share->reclength -
- share->null_bytes);
+ null_flags= null_pos= record + 1 + share->reclength - share->null_bytes;
null_bit_pos= 0;
}
#endif
@@ -1420,7 +1393,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
geom_type= (Field::geometry_type) strpos[14];
charset= &my_charset_bin;
#else
- error= 4; // unsupported field type
goto err;
#endif
}
@@ -1431,8 +1403,16 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
charset= &my_charset_bin;
else if (!(charset= get_charset(csid, MYF(0))))
{
- error= 5; // Unknown or unavailable charset
- errarg= (int) csid;
+ const char *csname= get_charset_name((uint) csid);
+ char tmp[10];
+ if (!csname || csname[0] =='?')
+ {
+ my_snprintf(tmp, sizeof(tmp), "#%d", csid);
+ csname= tmp;
+ }
+ my_printf_error(ER_UNKNOWN_COLLATION,
+ "Unknown collation '%s' in table '%-.64s' definition",
+ MYF(0), csname, share->table_name.str);
goto err;
}
}
@@ -1476,10 +1456,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (opt_interval_id)
interval_nr= (uint)vcol_screen_pos[3];
else if ((uint)vcol_screen_pos[0] != 1)
- {
- error= 4;
goto err;
- }
+
fld_stored_in_db= (bool) (uint) vcol_screen_pos[2];
vcol_expr_length= vcol_info_length -
(uint)(FRM_VCOL_HEADER_SIZE(opt_interval_id));
@@ -1578,10 +1556,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
(TYPELIB*) 0),
share->fieldnames.type_names[i]);
if (!reg_field) // Not supported field type
- {
- error= 4;
- goto err; /* purecov: inspected */
- }
+ goto err;
+
reg_field->field_index= i;
reg_field->comment=comment;
@@ -1607,20 +1583,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (reg_field->unireg_check == Field::NEXT_NUMBER)
share->found_next_number_field= field_ptr;
- if (use_hash)
- {
- if (my_hash_insert(&share->name_hash,
- (uchar*) field_ptr))
- {
- /*
- Set return code 8 here to indicate that an error has
- occurred but that the error message already has been
- sent (OOM).
- */
- error= 8;
- goto err;
- }
- }
+ if (use_hash && my_hash_insert(&share->name_hash, (uchar*) field_ptr))
+ goto err;
if (!reg_field->stored_in_db)
{
share->stored_fields--;
@@ -1772,10 +1736,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
(uint) key_part->offset,
(uint) key_part->length);
if (!key_part->fieldnr)
- {
- error= 4; // Wrong file
goto err;
- }
+
field= key_part->field= share->field[key_part->fieldnr-1];
key_part->type= field->key_type();
if (field->null_ptr)
@@ -1923,8 +1885,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
}
else
share->primary_key= MAX_KEY;
- my_free(disk_buff);
- disk_buff=0;
if (new_field_pack_flag <= 1)
{
/* Old file format with default as not null */
@@ -1933,7 +1893,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
null_length, 255);
}
- if (share->db_create_options & HA_OPTION_TEXT_CREATE_OPTIONS)
+ if (options)
{
DBUG_ASSERT(options_len);
if (engine_table_options_frm_read(options, options_len, share))
@@ -1950,13 +1910,8 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
share->default_values, reg_field,
&share->next_number_key_offset,
&share->next_number_keypart)) < 0)
- {
- /* Wrong field definition */
- error= 4;
- goto err;
- }
- else
- reg_field->flags |= AUTO_INCREMENT_FLAG;
+ goto err; // Wrong field definition
+ reg_field->flags |= AUTO_INCREMENT_FLAG;
}
if (share->blob_fields)
@@ -2000,17 +1955,18 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
if (use_hash)
(void) my_hash_check(&share->name_hash);
#endif
- my_free(extra_segment_buff);
- DBUG_RETURN (0);
+
+ share->db_plugin= se_plugin;
+ share->error= OPEN_FRM_OK;
+ thd->status_var.opened_shares++;
+ *root_ptr= old_root;
+ DBUG_RETURN(0);
err:
- share->error= error;
+ share->error= OPEN_FRM_CORRUPTED;
share->open_errno= my_errno;
- share->errarg= errarg;
- my_free(disk_buff);
- my_free(extra_segment_buff);
- delete crypted;
delete handler_file;
+ plugin_unlock(0, se_plugin);
my_hash_free(&share->name_hash);
if (share->ha_data_destroy)
{
@@ -2025,9 +1981,172 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
}
#endif /* WITH_PARTITION_STORAGE_ENGINE */
- open_table_error(share, error, share->open_errno, errarg);
- DBUG_RETURN(error);
-} /* open_binary_frm */
+ if (!thd->is_error())
+ open_table_error(share, OPEN_FRM_CORRUPTED, share->open_errno);
+
+ *root_ptr= old_root;
+ DBUG_RETURN(HA_ERR_NOT_A_TABLE);
+}
+
+
+static bool sql_unusable_for_discovery(THD *thd, const char *sql)
+{
+ LEX *lex= thd->lex;
+ HA_CREATE_INFO *create_info= &lex->create_info;
+
+ // ... not CREATE TABLE
+ if (lex->sql_command != SQLCOM_CREATE_TABLE)
+ return 1;
+ // ... create like
+ if (create_info->options & HA_LEX_CREATE_TABLE_LIKE)
+ return 1;
+ // ... create select
+ if (lex->select_lex.item_list.elements)
+ return 1;
+ // ... temporary
+ if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ return 1;
+ // ... if exists
+ if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
+ return 1;
+
+ // XXX error out or rather ignore the following:
+ // ... partitioning
+ if (lex->part_info)
+ return 1;
+ // ... union
+ if (create_info->used_fields & HA_CREATE_USED_UNION)
+ return 1;
+ // ... index/data directory
+ if (create_info->data_file_name || create_info->index_file_name)
+ return 1;
+ // ... engine
+ if (create_info->used_fields & HA_CREATE_USED_ENGINE)
+ return 1;
+
+ return 0;
+}
+
+int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
+ const char *sql, size_t sql_length)
+{
+ ulonglong saved_mode= thd->variables.sql_mode;
+ CHARSET_INFO *old_cs= thd->variables.character_set_client;
+ Parser_state parser_state;
+ bool error;
+ char *sql_copy;
+ handler *file;
+ LEX *old_lex;
+ Query_arena *arena, backup;
+ LEX tmp_lex;
+ LEX_CUSTRING frm= {0,0};
+
+ DBUG_ENTER("TABLE_SHARE::init_from_sql_statement_string");
+
+ /*
+ Ouch. Parser may *change* the string it's working on.
+ Currently (2013-02-26) it is used to permanently disable
+ conditional comments.
+ Anyway, let's copy the caller's string...
+ */
+ if (!(sql_copy= thd->strmake(sql, sql_length)))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+
+ if (parser_state.init(thd, sql_copy, sql_length))
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
+
+ thd->variables.sql_mode= MODE_NO_ENGINE_SUBSTITUTION | MODE_NO_DIR_IN_CREATE;
+ thd->variables.character_set_client= system_charset_info;
+ tmp_disable_binlog(thd);
+ old_lex= thd->lex;
+ thd->lex= &tmp_lex;
+
+ arena= thd->stmt_arena;
+ if (arena->is_conventional())
+ arena= 0;
+ else
+ thd->set_n_backup_active_arena(arena, &backup);
+
+ lex_start(thd);
+
+ if ((error= parse_sql(thd, & parser_state, NULL)))
+ goto ret;
+
+ if (sql_unusable_for_discovery(thd, sql_copy))
+ {
+ my_error(ER_SQL_DISCOVER_ERROR, MYF(0), plugin_name(db_plugin)->str,
+ db.str, table_name.str, sql_copy);
+ goto ret;
+ }
+
+ thd->lex->create_info.db_type= plugin_data(db_plugin, handlerton *);
+
+ if (tabledef_version.str)
+ thd->lex->create_info.tabledef_version= tabledef_version;
+
+ file= mysql_create_frm_image(thd, db.str, table_name.str,
+ &thd->lex->create_info, &thd->lex->alter_info,
+ C_ORDINARY_CREATE, &frm);
+ error|= file == 0;
+ delete file;
+
+ if (frm.str)
+ {
+ option_list= 0; // cleanup existing options ...
+ option_struct= 0; // ... if it's an assisted discovery
+ error= init_from_binary_frm_image(thd, write, frm.str, frm.length);
+ }
+
+ret:
+ my_free(const_cast<uchar*>(frm.str));
+ lex_end(thd->lex);
+ thd->lex= old_lex;
+ if (arena)
+ thd->restore_active_arena(arena, &backup);
+ reenable_binlog(thd);
+ thd->variables.sql_mode= saved_mode;
+ thd->variables.character_set_client= old_cs;
+ if (thd->is_error() || error)
+ {
+ thd->clear_error();
+ my_error(ER_NO_SUCH_TABLE, MYF(0), db.str, table_name.str);
+ DBUG_RETURN(HA_ERR_NOT_A_TABLE);
+ }
+ DBUG_RETURN(0);
+}
+
+bool TABLE_SHARE::write_frm_image(const uchar *frm, size_t len)
+{
+ return writefrm(normalized_path.str, db.str, table_name.str, false, frm, len);
+}
+
+
+bool TABLE_SHARE::read_frm_image(const uchar **frm, size_t *len)
+{
+ if (partition_info_str) // cannot discover a partition
+ {
+ DBUG_ASSERT(db_type()->discover_table == 0);
+ return 1;
+ }
+
+ if (frm_image)
+ {
+ *frm= frm_image->str;
+ *len= frm_image->length;
+ frm_image->str= 0; // pass the ownership to the caller
+ frm_image= 0;
+ return 0;
+ }
+ return readfrm(normalized_path.str, frm, len);
+}
+
+
+void TABLE_SHARE::free_frm_image(const uchar *frm)
+{
+ if (frm)
+ my_free(const_cast<uchar*>(frm));
+}
+
/*
@brief
@@ -2336,11 +2455,12 @@ end:
7 Table definition has changed in engine
*/
-int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
- uint db_stat, uint prgflag, uint ha_open_flags,
- TABLE *outparam, bool is_create_table)
+enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
+ const char *alias, uint db_stat, uint prgflag,
+ uint ha_open_flags, TABLE *outparam,
+ bool is_create_table)
{
- int error;
+ enum open_frm_error error;
uint records, i, bitmap_size;
bool error_reported= FALSE;
uchar *record, *bitmaps;
@@ -2352,7 +2472,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
thd->lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_VIEW; // not a view
- error= 1;
+ error= OPEN_FRM_ERROR_ALREADY_ISSUED; // for OOM errors below
bzero((char*) outparam, sizeof(*outparam));
outparam->in_use= thd;
outparam->s= share;
@@ -2381,7 +2501,6 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
DBUG_ASSERT(!db_stat);
}
- error= 4;
outparam->reginfo.lock_type= TL_UNLOCK;
outparam->current_lock= F_UNLCK;
records=0;
@@ -2534,7 +2653,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
&(*field_ptr)->vcol_info->expr_str,
&error_reported))
{
- error= 4; // in case no error is reported
+ error= OPEN_FRM_CORRUPTED;
goto err;
}
*(vfield_ptr++)= *field_ptr;
@@ -2645,53 +2764,32 @@ partititon_err:
outparam->default_column_bitmaps();
/* The table struct is now initialized; Open the table */
- error= 2;
if (db_stat)
{
- int ha_err;
- if ((ha_err= (outparam->file->
- ha_open(outparam, share->normalized_path.str,
- (db_stat & HA_READ_ONLY ? O_RDONLY : O_RDWR),
- (db_stat & HA_OPEN_TEMPORARY ? HA_OPEN_TMP_TABLE :
- ((db_stat & HA_WAIT_IF_LOCKED) ||
- (specialflag & SPECIAL_WAIT_IF_LOCKED)) ?
- HA_OPEN_WAIT_IF_LOCKED :
- (db_stat & (HA_ABORT_IF_LOCKED | HA_GET_INFO)) ?
- HA_OPEN_ABORT_IF_LOCKED :
- HA_OPEN_IGNORE_IF_LOCKED) | ha_open_flags))))
+ if (db_stat & HA_OPEN_TEMPORARY)
+ ha_open_flags|= HA_OPEN_TMP_TABLE;
+ else if ((db_stat & HA_WAIT_IF_LOCKED) ||
+ (specialflag & SPECIAL_WAIT_IF_LOCKED))
+ ha_open_flags|= HA_OPEN_WAIT_IF_LOCKED;
+ else if (db_stat & (HA_ABORT_IF_LOCKED | HA_GET_INFO))
+ ha_open_flags|= HA_OPEN_ABORT_IF_LOCKED;
+ else
+ ha_open_flags|= HA_OPEN_IGNORE_IF_LOCKED;
+
+ int ha_err= outparam->file->ha_open(outparam, share->normalized_path.str,
+ (db_stat & HA_READ_ONLY ? O_RDONLY : O_RDWR),
+ ha_open_flags);
+ if (ha_err)
{
+ share->open_errno= ha_err;
/* Set a flag if the table is crashed and it can be auto. repaired */
share->crashed= (outparam->file->auto_repair(ha_err) &&
!(ha_open_flags & HA_OPEN_FOR_REPAIR));
-
- switch (ha_err)
- {
- case HA_ERR_NO_SUCH_TABLE:
- /*
- The table did not exists in storage engine, use same error message
- as if the .frm file didn't exist
- */
- error= 1;
- my_errno= ENOENT;
- break;
- case EMFILE:
- /*
- Too many files opened, use same error message as if the .frm
- file can't open
- */
- DBUG_PRINT("error", ("open file: %s failed, too many files opened (errno: %d)",
- share->normalized_path.str, ha_err));
- error= 1;
- my_errno= EMFILE;
- break;
- default:
- outparam->file->print_error(ha_err, MYF(0));
- error_reported= TRUE;
- if (ha_err == HA_ERR_TABLE_DEF_CHANGED)
- error= 7;
- break;
- }
- goto err; /* purecov: inspected */
+ outparam->file->print_error(ha_err, MYF(0));
+ error_reported= TRUE;
+ if (ha_err == HA_ERR_TABLE_DEF_CHANGED)
+ error= OPEN_FRM_DISCOVER;
+ goto err;
}
}
@@ -2705,11 +2803,11 @@ partititon_err:
thd->status_var.opened_tables++;
thd->lex->context_analysis_only= save_context_analysis_only;
- DBUG_RETURN (0);
+ DBUG_RETURN (OPEN_FRM_OK);
err:
if (! error_reported)
- open_table_error(share, error, my_errno, 0);
+ open_table_error(share, error, my_errno);
delete outparam->file;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (outparam->part_info)
@@ -2820,158 +2918,17 @@ void free_field_buffers_larger_than(TABLE *table, uint32 size)
}
}
-/**
- Find where a form starts.
-
- @param head The start of the form file.
-
- @remark If formname is NULL then only formnames is read.
-
- @retval The form position.
-*/
-
-static ulong get_form_pos(File file, uchar *head)
-{
- uchar *pos, *buf;
- uint names, length;
- ulong ret_value=0;
- DBUG_ENTER("get_form_pos");
-
- names= uint2korr(head+8);
-
- if (!(names= uint2korr(head+8)))
- DBUG_RETURN(0);
-
- length= uint2korr(head+4);
-
- mysql_file_seek(file, 64L, MY_SEEK_SET, MYF(0));
-
- if (!(buf= (uchar*) my_malloc(length+names*4, MYF(MY_WME))))
- DBUG_RETURN(0);
-
- if (mysql_file_read(file, buf, length+names*4, MYF(MY_NABP)))
- {
- my_free(buf);
- DBUG_RETURN(0);
- }
-
- pos= buf+length;
- ret_value= uint4korr(pos);
-
- my_free(buf);
-
- DBUG_RETURN(ret_value);
-}
-
-
-/*
- Read string from a file with malloc
-
- NOTES:
- We add an \0 at end of the read string to make reading of C strings easier
-*/
+/* error message when opening a form file */
-int read_string(File file, uchar**to, size_t length)
+void open_table_error(TABLE_SHARE *share, enum open_frm_error error,
+ int db_errno)
{
- DBUG_ENTER("read_string");
-
- my_free(*to);
- if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) ||
- mysql_file_read(file, *to, length, MYF(MY_NABP)))
- {
- my_free(*to); /* purecov: inspected */
- *to= 0; /* purecov: inspected */
- DBUG_RETURN(1); /* purecov: inspected */
- }
- *((char*) *to+length)= '\0';
- DBUG_RETURN (0);
-} /* read_string */
-
-
- /* Add a new form to a form file */
-
-ulong make_new_entry(File file, uchar *fileinfo, TYPELIB *formnames,
- const char *newname)
-{
- uint i,bufflength,maxlength,n_length,length,names;
- ulong endpos,newpos;
- uchar buff[IO_SIZE];
- uchar *pos;
- DBUG_ENTER("make_new_entry");
-
- length=(uint) strlen(newname)+1;
- n_length=uint2korr(fileinfo+4);
- maxlength=uint2korr(fileinfo+6);
- names=uint2korr(fileinfo+8);
- newpos=uint4korr(fileinfo+10);
-
- if (64+length+n_length+(names+1)*4 > maxlength)
- { /* Expand file */
- newpos+=IO_SIZE;
- int4store(fileinfo+10,newpos);
- /* Copy from file-end */
- endpos= (ulong) mysql_file_seek(file, 0L, MY_SEEK_END, MYF(0));
- bufflength= (uint) (endpos & (IO_SIZE-1)); /* IO_SIZE is a power of 2 */
-
- while (endpos > maxlength)
- {
- mysql_file_seek(file, (ulong) (endpos-bufflength), MY_SEEK_SET, MYF(0));
- if (mysql_file_read(file, buff, bufflength, MYF(MY_NABP+MY_WME)))
- DBUG_RETURN(0L);
- mysql_file_seek(file, (ulong) (endpos-bufflength+IO_SIZE), MY_SEEK_SET,
- MYF(0));
- if ((mysql_file_write(file, buff, bufflength, MYF(MY_NABP+MY_WME))))
- DBUG_RETURN(0);
- endpos-=bufflength; bufflength=IO_SIZE;
- }
- bzero(buff,IO_SIZE); /* Null new block */
- mysql_file_seek(file, (ulong) maxlength, MY_SEEK_SET, MYF(0));
- if (mysql_file_write(file, buff, bufflength, MYF(MY_NABP+MY_WME)))
- DBUG_RETURN(0L);
- maxlength+=IO_SIZE; /* Fix old ref */
- int2store(fileinfo+6,maxlength);
- for (i=names, pos= (uchar*) *formnames->type_names+n_length-1; i-- ;
- pos+=4)
- {
- endpos=uint4korr(pos)+IO_SIZE;
- int4store(pos,endpos);
- }
- }
-
- if (n_length == 1 )
- { /* First name */
- length++;
- (void) strxmov((char*) buff,"/",newname,"/",NullS);
- }
- else
- (void) strxmov((char*) buff,newname,"/",NullS); /* purecov: inspected */
- mysql_file_seek(file, 63L+(ulong) n_length, MY_SEEK_SET, MYF(0));
- if (mysql_file_write(file, buff, (size_t) length+1, MYF(MY_NABP+MY_WME)) ||
- (names && mysql_file_write(file,
- (uchar*) (*formnames->type_names+n_length-1),
- names*4, MYF(MY_NABP+MY_WME))) ||
- mysql_file_write(file, fileinfo+10, 4, MYF(MY_NABP+MY_WME)))
- DBUG_RETURN(0L); /* purecov: inspected */
-
- int2store(fileinfo+8,names+1);
- int2store(fileinfo+4,n_length+length);
- (void) mysql_file_chsize(file, newpos, 0, MYF(MY_WME));/* Append file with '\0' */
- DBUG_RETURN(newpos);
-} /* make_new_entry */
-
-
- /* error message when opening a form file */
-
-void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg)
-{
- int err_no;
char buff[FN_REFLEN];
- myf errortype= ME_ERROR+ME_WAITTANG; // Write fatals error to log
+ const myf errortype= ME_ERROR+ME_WAITTANG; // Write fatals error to log
DBUG_ENTER("open_table_error");
switch (error) {
- case 7:
- case 1:
+ case OPEN_FRM_OPEN_ERROR:
/*
Test if file didn't exists. We have to also test for EINVAL as this
may happen on windows when opening a file with a not legal file name
@@ -2985,55 +2942,30 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg)
errortype, buff, db_errno);
}
break;
- case 2:
- {
- handler *file= 0;
- const char *datext= "";
-
- if (share->db_type() != NULL)
- {
- if ((file= get_new_handler(share, current_thd->mem_root,
- share->db_type())))
- {
- if (!(datext= *file->bas_ext()))
- datext= "";
- }
- }
- err_no= (db_errno == ENOENT) ? ER_FILE_NOT_FOUND : (db_errno == EAGAIN) ?
- ER_FILE_USED : ER_CANT_OPEN_FILE;
- strxmov(buff, share->normalized_path.str, datext, NullS);
- my_error(err_no,errortype, buff, db_errno);
- delete file;
+ case OPEN_FRM_OK:
+ DBUG_ASSERT(0); // open_table_error() is never called for this one
break;
- }
- case 5:
- {
- const char *csname= get_charset_name((uint) errarg);
- char tmp[10];
- if (!csname || csname[0] =='?')
- {
- my_snprintf(tmp, sizeof(tmp), "#%d", errarg);
- csname= tmp;
- }
- my_printf_error(ER_UNKNOWN_COLLATION,
- "Unknown collation '%s' in table '%-.64s' definition",
- MYF(0), csname, share->table_name.str);
+ case OPEN_FRM_ERROR_ALREADY_ISSUED:
break;
- }
- case 6:
- strxmov(buff, share->normalized_path.str, reg_ext, NullS);
- my_printf_error(ER_NOT_FORM_FILE,
- "Table '%-.64s' was created with a different version "
- "of MySQL and cannot be read",
- MYF(0), buff);
+ case OPEN_FRM_NOT_A_VIEW:
+ my_error(ER_WRONG_OBJECT, MYF(0), share->db.str,
+ share->table_name.str, "VIEW");
break;
- case 8:
+ case OPEN_FRM_NOT_A_TABLE:
+ my_error(ER_WRONG_OBJECT, MYF(0), share->db.str,
+ share->table_name.str, "TABLE");
break;
- default: /* Better wrong error than none */
- case 4:
+ case OPEN_FRM_DISCOVER:
+ DBUG_ASSERT(0); // open_table_error() is never called for this one
+ break;
+ case OPEN_FRM_CORRUPTED:
strxmov(buff, share->normalized_path.str, reg_ext, NullS);
my_error(ER_NOT_FORM_FILE, errortype, buff);
break;
+ case OPEN_FRM_READ_ERROR:
+ strxmov(buff, share->normalized_path.str, reg_ext, NullS);
+ my_error(ER_ERROR_ON_READ, errortype, buff, db_errno);
+ break;
}
DBUG_VOID_RETURN;
} /* open_table_error */
@@ -3137,28 +3069,6 @@ static uint find_field(Field **fields, uchar *record, uint start, uint length)
}
- /* Check that the integer is in the internal */
-
-int set_zone(register int nr, int min_zone, int max_zone)
-{
- if (nr<=min_zone)
- return (min_zone);
- if (nr>=max_zone)
- return (max_zone);
- return (nr);
-} /* set_zone */
-
- /* Adjust number to next larger disk buffer */
-
-ulong next_io_size(register ulong pos)
-{
- reg2 ulong offset;
- if ((offset= pos & (IO_SIZE-1)))
- return pos-offset+IO_SIZE;
- return pos;
-} /* next_io_size */
-
-
/*
Store an SQL quoted string.
@@ -3221,22 +3131,12 @@ void append_unescaped(String *res, const char *pos, uint length)
}
- /* Create a .frm file */
-
-File create_frm(THD *thd, const char *name, const char *db,
- const char *table, uint reclength, uchar *fileinfo,
- HA_CREATE_INFO *create_info, uint keys, KEY *key_info)
+void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
+ HA_CREATE_INFO *create_info, uint keys, KEY *key_info)
{
- register File file;
- ulong length;
- uchar fill[IO_SIZE];
- int create_flags= O_RDWR | O_TRUNC;
ulong key_comment_total_bytes= 0;
uint i;
- DBUG_ENTER("create_frm");
-
- if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
- create_flags|= O_EXCL | O_NOFOLLOW;
+ DBUG_ENTER("prepare_frm_header");
/* Fix this when we have new .frm files; Current limit is 4G rows (TODO) */
if (create_info->max_rows > UINT_MAX32)
@@ -3244,101 +3144,77 @@ File create_frm(THD *thd, const char *name, const char *db,
if (create_info->min_rows > UINT_MAX32)
create_info->min_rows= UINT_MAX32;
- if ((file= mysql_file_create(key_file_frm,
- name, CREATE_MODE, create_flags, MYF(0))) >= 0)
- {
- uint key_length, tmp_key_length, tmp, csid;
- bzero((char*) fileinfo,64);
- /* header */
- fileinfo[0]=(uchar) 254;
- fileinfo[1]= 1;
- fileinfo[2]= FRM_VER+3+ test(create_info->varchar);
+ uint key_length, tmp_key_length, tmp, csid;
+ bzero((char*) fileinfo, FRM_HEADER_SIZE);
+ /* header */
+ fileinfo[0]=(uchar) 254;
+ fileinfo[1]= 1;
+ fileinfo[2]= FRM_VER+3+ test(create_info->varchar);
- fileinfo[3]= (uchar) ha_legacy_type(
- ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0));
- fileinfo[4]=1;
- int2store(fileinfo+6,IO_SIZE); /* Next block starts here */
- /*
- Keep in sync with pack_keys() in unireg.cc
- For each key:
- 8 bytes for the key header
- 9 bytes for each key-part (MAX_REF_PARTS)
- NAME_LEN bytes for the name
- 1 byte for the NAMES_SEP_CHAR (before the name)
- For all keys:
- 6 bytes for the header
- 1 byte for the NAMES_SEP_CHAR (after the last name)
- 9 extra bytes (padding for safety? alignment?)
- */
- for (i= 0; i < keys; i++)
- {
- DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) ==
- (key_info[i].comment.length > 0));
- if (key_info[i].flags & HA_USES_COMMENT)
- key_comment_total_bytes += 2 + key_info[i].comment.length;
- }
+ fileinfo[3]= (uchar) ha_legacy_type(
+ ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0));
- key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16
- + key_comment_total_bytes;
-
- length= next_io_size((ulong) (IO_SIZE+key_length+reclength+
- create_info->extra_size));
- int4store(fileinfo+10,length);
- tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
- int2store(fileinfo+14,tmp_key_length);
- int2store(fileinfo+16,reclength);
- int4store(fileinfo+18,create_info->max_rows);
- int4store(fileinfo+22,create_info->min_rows);
- /* fileinfo[26] is set in mysql_create_frm() */
- fileinfo[27]=2; // Use long pack-fields
- /* fileinfo[28 & 29] is set to key_info_length in mysql_create_frm() */
- create_info->table_options|=HA_OPTION_LONG_BLOB_PTR; // Use portable blob pointers
- int2store(fileinfo+30,create_info->table_options);
- fileinfo[32]=0; // No filename anymore
- fileinfo[33]=5; // Mark for 5.0 frm file
- int4store(fileinfo+34,create_info->avg_row_length);
- csid= (create_info->default_table_charset ?
- create_info->default_table_charset->number : 0);
- fileinfo[38]= (uchar) csid;
- fileinfo[39]= (uchar) ((uint) create_info->transactional |
- ((uint) create_info->page_checksum << 2));
- fileinfo[40]= (uchar) create_info->row_type;
- /* Next few bytes where for RAID support */
- fileinfo[41]= (uchar) (csid >> 8);
- fileinfo[42]= 0;
- fileinfo[43]= 0;
- fileinfo[44]= 0;
- fileinfo[45]= 0;
- fileinfo[46]= 0;
- int4store(fileinfo+47, key_length);
- tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store
- int4store(fileinfo+51, tmp);
- int4store(fileinfo+55, create_info->extra_size);
- /*
- 59-60 is reserved for extra_rec_buf_length,
- 61 for default_part_db_type
- */
- int2store(fileinfo+62, create_info->key_block_size);
- bzero(fill,IO_SIZE);
- for (; length > IO_SIZE ; length-= IO_SIZE)
- {
- if (mysql_file_write(file, fill, IO_SIZE, MYF(MY_WME | MY_NABP)))
- {
- (void) mysql_file_close(file, MYF(0));
- (void) mysql_file_delete(key_file_frm, name, MYF(0));
- return(-1);
- }
- }
- }
- else
- {
- if (my_errno == ENOENT)
- my_error(ER_BAD_DB_ERROR,MYF(0),db);
- else
- my_error(ER_CANT_CREATE_TABLE,MYF(0),table,my_errno);
- }
- DBUG_RETURN(file);
-} /* create_frm */
+ /*
+ Keep in sync with pack_keys() in unireg.cc
+ For each key:
+ 8 bytes for the key header
+ 9 bytes for each key-part (MAX_REF_PARTS)
+ NAME_LEN bytes for the name
+ 1 byte for the NAMES_SEP_CHAR (before the name)
+ For all keys:
+ 6 bytes for the header
+ 1 byte for the NAMES_SEP_CHAR (after the last name)
+ 9 extra bytes (padding for safety? alignment?)
+ */
+ for (i= 0; i < keys; i++)
+ {
+ DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) ==
+ (key_info[i].comment.length > 0));
+ if (key_info[i].flags & HA_USES_COMMENT)
+ key_comment_total_bytes += 2 + key_info[i].comment.length;
+ }
+
+ key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16
+ + key_comment_total_bytes;
+
+ int2store(fileinfo+8,1);
+ tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
+ int2store(fileinfo+14,tmp_key_length);
+ int2store(fileinfo+16,reclength);
+ int4store(fileinfo+18,create_info->max_rows);
+ int4store(fileinfo+22,create_info->min_rows);
+ /* fileinfo[26] is set in mysql_create_frm() */
+ fileinfo[27]=2; // Use long pack-fields
+ /* fileinfo[28 & 29] is set to key_info_length in mysql_create_frm() */
+ create_info->table_options|=HA_OPTION_LONG_BLOB_PTR; // Use portable blob pointers
+ int2store(fileinfo+30,create_info->table_options);
+ fileinfo[32]=0; // No filename anymore
+ fileinfo[33]=5; // Mark for 5.0 frm file
+ int4store(fileinfo+34,create_info->avg_row_length);
+ csid= (create_info->default_table_charset ?
+ create_info->default_table_charset->number : 0);
+ fileinfo[38]= (uchar) csid;
+ fileinfo[39]= (uchar) ((uint) create_info->transactional |
+ ((uint) create_info->page_checksum << 2));
+ fileinfo[40]= (uchar) create_info->row_type;
+ /* Next few bytes where for RAID support */
+ fileinfo[41]= (uchar) (csid >> 8);
+ fileinfo[42]= 0;
+ fileinfo[43]= 0;
+ fileinfo[44]= 0;
+ fileinfo[45]= 0;
+ fileinfo[46]= 0;
+ int4store(fileinfo+47, key_length);
+ tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store
+ int4store(fileinfo+51, tmp);
+ int4store(fileinfo+55, create_info->extra_size);
+ /*
+ 59-60 is reserved for extra_rec_buf_length,
+ 61 for default_part_db_type
+ */
+ int2store(fileinfo+62, create_info->key_block_size);
+ DBUG_VOID_RETURN;
+} /* prepare_fileinfo */
void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
@@ -3367,7 +3243,7 @@ rename_file_ext(const char * from,const char * to,const char * ext)
char from_b[FN_REFLEN],to_b[FN_REFLEN];
(void) strxmov(from_b,from,ext,NullS);
(void) strxmov(to_b,to,ext,NullS);
- return (mysql_file_rename(key_file_frm, from_b, to_b, MYF(MY_WME)));
+ return mysql_file_rename(key_file_frm, from_b, to_b, MYF(0));
}
@@ -3578,9 +3454,9 @@ bool check_column_name(const char *name)
}
#else
last_char_is_space= *name==' ';
-#endif
- if (*name == NAMES_SEP_CHAR)
+ if (*name == '\377')
return 1;
+#endif
name++;
name_length++;
}
@@ -4818,7 +4694,7 @@ void TABLE_LIST::register_want_access(ulong want_access)
Load security context information for this view
SYNOPSIS
- TABLE_LIST::prepare_view_securety_context()
+ TABLE_LIST::prepare_view_security_context()
thd [in] thread handler
RETURN
@@ -4827,9 +4703,9 @@ void TABLE_LIST::register_want_access(ulong want_access)
*/
#ifndef NO_EMBEDDED_ACCESS_CHECKS
-bool TABLE_LIST::prepare_view_securety_context(THD *thd)
+bool TABLE_LIST::prepare_view_security_context(THD *thd)
{
- DBUG_ENTER("TABLE_LIST::prepare_view_securety_context");
+ DBUG_ENTER("TABLE_LIST::prepare_view_security_context");
DBUG_PRINT("enter", ("table: %s", alias));
DBUG_ASSERT(!prelocking_placeholder && view);
@@ -4936,7 +4812,7 @@ bool TABLE_LIST::prepare_security(THD *thd)
Security_context *save_security_ctx= thd->security_ctx;
DBUG_ASSERT(!prelocking_placeholder);
- if (prepare_view_securety_context(thd))
+ if (prepare_view_security_context(thd))
DBUG_RETURN(TRUE);
thd->security_ctx= find_view_security_context(thd);
while ((tbl= tb++))
diff --git a/sql/table.h b/sql/table.h
index 1a567ae75d1..fa5bd83371a 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -562,6 +562,17 @@ typedef I_P_List <Wait_for_flush,
Wait_for_flush_list;
+enum open_frm_error {
+ OPEN_FRM_OK = 0,
+ OPEN_FRM_OPEN_ERROR,
+ OPEN_FRM_READ_ERROR,
+ OPEN_FRM_CORRUPTED,
+ OPEN_FRM_DISCOVER,
+ OPEN_FRM_ERROR_ALREADY_ISSUED,
+ OPEN_FRM_NOT_A_VIEW,
+ OPEN_FRM_NOT_A_TABLE
+};
+
/**
Control block to access table statistics loaded
from persistent statistical tables
@@ -605,6 +616,8 @@ struct TABLE_SHARE
I_P_List <TABLE, TABLE_share> used_tables;
I_P_List <TABLE, TABLE_share> free_tables;
+ LEX_CUSTRING tabledef_version;
+
engine_option_value *option_list; /* text options for table */
ha_table_option_struct *option_struct; /* structure with parsed options */
@@ -654,8 +667,9 @@ struct TABLE_SHARE
plugin_ref db_plugin; /* storage engine plugin */
inline handlerton *db_type() const /* table_type for handler */
{
- // DBUG_ASSERT(db_plugin);
- return db_plugin ? plugin_data(db_plugin, handlerton*) : NULL;
+ return is_view ? view_pseudo_hton :
+ db_plugin ? plugin_data(db_plugin, handlerton*)
+ : NULL;
}
enum row_type row_type; /* How rows are stored */
enum tmp_table_type tmp_table;
@@ -694,7 +708,8 @@ struct TABLE_SHARE
uint next_number_index; /* autoincrement key number */
uint next_number_key_offset; /* autoinc keypart offset in a key */
uint next_number_keypart; /* autoinc keypart number in a key */
- uint error, open_errno, errarg; /* error from open_table_def() */
+ enum open_frm_error error; /* error from open_table_def() */
+ uint open_errno; /* error from open_table_def() */
uint column_bitmap_size;
uchar frm_version;
uint vfields; /* Number of computed (virtual) fields */
@@ -825,12 +840,42 @@ struct TABLE_SHARE
return table_map_id;
}
-
/** Is this table share being expelled from the table definition cache? */
inline bool has_old_version() const
{
return version != refresh_version;
}
+ inline bool protected_against_usage() const
+ {
+ return version == 0;
+ }
+ inline void protect_against_usage()
+ {
+ version= 0;
+ }
+ /*
+ This is used only for the case of locked tables, as we want to
+ allow one to do SHOW commands on them even after ALTER or REPAIR
+ */
+ inline void allow_access_to_protected_table()
+ {
+ DBUG_ASSERT(version == 0);
+ version= 1;
+ }
+ /*
+ Remove from table definition cache at close.
+ Table can still be opened by SHOW
+ */
+ inline void remove_from_cache_at_close()
+ {
+ if (version != 0) /* Don't remove protection */
+ version= 1;
+ }
+ inline void set_refresh_version()
+ {
+ version= refresh_version;
+ }
+
/**
Convert unrelated members of TABLE_SHARE to one enum
representing its type.
@@ -944,6 +989,40 @@ struct TABLE_SHARE
}
uint actual_n_key_parts(THD *thd);
+
+ LEX_CUSTRING *frm_image; ///< only during CREATE TABLE (@sa ha_create_table)
+
+ /*
+ populates TABLE_SHARE from the table description in the binary frm image.
+ if 'write' is true, this frm image is also written into a corresponding
+ frm file, that serves as a persistent metadata cache to avoid
+ discovering the table over and over again
+ */
+ int init_from_binary_frm_image(THD *thd, bool write,
+ const uchar *frm_image, size_t frm_length);
+
+ /*
+ populates TABLE_SHARE from the table description, specified as the
+ complete CREATE TABLE sql statement.
+ if 'write' is true, this frm image is also written into a corresponding
+ frm file, that serves as a persistent metadata cache to avoid
+ discovering the table over and over again
+ */
+ int init_from_sql_statement_string(THD *thd, bool write,
+ const char *sql, size_t sql_length);
+ /*
+ writes the frm image to an frm file, corresponding to this table
+ */
+ bool write_frm_image(const uchar *frm_image, size_t frm_length);
+
+ /*
+ returns an frm image for this table.
+ the memory is allocated and must be freed later
+ */
+ bool read_frm_image(const uchar **frm_image, size_t *frm_length);
+
+ /* frees the memory allocated in read_frm_image */
+ void free_frm_image(const uchar *frm);
};
@@ -1580,7 +1659,7 @@ struct TABLE_LIST
/**
Prepare TABLE_LIST that consists of one table instance to use in
- simple_open_and_lock_tables
+ open_and_lock_tables
*/
inline void init_one_table(const char *db_name_arg,
size_t db_length_arg,
@@ -2004,7 +2083,7 @@ struct TABLE_LIST
bool prepare_security(THD *thd);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *find_view_security_context(THD *thd);
- bool prepare_view_securety_context(THD *thd);
+ bool prepare_view_security_context(THD *thd);
#endif
/*
Cleanup for re-execution in a prepared statement or a stored
@@ -2147,9 +2226,9 @@ private:
#else
inline void set_check_merged() {}
#endif
- /** See comments for set_metadata_id() */
+ /** See comments for set_table_ref_id() */
enum enum_table_ref_type m_table_ref_type;
- /** See comments for set_metadata_id() */
+ /** See comments for set_table_ref_id() */
ulong m_table_ref_version;
};
@@ -2403,26 +2482,35 @@ static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set,
#endif
}
+enum get_table_share_flags {
+ GTS_TABLE = 1,
+ GTS_VIEW = 2,
+ GTS_NOLOCK = 4,
+ GTS_FORCE_DISCOVERY = 8
+};
size_t max_row_length(TABLE *table, const uchar *data);
-
void init_mdl_requests(TABLE_LIST *table_list);
-int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
- uint db_stat, uint prgflag, uint ha_open_flags,
- TABLE *outparam, bool is_create_table);
+enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share,
+ const char *alias, uint db_stat, uint prgflag,
+ uint ha_open_flags, TABLE *outparam,
+ bool is_create_table);
bool unpack_vcol_info_from_frm(THD *thd, MEM_ROOT *mem_root,
TABLE *table, Field *field,
LEX_STRING *vcol_expr, bool *error_reported);
-TABLE_SHARE *alloc_table_share(TABLE_LIST *table_list, char *key,
- uint key_length);
+TABLE_SHARE *alloc_table_share(const char *db, const char *table_name,
+ char *key, uint key_length);
void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
uint key_length,
const char *table_name, const char *path);
void free_table_share(TABLE_SHARE *share);
-int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags);
-void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg);
+enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share,
+ uint flags = GTS_TABLE);
+
+void open_table_error(TABLE_SHARE *share, enum open_frm_error error,
+ int db_errno);
void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase);
bool check_db_name(LEX_STRING *db);
@@ -2433,20 +2521,24 @@ char *get_field(MEM_ROOT *mem, Field *field);
bool get_field(MEM_ROOT *mem, Field *field, class String *res);
int closefrm(TABLE *table, bool free_share);
-int read_string(File file, uchar* *to, size_t length);
void free_blobs(TABLE *table);
void free_field_buffers_larger_than(TABLE *table, uint32 size);
-int set_zone(int nr,int min_zone,int max_zone);
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
-ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
- const char *newname);
-ulong next_io_size(ulong pos);
void append_unescaped(String *res, const char *pos, uint length);
-File create_frm(THD *thd, const char *name, const char *db,
- const char *table, uint reclength, uchar *fileinfo,
- HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
+void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
+ HA_CREATE_INFO *create_info, uint keys, KEY *key_info);
char *fn_rext(char *name);
+/* Check that the integer is in the internal */
+static inline int set_zone(int nr,int min_zone,int max_zone)
+{
+ if (nr <= min_zone)
+ return min_zone;
+ if (nr >= max_zone)
+ return max_zone;
+ return nr;
+}
+
/* performance schema */
extern LEX_STRING PERFORMANCE_SCHEMA_DB_NAME;
diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc
index 13deb167d9b..69df00a2c9a 100644
--- a/sql/threadpool_unix.cc
+++ b/sql/threadpool_unix.cc
@@ -29,14 +29,14 @@
#ifdef __linux__
#include <sys/epoll.h>
typedef struct epoll_event native_event;
-#endif
-#if defined (__FreeBSD__) || defined (__APPLE__)
+#elif defined(HAVE_KQUEUE)
#include <sys/event.h>
typedef struct kevent native_event;
-#endif
-#if defined (__sun)
+#elif defined (__sun)
#include <port.h>
typedef port_event_t native_event;
+#else
+#error threadpool is not available on this platform
#endif
/** Maximum number of native events a listener can read in one go */
@@ -285,7 +285,7 @@ static void *native_event_get_userdata(native_event *event)
return event->data.ptr;
}
-#elif defined (__FreeBSD__) || defined (__APPLE__)
+#elif defined(HAVE_KQUEUE)
int io_poll_create()
{
return kqueue();
@@ -386,8 +386,6 @@ static void* native_event_get_userdata(native_event *event)
{
return event->portev_user;
}
-#else
-#error not ported yet to this OS
#endif
@@ -1247,11 +1245,12 @@ static void connection_abort(connection_t *connection)
DBUG_ENTER("connection_abort");
thread_group_t *group= connection->thread_group;
+ threadpool_remove_connection(connection->thd);
+
mysql_mutex_lock(&group->mutex);
group->connection_count--;
mysql_mutex_unlock(&group->mutex);
-
- threadpool_remove_connection(connection->thd);
+
my_free(connection);
DBUG_VOID_RETURN;
}
diff --git a/sql/transaction.cc b/sql/transaction.cc
index 7d8fc89ec8c..9a1952427d8 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -610,15 +610,19 @@ bool trans_xa_start(THD *thd)
my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]);
else if (thd->locked_tables_mode || thd->in_active_multi_stmt_transaction())
my_error(ER_XAER_OUTSIDE, MYF(0));
- else if (xid_cache_search(thd->lex->xid))
- my_error(ER_XAER_DUPID, MYF(0));
else if (!trans_begin(thd))
{
DBUG_ASSERT(thd->transaction.xid_state.xid.is_null());
thd->transaction.xid_state.xa_state= XA_ACTIVE;
thd->transaction.xid_state.rm_error= 0;
thd->transaction.xid_state.xid.set(thd->lex->xid);
- xid_cache_insert(&thd->transaction.xid_state);
+ if (xid_cache_insert(&thd->transaction.xid_state))
+ {
+ thd->transaction.xid_state.xa_state= XA_NOTR;
+ thd->transaction.xid_state.xid.null();
+ trans_rollback(thd);
+ DBUG_RETURN(true);
+ }
DBUG_RETURN(FALSE);
}
@@ -704,6 +708,16 @@ bool trans_xa_commit(THD *thd)
if (!thd->transaction.xid_state.xid.eq(thd->lex->xid))
{
+ /*
+ xid_state.in_thd is always true beside of xa recovery procedure.
+ Note, that there is no race condition here between xid_cache_search
+ and xid_cache_delete, since we always delete our own XID
+ (thd->lex->xid == thd->transaction.xid_state.xid).
+ The only case when thd->lex->xid != thd->transaction.xid_state.xid
+ and xid_state->in_thd == 0 is in the function
+ xa_cache_insert(XID, xa_states), which is called before starting
+ client connections, and thus is always single-threaded.
+ */
XID_STATE *xs= xid_cache_search(thd->lex->xid);
res= !xs || xs->in_thd;
if (res)
diff --git a/sql/tztime.cc b/sql/tztime.cc
index b16cc65d6bb..5e1e8bec7b3 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1856,7 +1856,7 @@ static Time_zone*
tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
{
TABLE *table= 0;
- TIME_ZONE_INFO *tz_info;
+ TIME_ZONE_INFO *tz_info= NULL;
Tz_names_entry *tmp_tzname;
Time_zone *return_val= 0;
int res;
@@ -1866,7 +1866,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
uchar keybuff[32];
Field *field;
String abbr(buff, sizeof(buff), &my_charset_latin1);
- char *alloc_buff, *tz_name_buff;
+ char *alloc_buff= NULL;
+ char *tz_name_buff= NULL;
/*
Temporary arrays that are used for loading of data for filling
TIME_ZONE_INFO structure
@@ -1886,22 +1887,6 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
DBUG_ENTER("tz_load_from_open_tables");
- /* Prepare tz_info for loading also let us make copy of time zone name */
- if (!(alloc_buff= (char*) alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) +
- tz_name->length() + 1)))
- {
- sql_print_error("Out of memory while loading time zone description");
- return 0;
- }
- tz_info= (TIME_ZONE_INFO *)alloc_buff;
- bzero(tz_info, sizeof(TIME_ZONE_INFO));
- tz_name_buff= alloc_buff + sizeof(TIME_ZONE_INFO);
- /*
- By writing zero to the end we guarantee that we can call ptr()
- instead of c_ptr() for time zone name.
- */
- strmake(tz_name_buff, tz_name->ptr(), tz_name->length());
-
/*
Let us find out time zone id by its name (there is only one index
and it is specifically for this purpose).
@@ -2520,7 +2505,7 @@ scan_tz_dir(char * name_end)
name_end= strmake(name_end, "/", FN_REFLEN - (name_end - fullname));
- for (i= 0; i < cur_dir->number_off_files; i++)
+ for (i= 0; i < cur_dir->number_of_files; i++)
{
if (cur_dir->dir_entry[i].name[0] != '.')
{
diff --git a/sql/unireg.cc b/sql/unireg.cc
index e40dc02c21b..04af09fd31c 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -27,9 +28,9 @@
#include "sql_priv.h"
#include "unireg.h"
#include "sql_partition.h" // struct partition_info
-#include "sql_table.h" // check_duplicate_warning
#include "sql_class.h" // THD, Internal_error_handler
#include "create_options.h"
+#include "discover.h"
#include <m_ctype.h>
#include <assert.h>
@@ -38,137 +39,58 @@
/* threshold for safe_alloca */
#define ALLOCA_THRESHOLD 2048
-static uchar * pack_screens(List<Create_field> &create_fields,
- uint *info_length, uint *screens, bool small_file);
-static uint pack_keys(uchar *keybuff,uint key_count, KEY *key_info,
- ulong data_offset);
-static bool pack_header(uchar *forminfo,enum legacy_db_type table_type,
- List<Create_field> &create_fields,
- uint info_length, uint screens, uint table_options,
- ulong data_offset, handler *file);
+static uint pack_keys(uchar *,uint, KEY *, ulong);
+static bool pack_header(uchar *, List<Create_field> &, uint, ulong, handler *);
static uint get_interval_id(uint *,List<Create_field> &, Create_field *);
-static bool pack_fields(File file, List<Create_field> &create_fields,
- ulong data_offset);
-static bool make_empty_rec(THD *thd, int file, enum legacy_db_type table_type,
- uint table_options,
- List<Create_field> &create_fields,
- uint reclength, ulong data_offset,
- handler *handler);
+static bool pack_fields(uchar *, List<Create_field> &, ulong);
+static size_t packed_fields_length(List<Create_field> &);
+static bool make_empty_rec(THD *, uchar *, uint, List<Create_field> &, uint, ulong);
/**
- An interceptor to hijack ER_TOO_MANY_FIELDS error from
- pack_screens and retry again without UNIREG screens.
-
- XXX: what is a UNIREG screen?
-*/
-
-struct Pack_header_error_handler: public Internal_error_handler
-{
- virtual bool handle_condition(THD *thd,
- uint sql_errno,
- const char* sqlstate,
- MYSQL_ERROR::enum_warning_level level,
- const char* msg,
- MYSQL_ERROR ** cond_hdl);
- bool is_handled;
- Pack_header_error_handler() :is_handled(FALSE) {}
-};
-
-
-bool
-Pack_header_error_handler::
-handle_condition(THD *,
- uint sql_errno,
- const char*,
- MYSQL_ERROR::enum_warning_level,
- const char*,
- MYSQL_ERROR ** cond_hdl)
-{
- *cond_hdl= NULL;
- is_handled= (sql_errno == ER_TOO_MANY_FIELDS);
- return is_handled;
-}
-
-/*
Create a frm (table definition) file
- SYNOPSIS
- mysql_create_frm()
- thd Thread handler
- file_name Path for file (including database and .frm)
- db Name of database
- table Name of table
- create_info create info parameters
- create_fields Fields to create
- keys number of keys to create
- key_info Keys to create
- db_file Handler to use. May be zero, in which case we use
- create_info->db_type
- RETURN
- false ok
- true error
+ @param thd Thread handler
+ @param table Name of table
+ @param create_info create info parameters
+ @param create_fields Fields to create
+ @param keys number of keys to create
+ @param key_info Keys to create
+ @param db_file Handler to use.
+
+ @return the generated frm image as a LEX_CUSTRING,
+ or null LEX_CUSTRING (str==0) in case of an error.
*/
-bool mysql_create_frm(THD *thd, const char *file_name,
- const char *db, const char *table,
- HA_CREATE_INFO *create_info,
- List<Create_field> &create_fields,
- uint keys, KEY *key_info,
- handler *db_file)
+LEX_CUSTRING build_frm_image(THD *thd, const char *table,
+ HA_CREATE_INFO *create_info,
+ List<Create_field> &create_fields,
+ uint keys, KEY *key_info, handler *db_file)
{
LEX_STRING str_db_type;
- uint reclength, info_length, screens, key_info_length, maxlength, tmp_len, i;
+ uint reclength, key_info_length, tmp_len, i;
ulong key_buff_length;
- File file;
ulong filepos, data_offset;
uint options_len;
- uchar fileinfo[64],forminfo[288],*keybuff;
- uchar *screen_buff;
- char buff[128];
+ uchar fileinfo[FRM_HEADER_SIZE],forminfo[FRM_FORMINFO_SIZE];
#ifdef WITH_PARTITION_STORAGE_ENGINE
partition_info *part_info= thd->work_part_info;
#endif
- Pack_header_error_handler pack_header_error_handler;
int error;
- DBUG_ENTER("mysql_create_frm");
-
- DBUG_ASSERT(*fn_rext((char*)file_name)); // Check .frm extension
-
- if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,0)))
- DBUG_RETURN(1);
- DBUG_ASSERT(db_file != NULL);
+ uchar *frm_ptr, *pos;
+ LEX_CUSTRING frm= {0,0};
+ DBUG_ENTER("build_frm_image");
/* If fixed row records, we need one bit to check for deleted rows */
if (!(create_info->table_options & HA_OPTION_PACK_RECORD))
create_info->null_bits++;
data_offset= (create_info->null_bits + 7) / 8;
- thd->push_internal_handler(&pack_header_error_handler);
-
- error= pack_header(forminfo, ha_legacy_type(create_info->db_type),
- create_fields,info_length,
- screens, create_info->table_options,
+ error= pack_header(forminfo, create_fields, create_info->table_options,
data_offset, db_file);
- thd->pop_internal_handler();
-
if (error)
- {
- my_free(screen_buff);
- if (! pack_header_error_handler.is_handled)
- DBUG_RETURN(1);
-
- // Try again without UNIREG screens (to get more columns)
- if (!(screen_buff=pack_screens(create_fields,&info_length,&screens,1)))
- DBUG_RETURN(1);
- if (pack_header(forminfo, ha_legacy_type(create_info->db_type),
- create_fields,info_length,
- screens, create_info->table_options, data_offset, db_file))
- {
- my_free(screen_buff);
- DBUG_RETURN(1);
- }
- }
+ DBUG_RETURN(frm);
+
reclength=uint2korr(forminfo+266);
/* Calculate extra data segment length */
@@ -201,13 +123,6 @@ bool mysql_create_frm(THD *thd, const char *file_name,
create_fields,
keys, key_info);
DBUG_PRINT("info", ("Options length: %u", options_len));
- if (options_len)
- {
- create_info->table_options|= HA_OPTION_TEXT_CREATE_OPTIONS;
- create_info->extra_size+= (options_len + 4);
- }
- else
- create_info->table_options&= ~HA_OPTION_TEXT_CREATE_OPTIONS;
/*
This gives us the byte-position of the character at
@@ -244,58 +159,108 @@ bool mysql_create_frm(THD *thd, const char *file_name,
if (thd->is_strict_mode())
{
my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0),
- real_table_name, static_cast<ulong>(TABLE_COMMENT_MAXLEN));
- my_free(screen_buff);
- DBUG_RETURN(1);
+ real_table_name, TABLE_COMMENT_MAXLEN);
+ DBUG_RETURN(frm);
}
char warn_buff[MYSQL_ERRMSG_SIZE];
my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_TABLE_COMMENT),
- real_table_name, static_cast<ulong>(TABLE_COMMENT_MAXLEN));
- /* do not push duplicate warnings */
- if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff)))
- push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_TOO_LONG_TABLE_COMMENT, warn_buff);
+ real_table_name, TABLE_COMMENT_MAXLEN);
+ push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TOO_LONG_TABLE_COMMENT, warn_buff);
create_info->comment.length= tmp_len;
}
/*
If table comment is longer than TABLE_COMMENT_INLINE_MAXLEN bytes,
store the comment in an extra segment (up to TABLE_COMMENT_MAXLEN bytes).
- Pre 6.0, the limit was 60 characters, with no extra segment-handling.
+ Pre 5.5, the limit was 60 characters, with no extra segment-handling.
*/
if (create_info->comment.length > TABLE_COMMENT_INLINE_MAXLEN)
{
forminfo[46]=255;
create_info->extra_size+= 2 + create_info->comment.length;
}
- else{
+ else
+ {
strmake((char*) forminfo+47, create_info->comment.str ?
create_info->comment.str : "", create_info->comment.length);
forminfo[46]=(uchar) create_info->comment.length;
}
- if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
- create_info, keys, key_info)) < 0)
+ if (!create_info->tabledef_version.str)
{
- my_free(screen_buff);
- DBUG_RETURN(1);
+ uchar *to= (uchar*) thd->alloc(MY_UUID_SIZE);
+ if (unlikely(!to))
+ DBUG_RETURN(frm);
+ my_uuid(to);
+ create_info->tabledef_version.str= to;
+ create_info->tabledef_version.length= MY_UUID_SIZE;
}
+ DBUG_ASSERT(create_info->tabledef_version.length > 0);
+ DBUG_ASSERT(create_info->tabledef_version.length <= 255);
+
+ prepare_frm_header(thd, reclength, fileinfo, create_info, keys, key_info);
+
+ /* one byte for a type, one or three for a length */
+ uint extra2_size= 1 + 1 + create_info->tabledef_version.length;
+ if (options_len)
+ extra2_size+= 1 + (options_len > 255 ? 3 : 1) + options_len;
key_buff_length= uint4korr(fileinfo+47);
- keybuff=(uchar*) my_malloc(key_buff_length, MYF(MY_THREAD_SPECIFIC));
- key_info_length= pack_keys(keybuff, keys, key_info, data_offset);
- /*
- Ensure that there are no forms in this newly created form file.
- Even if the form file exists, create_frm must truncate it to
- ensure one form per form file.
- */
- DBUG_ASSERT(uint2korr(fileinfo+8) == 0);
+ frm.length= FRM_HEADER_SIZE; // fileinfo;
+ frm.length+= extra2_size + 4; // mariadb extra2 frm segment
+
+ int2store(fileinfo+4, extra2_size);
+ int2store(fileinfo+6, frm.length); // Position to key information
+ frm.length+= key_buff_length;
+ frm.length+= reclength; // row with default values
+ frm.length+= create_info->extra_size;
+
+ filepos= frm.length;
+ frm.length+= FRM_FORMINFO_SIZE; // forminfo
+ frm.length+= packed_fields_length(create_fields);
+
+ frm_ptr= (uchar*) my_malloc(frm.length, MYF(MY_WME | MY_ZEROFILL |
+ MY_THREAD_SPECIFIC));
+ if (!frm_ptr)
+ DBUG_RETURN(frm);
+
+ /* write the extra2 segment */
+ pos = frm_ptr + 64;
+ compile_time_assert(EXTRA2_TABLEDEF_VERSION != '/');
+ *pos++ = EXTRA2_TABLEDEF_VERSION; // old servers write '/' here
+ *pos++ = create_info->tabledef_version.length;
+ memcpy(pos, create_info->tabledef_version.str,
+ create_info->tabledef_version.length);
+ pos+= create_info->tabledef_version.length;
- if (!(filepos= make_new_entry(file, fileinfo, NULL, "")))
- goto err;
- maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000));
- int2store(forminfo+2,maxlength);
- int4store(fileinfo+10,(ulong) (filepos+maxlength));
+ if (options_len)
+ {
+ *pos++= EXTRA2_ENGINE_TABLEOPTS;
+ if (options_len < 255)
+ *pos++= options_len;
+ else
+ {
+ /*
+ At the moment we support options_len up to 64K.
+ We can easily extend it in the future, if the need arises.
+ */
+ DBUG_ASSERT(options_len <= 65535);
+ int2store(pos + 1, options_len);
+ pos+= 3;
+ }
+ pos= engine_table_options_frm_image(pos, create_info->option_list,
+ create_fields, keys, key_info);
+ }
+
+ int4store(pos, filepos); // end of the extra2 segment
+ pos+= 4;
+
+ DBUG_ASSERT(pos == frm_ptr + uint2korr(fileinfo+6));
+ key_info_length= pack_keys(pos, keys, key_info, data_offset);
+
+ int2store(forminfo+2, frm.length - filepos);
+ int4store(fileinfo+10, frm.length);
fileinfo[26]= (uchar) test((create_info->max_rows == 1) &&
(create_info->min_rows == 1) && (keys == 0));
int2store(fileinfo+28,key_info_length);
@@ -309,125 +274,59 @@ bool mysql_create_frm(THD *thd, const char *file_name,
#endif
int2store(fileinfo+59,db_file->extra_rec_buf_length());
- if (mysql_file_pwrite(file, fileinfo, 64, 0L, MYF_RW) ||
- mysql_file_pwrite(file, keybuff, key_info_length,
- (ulong) uint2korr(fileinfo+6), MYF_RW))
- goto err;
- mysql_file_seek(file,
- (ulong) uint2korr(fileinfo+6) + (ulong) key_buff_length,
- MY_SEEK_SET, MYF(0));
- if (make_empty_rec(thd,file,ha_legacy_type(create_info->db_type),
- create_info->table_options,
- create_fields,reclength, data_offset, db_file))
- goto err;
-
- int2store(buff, create_info->connect_string.length);
- if (mysql_file_write(file, (const uchar*)buff, 2, MYF(MY_NABP)) ||
- mysql_file_write(file, (const uchar*)create_info->connect_string.str,
- create_info->connect_string.length, MYF(MY_NABP)))
- goto err;
+ memcpy(frm_ptr, fileinfo, FRM_HEADER_SIZE);
- int2store(buff, str_db_type.length);
- if (mysql_file_write(file, (const uchar*)buff, 2, MYF(MY_NABP)) ||
- mysql_file_write(file, (const uchar*)str_db_type.str,
- str_db_type.length, MYF(MY_NABP)))
+ pos+= key_buff_length;
+ if (make_empty_rec(thd, pos, create_info->table_options, create_fields,
+ reclength, data_offset))
goto err;
+ pos+= reclength;
+ int2store(pos, create_info->connect_string.length);
+ pos+= 2;
+ memcpy(pos, create_info->connect_string.str, create_info->connect_string.length);
+ pos+= create_info->connect_string.length;
+ int2store(pos, str_db_type.length);
+ pos+= 2;
+ memcpy(pos, str_db_type.str, str_db_type.length);
+ pos+= str_db_type.length;
+
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (part_info)
{
char auto_partitioned= part_info->is_auto_partitioned ? 1 : 0;
- int4store(buff, part_info->part_info_len);
- if (mysql_file_write(file, (const uchar*)buff, 4, MYF_RW) ||
- mysql_file_write(file, (const uchar*)part_info->part_info_string,
- part_info->part_info_len + 1, MYF_RW) ||
- mysql_file_write(file, (const uchar*)&auto_partitioned, 1, MYF_RW))
- goto err;
+ int4store(pos, part_info->part_info_len);
+ pos+= 4;
+ memcpy(pos, part_info->part_info_string, part_info->part_info_len + 1);
+ pos+= part_info->part_info_len + 1;
+ *pos++= auto_partitioned;
}
else
#endif
{
- bzero((uchar*) buff, 6);
- if (mysql_file_write(file, (uchar*) buff, 6, MYF_RW))
- goto err;
+ pos+= 6;
}
for (i= 0; i < keys; i++)
{
if (key_info[i].parser_name)
{
- if (mysql_file_write(file, (const uchar*)key_info[i].parser_name->str,
- key_info[i].parser_name->length + 1, MYF(MY_NABP)))
- goto err;
+ memcpy(pos, key_info[i].parser_name->str, key_info[i].parser_name->length + 1);
+ pos+= key_info[i].parser_name->length + 1;
}
}
- if (forminfo[46] == (uchar)255)
+ if (forminfo[46] == (uchar)255) // New style MySQL 5.5 table comment
{
- uchar comment_length_buff[2];
- int2store(comment_length_buff,create_info->comment.length);
- if (mysql_file_write(file, comment_length_buff, 2, MYF(MY_NABP)) ||
- mysql_file_write(file, (uchar*) create_info->comment.str,
- create_info->comment.length, MYF(MY_NABP)))
- goto err;
+ int2store(pos, create_info->comment.length);
+ pos+=2;
+ memcpy(pos, create_info->comment.str, create_info->comment.length);
+ pos+= create_info->comment.length;
}
- if (options_len)
- {
- uchar *optbuff= (uchar *)my_safe_alloca(options_len + 4, ALLOCA_THRESHOLD);
- my_bool error;
- DBUG_PRINT("info", ("Create options length: %u", options_len));
- if (!optbuff)
- goto err;
- int4store(optbuff, options_len);
- engine_table_options_frm_image(optbuff + 4,
- create_info->option_list,
- create_fields,
- keys, key_info);
- error= my_write(file, optbuff, options_len + 4, MYF_RW);
- my_safe_afree(optbuff, options_len + 4, ALLOCA_THRESHOLD);
- if (error)
- goto err;
- }
-
- mysql_file_seek(file, filepos, MY_SEEK_SET, MYF(0));
- if (mysql_file_write(file, forminfo, 288, MYF_RW) ||
- mysql_file_write(file, screen_buff, info_length, MYF_RW) ||
- pack_fields(file, create_fields, data_offset))
+ memcpy(frm_ptr + filepos, forminfo, 288);
+ if (pack_fields(frm_ptr + filepos + 288, create_fields, data_offset))
goto err;
-#ifdef HAVE_CRYPTED_FRM
- if (create_info->password)
- {
- char tmp=2,*disk_buff=0;
- SQL_CRYPT *crypted=new SQL_CRYPT(create_info->password);
- if (!crypted || mysql_file_pwrite(file, &tmp, 1, 26, MYF_RW))// Mark crypted
- goto err;
- uint read_length=uint2korr(forminfo)-256;
- mysql_file_seek(file, filepos+256, MY_SEEK_SET, MYF(0));
- if (read_string(file,(uchar**) &disk_buff,read_length))
- goto err;
- crypted->encode(disk_buff,read_length);
- delete crypted;
- if (mysql_file_pwrite(file, disk_buff, read_length, filepos+256, MYF_RW))
- {
- my_free(disk_buff);
- goto err;
- }
- my_free(disk_buff);
- }
-#endif
-
- my_free(screen_buff);
- my_free(keybuff);
-
- if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) &&
- (mysql_file_sync(file, MYF(MY_WME)) ||
- my_sync_dir_by_file(file_name, MYF(MY_WME))))
- goto err2;
-
- if (mysql_file_close(file, MYF(MY_WME)))
- goto err3;
-
{
/*
Restore all UCS2 intervals.
@@ -444,17 +343,14 @@ bool mysql_create_frm(THD *thd, const char *file_name,
}
}
}
- DBUG_RETURN(0);
+
+ frm.str= frm_ptr;
+ DBUG_RETURN(frm);
err:
- my_free(screen_buff);
- my_free(keybuff);
-err2:
- (void) mysql_file_close(file, MYF(MY_WME));
-err3:
- mysql_file_delete(key_file_frm, file_name, MYF(0));
- DBUG_RETURN(1);
-} /* mysql_create_frm */
+ my_free(frm_ptr);
+ DBUG_RETURN(frm);
+}
/*
@@ -463,130 +359,58 @@ err3:
SYNOPSIS
rea_create_table()
thd Thread handler
+ frm binary frm image of the table to create
path Name of file (including database, without .frm)
db Data base name
table_name Table name
create_info create info parameters
- create_fields Fields to create
- keys number of keys to create
- key_info Keys to create
- file Handler to use
+ file Handler to use or NULL if only frm needs to be created
RETURN
0 ok
1 error
*/
-int rea_create_table(THD *thd, const char *path,
- const char *db, const char *table_name,
- HA_CREATE_INFO *create_info,
- List<Create_field> &create_fields,
- uint keys, KEY *key_info, handler *file)
+int rea_create_table(THD *thd, LEX_CUSTRING *frm,
+ const char *path, const char *db, const char *table_name,
+ HA_CREATE_INFO *create_info, handler *file)
{
DBUG_ENTER("rea_create_table");
- char frm_name[FN_REFLEN];
- strxmov(frm_name, path, reg_ext, NullS);
- if (mysql_create_frm(thd, frm_name, db, table_name, create_info,
- create_fields, keys, key_info, file))
+ if (file)
+ {
+ // TODO don't write frm for temp tables
+ if (create_info->tmp_table() &&
+ writefrm(path, db, table_name, true, frm->str, frm->length))
+ goto err_handler;
- DBUG_RETURN(1);
+ if (thd->variables.keep_files_on_create)
+ create_info->options|= HA_CREATE_KEEP_FILES;
+
+ if (file->ha_create_partitioning_metadata(path, NULL, CHF_CREATE_FLAG) ||
+ ha_create_table(thd, path, db, table_name, create_info, frm))
+ {
+ file->ha_create_partitioning_metadata(path, NULL, CHF_DELETE_FLAG);
+ goto err_handler;
+ }
+ }
+ else
+ {
+ if (writefrm(path, db, table_name, false, frm->str, frm->length))
+ goto err_handler;
+ }
- // Make sure mysql_create_frm din't remove extension
- DBUG_ASSERT(*fn_rext(frm_name));
- if (thd->variables.keep_files_on_create)
- create_info->options|= HA_CREATE_KEEP_FILES;
- if (!create_info->frm_only &&
- (file->ha_create_handler_files(path, NULL, CHF_CREATE_FLAG,
- create_info) ||
- ha_create_table(thd, path, db, table_name, create_info, 0)))
- goto err_handler;
DBUG_RETURN(0);
err_handler:
- (void) file->ha_create_handler_files(path, NULL, CHF_DELETE_FLAG, create_info);
+ char frm_name[FN_REFLEN];
+ strxmov(frm_name, path, reg_ext, NullS);
mysql_file_delete(key_file_frm, frm_name, MYF(0));
DBUG_RETURN(1);
} /* rea_create_table */
- /* Pack screens to a screen for save in a form-file */
-
-static uchar *pack_screens(List<Create_field> &create_fields,
- uint *info_length, uint *screens,
- bool small_file)
-{
- reg1 uint i;
- uint row,start_row,end_row,fields_on_screen;
- uint length,cols;
- uchar *info,*pos,*start_screen;
- uint fields=create_fields.elements;
- List_iterator<Create_field> it(create_fields);
- DBUG_ENTER("pack_screens");
-
- start_row=4; end_row=22; cols=80; fields_on_screen=end_row+1-start_row;
-
- *screens=(fields-1)/fields_on_screen+1;
- length= (*screens) * (SC_INFO_LENGTH+ (cols>> 1)+4);
-
- Create_field *field;
- while ((field=it++))
- length+=(uint) strlen(field->field_name)+1+TE_INFO_LENGTH+cols/2;
-
- if (!(info=(uchar*) my_malloc(length,MYF(MY_WME | MY_THREAD_SPECIFIC))))
- DBUG_RETURN(0);
-
- start_screen=0;
- row=end_row;
- pos=info;
- it.rewind();
- for (i=0 ; i < fields ; i++)
- {
- Create_field *cfield=it++;
- if (row++ == end_row)
- {
- if (i)
- {
- length=(uint) (pos-start_screen);
- int2store(start_screen,length);
- start_screen[2]=(uchar) (fields_on_screen+1);
- start_screen[3]=(uchar) (fields_on_screen);
- }
- row=start_row;
- start_screen=pos;
- pos+=4;
- pos[0]= (uchar) start_row-2; /* Header string */
- pos[1]= (uchar) (cols >> 2);
- pos[2]= (uchar) (cols >> 1) +1;
- strfill((char *) pos+3,(uint) (cols >> 1),' ');
- pos+=(cols >> 1)+4;
- }
- length=(uint) strlen(cfield->field_name);
- if (length > cols-3)
- length=cols-3;
-
- if (!small_file)
- {
- pos[0]=(uchar) row;
- pos[1]=0;
- pos[2]=(uchar) (length+1);
- pos=(uchar*) strmake((char*) pos+3,cfield->field_name,length)+1;
- }
- cfield->row=(uint8) row;
- cfield->col=(uint8) (length+1);
- cfield->sc_length=(uint8) min(cfield->length,cols-(length+2));
- }
- length=(uint) (pos-start_screen);
- int2store(start_screen,length);
- start_screen[2]=(uchar) (row-start_row+2);
- start_screen[3]=(uchar) (row-start_row+1);
-
- *info_length=(uint) (pos-info);
- DBUG_RETURN(info);
-} /* pack_screens */
-
-
- /* Pack keyinfo and keynames to keybuff for save in form-file. */
+/* Pack keyinfo and keynames to keybuff for save in form-file. */
static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
ulong data_offset)
@@ -669,12 +493,10 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
} /* pack_keys */
- /* Make formheader */
+/* Make formheader */
-static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
- List<Create_field> &create_fields,
- uint info_length, uint screens, uint table_options,
- ulong data_offset, handler *file)
+static bool pack_header(uchar *forminfo, List<Create_field> &create_fields,
+ uint table_options, ulong data_offset, handler *file)
{
uint length,int_count,int_length,no_empty, int_parts;
uint time_stamp_pos,null_fields;
@@ -693,8 +515,7 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
com_length=vcol_info_length=0;
n_length=2L;
- /* Check fields */
-
+ /* Check fields */
List_iterator<Create_field> it(create_fields);
Create_field *field;
while ((field=it++))
@@ -706,20 +527,14 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
COLUMN_COMMENT_MAXLEN);
if (tmp_len < field->comment.length)
{
- if (current_thd->is_strict_mode())
- {
- my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name,
- static_cast<ulong>(COLUMN_COMMENT_MAXLEN));
+ myf myf_warning= current_thd->is_strict_mode() ? 0 : ME_JUST_WARNING;
+
+ my_error(ER_TOO_LONG_FIELD_COMMENT, myf_warning, field->field_name,
+ COLUMN_COMMENT_MAXLEN);
+
+ if (!myf_warning)
DBUG_RETURN(1);
- }
- char warn_buff[MYSQL_ERRMSG_SIZE];
- my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_FIELD_COMMENT),
- field->field_name,
- static_cast<ulong>(COLUMN_COMMENT_MAXLEN));
- /* do not push duplicate warnings */
- if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff)))
- push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_TOO_LONG_FIELD_COMMENT, warn_buff);
+
field->comment.length= tmp_len;
}
if (field->vcol_info)
@@ -745,7 +560,7 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
expressions saved in the frm file for virtual columns.
*/
vcol_info_length+= field->vcol_info->expr_str.length+
- FRM_VCOL_HEADER_SIZE(field->interval!=NULL);
+ FRM_VCOL_HEADER_SIZE(field->interval);
}
totlength+= field->length;
@@ -822,8 +637,7 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
}
int_length+=int_count*2; // 255 prefix + 0 suffix
- /* Save values in forminfo */
-
+ /* Save values in forminfo */
if (reclength > (ulong) file->max_record_length())
{
my_error(ER_TOO_BIG_ROWSIZE, MYF(0), static_cast<long>(file->max_record_length()));
@@ -831,7 +645,7 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
}
/* Hack to avoid bugs with small static rows in MySQL */
reclength=max(file->min_record_length(table_options),reclength);
- if (info_length+(ulong) create_fields.elements*FCOMP+288+
+ if ((ulong) create_fields.elements*FCOMP+FRM_FORMINFO_SIZE+
n_length+int_length+com_length+vcol_info_length > 65535L ||
int_count > 255)
{
@@ -839,13 +653,13 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
DBUG_RETURN(1);
}
- bzero((char*)forminfo,288);
- length=(info_length+create_fields.elements*FCOMP+288+n_length+int_length+
+ bzero((char*)forminfo,FRM_FORMINFO_SIZE);
+ length=(create_fields.elements*FCOMP+FRM_FORMINFO_SIZE+n_length+int_length+
com_length+vcol_info_length);
int2store(forminfo,length);
- forminfo[256] = (uint8) screens;
+ forminfo[256] = 0;
int2store(forminfo+258,create_fields.elements);
- int2store(forminfo+260,info_length);
+ int2store(forminfo+260,0);
int2store(forminfo+262,totlength);
int2store(forminfo+264,no_empty);
int2store(forminfo+266,reclength);
@@ -859,13 +673,11 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type,
int2store(forminfo+282,null_fields);
int2store(forminfo+284,com_length);
int2store(forminfo+286,vcol_info_length);
- /* forminfo+288 is free to use for additional information */
DBUG_RETURN(0);
} /* pack_header */
- /* get each unique interval each own id */
-
+/* get each unique interval each own id */
static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
Create_field *last_field)
{
@@ -892,29 +704,57 @@ static uint get_interval_id(uint *int_count,List<Create_field> &create_fields,
}
- /* Save fields, fieldnames and intervals */
+static size_t packed_fields_length(List<Create_field> &create_fields)
+{
+ Create_field *field;
+ size_t length= 0;
+ DBUG_ENTER("packed_fields_length");
-static bool pack_fields(File file, List<Create_field> &create_fields,
+ List_iterator<Create_field> it(create_fields);
+ uint int_count=0;
+ while ((field=it++))
+ {
+ if (field->interval_id > int_count)
+ {
+ int_count= field->interval_id;
+ length++;
+ for (int i=0; field->interval->type_names[i]; i++)
+ {
+ length+= field->interval->type_lengths[i];
+ length++;
+ }
+ length++;
+ }
+ if (field->vcol_info)
+ {
+ length+= field->vcol_info->expr_str.length +
+ FRM_VCOL_HEADER_SIZE(field->interval);
+ }
+ length+= FCOMP;
+ length+= strlen(field->field_name)+1;
+ length+= field->comment.length;
+ }
+ length++;
+ length++;
+ DBUG_RETURN(length);
+}
+
+/* Save fields, fieldnames and intervals */
+
+static bool pack_fields(uchar *buff, List<Create_field> &create_fields,
ulong data_offset)
{
- reg2 uint i;
uint int_count, comment_length= 0, vcol_info_length=0;
- uchar buff[MAX_FIELD_WIDTH];
Create_field *field;
DBUG_ENTER("pack_fields");
- /* Write field info */
-
+ /* Write field info */
List_iterator<Create_field> it(create_fields);
-
int_count=0;
while ((field=it++))
{
uint recpos;
uint cur_vcol_expr_len= 0;
- buff[0]= (uchar) field->row;
- buff[1]= (uchar) field->col;
- buff[2]= (uchar) field->sc_length;
int2store(buff+3, field->length);
/* The +1 is here becasue the col offset in .frm file have offset 1 */
recpos= field->offset+1 + (uint) data_offset;
@@ -948,40 +788,29 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
the additional data saved for the virtual field
*/
buff[12]= cur_vcol_expr_len= field->vcol_info->expr_str.length +
- FRM_VCOL_HEADER_SIZE(field->interval!=NULL);
- vcol_info_length+= cur_vcol_expr_len +
- FRM_VCOL_HEADER_SIZE(field->interval!=NULL);
+ FRM_VCOL_HEADER_SIZE(field->interval);
+ vcol_info_length+= cur_vcol_expr_len;
buff[13]= (uchar) MYSQL_TYPE_VIRTUAL;
}
int2store(buff+15, field->comment.length);
comment_length+= field->comment.length;
set_if_bigger(int_count,field->interval_id);
- if (mysql_file_write(file, buff, FCOMP, MYF_RW))
- DBUG_RETURN(1);
+ buff+= FCOMP;
}
- /* Write fieldnames */
- buff[0]=(uchar) NAMES_SEP_CHAR;
- if (mysql_file_write(file, buff, 1, MYF_RW))
- DBUG_RETURN(1);
- i=0;
+ /* Write fieldnames */
+ *buff++= NAMES_SEP_CHAR;
it.rewind();
while ((field=it++))
{
- char *pos= strmov((char*) buff,field->field_name);
- *pos++=NAMES_SEP_CHAR;
- if (i == create_fields.elements-1)
- *pos++=0;
- if (mysql_file_write(file, buff, (size_t) (pos-(char*) buff), MYF_RW))
- DBUG_RETURN(1);
- i++;
+ buff= (uchar*)strmov((char*) buff, field->field_name);
+ *buff++=NAMES_SEP_CHAR;
}
+ *buff++= 0;
- /* Write intervals */
+ /* Write intervals */
if (int_count)
{
- String tmp((char*) buff,sizeof(buff), &my_charset_bin);
- tmp.length(0);
it.rewind();
int_count=0;
while ((field=it++))
@@ -1023,34 +852,30 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
}
int_count= field->interval_id;
- tmp.append(sep);
- for (const char **pos=field->interval->type_names ; *pos ; pos++)
+ *buff++= sep;
+ for (int i=0; field->interval->type_names[i]; i++)
{
- tmp.append(*pos);
- tmp.append(sep);
+ memcpy(buff, field->interval->type_names[i], field->interval->type_lengths[i]);
+ buff+= field->interval->type_lengths[i];
+ *buff++= sep;
}
- tmp.append('\0'); // End of intervall
+ *buff++= 0;
+
}
}
- if (mysql_file_write(file, (uchar*) tmp.ptr(), tmp.length(), MYF_RW))
- DBUG_RETURN(1);
}
if (comment_length)
{
it.rewind();
- int_count=0;
while ((field=it++))
{
- if (field->comment.length)
- if (mysql_file_write(file, (uchar*) field->comment.str,
- field->comment.length, MYF_RW))
- DBUG_RETURN(1);
+ memcpy(buff, field->comment.str, field->comment.length);
+ buff+= field->comment.length;
}
}
if (vcol_info_length)
{
it.rewind();
- int_count=0;
while ((field=it++))
{
/*
@@ -1063,18 +888,13 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
*/
if (field->vcol_info && field->vcol_info->expr_str.length)
{
- buff[0]= (uchar)(1 + test(field->interval_id));
- buff[1]= (uchar) field->sql_type;
- buff[2]= (uchar) field->stored_in_db;
- if (field->interval_id)
- buff[3]= (uchar) field->interval_id;
- if (my_write(file, buff, 3 + test(field->interval_id), MYF_RW))
- DBUG_RETURN(1);
- if (my_write(file,
- (uchar*) field->vcol_info->expr_str.str,
- field->vcol_info->expr_str.length,
- MYF_RW))
- DBUG_RETURN(1);
+ *buff++= (uchar)(1 + test(field->interval));
+ *buff++= (uchar) field->sql_type;
+ *buff++= (uchar) field->stored_in_db;
+ if (field->interval)
+ *buff++= (uchar) field->interval_id;
+ memcpy(buff, field->vcol_info->expr_str.str, field->vcol_info->expr_str.length);
+ buff+= field->vcol_info->expr_str.length;
}
}
}
@@ -1082,19 +902,16 @@ static bool pack_fields(File file, List<Create_field> &create_fields,
}
- /* save an empty record on start of formfile */
+/* save an empty record on start of formfile */
-static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
- uint table_options,
+static bool make_empty_rec(THD *thd, uchar *buff, uint table_options,
List<Create_field> &create_fields,
- uint reclength,
- ulong data_offset,
- handler *handler)
+ uint reclength, ulong data_offset)
{
int error= 0;
Field::utype type;
uint null_count;
- uchar *buff,*null_pos;
+ uchar *null_pos;
TABLE table;
TABLE_SHARE share;
Create_field *field;
@@ -1106,13 +923,6 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
bzero((char*) &share, sizeof(share));
table.s= &share;
- if (!(buff=(uchar*) my_malloc((size_t) reclength,
- MYF(MY_WME | MY_ZEROFILL |
- MY_THREAD_SPECIFIC))))
- {
- DBUG_RETURN(1);
- }
-
table.in_use= thd;
table.s->blob_ptr_size= portable_sizeof_char_ptr;
@@ -1198,10 +1008,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type,
if (null_count & 7)
*(null_pos + null_count / 8)|= ~(((uchar) 1 << (null_count & 7)) - 1);
- error= mysql_file_write(file, buff, (size_t) reclength, MYF_RW) != 0;
-
err:
- my_free(buff);
thd->count_cuted_fields= old_count_cuted_fields;
DBUG_RETURN(error);
} /* make_empty_rec */
diff --git a/sql/unireg.h b/sql/unireg.h
index da510bb4e6d..5e232becbb2 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -23,8 +23,6 @@
/* Extra functions used by unireg library */
-typedef struct st_ha_create_information HA_CREATE_INFO;
-
#ifndef NO_ALARM_LOOP
#define NO_ALARM_LOOP /* lib5 and popen can't use alarm */
#endif
@@ -88,7 +86,7 @@ typedef struct st_ha_create_information HA_CREATE_INFO;
#define READ_ALL 1 /* openfrm: Read all parameters */
#define CHANGE_FRM 2 /* openfrm: open .frm as O_RDWR */
#define READ_KEYINFO 4 /* L{s nyckeldata fr}n filen */
-#define EXTRA_RECORD 8 /* Reservera plats f|r extra record */
+#define EXTRA_RECORD 8 /* Reserve space for an extra record */
#define DONT_OPEN_TABLES 8 /* Don't open database-files (frd) */
#define DONT_OPEN_MASTER_REG 16 /* Don't open first reg-file (prt) */
#define EXTRA_LONG_RECORD 16 /* Plats f|r dubbel s|k-record */
@@ -169,15 +167,44 @@ typedef struct st_ha_create_information HA_CREATE_INFO;
#include "sql_list.h" /* List<> */
#include "field.h" /* Create_field */
-bool mysql_create_frm(THD *thd, const char *file_name,
- const char *db, const char *table,
- HA_CREATE_INFO *create_info,
- List<Create_field> &create_field,
- uint key_count,KEY *key_info,handler *db_type);
-int rea_create_table(THD *thd, const char *path,
- const char *db, const char *table_name,
- HA_CREATE_INFO *create_info,
- List<Create_field> &create_field,
- uint key_count,KEY *key_info,
- handler *file);
+/*
+ Types of values in the MariaDB extra2 frm segment.
+ Each value is written as
+ type: 1 byte
+ length: 1 byte (1..255) or \0 and 2 bytes.
+ binary value of the 'length' bytes.
+
+ Older MariaDB servers can ignore values of unknown types if
+ the type code is less than 128 (EXTRA2_ENGINE_IMPORTANT).
+ Otherwise older (but newer than 10.0.1) servers are required
+ to report an error.
+*/
+enum extra2_frm_value_type {
+ EXTRA2_TABLEDEF_VERSION=0,
+
+#define EXTRA2_ENGINE_IMPORTANT 128
+
+ EXTRA2_ENGINE_TABLEOPTS=128,
+};
+
+int rea_create_table(THD *thd, LEX_CUSTRING *frm,
+ const char *path, const char *db, const char *table_name,
+ HA_CREATE_INFO *create_info, handler *file);
+LEX_CUSTRING build_frm_image(THD *thd, const char *table,
+ HA_CREATE_INFO *create_info,
+ List<Create_field> &create_fields,
+ uint keys, KEY *key_info, handler *db_file);
+
+#define FRM_HEADER_SIZE 64
+#define FRM_FORMINFO_SIZE 288
+#define FRM_MAX_SIZE (256*1024)
+
+static inline bool is_binary_frm_header(uchar *head)
+{
+ return head[0] == 254
+ && head[1] == 1
+ && head[2] >= FRM_VER
+ && head[2] <= FRM_VER+4;
+}
+
#endif
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index 92d7ad70344..4519d15cefc 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -364,6 +364,8 @@ void read_header(azio_stream *s, unsigned char *buffer)
{
if (buffer[0] == az_magic[0] && buffer[1] == az_magic[1])
{
+ uchar tmp[AZ_FRMVER_LEN + 2];
+
s->version= (unsigned int)buffer[AZ_VERSION_POS];
s->minor_version= (unsigned int)buffer[AZ_MINOR_VERSION_POS];
s->block_size= 1024 * buffer[AZ_BLOCK_POS];
@@ -379,6 +381,22 @@ void read_header(azio_stream *s, unsigned char *buffer)
s->comment_start_pos= (unsigned int)uint4korr(buffer + AZ_COMMENT_POS);
s->comment_length= (unsigned int)uint4korr(buffer + AZ_COMMENT_LENGTH_POS);
s->dirty= (unsigned int)buffer[AZ_DIRTY_POS];
+
+ /*
+ we'll hard-code the current frm format for now, to avoid
+ changing archive table versions.
+ */
+ if (s->frm_length == 0 ||
+ my_pread(s->file, tmp, sizeof(tmp), s->frm_start_pos + 64, MYF(MY_NABP)) ||
+ tmp[0] != 0 || tmp[1] != AZ_FRMVER_LEN)
+ {
+ s->frmver_length= 0;
+ }
+ else
+ {
+ s->frmver_length= tmp[1];
+ memcpy(s->frmver, tmp+2, s->frmver_length);
+ }
}
else if (buffer[0] == gz_magic[0] && buffer[1] == gz_magic[1])
{
@@ -855,7 +873,7 @@ int azclose (azio_stream *s)
Though this was added to support MySQL's FRM file, anything can be
stored in this location.
*/
-int azwrite_frm(azio_stream *s, char *blob, unsigned int length)
+int azwrite_frm(azio_stream *s, const uchar *blob, unsigned int length)
{
if (s->mode == 'r')
return 1;
@@ -867,7 +885,7 @@ int azwrite_frm(azio_stream *s, char *blob, unsigned int length)
s->frm_length= length;
s->start+= length;
- if (my_pwrite(s->file, (uchar*) blob, s->frm_length,
+ if (my_pwrite(s->file, blob, s->frm_length,
s->frm_start_pos, MYF(MY_NABP)) ||
write_header(s) ||
(my_seek(s->file, 0, MY_SEEK_END, MYF(0)) == MY_FILEPOS_ERROR))
@@ -876,9 +894,9 @@ int azwrite_frm(azio_stream *s, char *blob, unsigned int length)
return 0;
}
-int azread_frm(azio_stream *s, char *blob)
+int azread_frm(azio_stream *s, uchar *blob)
{
- return my_pread(s->file, (uchar*) blob, s->frm_length,
+ return my_pread(s->file, blob, s->frm_length,
s->frm_start_pos, MYF(MY_NABP)) ? 1 : 0;
}
diff --git a/storage/archive/azlib.h b/storage/archive/azlib.h
index 29a6329fb0a..2971705b2f1 100644
--- a/storage/archive/azlib.h
+++ b/storage/archive/azlib.h
@@ -198,6 +198,7 @@ extern "C" {
#define AZ_BUFSIZE_READ 32768
#define AZ_BUFSIZE_WRITE 16384
+#define AZ_FRMVER_LEN 16 /* same as MY_UUID_SIZE in 10.0.2 */
typedef struct azio_stream {
z_stream stream;
@@ -227,6 +228,8 @@ typedef struct azio_stream {
unsigned char dirty; /* State of file */
unsigned int frm_start_pos; /* Position for start of FRM */
unsigned int frm_length; /* Position for start of FRM */
+ unsigned char frmver[AZ_FRMVER_LEN];
+ unsigned int frmver_length;
unsigned int comment_start_pos; /* Position for start of comment */
unsigned int comment_length; /* Position for start of comment */
} azio_stream;
@@ -331,8 +334,8 @@ extern int azclose(azio_stream *file);
error number (see function gzerror below).
*/
-extern int azwrite_frm (azio_stream *s, char *blob, unsigned int length);
-extern int azread_frm (azio_stream *s, char *blob);
+extern int azwrite_frm (azio_stream *s, const uchar *blob, unsigned int length);
+extern int azread_frm (azio_stream *s, uchar *blob);
extern int azwrite_comment (azio_stream *s, char *blob, unsigned int length);
extern int azread_comment (azio_stream *s, char *blob);
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 342f8be956e..d18e46c08b1 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -1,5 +1,6 @@
/*
Copyright (c) 2004, 2012, Oracle and/or its affiliates
+ Copyright (c) 2010, 2013 Monty Program Ab.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -25,6 +26,7 @@
#include <myisam.h> // T_EXTEND
#include "ha_archive.h"
+#include "discover.h"
#include <my_dir.h>
#include <mysql/plugin.h>
@@ -104,7 +106,6 @@ static HASH archive_open_tables;
/* The file extension */
#define ARZ ".ARZ" // The data file
#define ARN ".ARN" // Files used during an optimize call
-#define ARM ".ARM" // Meta file (deprecated)
/*
uchar + uchar
@@ -120,10 +121,7 @@ extern "C" PSI_file_key arch_key_file_data;
static handler *archive_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
-int archive_discover(handlerton *hton, THD* thd, const char *db,
- const char *name,
- uchar **frmblob,
- size_t *frmlen);
+int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share);
/*
Number of rows that will force a bulk insert.
@@ -161,12 +159,11 @@ static PSI_mutex_info all_archive_mutexes[]=
{ &az_key_mutex_ARCHIVE_SHARE_mutex, "ARCHIVE_SHARE::mutex", 0}
};
-PSI_file_key arch_key_file_metadata, arch_key_file_data, arch_key_file_frm;
+PSI_file_key arch_key_file_metadata, arch_key_file_data;
static PSI_file_info all_archive_files[]=
{
{ &arch_key_file_metadata, "metadata", 0},
- { &arch_key_file_data, "data", 0},
- { &arch_key_file_frm, "FRM", 0}
+ { &arch_key_file_data, "data", 0}
};
static void init_archive_psi_keys(void)
@@ -198,6 +195,14 @@ static void init_archive_psi_keys(void)
TRUE Error
*/
+/*
+ We just implement one additional file extension.
+*/
+static const char *ha_archive_exts[] = {
+ ARZ,
+ NullS
+};
+
int archive_db_init(void *p)
{
DBUG_ENTER("archive_db_init");
@@ -212,7 +217,8 @@ int archive_db_init(void *p)
archive_hton->db_type= DB_TYPE_ARCHIVE_DB;
archive_hton->create= archive_create_handler;
archive_hton->flags= HTON_NO_FLAGS;
- archive_hton->discover= archive_discover;
+ archive_hton->discover_table= archive_discover;
+ archive_hton->tablefile_extensions= ha_archive_exts;
if (mysql_mutex_init(az_key_mutex_archive_mutex,
&archive_mutex, MY_MUTEX_INIT_FAST))
@@ -261,22 +267,20 @@ ha_archive::ha_archive(handlerton *hton, TABLE_SHARE *table_arg)
archive_reader_open= FALSE;
}
-int archive_discover(handlerton *hton, THD* thd, const char *db,
- const char *name,
- uchar **frmblob,
- size_t *frmlen)
+int archive_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
{
DBUG_ENTER("archive_discover");
- DBUG_PRINT("archive_discover", ("db: %s, name: %s", db, name));
+ DBUG_PRINT("archive_discover", ("db: '%s' name: '%s'", share->db.str,
+ share->table_name.str));
azio_stream frm_stream;
char az_file[FN_REFLEN];
- char *frm_ptr;
+ uchar *frm_ptr;
MY_STAT file_stat;
- build_table_filename(az_file, sizeof(az_file) - 1, db, name, ARZ, 0);
+ strxmov(az_file, share->normalized_path.str, ARZ, NullS);
if (!(mysql_file_stat(/* arch_key_file_data */ 0, az_file, &file_stat, MYF(0))))
- goto err;
+ DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
if (!(azopen(&frm_stream, az_file, O_RDONLY|O_BINARY)))
{
@@ -286,19 +290,23 @@ int archive_discover(handlerton *hton, THD* thd, const char *db,
}
if (frm_stream.frm_length == 0)
- goto err;
+ DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
- frm_ptr= (char *)my_malloc(sizeof(char) * frm_stream.frm_length, MYF(0));
- azread_frm(&frm_stream, frm_ptr);
- azclose(&frm_stream);
+ frm_ptr= (uchar *)my_malloc(sizeof(char) * frm_stream.frm_length,
+ MYF(MY_THREAD_SPECIFIC | MY_WME));
+ if (!frm_ptr)
+ DBUG_RETURN(HA_ERR_OUT_OF_MEM);
- *frmlen= frm_stream.frm_length;
- *frmblob= (uchar*) frm_ptr;
+ if (azread_frm(&frm_stream, frm_ptr))
+ goto ret;
- DBUG_RETURN(0);
-err:
- my_errno= 0;
- DBUG_RETURN(1);
+ azclose(&frm_stream);
+
+ my_errno= share->init_from_binary_frm_image(thd, 1,
+ frm_ptr, frm_stream.frm_length);
+ret:
+ my_free(frm_ptr);
+ DBUG_RETURN(my_errno);
}
/*
@@ -427,6 +435,9 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc)
*/
if (archive_tmp.version < ARCHIVE_VERSION)
*rc= HA_ERR_TABLE_NEEDS_UPGRADE;
+ else if (frm_compare(&archive_tmp))
+ *rc= HA_ERR_TABLE_DEF_CHANGED;
+
azclose(&archive_tmp);
(void) my_hash_insert(&archive_open_tables, (uchar*) share);
@@ -529,20 +540,6 @@ int ha_archive::init_archive_reader()
}
-/*
- We just implement one additional file extension.
-*/
-static const char *ha_archive_exts[] = {
- ARZ,
- NullS
-};
-
-const char **ha_archive::bas_ext() const
-{
- return ha_archive_exts;
-}
-
-
/*
When opening a file we:
Create/get our shared structure.
@@ -569,14 +566,8 @@ int ha_archive::open(const char *name, int mode, uint open_options)
{
case 0:
break;
+ case HA_ERR_TABLE_DEF_CHANGED:
case HA_ERR_CRASHED_ON_USAGE:
- DBUG_PRINT("ha_archive", ("archive table was crashed"));
- if (open_options & HA_OPEN_FOR_REPAIR)
- {
- rc= 0;
- break;
- }
- /* fall through */
case HA_ERR_TABLE_NEEDS_UPGRADE:
if (open_options & HA_OPEN_FOR_REPAIR)
{
@@ -655,9 +646,10 @@ int ha_archive::close(void)
int ha_archive::frm_copy(azio_stream *src, azio_stream *dst)
{
int rc= 0;
- char *frm_ptr;
+ uchar *frm_ptr;
- if (!(frm_ptr= (char *) my_malloc(src->frm_length, MYF(0))))
+ if (!(frm_ptr= (uchar *) my_malloc(src->frm_length,
+ MYF(MY_THREAD_SPECIFIC | MY_WME))))
return HA_ERR_OUT_OF_MEM;
/* Write file offset is set to the end of the file. */
@@ -671,6 +663,25 @@ int ha_archive::frm_copy(azio_stream *src, azio_stream *dst)
}
+/**
+ Compare frm blob with the on-disk frm file
+
+ @param s The azio stream.
+
+ @return Zero if equal, non-zero otherwise.
+*/
+
+int ha_archive::frm_compare(azio_stream *s)
+{
+ if (!s->frmver_length)
+ return 0; // Old pre-10.0 archive table. Never rediscover.
+
+ LEX_CUSTRING *ver= &table->s->tabledef_version;
+ return ver->length != s->frmver_length ||
+ memcmp(ver->str, s->frmver, ver->length);
+}
+
+
/*
We create our data file here. The format is pretty simple.
You can read about the format of the data file above.
@@ -687,9 +698,8 @@ int ha_archive::create(const char *name, TABLE *table_arg,
char linkname[FN_REFLEN];
int error;
azio_stream create_stream; /* Archive file we are working with */
- File frm_file; /* File handler for readers */
- MY_STAT file_stat; // Stat information for the data file
- uchar *frm_ptr;
+ const uchar *frm_ptr;
+ size_t frm_len;
DBUG_ENTER("ha_archive::create");
@@ -738,56 +748,40 @@ int ha_archive::create(const char *name, TABLE *table_arg,
There is a chance that the file was "discovered". In this case
just use whatever file is there.
*/
- if (!(mysql_file_stat(/* arch_key_file_data */ 0, name_buff, &file_stat, MYF(0))))
+ my_errno= 0;
+ if (!(azopen(&create_stream, name_buff, O_CREAT|O_RDWR|O_BINARY)))
{
- my_errno= 0;
- if (!(azopen(&create_stream, name_buff, O_CREAT|O_RDWR|O_BINARY)))
- {
- error= errno;
- goto error2;
- }
+ error= errno;
+ goto error2;
+ }
- if (linkname[0])
- my_symlink(name_buff, linkname, MYF(0));
- fn_format(name_buff, name, "", ".frm",
- MY_REPLACE_EXT | MY_UNPACK_FILENAME);
+ if (linkname[0])
+ my_symlink(name_buff, linkname, MYF(0));
- /*
- Here is where we open up the frm and pass it to archive to store
- */
- if ((frm_file= mysql_file_open(arch_key_file_frm, name_buff, O_RDONLY, MYF(0))) >= 0)
- {
- if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME)))
- {
- frm_ptr= (uchar *)my_malloc(sizeof(uchar) * (size_t)file_stat.st_size, MYF(0));
- if (frm_ptr)
- {
- mysql_file_read(frm_file, frm_ptr, (size_t)file_stat.st_size, MYF(0));
- azwrite_frm(&create_stream, (char *)frm_ptr, (size_t)file_stat.st_size);
- my_free(frm_ptr);
- }
- }
- mysql_file_close(frm_file, MYF(0));
- }
+ /*
+ Here is where we open up the frm and pass it to archive to store
+ */
+ if (!table_arg->s->read_frm_image(&frm_ptr, &frm_len))
+ {
+ azwrite_frm(&create_stream, frm_ptr, frm_len);
+ table_arg->s->free_frm_image(frm_ptr);
+ }
- if (create_info->comment.str)
- azwrite_comment(&create_stream, create_info->comment.str,
- create_info->comment.length);
+ if (create_info->comment.str)
+ azwrite_comment(&create_stream, create_info->comment.str,
+ create_info->comment.length);
- /*
- Yes you need to do this, because the starting value
- for the autoincrement may not be zero.
- */
- create_stream.auto_increment= stats.auto_increment_value ?
- stats.auto_increment_value - 1 : 0;
- if (azclose(&create_stream))
- {
- error= errno;
- goto error2;
- }
+ /*
+ Yes you need to do this, because the starting value
+ for the autoincrement may not be zero.
+ */
+ create_stream.auto_increment= stats.auto_increment_value ?
+ stats.auto_increment_value - 1 : 0;
+ if (azclose(&create_stream))
+ {
+ error= errno;
+ goto error2;
}
- else
- my_errno= 0;
DBUG_PRINT("ha_archive", ("Creating File %s", name_buff));
DBUG_PRINT("ha_archive", ("Creating Link %s", linkname));
@@ -906,10 +900,11 @@ int ha_archive::write_row(uchar *buf)
mysql_mutex_lock(&share->mutex);
- if (!share->archive_write_open)
- if (init_archive_writer())
- DBUG_RETURN(errno);
-
+ if (!share->archive_write_open && init_archive_writer())
+ {
+ rc= errno;
+ goto error;
+ }
if (table->next_number_field && record == table->record[0])
{
@@ -939,7 +934,8 @@ int ha_archive::write_row(uchar *buf)
First we create a buffer that we can use for reading rows, and can pass
to get_row().
*/
- if (!(read_buf= (uchar*) my_malloc(table->s->reclength, MYF(MY_WME))))
+ if (!(read_buf= (uchar*) my_malloc(table->s->reclength,
+ MYF(MY_THREAD_SPECIFIC | MY_WME))))
{
rc= HA_ERR_OUT_OF_MEM;
goto error;
@@ -989,7 +985,6 @@ int ha_archive::write_row(uchar *buf)
error:
mysql_mutex_unlock(&share->mutex);
my_free(read_buf);
-
DBUG_RETURN(rc);
}
@@ -1809,23 +1804,6 @@ void ha_archive::destroy_record_buffer(archive_record_buffer *r)
struct st_mysql_storage_engine archive_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
-mysql_declare_plugin(archive)
-{
- MYSQL_STORAGE_ENGINE_PLUGIN,
- &archive_storage_engine,
- "ARCHIVE",
- "Brian Aker, MySQL AB",
- "Archive storage engine",
- PLUGIN_LICENSE_GPL,
- archive_db_init, /* Plugin Init */
- archive_db_done, /* Plugin Deinit */
- 0x0300 /* 3.0 */,
- NULL, /* status variables */
- NULL, /* system variables */
- NULL, /* config options */
- 0, /* flags */
-}
-mysql_declare_plugin_end;
maria_declare_plugin(archive)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index 627267c7306..7e8d5cee47b 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -51,7 +51,7 @@ typedef struct st_archive_share {
Version for file format.
1 - Initial Version (Never Released)
2 - Stream Compression, seperate blobs, no packing
- 3 - One steam (row and blobs), with packing
+ 3 - One stream (row and blobs), with packing
*/
#define ARCHIVE_VERSION 3
@@ -76,6 +76,7 @@ class ha_archive: public handler
archive_record_buffer *create_record_buffer(unsigned int length);
void destroy_record_buffer(archive_record_buffer *r);
int frm_copy(azio_stream *src, azio_stream *dst);
+ int frm_compare(azio_stream *src);
public:
ha_archive(handlerton *hton, TABLE_SHARE *table_arg);
@@ -83,7 +84,6 @@ public:
{
}
const char *index_type(uint inx) { return "NONE"; }
- const char **bas_ext() const;
ulonglong table_flags() const
{
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_CAN_BIT_FIELD |
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 812623314bf..91a2c70cb9f 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -52,15 +52,6 @@ ha_blackhole::ha_blackhole(handlerton *hton,
{}
-static const char *ha_blackhole_exts[] = {
- NullS
-};
-
-const char **ha_blackhole::bas_ext() const
-{
- return ha_blackhole_exts;
-}
-
int ha_blackhole::open(const char *name, int mode, uint test_if_locked)
{
DBUG_ENTER("ha_blackhole::open");
diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h
index 51857f3bb2a..b70320848d7 100644
--- a/storage/blackhole/ha_blackhole.h
+++ b/storage/blackhole/ha_blackhole.h
@@ -51,7 +51,6 @@ public:
don't implement this method unless you really have indexes
*/
const char *index_type(uint key_number);
- const char **bas_ext() const;
ulonglong table_flags() const
{
return(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc
index e8c5b844e3d..a9a97806a7e 100644
--- a/storage/cassandra/ha_cassandra.cc
+++ b/storage/cassandra/ha_cassandra.cc
@@ -369,16 +369,6 @@ ha_cassandra::ha_cassandra(handlerton *hton, TABLE_SHARE *table_arg)
{}
-static const char *ha_cassandra_exts[] = {
- NullS
-};
-
-const char **ha_cassandra::bas_ext() const
-{
- return ha_cassandra_exts;
-}
-
-
int ha_cassandra::connect_and_check_options(TABLE *table_arg)
{
ha_table_option_struct *options= table_arg->s->option_struct;
@@ -2578,21 +2568,21 @@ struct st_mysql_storage_engine cassandra_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
static SHOW_VAR cassandra_status_variables[]= {
- {"Cassandra_row_inserts",
+ {"row_inserts",
(char*) &cassandra_counters.row_inserts, SHOW_LONG},
- {"Cassandra_row_insert_batches",
+ {"row_insert_batches",
(char*) &cassandra_counters.row_insert_batches, SHOW_LONG},
- {"Cassandra_multiget_keys_scanned",
+ {"multiget_keys_scanned",
(char*) &cassandra_counters.multiget_keys_scanned, SHOW_LONG},
- {"Cassandra_multiget_reads",
+ {"multiget_reads",
(char*) &cassandra_counters.multiget_reads, SHOW_LONG},
- {"Cassandra_multiget_rows_read",
+ {"multiget_rows_read",
(char*) &cassandra_counters.multiget_rows_read, SHOW_LONG},
- {"Cassandra_timeout_exceptions",
+ {"timeout_exceptions",
(char*) &cassandra_counters.timeout_exceptions, SHOW_LONG},
- {"Cassandra_unavailable_exceptions",
+ {"unavailable_exceptions",
(char*) &cassandra_counters.unavailable_exceptions, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h
index cb2f9fb237b..0c225c58780 100644
--- a/storage/cassandra/ha_cassandra.h
+++ b/storage/cassandra/ha_cassandra.h
@@ -132,11 +132,6 @@ public:
const char *index_type(uint inx) { return "HASH"; }
/** @brief
- The file extensions.
- */
- const char **bas_ext() const;
-
- /** @brief
This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h
*/
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 916c7b151de..c97cfc57bdb 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -136,6 +136,16 @@ static void init_tina_psi_keys(void)
}
#endif /* HAVE_PSI_INTERFACE */
+/*
+ If frm_error() is called in table.cc this is called to find out what file
+ extensions exist for this handler.
+*/
+static const char *ha_tina_exts[] = {
+ CSV_EXT,
+ CSM_EXT,
+ NullS
+};
+
static int tina_init_func(void *p)
{
handlerton *tina_hton;
@@ -153,6 +163,7 @@ static int tina_init_func(void *p)
tina_hton->create= tina_create_handler;
tina_hton->flags= (HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES |
HTON_NO_PARTITION);
+ tina_hton->tablefile_extensions= ha_tina_exts;
return 0;
}
@@ -825,21 +836,6 @@ err:
}
/*
- If frm_error() is called in table.cc this is called to find out what file
- extensions exist for this handler.
-*/
-static const char *ha_tina_exts[] = {
- CSV_EXT,
- CSM_EXT,
- NullS
-};
-
-const char **ha_tina::bas_ext() const
-{
- return ha_tina_exts;
-}
-
-/*
Three functions below are needed to enable concurrent insert functionality
for CSV engine. For more details see mysys/thr_lock.c
*/
@@ -1413,9 +1409,9 @@ int ha_tina::rnd_end()
DBUG_RETURN(-1);
/* Open the file again */
- if (((data_file= mysql_file_open(csv_key_file_data,
- share->data_file_name,
- O_RDONLY, MYF(MY_WME))) == -1))
+ if ((data_file= mysql_file_open(csv_key_file_data,
+ share->data_file_name,
+ O_RDONLY, MYF(MY_WME))) == -1)
DBUG_RETURN(my_errno ? my_errno : -1);
/*
As we reopened the data file, increase share->data_file_version
@@ -1754,23 +1750,6 @@ bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info,
struct st_mysql_storage_engine csv_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
-mysql_declare_plugin(csv)
-{
- MYSQL_STORAGE_ENGINE_PLUGIN,
- &csv_storage_engine,
- "CSV",
- "Brian Aker, MySQL AB",
- "CSV storage engine",
- PLUGIN_LICENSE_GPL,
- tina_init_func, /* Plugin Init */
- tina_done_func, /* Plugin Deinit */
- 0x0100 /* 1.0 */,
- NULL, /* status variables */
- NULL, /* system variables */
- NULL, /* config options */
- 0, /* flags */
-}
-mysql_declare_plugin_end;
maria_declare_plugin(csv)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index 26404b3a9e7..ebf62fbed65 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -103,7 +103,6 @@ public:
free_root(&blobroot, MYF(0));
}
const char *index_type(uint inx) { return "NONE"; }
- const char **bas_ext() const;
ulonglong table_flags() const
{
return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT |
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 98968d0b5b5..588cf11f641 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -118,6 +118,8 @@ static HASH example_open_tables;
/* The mutex used to init the hash; variable for example share methods */
mysql_mutex_t example_mutex;
+static MYSQL_THDVAR_ULONG(varopt_default, PLUGIN_VAR_RQCMDARG,
+ "default value of the VAROPT table option", NULL, NULL, 5, 0, 100, 0);
/**
Structure for CREATE TABLE options (table options).
@@ -133,6 +135,7 @@ struct ha_table_option_struct
ulonglong ullparam;
uint enumparam;
bool boolparam;
+ ulonglong varparam;
};
@@ -179,6 +182,12 @@ ha_create_table_option example_table_option_list[]=
The default is 1, that is true, yes, on.
*/
HA_TOPTION_BOOL("YESNO", boolparam, 1),
+ /*
+ one option defined by the system variable. The type, the range, or
+ a list of allowed values is the same as for the system variable.
+ */
+ HA_TOPTION_SYSVAR("VAROPT", varparam, varopt_default),
+
HA_TOPTION_END
};
@@ -229,6 +238,27 @@ static void init_example_psi_keys()
#endif
+/**
+ @brief
+ If frm_error() is called then we will use this to determine
+ the file extensions that exist for the storage engine. This is also
+ used by the default rename_table and delete_table method in
+ handler.cc and by the default discover_many method.
+
+ For engines that have two file name extentions (separate meta/index file
+ and data file), the order of elements is relevant. First element of engine
+ file name extentions array should be meta/index file extention. Second
+ element - data file extention. This order is assumed by
+ prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
+
+ @see
+ rename_table method in handler.cc and
+ delete_table method in handler.cc
+*/
+
+static const char *ha_example_exts[] = {
+ NullS
+};
static int example_init_func(void *p)
{
DBUG_ENTER("example_init_func");
@@ -247,6 +277,7 @@ static int example_init_func(void *p)
example_hton->flags= HTON_CAN_RECREATE;
example_hton->table_options= example_table_option_list;
example_hton->field_options= example_field_option_list;
+ example_hton->tablefile_extensions= ha_example_exts;
DBUG_RETURN(0);
}
@@ -355,33 +386,6 @@ ha_example::ha_example(handlerton *hton, TABLE_SHARE *table_arg)
/**
@brief
- If frm_error() is called then we will use this to determine
- the file extensions that exist for the storage engine. This is also
- used by the default rename_table and delete_table method in
- handler.cc.
-
- For engines that have two file name extentions (separate meta/index file
- and data file), the order of elements is relevant. First element of engine
- file name extentions array should be meta/index file extention. Second
- element - data file extention. This order is assumed by
- prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
-
- @see
- rename_table method in handler.cc and
- delete_table method in handler.cc
-*/
-
-static const char *ha_example_exts[] = {
- NullS
-};
-
-const char **ha_example::bas_ext() const
-{
- return ha_example_exts;
-}
-
-/**
- @brief
Used for opening tables. The name will be the name of the file.
@details
@@ -1092,6 +1096,7 @@ static MYSQL_SYSVAR_ULONG(
static struct st_mysql_sys_var* example_system_variables[]= {
MYSQL_SYSVAR(enum_var),
MYSQL_SYSVAR(ulong_var),
+ MYSQL_SYSVAR(varopt_default),
NULL
};
@@ -1110,7 +1115,7 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
static struct st_mysql_show_var func_status[]=
{
- {"example_func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC},
+ {"func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC},
{0,0,SHOW_UNDEF}
};
diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h
index 9be370edfe3..d3d31893781 100644
--- a/storage/example/ha_example.h
+++ b/storage/example/ha_example.h
@@ -73,11 +73,6 @@ public:
const char *index_type(uint inx) { return "HASH"; }
/** @brief
- The file extensions.
- */
- const char **bas_ext() const;
-
- /** @brief
This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h
*/
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index 0c07af0a554..7cd7e82f69e 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -1615,21 +1615,6 @@ ha_rows ha_federated::records_in_range(uint inx, key_range *start_key,
DBUG_ENTER("ha_federated::records_in_range");
DBUG_RETURN(FEDERATED_RECORDS_IN_RANGE);
}
-/*
- If frm_error() is called then we will use this to to find out
- what file extentions exist for the storage engine. This is
- also used by the default rename_table and delete_table method
- in handler.cc.
-*/
-
-const char **ha_federated::bas_ext() const
-{
- static const char *ext[]=
- {
- NullS
- };
- return ext;
-}
/*
diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h
index fc2c4740cc0..31f33f5f789 100644
--- a/storage/federated/ha_federated.h
+++ b/storage/federated/ha_federated.h
@@ -134,7 +134,6 @@ public:
*/
// perhaps get index type
const char *index_type(uint inx) { return "REMOTE"; }
- const char **bas_ext() const;
/*
This is a list of flags that says what the storage engine
implements. The current table flags are documented in
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index e1c2a38964a..d760fcf082f 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -426,6 +426,7 @@ int federatedx_db_init(void *p)
federatedx_hton->savepoint_release= ha_federatedx::savepoint_release;
federatedx_hton->commit= ha_federatedx::commit;
federatedx_hton->rollback= ha_federatedx::rollback;
+ federatedx_hton->discover_table_structure= ha_federatedx::discover_assisted;
federatedx_hton->create= federatedx_create_handler;
federatedx_hton->flags= HTON_ALTER_NOT_SUPPORTED;
@@ -516,15 +517,16 @@ err:
}
-static int parse_url_error(FEDERATEDX_SHARE *share, TABLE *table, int error_num)
+static int parse_url_error(FEDERATEDX_SHARE *share, TABLE_SHARE *table_s,
+ int error_num)
{
char buf[FEDERATEDX_QUERY_BUFFER_SIZE];
int buf_len;
DBUG_ENTER("ha_federatedx parse_url_error");
- buf_len= min(table->s->connect_string.length,
+ buf_len= min(table_s->connect_string.length,
FEDERATEDX_QUERY_BUFFER_SIZE-1);
- strmake(buf, table->s->connect_string.str, buf_len);
+ strmake(buf, table_s->connect_string.str, buf_len);
my_error(error_num, MYF(0), buf);
DBUG_RETURN(error_num);
}
@@ -646,8 +648,8 @@ error:
*/
-static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share, TABLE *table,
- uint table_create_flag)
+static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share,
+ TABLE_SHARE *table_s, uint table_create_flag)
{
uint error_num= (table_create_flag ?
ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE :
@@ -657,11 +659,11 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share, TABLE *table,
share->port= 0;
share->socket= 0;
DBUG_PRINT("info", ("share at %lx", (long unsigned int) share));
- DBUG_PRINT("info", ("Length: %u", (uint) table->s->connect_string.length));
- DBUG_PRINT("info", ("String: '%.*s'", (int) table->s->connect_string.length,
- table->s->connect_string.str));
- share->connection_string= strmake_root(mem_root, table->s->connect_string.str,
- table->s->connect_string.length);
+ DBUG_PRINT("info", ("Length: %u", (uint) table_s->connect_string.length));
+ DBUG_PRINT("info", ("String: '%.*s'", (int) table_s->connect_string.length,
+ table_s->connect_string.str));
+ share->connection_string= strmake_root(mem_root, table_s->connect_string.str,
+ table_s->connect_string.length);
DBUG_PRINT("info",("parse_url alloced share->connection_string %lx",
(long unsigned int) share->connection_string));
@@ -714,9 +716,9 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share, TABLE *table,
Connection specifies everything but, resort to
expecting remote and foreign table names to match
*/
- share->table_name= strmake_root(mem_root, table->s->table_name.str,
+ share->table_name= strmake_root(mem_root, table_s->table_name.str,
(share->table_name_length=
- table->s->table_name.length));
+ table_s->table_name.length));
DBUG_PRINT("info",
("internal format, default table_name "
"share->connection_string: %s share->table_name: %s",
@@ -730,7 +732,7 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share, TABLE *table,
{
share->parsed= TRUE;
// Add a null for later termination of table name
- share->connection_string[table->s->connect_string.length]= 0;
+ share->connection_string[table_s->connect_string.length]= 0;
share->scheme= share->connection_string;
DBUG_PRINT("info",("parse_url alloced share->scheme: %lx",
(ulong) share->scheme));
@@ -764,7 +766,7 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share, TABLE *table,
user:@hostname:port/db/table
Then password is a null string, so set to NULL
*/
- if ((share->password[0] == '\0'))
+ if (share->password[0] == '\0')
share->password= NULL;
}
@@ -817,7 +819,7 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share, TABLE *table,
DBUG_RETURN(0);
error:
- DBUG_RETURN(parse_url_error(share, table, error_num));
+ DBUG_RETURN(parse_url_error(share, table_s, error_num));
}
/*****************************************************************************
@@ -1583,7 +1585,7 @@ static FEDERATEDX_SHARE *get_share(const char *table_name, TABLE *table)
tmp_share.share_key= table_name;
tmp_share.share_key_length= strlen(table_name);
- if (parse_url(&mem_root, &tmp_share, table, 0))
+ if (parse_url(&mem_root, &tmp_share, table->s, 0))
goto error;
/* TODO: change tmp_share.scheme to LEX_STRING object */
@@ -1719,22 +1721,6 @@ ha_rows ha_federatedx::records_in_range(uint inx, key_range *start_key,
DBUG_ENTER("ha_federatedx::records_in_range");
DBUG_RETURN(FEDERATEDX_RECORDS_IN_RANGE);
}
-/*
- If frm_error() is called then we will use this to to find out
- what file extentions exist for the storage engine. This is
- also used by the default rename_table and delete_table method
- in handler.cc.
-*/
-
-const char **ha_federatedx::bas_ext() const
-{
- static const char *ext[]=
- {
- NullS
- };
- return ext;
-}
-
federatedx_txn *ha_federatedx::get_txn(THD *thd, bool no_create)
{
@@ -3366,7 +3352,7 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
federatedx_io *tmp_io= NULL;
DBUG_ENTER("ha_federatedx::create");
- if ((retval= parse_url(thd->mem_root, &tmp_share, table_arg, 1)))
+ if ((retval= parse_url(thd->mem_root, &tmp_share, table_arg->s, 1)))
goto error;
/* loopback socket connections hang due to LOCK_open mutex */
@@ -3588,6 +3574,72 @@ int ha_federatedx::rollback(handlerton *hton, MYSQL_THD thd, bool all)
DBUG_RETURN(return_val);
}
+
+/*
+ Federated supports assisted discovery, like
+ CREATE TABLE t1 CONNECTION="mysql://joe:pass@192.168.1.111/federated/t1";
+ but not a fully automatic discovery where a table magically appear
+ on any use (like, on SELECT * from t1).
+*/
+int ha_federatedx::discover_assisted(handlerton *hton, THD* thd,
+ TABLE_SHARE *table_s, HA_CREATE_INFO *info)
+{
+ int error= HA_ERR_NO_CONNECTION;
+ FEDERATEDX_SHARE tmp_share;
+ CHARSET_INFO *cs= system_charset_info;
+ MYSQL mysql;
+ char buf[1024];
+ String query(buf, sizeof(buf), cs);
+ MYSQL_RES *res;
+ MYSQL_ROW rdata;
+ ulong *rlen;
+
+ if (parse_url(thd->mem_root, &tmp_share, table_s, 1))
+ return HA_WRONG_CREATE_OPTION;
+
+ mysql_init(&mysql);
+ mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, cs->csname);
+
+ if (!mysql_real_connect(&mysql, tmp_share.hostname, tmp_share.username,
+ tmp_share.password, tmp_share.database,
+ tmp_share.port, tmp_share.socket, 0))
+ goto err1;
+
+ if (mysql_real_query(&mysql, STRING_WITH_LEN("SET SQL_MODE=NO_TABLE_OPTIONS")))
+ goto err1;
+
+ query.copy(STRING_WITH_LEN("SHOW CREATE TABLE "), cs);
+ append_ident(&query, tmp_share.table_name,
+ tmp_share.table_name_length, ident_quote_char);
+
+ if (mysql_real_query(&mysql, query.ptr(), query.length()))
+ goto err1;
+
+ if (!((res= mysql_store_result(&mysql))))
+ goto err1;
+
+ if (!(rdata= mysql_fetch_row(res)) || !((rlen= mysql_fetch_lengths(res))))
+ goto err2;
+
+ query.copy(rdata[1], rlen[1], cs);
+ query.append(STRING_WITH_LEN(" CONNECTION='"), cs);
+ query.append_for_single_quote(table_s->connect_string.str,
+ table_s->connect_string.length);
+ query.append('\'');
+
+ error= table_s->init_from_sql_statement_string(thd, true,
+ query.ptr(), query.length());
+
+err2:
+ mysql_free_result(res);
+err1:
+ if (error)
+ my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), mysql_error(&mysql));
+ mysql_close(&mysql);
+ return error;
+}
+
+
struct st_mysql_storage_engine federatedx_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
@@ -3601,10 +3653,10 @@ maria_declare_plugin(federatedx)
PLUGIN_LICENSE_GPL,
federatedx_db_init, /* Plugin Init */
federatedx_done, /* Plugin Deinit */
- 0x0200 /* 2.0 */,
+ 0x0201 /* 2.1 */,
NULL, /* status variables */
NULL, /* system variables */
- "2.0", /* string version */
+ "2.1", /* string version */
MariaDB_PLUGIN_MATURITY_BETA /* maturity */
}
maria_declare_plugin_end;
diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h
index dcbbe534262..44c20b6703a 100644
--- a/storage/federatedx/ha_federatedx.h
+++ b/storage/federatedx/ha_federatedx.h
@@ -297,6 +297,8 @@ private:
static int savepoint_release(handlerton *hton, MYSQL_THD thd, void *sv);
static int commit(handlerton *hton, MYSQL_THD thd, bool all);
static int rollback(handlerton *hton, MYSQL_THD thd, bool all);
+ static int discover_assisted(handlerton *, THD*, TABLE_SHARE *,
+ HA_CREATE_INFO *);
bool append_stmt_insert(String *query);
@@ -317,7 +319,6 @@ public:
*/
// perhaps get index type
const char *index_type(uint inx) { return "REMOTE"; }
- const char **bas_ext() const;
/*
This is a list of flags that says what the storage engine
implements. The current table flags are documented in
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index 8e63799680b..916abaa60ea 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -75,16 +75,6 @@ ha_heap::ha_heap(handlerton *hton, TABLE_SHARE *table_arg)
internal_table(0)
{}
-
-static const char *ha_heap_exts[] = {
- NullS
-};
-
-const char **ha_heap::bas_ext() const
-{
- return ha_heap_exts;
-}
-
/*
Hash index statistics is updated (copied from HP_KEYDEF::hash_buckets to
rec_per_key) after 1/HEAP_STATS_UPDATE_THRESHOLD fraction of table records
diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h
index 30ad06e2c06..74824b66c42 100644
--- a/storage/heap/ha_heap.h
+++ b/storage/heap/ha_heap.h
@@ -45,7 +45,6 @@ public:
}
/* Rows also use a fixed-size format */
enum row_type get_row_type() const { return ROW_TYPE_FIXED; }
- const char **bas_ext() const;
ulonglong table_flags() const
{
return (HA_FAST_KEY_READ | HA_NO_BLOBS | HA_NULL_IN_KEY |
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c
index d00ac94a918..043e4d3540d 100644
--- a/storage/heap/hp_delete.c
+++ b/storage/heap/hp_delete.c
@@ -48,7 +48,6 @@ int heap_delete(HP_INFO *info, const uchar *record)
pos[share->reclength]=0; /* Record deleted */
share->deleted++;
share->key_version++;
- info->current_hash_ptr=0;
#if !defined(DBUG_OFF) && defined(EXTRA_HEAP_DEBUG)
DBUG_EXECUTE("check_heap",heap_check_heap(info, 0););
#endif
@@ -105,7 +104,7 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
const uchar *record, uchar *recpos, int flag)
{
- ulong blength,pos2,pos_hashnr,lastpos_hashnr;
+ ulong blength, pos2, pos_hashnr, lastpos_hashnr, key_pos;
HASH_INFO *lastpos,*gpos,*pos,*pos3,*empty,*last_ptr;
HP_SHARE *share=info->s;
DBUG_ENTER("hp_delete_key");
@@ -117,9 +116,9 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
last_ptr=0;
/* Search after record with key */
- pos= hp_find_hash(&keyinfo->block,
- hp_mask(hp_rec_hashnr(keyinfo, record), blength,
- share->records + 1));
+ key_pos= hp_mask(hp_rec_hashnr(keyinfo, record), blength, share->records + 1);
+ pos= hp_find_hash(&keyinfo->block, key_pos);
+
gpos = pos3 = 0;
while (pos->ptr_to_rec != recpos)
@@ -182,21 +181,50 @@ int hp_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
}
pos2= hp_mask(lastpos_hashnr, blength, share->records + 1);
if (pos2 == hp_mask(pos_hashnr, blength, share->records + 1))
- { /* Identical key-positions */
+ {
+ /* lastpos and the row in the main bucket entry (pos) has the same hash */
if (pos2 != share->records)
{
- empty[0]=lastpos[0];
+ /*
+ The bucket entry was not deleted. Copy lastpos over the
+ deleted entry and update previous link to point to it.
+ */
+ empty[0]= lastpos[0];
hp_movelink(lastpos, pos, empty);
+ if (last_ptr == lastpos)
+ {
+ /*
+ We moved the row that info->current_hash_ptr points to.
+ Update info->current_hash_ptr to point to the new position.
+ */
+ info->current_hash_ptr= empty;
+ }
DBUG_RETURN(0);
}
- pos3= pos; /* Link pos->next after lastpos */
- }
- else
- {
- pos3= 0; /* Different positions merge */
- keyinfo->hash_buckets--;
+ /*
+ Shrinking the hash table deleted the main bucket entry for this hash.
+ In this case the last entry was the first key in the key chain.
+ We move things around so that we keep the original key order to ensure
+ that heap_rnext() works.
+
+ - Move the row at the main bucket entry to the empty spot.
+ - Move the last entry first in the new chain.
+ - Link in the first element of the hash.
+ */
+ empty[0]= pos[0];
+ pos[0]= lastpos[0];
+ hp_movelink(pos, pos, empty);
+
+ /* Update current_hash_ptr if the entry moved */
+ if (last_ptr == lastpos)
+ info->current_hash_ptr= pos;
+ else if (last_ptr == pos)
+ info->current_hash_ptr= empty;
+ DBUG_RETURN(0);
}
+ pos3= 0; /* Different positions merge */
+ keyinfo->hash_buckets--;
empty[0]=lastpos[0];
hp_movelink(pos3, empty, pos->next_key);
pos->next_key=empty;
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 8b7a19777ab..8eae3c7e3bc 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -3098,6 +3098,8 @@ btr_lift_page_up(
buf_block_t* blocks[BTR_MAX_LEVELS];
ulint n_blocks; /*!< last used index in blocks[] */
ulint i;
+ ibool lift_father_up = FALSE;
+ buf_block_t* block_orig = block;
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
@@ -3108,11 +3110,13 @@ btr_lift_page_up(
{
btr_cur_t cursor;
- mem_heap_t* heap = mem_heap_create(100);
- ulint* offsets;
+ ulint* offsets = NULL;
+ mem_heap_t* heap = mem_heap_create(
+ sizeof(*offsets)
+ * (REC_OFFS_HEADER_SIZE + 1 + 1 + index->n_fields));
buf_block_t* b;
- offsets = btr_page_get_father_block(NULL, heap, index,
+ offsets = btr_page_get_father_block(offsets, heap, index,
block, mtr, &cursor);
father_block = btr_cur_get_block(&cursor);
father_page_zip = buf_block_get_page_zip(father_block);
@@ -3136,6 +3140,29 @@ btr_lift_page_up(
blocks[n_blocks++] = b = btr_cur_get_block(&cursor);
}
+ if (n_blocks && page_level == 0) {
+ /* The father page also should be the only on its level (not
+ root). We should lift up the father page at first.
+ Because the leaf page should be lifted up only for root page.
+ The freeing page is based on page_level (==0 or !=0)
+ to choose segment. If the page_level is changed ==0 from !=0,
+ later freeing of the page doesn't find the page allocation
+ to be freed.*/
+
+ lift_father_up = TRUE;
+ block = father_block;
+ page = buf_block_get_frame(block);
+ page_level = btr_page_get_level(page, mtr);
+
+ ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
+ ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
+ ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
+
+ father_block = blocks[0];
+ father_page_zip = buf_block_get_page_zip(father_block);
+ father_page = buf_block_get_frame(father_block);
+ }
+
mem_heap_free(heap);
}
@@ -3143,6 +3170,7 @@ btr_lift_page_up(
/* Make the father empty */
btr_page_empty(father_block, father_page_zip, index, page_level, mtr);
+ page_level++;
/* Copy the records to the father page one by one. */
if (0
@@ -3174,7 +3202,7 @@ btr_lift_page_up(
lock_update_copy_and_discard(father_block, block);
/* Go upward to root page, decrementing levels by one. */
- for (i = 0; i < n_blocks; i++, page_level++) {
+ for (i = lift_father_up ? 1 : 0; i < n_blocks; i++, page_level++) {
page_t* page = buf_block_get_frame(blocks[i]);
page_zip_des_t* page_zip= buf_block_get_page_zip(blocks[i]);
@@ -3196,7 +3224,7 @@ btr_lift_page_up(
ut_ad(page_validate(father_page, index));
ut_ad(btr_check_node_ptr(index, father_block, mtr));
- return(father_block);
+ return(lift_father_up ? block_orig : father_block);
}
/*************************************************************//**
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index aeb16200f80..56cce411bba 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -97,6 +97,11 @@ srv_refresh_innodb_monitor_stats(). Referenced by
srv_printf_innodb_monitor(). */
UNIV_INTERN ulint btr_cur_n_sea_old = 0;
+#ifdef UNIV_DEBUG
+/* Flag to limit optimistic insert records */
+UNIV_INTERN uint btr_cur_limit_optimistic_insert_debug = 0;
+#endif /* UNIV_DEBUG */
+
/** In the optimistic insert, if the insert does not fit, but this much space
can be released by page reorganize, then it is reorganized */
#define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32)
@@ -1276,6 +1281,9 @@ btr_cur_optimistic_insert(
}
}
+ LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page),
+ goto fail);
+
/* If there have been many consecutive inserts, and we are on the leaf
level, check if we have to split the page to reserve enough free space
for future updates of records. */
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 96821478e60..28d5a472531 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -383,6 +383,33 @@ buf_get_total_list_len(
}
/********************************************************************//**
+Get total list size in bytes from all buffer pools. */
+UNIV_INTERN
+void
+buf_get_total_list_size_in_bytes(
+/*=============================*/
+ buf_pools_list_size_t* buf_pools_list_size) /*!< out: list sizes
+ in all buffer pools */
+{
+ ulint i;
+ ut_ad(buf_pools_list_size);
+ memset(buf_pools_list_size, 0, sizeof(*buf_pools_list_size));
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ /* We don't need mutex protection since this is
+ for statistics purpose */
+ buf_pools_list_size->LRU_bytes += buf_pool->stat.LRU_bytes;
+ buf_pools_list_size->unzip_LRU_bytes +=
+ UT_LIST_GET_LEN(buf_pool->unzip_LRU) * UNIV_PAGE_SIZE;
+ buf_pools_list_size->flush_list_bytes +=
+ buf_pool->stat.flush_list_bytes;
+ }
+}
+
+/********************************************************************//**
Get total buffer pool statistics. */
UNIV_INTERN
void
@@ -1802,34 +1829,24 @@ buf_page_make_young(
}
/********************************************************************//**
-Sets the time of the first access of a page and moves a page to the
-start of the buffer pool LRU list if it is too old. This high-level
-function can be used to prevent an important page from slipping
-out of the buffer pool. */
+Moves a page to the start of the buffer pool LRU list if it is too old.
+This high-level function can be used to prevent an important page from
+slipping out of the buffer pool. */
static
void
-buf_page_set_accessed_make_young(
-/*=============================*/
- buf_page_t* bpage, /*!< in/out: buffer block of a
+buf_page_make_young_if_needed(
+/*==========================*/
+ buf_page_t* bpage) /*!< in/out: buffer block of a
file page */
- unsigned access_time) /*!< in: bpage->access_time
- read under mutex protection,
- or 0 if unknown */
{
+#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
-
ut_ad(!buf_pool_mutex_own(buf_pool));
+#endif /* UNIV_DEBUG */
ut_a(buf_page_in_file(bpage));
if (buf_page_peek_if_too_old(bpage)) {
- buf_pool_mutex_enter(buf_pool);
- buf_LRU_make_block_young(bpage);
- buf_pool_mutex_exit(buf_pool);
- } else if (!access_time) {
- ulint time_ms = ut_time_ms();
- buf_pool_mutex_enter(buf_pool);
- buf_page_set_accessed(bpage, time_ms);
- buf_pool_mutex_exit(buf_pool);
+ buf_page_make_young(bpage);
}
}
@@ -1978,7 +1995,6 @@ buf_page_get_zip(
rw_lock_t* hash_lock;
ibool discard_attempted = FALSE;
ibool must_read;
- unsigned access_time;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
buf_pool->stat.n_page_gets++;
@@ -2051,15 +2067,17 @@ err_exit:
got_block:
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
- access_time = buf_page_is_accessed(bpage);
rw_lock_s_unlock(hash_lock);
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(!bpage->file_page_was_freed);
#endif
+
+ buf_page_set_accessed(bpage);
+
mutex_exit(block_mutex);
- buf_page_set_accessed_make_young(bpage, access_time);
+ buf_page_make_young_if_needed(bpage);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 5771 || buf_validate());
@@ -2671,22 +2689,29 @@ wait_until_unfixed:
UNIV_MEM_INVALID(bpage, sizeof *bpage);
rw_lock_x_unlock(hash_lock);
- mutex_exit(&block->mutex);
- mutex_exit(&buf_pool->zip_mutex);
buf_pool->n_pend_unzip++;
-
buf_pool_mutex_exit(buf_pool);
+ access_time = buf_page_is_accessed(&block->page);
+ mutex_exit(&block->mutex);
+ mutex_exit(&buf_pool->zip_mutex);
+
buf_page_free_descriptor(bpage);
- /* Decompress the page and apply buffered operations
- while not holding buf_pool->mutex or block->mutex. */
+ /* Decompress the page while not holding
+ buf_pool->mutex or block->mutex. */
ut_a(buf_zip_decompress(block, TRUE));
if (UNIV_LIKELY(!recv_no_ibuf_operations)) {
- ibuf_merge_or_delete_for_page(block, space, offset,
- zip_size, TRUE);
+ if (access_time) {
+#ifdef UNIV_IBUF_COUNT_DEBUG
+ ut_a(ibuf_count_get(space, offset) == 0);
+#endif /* UNIV_IBUF_COUNT_DEBUG */
+ } else {
+ ibuf_merge_or_delete_for_page(
+ block, space, offset, zip_size, TRUE);
+ }
}
/* Unfix and unlatch the block. */
@@ -2799,14 +2824,15 @@ wait_until_unfixed:
ut_a(mode == BUF_GET_POSSIBLY_FREED
|| !block->page.file_page_was_freed);
#endif
- mutex_exit(&block->mutex);
-
/* Check if this is the first access to the page */
-
access_time = buf_page_is_accessed(&block->page);
- if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) {
- buf_page_set_accessed_make_young(&block->page, access_time);
+ buf_page_set_accessed(&block->page);
+
+ mutex_exit(&block->mutex);
+
+ if (mode != BUF_PEEK_IF_IN_POOL) {
+ buf_page_make_young_if_needed(&block->page);
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -2857,7 +2883,7 @@ wait_until_unfixed:
mtr_memo_push(mtr, block, fix_type);
- if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL) && !access_time) {
+ if (mode != BUF_PEEK_IF_IN_POOL && !access_time) {
/* In the case of a first access, try to apply linear
read-ahead */
@@ -2912,15 +2938,13 @@ buf_page_optimistic_get(
buf_block_buf_fix_inc(block, file, line);
- mutex_exit(&block->mutex);
+ access_time = buf_page_is_accessed(&block->page);
- /* Check if this is the first access to the page.
- We do a dirty read on purpose, to avoid mutex contention.
- This field is only used for heuristic purposes; it does not
- affect correctness. */
+ buf_page_set_accessed(&block->page);
- access_time = buf_page_is_accessed(&block->page);
- buf_page_set_accessed_make_young(&block->page, access_time);
+ mutex_exit(&block->mutex);
+
+ buf_page_make_young_if_needed(&block->page);
ut_ad(!ibuf_inside(mtr)
|| ibuf_page(buf_block_get_space(block),
@@ -2975,7 +2999,7 @@ buf_page_optimistic_get(
mutex_exit(&block->mutex);
#endif
- if (UNIV_UNLIKELY(!access_time)) {
+ if (!access_time) {
/* In the case of a first access, try to apply linear
read-ahead */
@@ -3038,24 +3062,14 @@ buf_page_get_known_nowait(
buf_block_buf_fix_inc(block, file, line);
+ buf_page_set_accessed(&block->page);
+
mutex_exit(&block->mutex);
buf_pool = buf_pool_from_block(block);
- if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
- buf_pool_mutex_enter(buf_pool);
- buf_LRU_make_block_young(&block->page);
- buf_pool_mutex_exit(buf_pool);
- } else if (!buf_page_is_accessed(&block->page)) {
- /* Above, we do a dirty read on purpose, to avoid
- mutex contention. The field buf_page_t::access_time
- is only used for heuristic purposes. Writes to the
- field must be protected by mutex, however. */
- ulint time_ms = ut_time_ms();
-
- buf_pool_mutex_enter(buf_pool);
- buf_page_set_accessed(&block->page, time_ms);
- buf_pool_mutex_exit(buf_pool);
+ if (mode == BUF_MAKE_YOUNG) {
+ buf_page_make_young_if_needed(&block->page);
}
ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
@@ -3234,6 +3248,7 @@ buf_page_init(
ulint offset, /*!< in: offset of the page within space
in units of a page */
ulint fold, /*!< in: buf_page_address_fold(space,offset) */
+ ulint zip_size,/*!< in: compressed page size, or 0 */
buf_block_t* block) /*!< in/out: block to init */
{
buf_page_t* hash_page;
@@ -3302,6 +3317,9 @@ buf_page_init(
ut_d(block->page.in_page_hash = TRUE);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
fold, &block->page);
+ if (zip_size) {
+ page_zip_set_size(&block->page.zip, zip_size);
+ }
}
/********************************************************************//**
@@ -3407,7 +3425,7 @@ err_exit:
ut_ad(buf_pool_from_bpage(bpage) == buf_pool);
- buf_page_init(buf_pool, space, offset, fold, block);
+ buf_page_init(buf_pool, space, offset, fold, zip_size, block);
rw_lock_x_unlock(hash_lock);
/* The block must be put to the LRU list, to the old blocks */
@@ -3426,8 +3444,6 @@ err_exit:
buf_page_set_io_fix(bpage, BUF_IO_READ);
if (zip_size) {
- page_zip_set_size(&block->page.zip, zip_size);
-
/* buf_pool->mutex may be released and
reacquired by buf_buddy_alloc(). Thus, we
must release block->mutex in order not to
@@ -3528,7 +3544,8 @@ err_exit:
rw_lock_x_unlock(hash_lock);
- /* The block must be put to the LRU list, to the old blocks */
+ /* The block must be put to the LRU list, to the old blocks
+ The zip_size is already set into the page zip */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(bpage);
@@ -3578,7 +3595,6 @@ buf_page_create(
buf_block_t* block;
ulint fold;
buf_block_t* free_block = NULL;
- ulint time_ms = ut_time_ms();
buf_pool_t* buf_pool = buf_pool_get(space, offset);
rw_lock_t* hash_lock;
@@ -3630,7 +3646,7 @@ buf_page_create(
mutex_enter(&block->mutex);
- buf_page_init(buf_pool, space, offset, fold, block);
+ buf_page_init(buf_pool, space, offset, fold, zip_size, block);
rw_lock_x_unlock(hash_lock);
@@ -3650,8 +3666,6 @@ buf_page_create(
buf_page_set_io_fix(&block->page, BUF_IO_READ);
rw_lock_x_lock(&block->lock);
-
- page_zip_set_size(&block->page.zip, zip_size);
mutex_exit(&block->mutex);
/* buf_pool->mutex may be released and reacquired by
buf_buddy_alloc(). Thus, we must release block->mutex
@@ -3675,12 +3689,12 @@ buf_page_create(
rw_lock_x_unlock(&block->lock);
}
- buf_page_set_accessed(&block->page, time_ms);
-
buf_pool_mutex_exit(buf_pool);
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
+ buf_page_set_accessed(&block->page);
+
mutex_exit(&block->mutex);
/* Delete possible entries for the page from the insert buffer:
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 023ed766c62..577878ef964 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -104,6 +104,23 @@ in thrashing. */
/* @} */
+/******************************************************************//**
+Increases flush_list size in bytes with zip_size for compressed page,
+UNIV_PAGE_SIZE for uncompressed page in inline function */
+static inline
+void
+incr_flush_list_size_in_bytes(
+/*==========================*/
+ buf_block_t* block, /*!< in: control block */
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
+{
+ ulint zip_size;
+ ut_ad(buf_flush_list_mutex_own(buf_pool));
+ zip_size = page_zip_get_size(&block->page.zip);
+ buf_pool->stat.flush_list_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE;
+ ut_ad(buf_pool->stat.flush_list_bytes <= buf_pool->curr_pool_size);
+}
+
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/******************************************************************//**
Validates the flush list.
@@ -333,6 +350,7 @@ buf_flush_insert_into_flush_list(
ut_d(block->page.in_flush_list = TRUE);
block->page.oldest_modification = lsn;
UT_LIST_ADD_FIRST(list, buf_pool->flush_list, &block->page);
+ incr_flush_list_size_in_bytes(block, buf_pool);
#ifdef UNIV_DEBUG_VALGRIND
{
@@ -439,6 +457,8 @@ buf_flush_insert_sorted_into_flush_list(
MONITOR_INC(MONITOR_PAGE_INFLUSH);
+ incr_flush_list_size_in_bytes(block, buf_pool);
+
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_low(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
@@ -538,6 +558,7 @@ buf_flush_remove(
buf_page_t* bpage) /*!< in: pointer to the block in question */
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ ulint zip_size;
ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
@@ -576,6 +597,9 @@ buf_flush_remove(
because we assert on in_flush_list in comparison function. */
ut_d(bpage->in_flush_list = FALSE);
+ zip_size = page_zip_get_size(&bpage->zip);
+ buf_pool->stat.flush_list_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE;
+
bpage->oldest_modification = 0;
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index c35d84cb985..5f0c0cae96c 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -158,6 +158,23 @@ buf_LRU_block_free_hashed_page(
be in a state where it can be freed */
/******************************************************************//**
+Increases LRU size in bytes with zip_size for compressed page,
+UNIV_PAGE_SIZE for uncompressed page in inline function */
+static inline
+void
+incr_LRU_size_in_bytes(
+/*===================*/
+ buf_page_t* bpage, /*!< in: control block */
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
+{
+ ulint zip_size;
+ ut_ad(buf_pool_mutex_own(buf_pool));
+ zip_size = page_zip_get_size(&bpage->zip);
+ buf_pool->stat.LRU_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE;
+ ut_ad(buf_pool->stat.LRU_bytes <= buf_pool->curr_pool_size);
+}
+
+/******************************************************************//**
Determines if the unzip_LRU list should be used for evicting a victim
instead of the general LRU list.
@return TRUE if should use unzip_LRU */
@@ -1107,6 +1124,7 @@ buf_LRU_remove_block(
buf_page_t* bpage) /*!< in: control block */
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ ulint zip_size;
ut_ad(buf_pool);
ut_ad(bpage);
@@ -1142,6 +1160,9 @@ buf_LRU_remove_block(
UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage);
ut_d(bpage->in_LRU_list = FALSE);
+ zip_size = page_zip_get_size(&bpage->zip);
+ buf_pool->stat.LRU_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE;
+
buf_unzip_LRU_remove_block_if_needed(bpage);
/* If the LRU list is so short that LRU_old is not defined,
@@ -1202,7 +1223,10 @@ buf_unzip_LRU_add_block(
}
/******************************************************************//**
-Adds a block to the LRU list end. */
+Adds a block to the LRU list end. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INLINE
void
buf_LRU_add_block_to_end_low(
@@ -1221,6 +1245,8 @@ buf_LRU_add_block_to_end_low(
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
ut_d(bpage->in_LRU_list = TRUE);
+ incr_LRU_size_in_bytes(bpage, buf_pool);
+
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old);
@@ -1249,7 +1275,10 @@ buf_LRU_add_block_to_end_low(
}
/******************************************************************//**
-Adds a block to the LRU list. */
+Adds a block to the LRU list. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INLINE
void
buf_LRU_add_block_low(
@@ -1291,6 +1320,8 @@ buf_LRU_add_block_low(
ut_d(bpage->in_LRU_list = TRUE);
+ incr_LRU_size_in_bytes(bpage, buf_pool);
+
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old);
@@ -1318,7 +1349,10 @@ buf_LRU_add_block_low(
}
/******************************************************************//**
-Adds a block to the LRU list. */
+Adds a block to the LRU list. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INTERN
void
buf_LRU_add_block(
@@ -1540,6 +1574,8 @@ func_exit:
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU,
prev_b, b);
+ incr_LRU_size_in_bytes(b, buf_pool);
+
if (buf_page_is_old(b)) {
buf_pool->LRU_old_len++;
if (UNIV_UNLIKELY
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index ff93be3e76a..95bc022de8b 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -2380,7 +2380,8 @@ dict_load_foreigns(
ibool check_charsets) /*!< in: TRUE=check charset
compatibility */
{
- char tuple_buf[DTUPLE_EST_ALLOC(1)];
+ ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1)
+ / sizeof(ulint)];
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 2e6835fe0c0..9aafeb4f69c 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1493,7 +1493,7 @@ fil_space_get_size(
ut_ad(fil_system);
- fil_mutex_enter_and_prepare_for_io(id);
+ mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
@@ -1508,6 +1508,23 @@ fil_space_get_size(
ut_a(1 == UT_LIST_GET_LEN(space->chain));
+ mutex_exit(&fil_system->mutex);
+
+ /* It is possible that the space gets evicted at this point
+ before the fil_mutex_enter_and_prepare_for_io() acquires
+ the fil_system->mutex. Check for this after completing the
+ call to fil_mutex_enter_and_prepare_for_io(). */
+ fil_mutex_enter_and_prepare_for_io(id);
+
+ /* We are still holding the fil_system->mutex. Check if
+ the space is still in memory cache. */
+ space = fil_space_get_by_id(id);
+
+ if (space == NULL) {
+ mutex_exit(&fil_system->mutex);
+ return(0);
+ }
+
node = UT_LIST_GET_FIRST(space->chain);
/* It must be a single-table tablespace and we have not opened
@@ -1545,7 +1562,7 @@ fil_space_get_flags(
return(0);
}
- fil_mutex_enter_and_prepare_for_io(id);
+ mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
@@ -1560,6 +1577,23 @@ fil_space_get_flags(
ut_a(1 == UT_LIST_GET_LEN(space->chain));
+ mutex_exit(&fil_system->mutex);
+
+ /* It is possible that the space gets evicted at this point
+ before the fil_mutex_enter_and_prepare_for_io() acquires
+ the fil_system->mutex. Check for this after completing the
+ call to fil_mutex_enter_and_prepare_for_io(). */
+ fil_mutex_enter_and_prepare_for_io(id);
+
+ /* We are still holding the fil_system->mutex. Check if
+ the space is still in memory cache. */
+ space = fil_space_get_by_id(id);
+
+ if (space == NULL) {
+ mutex_exit(&fil_system->mutex);
+ return(0);
+ }
+
node = UT_LIST_GET_FIRST(space->chain);
/* It must be a single-table tablespace and we have not opened
@@ -2745,7 +2779,7 @@ retry:
mutex_exit(&fil_system->mutex);
#ifndef UNIV_HOTBACKUP
- if (success) {
+ if (success && !recv_recovery_on) {
mtr_t mtr;
mtr_start(&mtr);
@@ -4047,6 +4081,21 @@ retry:
start_page_no = space->size;
file_start_page_no = space->size - node->size;
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ mutex_exit(&fil_system->mutex);
+ success = os_file_set_size(node->name, node->handle,
+ size_after_extend * page_size);
+ mutex_enter(&fil_system->mutex);
+ if (success) {
+ node->size += (size_after_extend - start_page_no);
+ space->size += (size_after_extend - start_page_no);
+ os_has_said_disk_full = FALSE;
+ }
+ goto complete_io;
+ }
+#endif
+
/* Extend at most 64 pages at a time */
buf_size = ut_min(64, size_after_extend - start_page_no) * page_size;
buf2 = static_cast<byte*>(mem_alloc(buf_size + page_size));
@@ -4102,6 +4151,10 @@ retry:
node->size += pages_added;
node->being_extended = FALSE;
+#ifdef HAVE_POSIX_FALLOCATE
+complete_io:
+#endif
+
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
*actual_size = space->size;
@@ -5025,3 +5078,28 @@ fil_close(void)
fil_system = NULL;
}
+
+/****************************************************************//**
+Generate redo logs for swapping two .ibd files */
+UNIV_INTERN
+void
+fil_mtr_rename_log(
+/*===============*/
+ ulint old_space_id, /*!< in: tablespace id of the old
+ table. */
+ const char* old_name, /*!< in: old table name */
+ ulint new_space_id, /*!< in: tablespace id of the new
+ table */
+ const char* new_name, /*!< in: new table name */
+ const char* tmp_name) /*!< in: temp table name used while
+ swapping */
+{
+ mtr_t mtr;
+ mtr_start(&mtr);
+ fil_op_write_log(MLOG_FILE_RENAME, old_space_id,
+ 0, 0, old_name, tmp_name, &mtr);
+ fil_op_write_log(MLOG_FILE_RENAME, new_space_id,
+ 0, 0, new_name, old_name, &mtr);
+ mtr_commit(&mtr);
+}
+
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e19fe47e81a..e3c2204affb 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -167,6 +167,8 @@ static my_bool innobase_file_format_check = TRUE;
static my_bool innobase_log_archive = FALSE;
static char* innobase_log_arch_dir = NULL;
#endif /* UNIV_LOG_ARCHIVE */
+static my_bool innobase_use_atomic_writes = FALSE;
+static my_bool innobase_use_fallocate = TRUE;
static my_bool innobase_use_doublewrite = TRUE;
static my_bool innobase_use_checksums = TRUE;
static my_bool innobase_locks_unsafe_for_binlog = FALSE;
@@ -471,8 +473,12 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_buffer_pool_load_status, SHOW_CHAR},
{"buffer_pool_pages_data",
(char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
+ {"buffer_pool_bytes_data",
+ (char*) &export_vars.innodb_buffer_pool_bytes_data, SHOW_LONG},
{"buffer_pool_pages_dirty",
(char*) &export_vars.innodb_buffer_pool_pages_dirty, SHOW_LONG},
+ {"buffer_pool_bytes_dirty",
+ (char*) &export_vars.innodb_buffer_pool_bytes_dirty, SHOW_LONG},
{"buffer_pool_pages_flushed",
(char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG},
{"buffer_pool_pages_free",
@@ -567,6 +573,12 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_truncated_status_writes, SHOW_LONG},
{"available_undo_logs",
(char*) &export_vars.innodb_available_undo_logs, SHOW_LONG},
+#ifdef UNIV_DEBUG
+ {"purge_trx_id_age",
+ (char*) &export_vars.innodb_purge_trx_id_age, SHOW_LONG},
+ {"purge_view_trx_id_age",
+ (char*) &export_vars.innodb_purge_view_trx_id_age, SHOW_LONG},
+#endif /* UNIV_DEBUG */
{NullS, NullS, SHOW_LONG}
};
@@ -1407,6 +1419,8 @@ convert_error_code_to_mysql(
return(HA_ERR_INDEX_CORRUPT);
case DB_UNDO_RECORD_TOO_BIG:
return(HA_ERR_UNDO_REC_TOO_BIG);
+ case DB_OUT_OF_MEMORY:
+ return(HA_ERR_OUT_OF_MEM);
}
}
@@ -1621,15 +1635,6 @@ innobase_get_lower_case_table_names(void)
return(lower_case_table_names);
}
-#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
-extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
-/*******************************************************************//**
-Map an OS error to an errno value. The OS error number is stored in
-_doserrno and the mapped value is stored in errno) */
-void __cdecl
-_dosmaperr(
- unsigned long); /*!< in: OS error value */
-
/*********************************************************************//**
Creates a temporary file.
@return temporary file descriptor, or < 0 on error */
@@ -1638,92 +1643,16 @@ int
innobase_mysql_tmpfile(void)
/*========================*/
{
- int fd; /* handle of opened file */
- HANDLE osfh; /* OS handle of opened file */
- char* tmpdir; /* point to the directory
- where to create file */
- TCHAR path_buf[MAX_PATH - 14]; /* buffer for tmp file path.
- The length cannot be longer
- than MAX_PATH - 14, or
- GetTempFileName will fail. */
- char filename[MAX_PATH]; /* name of the tmpfile */
- DWORD fileaccess = GENERIC_READ /* OS file access */
- | GENERIC_WRITE
- | DELETE;
- DWORD fileshare = FILE_SHARE_READ /* OS file sharing mode */
- | FILE_SHARE_WRITE
- | FILE_SHARE_DELETE;
- DWORD filecreate = CREATE_ALWAYS; /* OS method of open/create */
- DWORD fileattrib = /* OS file attribute flags */
- FILE_ATTRIBUTE_NORMAL
- | FILE_FLAG_DELETE_ON_CLOSE
- | FILE_ATTRIBUTE_TEMPORARY
- | FILE_FLAG_SEQUENTIAL_SCAN;
-
- DBUG_ENTER("innobase_mysql_tmpfile");
-
- tmpdir = my_tmpdir(&mysql_tmpdir_list);
-
- /* The tmpdir parameter can not be NULL for GetTempFileName. */
- if (!tmpdir) {
- uint ret;
-
- /* Use GetTempPath to determine path for temporary files. */
- ret = GetTempPath(sizeof(path_buf), path_buf);
- if (ret > sizeof(path_buf) || (ret == 0)) {
-
- _dosmaperr(GetLastError()); /* map error */
- DBUG_RETURN(-1);
- }
-
- tmpdir = path_buf;
- }
-
- /* Use GetTempFileName to generate a unique filename. */
- if (!GetTempFileName(tmpdir, "ib", 0, filename)) {
-
- _dosmaperr(GetLastError()); /* map error */
- DBUG_RETURN(-1);
- }
-
- DBUG_PRINT("info", ("filename: %s", filename));
-
- /* Open/Create the file. */
- osfh = CreateFile(filename, fileaccess, fileshare, NULL,
- filecreate, fileattrib, NULL);
- if (osfh == INVALID_HANDLE_VALUE) {
-
- /* open/create file failed! */
- _dosmaperr(GetLastError()); /* map error */
- DBUG_RETURN(-1);
- }
-
- do {
- /* Associates a CRT file descriptor with the OS file handle. */
- fd = _open_osfhandle((intptr_t) osfh, 0);
- } while (fd == -1 && errno == EINTR);
+ int fd2 = -1;
+ File fd;
- if (fd == -1) {
- /* Open failed, close the file handle. */
+ DBUG_EXECUTE_IF(
+ "innobase_tmpfile_creation_failure",
+ return(-1);
+ );
- _dosmaperr(GetLastError()); /* map error */
- CloseHandle(osfh); /* no need to check if
- CloseHandle fails */
- }
+ fd = mysql_tmpfile("ib");
- DBUG_RETURN(fd);
-}
-#else
-/*********************************************************************//**
-Creates a temporary file.
-@return temporary file descriptor, or < 0 on error */
-UNIV_INTERN
-int
-innobase_mysql_tmpfile(void)
-/*========================*/
-{
- int fd2 = -1;
- File fd = mysql_tmpfile("ib");
if (fd >= 0) {
/* Copy the file descriptor, so that the additional resources
allocated by create_temp_file() can be freed by invoking
@@ -1767,7 +1696,6 @@ innobase_mysql_tmpfile(void)
}
return(fd2);
}
-#endif /* defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) */
/*********************************************************************//**
Wrapper around MySQL's copy_and_convert function.
@@ -2635,6 +2563,13 @@ ha_innobase::init_table_handle_for_HANDLER(void)
reset_template();
}
+/****************************************************************//**
+Gives the file extension of an InnoDB single-table tablespace. */
+static const char* ha_innobase_exts[] = {
+ ".ibd",
+ NullS
+};
+
/*********************************************************************//**
Opens an InnoDB database.
@return 0 on success, error code on failure */
@@ -2691,6 +2626,9 @@ innobase_init(
innobase_hton->alter_table_flags = innobase_alter_table_flags;
innobase_hton->kill_query = innobase_kill_query;
+ if (srv_file_per_table)
+ innobase_hton->tablefile_extensions = ha_innobase_exts;
+
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
#ifndef DBUG_OFF
@@ -3026,6 +2964,38 @@ innobase_change_buffering_inited_ok:
innobase_commit_concurrency_init_default();
+#ifdef HAVE_POSIX_FALLOCATE
+ srv_use_posix_fallocate = 0 && (ibool) innobase_use_fallocate;
+#endif
+ srv_use_atomic_writes = (ibool) innobase_use_atomic_writes;
+ if (innobase_use_atomic_writes) {
+ fprintf(stderr, "InnoDB: using atomic writes.\n");
+
+ /* Force doublewrite buffer off, atomic writes replace it. */
+ if (srv_use_doublewrite_buf) {
+ fprintf(stderr, "InnoDB: Switching off doublewrite buffer "
+ "because of atomic writes.\n");
+ innobase_use_doublewrite = srv_use_doublewrite_buf = FALSE;
+ }
+
+ /* Force O_DIRECT on Unixes (on Windows writes are always unbuffered)*/
+#ifndef _WIN32
+ if(!innobase_file_flush_method ||
+ !strstr(innobase_file_flush_method, "O_DIRECT")) {
+ innobase_file_flush_method =
+ srv_file_flush_method_str = (char*)"O_DIRECT";
+ fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n");
+ }
+#endif
+#ifdef HAVE_POSIX_FALLOCATE
+ /* Due to a bug in directFS, using atomics needs
+ * posix_fallocate to extend the file
+ * pwrite() past end of the file won't work
+ */
+ srv_use_posix_fallocate = TRUE;
+#endif
+ }
+
#ifdef HAVE_PSI_INTERFACE
/* Register keys with MySQL performance schema */
int count;
@@ -3924,13 +3894,6 @@ ha_innobase::table_flags() const
}
/****************************************************************//**
-Gives the file extension of an InnoDB single-table tablespace. */
-static const char* ha_innobase_exts[] = {
- ".ibd",
- NullS
-};
-
-/****************************************************************//**
Returns the table type (storage engine name).
@return table type */
UNIV_INTERN
@@ -14619,6 +14582,20 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
"Disable with --skip-innodb-doublewrite.",
NULL, NULL, TRUE);
+static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Prevent partial page writes, via atomic writes."
+ "The option is used to prevent partial writes in case of a crash/poweroff, "
+ "as faster alternative to doublewrite buffer."
+ "Currently this option works only "
+ "on Linux only with FusionIO device, and directFS filesystem.",
+ NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.",
+ NULL, NULL, TRUE);
+
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG,
"Number of IOPs the server can do. Tunes the background IO rate",
@@ -15179,11 +15156,23 @@ static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks,
"Print all deadlocks to MySQL error log (off by default)",
NULL, NULL, FALSE);
-#ifdef UNIV_DEBUG_never
+#ifdef UNIV_DEBUG
static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT,
"Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()",
NULL, NULL, 0, 0, 1024, 0);
+
+static MYSQL_SYSVAR_UINT(limit_optimistic_insert_debug,
+ btr_cur_limit_optimistic_insert_debug, PLUGIN_VAR_RQCMDARG,
+ "Artificially limit the number of records per B-tree page (0=unlimited).",
+ NULL, NULL, 0, 0, UINT_MAX32, 0);
+
+static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug,
+ srv_purge_view_update_only_debug, PLUGIN_VAR_NOCMDOPT,
+ "Pause actual purging any delete-marked records, but merely update the purge view. "
+ "It is to create artificially the situation the purge view have been updated "
+ "but the each purges were not done yet.",
+ NULL, NULL, FALSE);
#endif /* UNIV_DEBUG */
static struct st_mysql_sys_var* innobase_system_variables[]= {
@@ -15206,6 +15195,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(data_file_path),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
+ MYSQL_SYSVAR(use_atomic_writes),
+ MYSQL_SYSVAR(use_fallocate),
MYSQL_SYSVAR(fast_shutdown),
MYSQL_SYSVAR(file_io_threads),
MYSQL_SYSVAR(read_io_threads),
@@ -15299,8 +15290,10 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(undo_directory),
MYSQL_SYSVAR(undo_tablespaces),
MYSQL_SYSVAR(sync_array_size),
-#ifdef UNIV_DEBUG_never /* disable this flag. --innodb-trx becomes ambiguous */
+#ifdef UNIV_DEBUG
MYSQL_SYSVAR(trx_rseg_n_slots_debug),
+ MYSQL_SYSVAR(limit_optimistic_insert_debug),
+ MYSQL_SYSVAR(trx_purge_view_update_only_debug),
#endif /* UNIV_DEBUG */
NULL
};
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 1468bc79c04..e1a10ade9ad 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -102,8 +102,6 @@ innobase_col_to_mysql(
ut_ad(flen >= len);
ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
>= DATA_MBMINLEN(col->mbminmaxlen));
- ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
- > DATA_MBMINLEN(col->mbminmaxlen) || flen == len);
memcpy(dest, data, len);
break;
@@ -315,7 +313,7 @@ innobase_check_index_keys(
}
}
- my_error(ER_WRONG_KEY_COLUMN, MYF(0),
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB",
field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
@@ -329,7 +327,7 @@ innobase_check_index_keys(
continue;
}
- my_error(ER_WRONG_KEY_COLUMN, MYF(0),
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB",
key_part1.field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index f437575579e..80c62185fb0 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -822,6 +822,11 @@ srv_printf_innodb_monitor(). */
extern ulint btr_cur_n_sea_old;
#endif /* !UNIV_HOTBACKUP */
+#ifdef UNIV_DEBUG
+/* Flag to limit optimistic insert records */
+extern uint btr_cur_limit_optimistic_insert_debug;
+#endif /* UNIV_DEBUG */
+
#ifndef UNIV_NONINL
#include "btr0cur.ic"
#endif
diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic
index 540417e3062..080866c7465 100644
--- a/storage/innobase/include/btr0cur.ic
+++ b/storage/innobase/include/btr0cur.ic
@@ -27,6 +27,16 @@ Created 10/16/1994 Heikki Tuuri
#include "btr0btr.h"
#ifdef UNIV_DEBUG
+# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\
+if (btr_cur_limit_optimistic_insert_debug\
+ && (NREC) >= (ulint)btr_cur_limit_optimistic_insert_debug) {\
+ CODE;\
+}
+#else
+# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)
+#endif /* UNIV_DEBUG */
+
+#ifdef UNIV_DEBUG
/*********************************************************//**
Returns the page cursor component of a tree cursor.
@return pointer to page cursor component */
@@ -135,6 +145,9 @@ btr_cur_compress_recommendation(
page = btr_cur_get_page(cursor);
+ LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page) * 2,
+ return(FALSE));
+
if ((page_get_data_size(page) < BTR_CUR_PAGE_COMPRESS_LIMIT)
|| ((btr_page_get_next(page, mtr) == FIL_NULL)
&& (btr_page_get_prev(page, mtr) == FIL_NULL))) {
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 2284f21e3ab..d56f1790ae4 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -205,6 +205,15 @@ struct buf_pool_info_struct{
typedef struct buf_pool_info_struct buf_pool_info_t;
+/** The occupied bytes of lists in all buffer pools */
+struct buf_pools_list_size_struct {
+ ulint LRU_bytes; /*!< LRU size in bytes */
+ ulint unzip_LRU_bytes; /*!< unzip_LRU size in bytes */
+ ulint flush_list_bytes; /*!< flush_list size in bytes */
+};
+
+typedef struct buf_pools_list_size_struct buf_pools_list_size_t;
+
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
Acquire mutex on all buffer pool instances */
@@ -1010,8 +1019,7 @@ UNIV_INLINE
void
buf_page_set_accessed(
/*==================*/
- buf_page_t* bpage, /*!< in/out: control block */
- ulint time_ms) /*!< in: ut_time_ms() */
+ buf_page_t* bpage) /*!< in/out: control block */
__attribute__((nonnull));
/*********************************************************************//**
Gets the buf_block_t handle of a buffered file block if an uncompressed
@@ -1368,6 +1376,14 @@ buf_get_total_list_len(
ulint* free_len, /*!< out: length of all free lists */
ulint* flush_list_len);/*!< out: length of all flush lists */
/********************************************************************//**
+Get total list size in bytes from all buffer pools. */
+UNIV_INTERN
+void
+buf_get_total_list_size_in_bytes(
+/*=============================*/
+ buf_pools_list_size_t* buf_pools_list_size); /*!< out: list sizes
+ in all buffer pools */
+/********************************************************************//**
Get total buffer pool statistics. */
UNIV_INTERN
void
@@ -1547,10 +1563,11 @@ struct buf_page_struct{
to read this for heuristic
purposes without holding any
mutex or latch */
- unsigned access_time:32; /*!< time of first access, or
- 0 if the block was never accessed
- in the buffer pool */
/* @} */
+ unsigned access_time; /*!< time of first access, or
+ 0 if the block was never accessed
+ in the buffer pool. Protected by
+ block mutex */
# if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ibool file_page_was_freed;
/*!< this is set to TRUE when
@@ -1730,6 +1747,8 @@ struct buf_pool_stat_struct{
young because the first access
was not long enough ago, in
buf_page_peek_if_too_old() */
+ ulint LRU_bytes; /*!< LRU size in bytes */
+ ulint flush_list_bytes;/*!< flush_list size in bytes */
};
/** Statistics of buddy blocks of a given size. */
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 88c29ab5603..d0a6df4eb40 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -614,18 +614,18 @@ UNIV_INLINE
void
buf_page_set_accessed(
/*==================*/
- buf_page_t* bpage, /*!< in/out: control block */
- ulint time_ms) /*!< in: ut_time_ms() */
+ buf_page_t* bpage) /*!< in/out: control block */
{
#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- ut_ad(buf_pool_mutex_own(buf_pool));
+ ut_ad(!buf_pool_mutex_own(buf_pool));
+ ut_ad(mutex_own(buf_page_get_mutex(bpage)));
#endif
ut_a(buf_page_in_file(bpage));
if (!bpage->access_time) {
/* Make this the time of the first access. */
- bpage->access_time = time_ms;
+ bpage->access_time = ut_time_ms();
}
}
diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
index 527852da758..74c5525c2e5 100644
--- a/storage/innobase/include/buf0lru.h
+++ b/storage/innobase/include/buf0lru.h
@@ -157,7 +157,10 @@ buf_LRU_block_free_non_file_page(
/*=============================*/
buf_block_t* block); /*!< in: block, must not contain a file page */
/******************************************************************//**
-Adds a block to the LRU list. */
+Adds a block to the LRU list. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INTERN
void
buf_LRU_add_block(
diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic
index a5e94a8edff..d489bef89a8 100644
--- a/storage/innobase/include/data0type.ic
+++ b/storage/innobase/include/data0type.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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 the Free Software
@@ -556,35 +556,18 @@ dtype_get_fixed_size_low(
} else if (!comp) {
return(len);
} else {
- /* We play it safe here and ask MySQL for
- mbminlen and mbmaxlen. Although
- mbminlen and mbmaxlen are
- initialized if and only if prtype
- is (in one of the 3 functions in this file),
- it could be that none of these functions
- has been called. */
-
+#ifdef UNIV_DEBUG
ulint i_mbminlen, i_mbmaxlen;
innobase_get_cset_width(
dtype_get_charset_coll(prtype),
&i_mbminlen, &i_mbmaxlen);
- if (DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen)
- != mbminmaxlen) {
-
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: "
- "mbminlen=%lu, "
- "mbmaxlen=%lu, "
- "type->mbminlen=%lu, "
- "type->mbmaxlen=%lu\n",
- (ulong) i_mbminlen,
- (ulong) i_mbmaxlen,
- (ulong) DATA_MBMINLEN(mbminmaxlen),
- (ulong) DATA_MBMAXLEN(mbminmaxlen));
- }
- if (i_mbminlen == i_mbmaxlen) {
+ ut_ad(DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen)
+ == mbminmaxlen);
+#endif /* UNIV_DEBUG */
+ if (DATA_MBMINLEN(mbminmaxlen)
+ == DATA_MBMAXLEN(mbminmaxlen)) {
return(len);
}
}
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 1e2b8049860..4bd9f9fa51f 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -739,6 +739,21 @@ fil_tablespace_is_being_deleted(
/*============================*/
ulint id); /*!< in: space id */
+/****************************************************************//**
+Generate redo logs for swapping two .ibd files */
+UNIV_INTERN
+void
+fil_mtr_rename_log(
+/*===============*/
+ ulint old_space_id, /*!< in: tablespace id of the old
+ table. */
+ const char* old_name, /*!< in: old table name */
+ ulint new_space_id, /*!< in: tablespace id of the new
+ table */
+ const char* new_name, /*!< in: new table name */
+ const char* tmp_name); /*!< in: temp table name used while
+ swapping */
+
typedef struct fil_space_struct fil_space_t;
#endif /* !UNIV_INNOCHECKSUM */
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index a1ffe87d5bd..f97a11b9483 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -864,14 +864,22 @@ lock_trx_has_sys_table_locks(
remains set when the waiting lock is granted,
or if the lock is inherited to a neighboring
record */
-#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_MODE_MASK
+#define LOCK_CONV_BY_OTHER 4096 /*!< this bit is set when the lock is created
+ by other transaction */
+#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_MODE_MASK
# error
#endif
-#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_TYPE_MASK
+#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_TYPE_MASK
# error
#endif
/* @} */
+/** Checks if this is a waiting lock created by lock->trx itself.
+@param type_mode lock->type_mode
+@return whether it is a waiting lock belonging to lock->trx */
+#define lock_is_wait_not_by_other(type_mode) \
+ ((type_mode & (LOCK_CONV_BY_OTHER | LOCK_WAIT)) == LOCK_WAIT)
+
/** Lock operation struct */
typedef struct lock_op_struct lock_op_t;
/** Lock operation struct */
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index c6c70bb5f09..671f8052afa 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -362,24 +362,6 @@ rec_get_offsets_func(
rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__)
/******************************************************//**
-Determine the offset to each field in a leaf-page record
-in ROW_FORMAT=COMPACT. This is a special case of
-rec_init_offsets() and rec_get_offsets_func(). */
-UNIV_INTERN
-void
-rec_init_offsets_comp_ordinary(
-/*===========================*/
- const rec_t* rec, /*!< in: physical record in
- ROW_FORMAT=COMPACT */
- ulint extra, /*!< in: number of bytes to reserve
- between the record header and
- the data payload
- (usually REC_N_NEW_EXTRA_BYTES) */
- const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets);/*!< in/out: array of offsets;
- in: n=rec_offs_n_fields(offsets) */
-
-/******************************************************//**
The following function determines the offsets to each field
in the record. It can reuse a previously allocated array. */
UNIV_INTERN
@@ -648,8 +630,48 @@ rec_copy(
/*=====*/
void* buf, /*!< in: buffer */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ __attribute__((nonnull));
#ifndef UNIV_HOTBACKUP
+/**********************************************************//**
+Determines the size of a data tuple prefix in a temporary file.
+@return total size */
+UNIV_INTERN
+ulint
+rec_get_converted_size_temp(
+/*========================*/
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint* extra) /*!< out: extra size */
+ __attribute__((warn_unused_result, nonnull));
+
+/******************************************************//**
+Determine the offset to each field in temporary file.
+@see rec_convert_dtuple_to_temp() */
+UNIV_INTERN
+void
+rec_init_offsets_temp(
+/*==================*/
+ const rec_t* rec, /*!< in: temporary file record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ ulint* offsets)/*!< in/out: array of offsets;
+ in: n=rec_offs_n_fields(offsets) */
+ __attribute__((nonnull));
+
+/*********************************************************//**
+Builds a temporary file record out of a data tuple.
+@see rec_init_offsets_temp() */
+UNIV_INTERN
+void
+rec_convert_dtuple_to_temp(
+/*=======================*/
+ rec_t* rec, /*!< out: record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields) /*!< in: number of fields */
+ __attribute__((nonnull));
+
/**************************************************************//**
Copies the first n fields of a physical record to a new physical record in
a buffer.
@@ -684,21 +706,6 @@ rec_fold(
__attribute__((pure));
#endif /* !UNIV_HOTBACKUP */
/*********************************************************//**
-Builds a ROW_FORMAT=COMPACT record out of a data tuple. */
-UNIV_INTERN
-void
-rec_convert_dtuple_to_rec_comp(
-/*===========================*/
- rec_t* rec, /*!< in: origin of record */
- ulint extra, /*!< in: number of bytes to
- reserve between the record
- header and the data payload
- (normally REC_N_NEW_EXTRA_BYTES) */
- const dict_index_t* index, /*!< in: record descriptor */
- ulint status, /*!< in: status bits of the record */
- const dfield_t* fields, /*!< in: array of data fields */
- ulint n_fields);/*!< in: number of data fields */
-/*********************************************************//**
Builds a physical record out of a data tuple and
stores it into the given buffer.
@return pointer to the origin of physical record */
@@ -731,10 +738,7 @@ UNIV_INTERN
ulint
rec_get_converted_size_comp_prefix(
/*===============================*/
- const dict_index_t* index, /*!< in: record descriptor;
- dict_table_is_comp() is
- assumed to hold, even if
- it does not */
+ const dict_index_t* index, /*!< in: record descriptor */
const dfield_t* fields, /*!< in: array of data fields */
ulint n_fields,/*!< in: number of data fields */
ulint* extra); /*!< out: extra size */
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index c4e2f5ddf41..95c6d85075c 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -294,7 +294,7 @@ row_merge_buf_empty(
/*********************************************************************//**
Create a merge file. */
UNIV_INTERN
-void
+int
row_merge_file_create(
/*==================*/
merge_file_t* merge_file); /*!< out: merge file structure */
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index 99cff251e3c..65257baa4bb 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -252,6 +252,11 @@ extern ibool srv_use_doublewrite_buf;
extern ulong srv_doublewrite_batch_size;
extern ulong srv_checksum_algorithm;
+extern ibool srv_use_atomic_writes;
+#ifdef HAVE_POSIX_FALLOCATE
+extern ibool srv_use_posix_fallocate;
+#endif
+
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
extern ulong srv_max_purge_lag_delay;
@@ -312,6 +317,10 @@ extern ibool srv_print_latch_waits;
extern ulint srv_fatal_semaphore_wait_threshold;
extern ulint srv_dml_needed_delay;
+#ifdef UNIV_DEBUG
+extern my_bool srv_purge_view_update_only_debug;
+#endif /* UNIV_DEBUG */
+
#ifndef HAVE_ATOMIC_BUILTINS
/** Mutex protecting some server global variables. */
extern mutex_t server_mutex;
@@ -379,7 +388,7 @@ extern ulint srv_buf_pool_flushed;
reading of a disk page */
extern ulint srv_buf_pool_reads;
-/* print all user-level transactions deadlocks to mysqld stderr */
+/** print all user-level transactions deadlocks to mysqld stderr */
extern my_bool srv_print_all_deadlocks;
/** Status variables to be passed to MySQL */
@@ -727,7 +736,9 @@ struct export_var_struct{
char innodb_buffer_pool_load_status[512];/*!< Buf pool load status */
ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */
ulint innodb_buffer_pool_pages_data; /*!< Data pages */
+ ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */
ulint innodb_buffer_pool_pages_dirty; /*!< Dirty data pages */
+ ulint innodb_buffer_pool_bytes_dirty; /*!< File bytes modified */
ulint innodb_buffer_pool_pages_misc; /*!< Miscellanous pages */
ulint innodb_buffer_pool_pages_free; /*!< Free pages */
#ifdef UNIV_DEBUG
@@ -771,6 +782,11 @@ struct export_var_struct{
ulint innodb_num_open_files; /*!< fil_n_file_opened */
ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
ulint innodb_available_undo_logs; /*!< srv_available_undo_logs */
+#ifdef UNIV_DEBUG
+ ulint innodb_purge_trx_id_age; /*!< max_trx_id - purged trx_id */
+ ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id
+ - purged view's min trx_id */
+#endif /* UNIV_DEBUG */
};
/** Thread slot in the thread table. */
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 60eb1fede91..422828e76f4 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -42,6 +42,8 @@ Created 1/20/1994 Heikki Tuuri
#define _IB_TO_STR(s) #s
#define IB_TO_STR(s) _IB_TO_STR(s)
+#include <mysql_version.h>
+
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 2
#define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH
@@ -55,10 +57,7 @@ component, i.e. we show M.N.P as M.N */
#define INNODB_VERSION_SHORT \
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
-#define INNODB_VERSION_STR \
- IB_TO_STR(INNODB_VERSION_MAJOR) "." \
- IB_TO_STR(INNODB_VERSION_MINOR) "." \
- IB_TO_STR(INNODB_VERSION_BUGFIX)
+#define INNODB_VERSION_STR MYSQL_SERVER_VERSION
#define REFMAN "http://dev.mysql.com/doc/refman/" \
IB_TO_STR(MYSQL_VERSION_MAJOR) "." \
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 476b305ca70..fff59852704 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -858,13 +858,17 @@ lock_reset_lock_and_trx_wait(
/*=========================*/
lock_t* lock) /*!< in/out: record lock */
{
- ut_ad(lock->trx->lock.wait_lock == lock);
ut_ad(lock_get_wait(lock));
ut_ad(lock_mutex_own());
/* Reset the back pointer in trx to this waiting lock request */
- lock->trx->lock.wait_lock = NULL;
+ if (!(lock->type_mode & LOCK_CONV_BY_OTHER)) {
+ ut_ad(lock->trx->lock.wait_lock == lock);
+ lock->trx->lock.wait_lock = NULL;
+ } else {
+ ut_ad(lock_get_type_low(lock) == LOCK_REC);
+ }
lock->type_mode &= ~LOCK_WAIT;
}
@@ -1476,7 +1480,7 @@ Checks if a transaction has a GRANTED explicit lock on rec stronger or equal
to precise_mode.
@return lock or NULL */
UNIV_INLINE
-const lock_t*
+lock_t*
lock_rec_has_expl(
/*==============*/
ulint precise_mode,/*!< in: LOCK_S or LOCK_X
@@ -1489,7 +1493,7 @@ lock_rec_has_expl(
ulint heap_no,/*!< in: heap number of the record */
const trx_t* trx) /*!< in: transaction */
{
- const lock_t* lock;
+ lock_t* lock;
ut_ad(lock_mutex_own());
ut_ad((precise_mode & LOCK_MODE_MASK) == LOCK_S
@@ -1498,14 +1502,14 @@ lock_rec_has_expl(
for (lock = lock_rec_get_first(block, heap_no);
lock != NULL;
- lock = lock_rec_get_next_const(heap_no, lock)) {
+ lock = lock_rec_get_next(heap_no, lock)) {
if (lock->trx == trx
+ && !lock_is_wait_not_by_other(lock->type_mode)
&& lock_mode_stronger_or_eq(
lock_get_mode(lock),
static_cast<enum lock_mode>(
precise_mode & LOCK_MODE_MASK))
- && !lock_get_wait(lock)
&& (!lock_rec_get_rec_not_gap(lock)
|| (precise_mode & LOCK_REC_NOT_GAP)
|| heap_no == PAGE_HEAP_NO_SUPREMUM)
@@ -1813,7 +1817,7 @@ lock_rec_create(
}
ut_ad(trx_mutex_own(trx));
- if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) {
+ if (lock_is_wait_not_by_other(type_mode)) {
lock_set_lock_and_trx_wait(lock, trx);
}
@@ -1853,11 +1857,12 @@ lock_rec_enqueue_waiting(
const buf_block_t* block, /*!< in: buffer block containing
the record */
ulint heap_no,/*!< in: heap number of the record */
+ lock_t* lock, /*!< in: lock object; NULL if a new
+ one should be created. */
dict_index_t* index, /*!< in: index of record */
que_thr_t* thr) /*!< in: query thread */
{
trx_t* trx;
- lock_t* lock;
trx_id_t victim_trx_id;
ut_ad(lock_mutex_own());
@@ -1893,10 +1898,20 @@ lock_rec_enqueue_waiting(
ut_ad(0);
}
- /* Enqueue the lock request that will wait to be granted, note that
- we already own the trx mutex. */
- lock = lock_rec_create(
- type_mode | LOCK_WAIT, block, heap_no, index, trx, TRUE);
+ if (lock == NULL) {
+ /* Enqueue the lock request that will wait
+ to be granted, note that we already own
+ the trx mutex. */
+ lock = lock_rec_create(
+ type_mode | LOCK_WAIT, block, heap_no,
+ index, trx, TRUE);
+ } else {
+ ut_ad(lock->type_mode & LOCK_WAIT);
+ ut_ad(lock->type_mode & LOCK_CONV_BY_OTHER);
+
+ lock->type_mode &= ~LOCK_CONV_BY_OTHER;
+ lock_set_lock_and_trx_wait(lock, trx);
+ }
/* Release the mutex to obey the latching order.
This is safe, because lock_deadlock_check_and_resolve()
@@ -2163,6 +2178,7 @@ lock_rec_lock_slow(
que_thr_t* thr) /*!< in: query thread */
{
trx_t* trx;
+ lock_t* lock;
enum db_err err = DB_SUCCESS;
ut_ad(lock_mutex_own());
@@ -2180,7 +2196,27 @@ lock_rec_lock_slow(
trx_mutex_enter(trx);
- if (lock_rec_has_expl(mode, block, heap_no, trx)) {
+ lock = lock_rec_has_expl(mode, block, heap_no, trx);
+ if (lock) {
+ if (lock->type_mode & LOCK_CONV_BY_OTHER) {
+ /* This lock or lock waiting was created by the other
+ transaction, not by the transaction (trx) itself.
+ So, the transaction (trx) should treat it collectly
+ according as whether granted or not. */
+
+ if (lock->type_mode & LOCK_WAIT) {
+ /* This lock request was not granted yet.
+ Should wait for granted. */
+
+ goto enqueue_waiting;
+ } else {
+ /* This lock request was already granted.
+ Just clearing the flag. */
+
+ lock->type_mode &= ~LOCK_CONV_BY_OTHER;
+ }
+ }
+
/* The trx already has a strong enough lock on rec: do
nothing */
@@ -2193,8 +2229,10 @@ lock_rec_lock_slow(
have a lock strong enough already granted on the
record, we have to wait. */
+ ut_ad(lock == NULL);
+enqueue_waiting:
err = lock_rec_enqueue_waiting(
- mode, block, heap_no, index, thr);
+ mode, block, heap_no, lock, index, thr);
} else if (!impl) {
/* Set the requested lock on the record, note that
@@ -2348,7 +2386,8 @@ lock_grant(
TRX_QUE_LOCK_WAIT state, and there is no need to end the lock wait
for it */
- if (lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
+ if (!(lock->type_mode & LOCK_CONV_BY_OTHER)
+ && lock->trx->lock.que_state == TRX_QUE_LOCK_WAIT) {
que_thr_t* thr;
thr = que_thr_end_lock_wait(lock->trx);
@@ -2375,6 +2414,7 @@ lock_rec_cancel(
ut_ad(lock_mutex_own());
ut_ad(lock_get_type_low(lock) == LOCK_REC);
+ ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER));
/* Reset the bit (there can be only one set bit) in the lock bitmap */
lock_rec_reset_nth_bit(lock, lock_rec_find_set_bit(lock));
@@ -2541,8 +2581,12 @@ lock_rec_reset_and_release_wait(
lock != NULL;
lock = lock_rec_get_next(heap_no, lock)) {
- if (lock_get_wait(lock)) {
+ if (lock_is_wait_not_by_other(lock->type_mode)) {
lock_rec_cancel(lock);
+ } else if (lock_get_wait(lock)) {
+ /* just reset LOCK_WAIT */
+ lock_rec_reset_nth_bit(lock, heap_no);
+ lock_reset_lock_and_trx_wait(lock);
} else {
lock_rec_reset_nth_bit(lock, heap_no);
}
@@ -4017,6 +4061,7 @@ lock_table_create(
ut_ad(table && trx);
ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(trx));
+ ut_ad(!(type_mode & LOCK_CONV_BY_OTHER));
/* Non-locking autocommit read-only transactions should not set
any locks. */
@@ -5850,7 +5895,7 @@ lock_rec_insert_check_and_lock(
err = lock_rec_enqueue_waiting(
LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION,
- block, next_rec_heap_no, index, thr);
+ block, next_rec_heap_no, NULL, index, thr);
trx_mutex_exit(trx);
} else {
@@ -5943,10 +5988,25 @@ lock_rec_convert_impl_to_expl(
if (impl_trx != NULL
&& !lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, block,
heap_no, impl_trx)) {
+ ulint type_mode = (LOCK_REC | LOCK_X
+ | LOCK_REC_NOT_GAP);
+
+ /* If the delete-marked record was locked already,
+ we should reserve lock waiting for impl_trx as
+ implicit lock. Because cannot lock at this moment.*/
+
+ if (rec_get_deleted_flag(rec, rec_offs_comp(offsets))
+ && lock_rec_other_has_conflicting(
+ static_cast<enum lock_mode>
+ (LOCK_X | LOCK_REC_NOT_GAP), block,
+ heap_no, impl_trx)) {
+
+ type_mode |= (LOCK_WAIT | LOCK_CONV_BY_OTHER);
+ }
lock_rec_add_to_queue(
- LOCK_REC | LOCK_X | LOCK_REC_NOT_GAP,
- block, heap_no, index, impl_trx, FALSE);
+ type_mode, block, heap_no, index,
+ impl_trx, FALSE);
}
lock_mutex_exit();
@@ -6581,6 +6641,7 @@ lock_cancel_waiting_and_release(
ut_ad(lock_mutex_own());
ut_ad(trx_mutex_own(lock->trx));
+ ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER));
lock->trx->lock.cancel = TRUE;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index f914fc2676c..c2b9c152a44 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -958,8 +958,11 @@ recv_parse_or_apply_log_rec_body(
not NULL, then the log record is
applied to the page, and the log
record should be complete then */
- mtr_t* mtr) /*!< in: mtr or NULL; should be non-NULL
+ mtr_t* mtr, /*!< in: mtr or NULL; should be non-NULL
if and only if block is non-NULL */
+ ulint space_id)
+ /*!< in: tablespace id obtained by
+ parsing initial log record */
{
dict_index_t* index = NULL;
page_t* page;
@@ -1231,8 +1234,11 @@ recv_parse_or_apply_log_rec_body(
ut_ad(!page || page_type != FIL_PAGE_TYPE_ALLOCATED);
ptr = mlog_parse_string(ptr, end_ptr, page, page_zip);
break;
- case MLOG_FILE_CREATE:
case MLOG_FILE_RENAME:
+ ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type,
+ space_id, 0);
+ break;
+ case MLOG_FILE_CREATE:
case MLOG_FILE_DELETE:
case MLOG_FILE_CREATE2:
ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, 0, 0);
@@ -1611,7 +1617,8 @@ recv_recover_page_func(
recv_parse_or_apply_log_rec_body(recv->type, buf,
buf + recv->len,
- block, &mtr);
+ block, &mtr,
+ recv_addr->space);
end_lsn = recv->start_lsn + recv->len;
mach_write_to_8(FIL_PAGE_LSN + page, end_lsn);
@@ -2079,7 +2086,7 @@ recv_parse_log_rec(
#endif /* UNIV_LOG_LSN_DEBUG */
new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
- NULL, NULL);
+ NULL, NULL, *space);
if (UNIV_UNLIKELY(new_ptr == NULL)) {
return(0);
diff --git a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff
index c24594c5024..00cda7c4435 100644
--- a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff
@@ -8,7 +8,7 @@
-SELECT LAST_INSERT_ID();
-LAST_INSERT_ID()
-1
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-a 1
-a 2
diff --git a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff
index 62895fa928f..9e6cddf03f0 100644
--- a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff
@@ -1,5 +1,5 @@
---- suite/storage_engine/insert_delayed.result 2012-07-12 20:04:07.143544998 +0400
-+++ suite/storage_engine/insert_delayed.reject 2012-07-15 17:49:34.551810189 +0400
+--- suite/storage_engine/insert_delayed.result 2013-01-23 01:23:49.461254916 +0400
++++ suite/storage_engine/insert_delayed.reject 2013-01-23 01:47:05.975698364 +0400
@@ -5,7 +5,16 @@
connect con0,localhost,root,,;
SET lock_wait_timeout = 1;
@@ -14,7 +14,7 @@
+# -------------------------------------------
INSERT DELAYED INTO t1 SET a=4, b='d';
+ERROR HY000: DELAYED option not supported for table 't1'
- INSERT DELAYED INTO t1 SELECT 5, 'e';
+ INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e';
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con0;
@@ -20,6 +29,4 @@
diff --git a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff
index aab866fde83..7ddc57e0ead 100644
--- a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff
@@ -1,12 +1,12 @@
---- suite/storage_engine/parts/repair_table.result 2012-07-15 01:22:58.861853325 +0400
-+++ suite/storage_engine/parts/repair_table.reject 2012-07-15 20:07:11.268009209 +0400
+--- suite/storage_engine/parts/repair_table.result 2013-01-23 01:35:44.388267080 +0400
++++ suite/storage_engine/parts/repair_table.reject 2013-01-23 01:44:40.337529283 +0400
@@ -9,27 +9,27 @@
INSERT INTO t2 (a,b) SELECT a, b FROM t1;
ALTER TABLE t1 REPAIR PARTITION p0;
Table Op Msg_type Msg_text
-test.t1 repair status OK
+test.t1 repair note The storage engine for the table doesn't support repair
- INSERT INTO t1 VALUES (3,'c');
+ INSERT INTO t1 (a,b) VALUES (3,'c');
ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
Table Op Msg_type Msg_text
-test.t1 repair status OK
@@ -21,7 +21,7 @@
Table Op Msg_type Msg_text
-test.t1 repair status OK
+test.t1 repair note The storage engine for the table doesn't support repair
- INSERT INTO t1 VALUES (10,'j');
+ INSERT INTO t1 (a,b) VALUES (10,'j');
ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM;
Table Op Msg_type Msg_text
-test.t1 repair status OK
@@ -112,7 +112,7 @@
-test.t1 check error Size of datafile is: 26 Should be: 39
-test.t1 check error Partition p0 returned error
-test.t1 check error Corrupt
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-8 h
-10 j
@@ -136,7 +136,7 @@
-test.t1 check warning Found 3 key parts. Should be: 2
-test.t1 check error Partition p0 returned error
-test.t1 check error Corrupt
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-8 h
-10 j
@@ -160,7 +160,7 @@
-test.t1 check error Size of datafile is: 39 Should be: 52
-test.t1 check error Partition p1 returned error
-test.t1 check error Corrupt
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-8 h
-10 j
@@ -187,7 +187,7 @@
-test.t1 check warning Found 4 key parts. Should be: 3
-test.t1 check error Partition p1 returned error
-test.t1 check error Corrupt
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-8 h
-10 j
diff --git a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff
index 9c51fea47ff..ae5b863eae1 100644
--- a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff
@@ -57,7 +57,7 @@
-test.t1 check Error Incorrect file format 't1'
-test.t1 check error Corrupt
+test.t1 check status OK
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
-ERROR HY000: Incorrect file format 't1'
+a b
+1 a
@@ -107,7 +107,7 @@
-Table Op Msg_type Msg_text
-test.t1 check error Size of datafile is: 39 Should be: 65
-test.t1 check error Corrupt
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-ERROR HY000: Incorrect key file for table 't1'; try to repair it
-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-# If you got a difference in error message, just add it to rdiff file
@@ -122,7 +122,7 @@
-test.t1 check warning Table is marked as crashed and last repair failed
-test.t1 check error Size of datafile is: 39 Should be: 65
-test.t1 check error Corrupt
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-# If you got a difference in error message, just add it to rdiff file
diff --git a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff
index 7fce0a108e9..53241fe331e 100644
--- a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff
@@ -2,19 +2,19 @@
+++ suite/storage_engine/type_char_indexes.reject 2012-07-15 17:51:55.810034331 +0400
@@ -98,7 +98,7 @@
SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
- EXPLAIN SELECT * FROM t1 WHERE c > 'a';
+ EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
id select_type table type possible_keys key key_len ref rows Extra
-# # # range c_v c_v # # # Using index condition
+# # # range c_v c_v # # # Using where
- SELECT * FROM t1 WHERE c > 'a';
+ SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
c c20 v16 v128
b char3 varchar1a varchar1b
@@ -135,7 +135,7 @@
r3a
- EXPLAIN SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
id select_type table type possible_keys key key_len ref rows Extra
-# # # range # v16 # # # #
+# # # ALL # NULL # # # #
- SELECT * FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
c c20 v16 v128
a char1 varchar1a varchar1b
diff --git a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
index 9a9566deafb..9061900182e 100644
--- a/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -1,5 +1,5 @@
---- suite/storage_engine/type_spatial_indexes.result 2012-07-12 04:52:40.840023344 +0400
-+++ suite/storage_engine/type_spatial_indexes.reject 2012-07-15 19:27:32.761911079 +0400
+--- suite/storage_engine/type_spatial_indexes.result 2013-01-23 01:25:45.367797786 +0400
++++ suite/storage_engine/type_spatial_indexes.reject 2013-01-23 01:46:17.560307029 +0400
@@ -702,699 +702,15 @@
DROP DATABASE IF EXISTS gis_ogs;
CREATE DATABASE gis_ogs;
@@ -79,43 +79,43 @@
-Field Type Null Key Default Extra
-fid int(11) YES NULL
-g geometry NO NULL
--INSERT INTO gis_point VALUES
+-INSERT INTO gis_point (fid,g) VALUES
-(101, PointFromText('POINT(10 10)')),
-(102, PointFromText('POINT(20 10)')),
-(103, PointFromText('POINT(20 20)')),
-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
--INSERT INTO gis_line VALUES
+-INSERT INTO gis_line (fid,g) VALUES
-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
--INSERT INTO gis_polygon VALUES
+-INSERT INTO gis_polygon (fid,g) VALUES
-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
--INSERT INTO gis_multi_point VALUES
+-INSERT INTO gis_multi_point (fid,g) VALUES
-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
--INSERT INTO gis_multi_line VALUES
+-INSERT INTO gis_multi_line (fid,g) VALUES
-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
--INSERT INTO gis_multi_polygon VALUES
+-INSERT INTO gis_multi_polygon (fid,g) VALUES
-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
--INSERT INTO gis_geometrycollection VALUES
+-INSERT INTO gis_geometrycollection (fid,g) VALUES
-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
-(122, GeomFromText('GeometryCollection()')),
-(123, GeomFromText('GeometryCollection EMPTY'));
--INSERT into gis_geometry SELECT * FROM gis_point;
--INSERT into gis_geometry SELECT * FROM gis_line;
--INSERT into gis_geometry SELECT * FROM gis_polygon;
--INSERT into gis_geometry SELECT * FROM gis_multi_point;
--INSERT into gis_geometry SELECT * FROM gis_multi_line;
--INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
--INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
-SELECT fid, AsText(g) FROM gis_point;
-fid AsText(g)
-101 POINT(10 10)
@@ -433,7 +433,7 @@
-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-USE gis_ogs;
-# Lakes
--INSERT INTO lakes VALUES (
+-INSERT INTO lakes (fid,name,shore) VALUES (
-101, 'BLUE LAKE',
-PolyFromText(
-'POLYGON(
@@ -442,68 +442,68 @@
- )',
-101));
-# Road Segments
--INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
-LineFromText(
-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
--INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
-LineFromText(
-'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
--INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
-LineFromText(
-'LINESTRING( 70 38, 72 48 )' ,101));
--INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
-LineFromText(
-'LINESTRING( 70 38, 84 42 )' ,101));
--INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
-1,
-LineFromText(
-'LINESTRING( 28 26, 28 0 )',101));
-# DividedRoutes
--INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
+-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
-MLineFromText(
-'MULTILINESTRING((10 48,10 21,10 0),
- (16 0,16 23,16 48))', 101));
-# Forests
--INSERT INTO forests VALUES(109, 'Green Forest',
+-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
-MPolyFromText(
-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
-101));
-# Bridges
--INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
+-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
-'POINT( 44 31 )', 101));
-# Streams
--INSERT INTO streams VALUES(111, 'Cam Stream',
+-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
-LineFromText(
-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
--INSERT INTO streams VALUES(112, NULL,
+-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
-LineFromText(
-'LINESTRING( 76 0, 78 4, 73 9 )', 101));
-# Buildings
--INSERT INTO buildings VALUES(113, '123 Main Street',
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
-PointFromText(
-'POINT( 52 30 )', 101),
-PolyFromText(
-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
--INSERT INTO buildings VALUES(114, '215 Main Street',
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
-PointFromText(
-'POINT( 64 33 )', 101),
-PolyFromText(
-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
-# Ponds
--INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
+-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
-MPolyFromText(
-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
-# Named Places
--INSERT INTO named_places VALUES(117, 'Ashton',
+-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
-PolyFromText(
-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
--INSERT INTO named_places VALUES(118, 'Goose Island',
+-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
-PolyFromText(
-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
-# Map Neatlines
--INSERT INTO map_neatlines VALUES(115,
+-INSERT INTO map_neatlines (fid,neatline) VALUES(115,
-PolyFromText(
-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
-SELECT Dimension(shore)
diff --git a/storage/innobase/mysql-test/storage_engine/vcol.rdiff b/storage/innobase/mysql-test/storage_engine/vcol.rdiff
index 2226062834e..23b26a52228 100644
--- a/storage/innobase/mysql-test/storage_engine/vcol.rdiff
+++ b/storage/innobase/mysql-test/storage_engine/vcol.rdiff
@@ -12,7 +12,7 @@
-Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-1 2
-2 3
@@ -29,7 +29,7 @@
-Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-1 2
-2 3
@@ -46,7 +46,7 @@
-Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-1 2
-2 3
@@ -63,7 +63,7 @@
-Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
--SELECT * FROM t1;
+-SELECT a,b FROM t1;
-a b
-1 2
-2 3
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 62cde1cf728..57ff14b9f95 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1402,6 +1402,43 @@ os_file_set_nocache(
#endif
}
+
+#ifdef __linux__
+#include <sys/ioctl.h>
+#ifndef DFS_IOCTL_ATOMIC_WRITE_SET
+#define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint)
+#endif
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ static int first_time = 1;
+ int atomic_option = 1;
+
+ int ret = ioctl (file, DFS_IOCTL_ATOMIC_WRITE_SET, &atomic_option);
+
+ if (ret) {
+ fprintf(stderr,
+ "InnoDB : can't use atomic write on %s, errno %d\n",
+ name, errno);
+ return ret;
+ }
+ return ret;
+}
+#else
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ fprintf(stderr,
+ "InnoDB : can't use atomic writes on %s - not implemented on this platform."
+ "innodb_use_atomic_writes needs to be 0.\n",
+ name);
+#ifdef _WIN32
+ SetLastError(ERROR_INVALID_FUNCTION);
+#else
+ errno = EINVAL;
+#endif
+ return -1;
+}
+#endif
+
/****************************************************************//**
NOTE! Use the corresponding macro os_file_create(), not directly
this function!
@@ -1552,6 +1589,13 @@ try_again:
*success = TRUE;
}
+ if (srv_use_atomic_writes && type == OS_DATA_FILE &&
+ os_file_set_atomic_writes(file, name)) {
+ CloseHandle(file);
+ *success = FALSE;
+ file = INVALID_HANDLE_VALUE;
+ }
+
return(file);
#else /* __WIN__ */
os_file_t file;
@@ -1668,6 +1712,12 @@ try_again:
file = -1;
}
#endif /* USE_FILE_LOCK */
+ if (srv_use_atomic_writes && type == OS_DATA_FILE
+ && os_file_set_atomic_writes(file, name)) {
+ close(file);
+ *success = FALSE;
+ file = -1;
+ }
return(file);
#endif /* __WIN__ */
@@ -1965,6 +2015,28 @@ os_file_set_size(
current_size = 0;
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ if (posix_fallocate(file, current_size, size) == -1) {
+ fprintf(stderr,
+ "InnoDB: Error: preallocating data for"
+ " file %s failed at\n"
+ "InnoDB: offset 0 size %lld. Operating system"
+ " error number %d.\n"
+ "InnoDB: Check that the disk is not full"
+ " or a disk quota exceeded.\n"
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ REFMAN "operating-system-error-codes.html\n",
+ name, (longlong)size, errno);
+
+ return (FALSE);
+ }
+ return (TRUE);
+ }
+#endif
+
/* Write up to 1 megabyte at a time. */
buf_size = ut_min(64, (ulint) (size / UNIV_PAGE_SIZE))
* UNIV_PAGE_SIZE;
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index 5a864f122a3..d56eb59e0bb 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -168,7 +168,6 @@ rec_get_n_extern_new(
{
const byte* nulls;
const byte* lens;
- dict_field_t* field;
ulint null_mask;
ulint n_extern;
ulint i;
@@ -189,10 +188,13 @@ rec_get_n_extern_new(
/* read the lengths of fields 0..n */
do {
- ulint len;
+ const dict_field_t* field
+ = dict_index_get_nth_field(index, i);
+ const dict_col_t* col
+ = dict_field_get_col(field);
+ ulint len;
- field = dict_index_get_nth_field(index, i);
- if (!(dict_field_get_col(field)->prtype & DATA_NOT_NULL)) {
+ if (!(col->prtype & DATA_NOT_NULL)) {
/* nullable field => read the null flag */
if (UNIV_UNLIKELY(!(byte) null_mask)) {
@@ -210,8 +212,6 @@ rec_get_n_extern_new(
if (UNIV_UNLIKELY(!field->fixed_len)) {
/* Variable-length field: read the length */
- const dict_col_t* col
- = dict_field_get_col(field);
len = *lens--;
/* If the maximum length of the field is up
to 255 bytes, the actual length is always
@@ -240,16 +240,15 @@ rec_get_n_extern_new(
Determine the offset to each field in a leaf-page record
in ROW_FORMAT=COMPACT. This is a special case of
rec_init_offsets() and rec_get_offsets_func(). */
-UNIV_INTERN
+UNIV_INLINE __attribute__((nonnull))
void
rec_init_offsets_comp_ordinary(
/*===========================*/
const rec_t* rec, /*!< in: physical record in
ROW_FORMAT=COMPACT */
- ulint extra, /*!< in: number of bytes to reserve
- between the record header and
- the data payload
- (usually REC_N_NEW_EXTRA_BYTES) */
+ ibool temp, /*!< in: whether to use the
+ format for temporary files in
+ index creation */
const dict_index_t* index, /*!< in: record descriptor */
ulint* offsets)/*!< in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
@@ -257,27 +256,38 @@ rec_init_offsets_comp_ordinary(
ulint i = 0;
ulint offs = 0;
ulint any_ext = 0;
- const byte* nulls = rec - (extra + 1);
+ const byte* nulls = temp
+ ? rec - 1
+ : rec - (1 + REC_N_NEW_EXTRA_BYTES);
const byte* lens = nulls
- UT_BITS_IN_BYTES(index->n_nullable);
- dict_field_t* field;
ulint null_mask = 1;
#ifdef UNIV_DEBUG
- /* We cannot invoke rec_offs_make_valid() here, because it can hold
- that extra != REC_N_NEW_EXTRA_BYTES. Similarly, rec_offs_validate()
- will fail in that case, because it invokes rec_get_status(). */
+ /* We cannot invoke rec_offs_make_valid() here if temp=TRUE.
+ Similarly, rec_offs_validate() will fail in that case, because
+ it invokes rec_get_status(). */
offsets[2] = (ulint) rec;
offsets[3] = (ulint) index;
#endif /* UNIV_DEBUG */
+ ut_ad(temp || dict_table_is_comp(index->table));
+
+ if (temp && dict_table_is_comp(index->table)) {
+ /* No need to do adjust fixed_len=0. We only need to
+ adjust it for ROW_FORMAT=REDUNDANT. */
+ temp = FALSE;
+ }
+
/* read the lengths of fields 0..n */
do {
- ulint len;
+ const dict_field_t* field
+ = dict_index_get_nth_field(index, i);
+ const dict_col_t* col
+ = dict_field_get_col(field);
+ ulint len;
- field = dict_index_get_nth_field(index, i);
- if (!(dict_field_get_col(field)->prtype
- & DATA_NOT_NULL)) {
+ if (!(col->prtype & DATA_NOT_NULL)) {
/* nullable field => read the null flag */
if (UNIV_UNLIKELY(!(byte) null_mask)) {
@@ -297,10 +307,9 @@ rec_init_offsets_comp_ordinary(
null_mask <<= 1;
}
- if (UNIV_UNLIKELY(!field->fixed_len)) {
+ if (!field->fixed_len
+ || (temp && !dict_col_get_fixed_size(col, temp))) {
/* Variable-length field: read the length */
- const dict_col_t* col
- = dict_field_get_col(field);
len = *lens--;
/* If the maximum length of the field is up
to 255 bytes, the actual length is always
@@ -394,9 +403,8 @@ rec_init_offsets(
= dict_index_get_n_unique_in_tree(index);
break;
case REC_STATUS_ORDINARY:
- rec_init_offsets_comp_ordinary(rec,
- REC_N_NEW_EXTRA_BYTES,
- index, offsets);
+ rec_init_offsets_comp_ordinary(
+ rec, FALSE, index, offsets);
return;
}
@@ -774,17 +782,19 @@ rec_get_nth_field_offs_old(
/**********************************************************//**
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
@return total size */
-UNIV_INTERN
+UNIV_INLINE __attribute__((warn_unused_result, nonnull(1,2)))
ulint
-rec_get_converted_size_comp_prefix(
-/*===============================*/
+rec_get_converted_size_comp_prefix_low(
+/*===================================*/
const dict_index_t* index, /*!< in: record descriptor;
dict_table_is_comp() is
assumed to hold, even if
it does not */
const dfield_t* fields, /*!< in: array of data fields */
ulint n_fields,/*!< in: number of data fields */
- ulint* extra) /*!< out: extra size */
+ ulint* extra, /*!< out: extra size */
+ ibool temp) /*!< in: whether this is a
+ temporary file record */
{
ulint extra_size;
ulint data_size;
@@ -793,15 +803,25 @@ rec_get_converted_size_comp_prefix(
ut_ad(fields);
ut_ad(n_fields > 0);
ut_ad(n_fields <= dict_index_get_n_fields(index));
+ ut_ad(!temp || extra);
- extra_size = REC_N_NEW_EXTRA_BYTES
+ extra_size = temp
+ ? UT_BITS_IN_BYTES(index->n_nullable)
+ : REC_N_NEW_EXTRA_BYTES
+ UT_BITS_IN_BYTES(index->n_nullable);
data_size = 0;
+ if (temp && dict_table_is_comp(index->table)) {
+ /* No need to do adjust fixed_len=0. We only need to
+ adjust it for ROW_FORMAT=REDUNDANT. */
+ temp = FALSE;
+ }
+
/* read the lengths of fields 0..n */
for (i = 0; i < n_fields; i++) {
const dict_field_t* field;
ulint len;
+ ulint fixed_len;
const dict_col_t* col;
field = dict_index_get_nth_field(index, i);
@@ -820,6 +840,11 @@ rec_get_converted_size_comp_prefix(
ut_ad(len <= col->len || col->mtype == DATA_BLOB
|| (col->len == 0 && col->mtype == DATA_VARCHAR));
+ fixed_len = field->fixed_len;
+ if (temp && fixed_len
+ && !dict_col_get_fixed_size(col, temp)) {
+ fixed_len = 0;
+ }
/* If the maximum length of a variable-length field
is up to 255 bytes, the actual length is always stored
in one byte. If the maximum length is more than 255
@@ -827,11 +852,20 @@ rec_get_converted_size_comp_prefix(
0..127. The length will be encoded in two bytes when
it is 128 or more, or when the field is stored externally. */
- if (field->fixed_len) {
- ut_ad(len == field->fixed_len);
+ if (fixed_len) {
+#ifdef UNIV_DEBUG
+ ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen);
+
+ ut_ad(len <= fixed_len);
+
+ ut_ad(!mbmaxlen || len >= mbminlen
+ * (fixed_len / mbmaxlen));
+
/* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len
- || field->fixed_len == field->prefix_len);
+ || fixed_len == field->prefix_len);
+#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(&fields[i])) {
ut_ad(col->len >= 256 || col->mtype == DATA_BLOB);
extra_size += 2;
@@ -848,7 +882,7 @@ rec_get_converted_size_comp_prefix(
data_size += len;
}
- if (UNIV_LIKELY_NULL(extra)) {
+ if (extra) {
*extra = extra_size;
}
@@ -856,6 +890,23 @@ rec_get_converted_size_comp_prefix(
}
/**********************************************************//**
+Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
+@return total size */
+UNIV_INTERN
+ulint
+rec_get_converted_size_comp_prefix(
+/*===============================*/
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint* extra) /*!< out: extra size */
+{
+ ut_ad(dict_table_is_comp(index->table));
+ return(rec_get_converted_size_comp_prefix_low(
+ index, fields, n_fields, extra, FALSE));
+}
+
+/**********************************************************//**
Determines the size of a data tuple in ROW_FORMAT=COMPACT.
@return total size */
UNIV_INTERN
@@ -899,8 +950,8 @@ rec_get_converted_size_comp(
return(ULINT_UNDEFINED);
}
- return(size + rec_get_converted_size_comp_prefix(index, fields,
- n_fields, extra));
+ return(size + rec_get_converted_size_comp_prefix_low(
+ index, fields, n_fields, extra, FALSE));
}
/***********************************************************//**
@@ -1077,19 +1128,18 @@ rec_convert_dtuple_to_rec_old(
/*********************************************************//**
Builds a ROW_FORMAT=COMPACT record out of a data tuple. */
-UNIV_INTERN
+UNIV_INLINE __attribute__((nonnull))
void
rec_convert_dtuple_to_rec_comp(
/*===========================*/
rec_t* rec, /*!< in: origin of record */
- ulint extra, /*!< in: number of bytes to
- reserve between the record
- header and the data payload
- (normally REC_N_NEW_EXTRA_BYTES) */
const dict_index_t* index, /*!< in: record descriptor */
- ulint status, /*!< in: status bits of the record */
const dfield_t* fields, /*!< in: array of data fields */
- ulint n_fields)/*!< in: number of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint status, /*!< in: status bits of the record */
+ ibool temp) /*!< in: whether to use the
+ format for temporary files in
+ index creation */
{
const dfield_t* field;
const dtype_t* type;
@@ -1101,31 +1151,44 @@ rec_convert_dtuple_to_rec_comp(
ulint n_node_ptr_field;
ulint fixed_len;
ulint null_mask = 1;
- ut_ad(extra == 0 || dict_table_is_comp(index->table));
- ut_ad(extra == 0 || extra == REC_N_NEW_EXTRA_BYTES);
+ ut_ad(temp || dict_table_is_comp(index->table));
ut_ad(n_fields > 0);
- switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
- case REC_STATUS_ORDINARY:
+ if (temp) {
+ ut_ad(status == REC_STATUS_ORDINARY);
ut_ad(n_fields <= dict_index_get_n_fields(index));
n_node_ptr_field = ULINT_UNDEFINED;
- break;
- case REC_STATUS_NODE_PTR:
- ut_ad(n_fields == dict_index_get_n_unique_in_tree(index) + 1);
- n_node_ptr_field = n_fields - 1;
- break;
- case REC_STATUS_INFIMUM:
- case REC_STATUS_SUPREMUM:
- ut_ad(n_fields == 1);
- n_node_ptr_field = ULINT_UNDEFINED;
- break;
- default:
- ut_error;
- return;
+ nulls = rec - 1;
+ if (dict_table_is_comp(index->table)) {
+ /* No need to do adjust fixed_len=0. We only
+ need to adjust it for ROW_FORMAT=REDUNDANT. */
+ temp = FALSE;
+ }
+ } else {
+ nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
+
+ switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
+ case REC_STATUS_ORDINARY:
+ ut_ad(n_fields <= dict_index_get_n_fields(index));
+ n_node_ptr_field = ULINT_UNDEFINED;
+ break;
+ case REC_STATUS_NODE_PTR:
+ ut_ad(n_fields
+ == dict_index_get_n_unique_in_tree(index) + 1);
+ n_node_ptr_field = n_fields - 1;
+ break;
+ case REC_STATUS_INFIMUM:
+ case REC_STATUS_SUPREMUM:
+ ut_ad(n_fields == 1);
+ n_node_ptr_field = ULINT_UNDEFINED;
+ break;
+ default:
+ ut_error;
+ return;
+ }
}
end = rec;
- nulls = rec - (extra + 1);
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
/* clear the SQL-null flags */
memset(lens + 1, 0, nulls - lens);
@@ -1171,6 +1234,10 @@ rec_convert_dtuple_to_rec_comp(
ifield = dict_index_get_nth_field(index, i);
fixed_len = ifield->fixed_len;
+ if (temp && fixed_len
+ && !dict_col_get_fixed_size(ifield->col, temp)) {
+ fixed_len = 0;
+ }
/* If the maximum length of a variable-length field
is up to 255 bytes, the actual length is always stored
in one byte. If the maximum length is more than 255
@@ -1178,8 +1245,17 @@ rec_convert_dtuple_to_rec_comp(
0..127. The length will be encoded in two bytes when
it is 128 or more, or when the field is stored externally. */
if (fixed_len) {
- ut_ad(len == fixed_len);
+#ifdef UNIV_DEBUG
+ ulint mbminlen = DATA_MBMINLEN(
+ ifield->col->mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(
+ ifield->col->mbminmaxlen);
+
+ ut_ad(len <= fixed_len);
+ ut_ad(!mbmaxlen || len >= mbminlen
+ * (fixed_len / mbmaxlen));
ut_ad(!dfield_is_ext(field));
+#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(field)) {
ut_ad(ifield->col->len >= 256
|| ifield->col->mtype == DATA_BLOB);
@@ -1233,8 +1309,7 @@ rec_convert_dtuple_to_rec_new(
rec = buf + extra_size;
rec_convert_dtuple_to_rec_comp(
- rec, REC_N_NEW_EXTRA_BYTES, index, status,
- dtuple->fields, dtuple->n_fields);
+ rec, index, dtuple->fields, dtuple->n_fields, status, FALSE);
/* Set the info bits of the record */
rec_set_info_and_status_bits(rec, dtuple_get_info_bits(dtuple));
@@ -1296,6 +1371,54 @@ rec_convert_dtuple_to_rec(
return(rec);
}
+#ifndef UNIV_HOTBACKUP
+/**********************************************************//**
+Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
+@return total size */
+UNIV_INTERN
+ulint
+rec_get_converted_size_temp(
+/*========================*/
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint* extra) /*!< out: extra size */
+{
+ return(rec_get_converted_size_comp_prefix_low(
+ index, fields, n_fields, extra, TRUE));
+}
+
+/******************************************************//**
+Determine the offset to each field in temporary file.
+@see rec_convert_dtuple_to_temp() */
+UNIV_INTERN
+void
+rec_init_offsets_temp(
+/*==================*/
+ const rec_t* rec, /*!< in: temporary file record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ ulint* offsets)/*!< in/out: array of offsets;
+ in: n=rec_offs_n_fields(offsets) */
+{
+ rec_init_offsets_comp_ordinary(rec, TRUE, index, offsets);
+}
+
+/*********************************************************//**
+Builds a temporary file record out of a data tuple.
+@see rec_init_offsets_temp() */
+UNIV_INTERN
+void
+rec_convert_dtuple_to_temp(
+/*=======================*/
+ rec_t* rec, /*!< out: record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields) /*!< in: number of fields */
+{
+ rec_convert_dtuple_to_rec_comp(rec, index, fields, n_fields,
+ REC_STATUS_ORDINARY, TRUE);
+}
+
/**************************************************************//**
Copies the first n fields of a physical record to a data tuple. The fields
are copied to the memory heap. */
@@ -1506,6 +1629,7 @@ rec_copy_prefix_to_buf(
return(*buf + (rec - (lens + 1)));
}
+#endif /* UNIV_HOTBACKUP */
/***************************************************************//**
Validates the consistency of an old-style physical record.
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index e79518e24de..e8d15fb539c 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -2394,7 +2394,10 @@ row_ins_index_entry(
err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
n_ext, thr);
if (err != DB_FAIL) {
-
+ if (index == dict_table_get_first_index(index->table)
+ && thr_get_trx(thr)->mysql_thd != 0) {
+ DEBUG_SYNC_C("row_ins_clust_index_entry_leaf_after");
+ }
return(err);
}
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index cf662cb1f88..244aa0a69f1 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -294,6 +294,7 @@ row_merge_buf_add(
ulint len;
const dict_col_t* col;
ulint col_no;
+ ulint fixed_len;
const dfield_t* row_field;
ibool col_adjusted;
@@ -435,9 +436,30 @@ row_merge_buf_add(
ut_ad(len <= col->len || col->mtype == DATA_BLOB);
- if (ifield->fixed_len) {
- ut_ad(len == ifield->fixed_len);
+ fixed_len = ifield->fixed_len;
+ if (fixed_len && !dict_table_is_comp(index->table)
+ && DATA_MBMINLEN(col->mbminmaxlen)
+ != DATA_MBMAXLEN(col->mbminmaxlen)) {
+ /* CHAR in ROW_FORMAT=REDUNDANT is always
+ fixed-length, but in the temporary file it is
+ variable-length for variable-length character
+ sets. */
+ fixed_len = 0;
+ }
+
+ if (fixed_len) {
+#ifdef UNIV_DEBUG
+ ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen);
+
+ /* len should be between size calcualted base on
+ mbmaxlen and mbminlen */
+ ut_ad(len <= fixed_len);
+ ut_ad(!mbmaxlen || len >= mbminlen
+ * (fixed_len / mbmaxlen));
+
ut_ad(!dfield_is_ext(field));
+#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(field)) {
extra_size += 2;
} else if (len < 128
@@ -464,12 +486,11 @@ row_merge_buf_add(
ulint size;
ulint extra;
- size = rec_get_converted_size_comp(index,
- REC_STATUS_ORDINARY,
- entry, n_fields, &extra);
+ size = rec_get_converted_size_temp(
+ index, entry, n_fields, &extra);
- ut_ad(data_size + extra_size + REC_N_NEW_EXTRA_BYTES == size);
- ut_ad(extra_size + REC_N_NEW_EXTRA_BYTES == extra);
+ ut_ad(data_size + extra_size == size);
+ ut_ad(extra_size == extra);
}
#endif /* UNIV_DEBUG */
@@ -660,14 +681,9 @@ row_merge_buf_write(
ulint extra_size;
const dfield_t* entry = buf->tuples[i];
- size = rec_get_converted_size_comp(index,
- REC_STATUS_ORDINARY,
- entry, n_fields,
- &extra_size);
+ size = rec_get_converted_size_temp(
+ index, entry, n_fields, &extra_size);
ut_ad(size >= extra_size);
- ut_ad(extra_size >= REC_N_NEW_EXTRA_BYTES);
- extra_size -= REC_N_NEW_EXTRA_BYTES;
- size -= REC_N_NEW_EXTRA_BYTES;
/* Encode extra_size + 1 */
if (extra_size + 1 < 0x80) {
@@ -680,9 +696,8 @@ row_merge_buf_write(
ut_ad(b + size < &block[srv_sort_buf_size]);
- rec_convert_dtuple_to_rec_comp(b + extra_size, 0, index,
- REC_STATUS_ORDINARY,
- entry, n_fields);
+ rec_convert_dtuple_to_temp(b + extra_size, index,
+ entry, n_fields);
b += size;
@@ -790,6 +805,8 @@ row_merge_read(
os_offset_t ofs = ((os_offset_t) offset) * srv_sort_buf_size;
ibool success;
+ DBUG_EXECUTE_IF("row_merge_read_failure", return(FALSE););
+
#ifdef UNIV_DEBUG
if (row_merge_print_block_read) {
fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n",
@@ -839,6 +856,8 @@ row_merge_write(
ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
+ DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
+
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
fprintf(stderr, "row_merge_write fd=%d ofs=%lu\n",
@@ -951,7 +970,7 @@ err_exit:
*mrec = *buf + extra_size;
- rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets);
+ rec_init_offsets_temp(*mrec, index, offsets);
data_size = rec_offs_data_size(offsets);
@@ -970,7 +989,7 @@ err_exit:
*mrec = b + extra_size;
- rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets);
+ rec_init_offsets_temp(*mrec, index, offsets);
data_size = rec_offs_data_size(offsets);
ut_ad(extra_size + data_size < sizeof *buf);
@@ -2449,7 +2468,7 @@ row_merge_drop_temp_indexes(void)
/*********************************************************************//**
Creates temporary merge files, and if UNIV_PFS_IO defined, register
the file descriptor with Performance Schema.
-@return File descriptor */
+@return file descriptor, or -1 on failure */
UNIV_INLINE
int
row_merge_file_create_low(void)
@@ -2471,13 +2490,19 @@ row_merge_file_create_low(void)
#ifdef UNIV_PFS_IO
register_pfs_file_open_end(locker, fd);
#endif
+ if (fd < 0) {
+ fprintf(stderr,
+ "InnoDB: Error: Cannot create temporary merge file\n");
+ return(-1);
+ }
return(fd);
}
/*********************************************************************//**
-Create a merge file. */
+Create a merge file.
+@return file descriptor, or -1 on failure */
UNIV_INTERN
-void
+int
row_merge_file_create(
/*==================*/
merge_file_t* merge_file) /*!< out: merge file structure */
@@ -2488,6 +2513,7 @@ row_merge_file_create(
}
merge_file->offset = 0;
merge_file->n_rec = 0;
+ return(merge_file->fd);
}
/*********************************************************************//**
@@ -2761,6 +2787,28 @@ row_merge_rename_tables(
goto err_exit;
}
+ /* Generate the redo logs for file operations */
+ fil_mtr_rename_log(old_table->space, old_name,
+ new_table->space, new_table->name, tmp_name);
+
+ /* What if the redo logs are flushed to disk here? This is
+ tested with following crash point */
+ DBUG_EXECUTE_IF("bug14669848_precommit", log_buffer_flush_to_disk();
+ DBUG_SUICIDE(););
+
+ /* File operations cannot be rolled back. So, before proceeding
+ with file operations, commit the dictionary changes.*/
+ trx_commit_for_mysql(trx);
+
+ /* If server crashes here, the dictionary in InnoDB and MySQL
+ will differ. The .ibd files and the .frm files must be swapped
+ manually by the administrator. No loss of data. */
+ DBUG_EXECUTE_IF("bug14669848", DBUG_SUICIDE(););
+
+ /* Ensure that the redo logs are flushed to disk. The config
+ innodb_flush_log_at_trx_commit must not affect this. */
+ log_buffer_flush_to_disk();
+
/* The following calls will also rename the .ibd data files if
the tables are stored in a single-table tablespace */
@@ -2935,7 +2983,7 @@ row_merge_build_indexes(
ulint i;
ulint j;
ulint error;
- int tmpfd;
+ int tmpfd = -1;
dict_index_t* fts_sort_idx = NULL;
fts_psort_t* psort_info = NULL;
fts_psort_t* merge_info = NULL;
@@ -2959,9 +3007,21 @@ row_merge_build_indexes(
block = static_cast<row_merge_block_t*>(
os_mem_alloc_large(&block_size));
+ /* Initialize all the merge file descriptors, so that we
+ don't call row_merge_file_destroy() on uninitialized
+ merge file descriptor */
+
for (i = 0; i < n_indexes; i++) {
+ merge_files[i].fd = -1;
+ }
- row_merge_file_create(&merge_files[i]);
+ for (i = 0; i < n_indexes; i++) {
+
+ if (row_merge_file_create(&merge_files[i]) < 0)
+ {
+ error = DB_OUT_OF_MEMORY;
+ goto func_exit;
+ }
if (indexes[i]->type & DICT_FTS) {
ibool opt_doc_id_size = FALSE;
@@ -2982,6 +3042,12 @@ row_merge_build_indexes(
tmpfd = row_merge_file_create_low();
+ if (tmpfd < 0)
+ {
+ error = DB_OUT_OF_MEMORY;
+ goto func_exit;
+ }
+
/* Reset the MySQL row buffer that is used when reporting
duplicate keys. */
innobase_rec_reset(table);
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index f1811a664c2..7a07833fa16 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -4532,6 +4532,13 @@ end:
trx->error_state = DB_SUCCESS;
trx_rollback_to_savepoint(trx, NULL);
trx->error_state = DB_SUCCESS;
+ } else {
+ if (old_is_tmp && !new_is_tmp) {
+ /* After ALTER TABLE the table statistics
+ needs to be rebuilt. It will be rebuilt
+ when the table is loaded again. */
+ table->stat_initialized = FALSE;
+ }
}
}
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 4869909f5a6..42034c5b80d 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -518,7 +518,7 @@ row_undo_mod_upd_del_sec(
ulint err = DB_SUCCESS;
ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
-
+ ut_ad(!node->undo_row);
heap = mem_heap_create(1024);
while (node->index != NULL) {
@@ -576,6 +576,8 @@ row_undo_mod_del_mark_sec(
mem_heap_t* heap;
ulint err = DB_SUCCESS;
+ ut_ad(!node->undo_row);
+
heap = mem_heap_create(1024);
while (node->index != NULL) {
diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc
index 757d3544ba4..a73f858599d 100644
--- a/storage/innobase/row/row0undo.cc
+++ b/storage/innobase/row/row0undo.cc
@@ -217,7 +217,7 @@ row_undo_search_clust_to_pcur(
node->row = row_build(ROW_COPY_DATA, clust_index, rec,
offsets, NULL, ext, node->heap);
- if (node->update) {
+ if (node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
node->undo_row = dtuple_copy(node->row, node->heap);
row_upd_replace(node->undo_row, &node->undo_ext,
clust_index, node->update, node->heap);
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index e64cc006f02..30e0698eab9 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -39,6 +39,8 @@ Created 10/8/1995 Heikki Tuuri
*******************************************************/
/* Dummy comment */
+#include "m_string.h" /* for my_sys.h */
+#include "my_sys.h" /* DEBUG_SYNC_C */
#include "srv0srv.h"
#include "ut0mem.h"
@@ -354,6 +356,11 @@ UNIV_INTERN unsigned long long srv_stats_persistent_sample_pages = 20;
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
+UNIV_INTERN ibool srv_use_atomic_writes = FALSE;
+#ifdef HAVE_POSIX_FALLOCATE
+UNIV_INTERN ibool srv_use_posix_fallocate = TRUE;
+#endif
+
/** doublewrite buffer is 1MB is size i.e.: it can hold 128 16K pages.
The following parameter is the size of the buffer that is used for
batch flushing i.e.: LRU flushing and flush_list flushing. The rest
@@ -1308,13 +1315,15 @@ void
srv_export_innodb_status(void)
/*==========================*/
{
- buf_pool_stat_t stat;
- ulint LRU_len;
- ulint free_len;
- ulint flush_list_len;
+ buf_pool_stat_t stat;
+ buf_pools_list_size_t buf_pools_list_size;
+ ulint LRU_len;
+ ulint free_len;
+ ulint flush_list_len;
buf_get_total_stat(&stat);
buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
+ buf_get_total_list_size_in_bytes(&buf_pools_list_size);
mutex_enter(&srv_innodb_monitor_mutex);
@@ -1343,7 +1352,12 @@ srv_export_innodb_status(void)
export_vars.innodb_buffer_pool_read_ahead_evicted
= stat.n_ra_pages_evicted;
export_vars.innodb_buffer_pool_pages_data = LRU_len;
+ export_vars.innodb_buffer_pool_bytes_data =
+ buf_pools_list_size.LRU_bytes
+ + buf_pools_list_size.unzip_LRU_bytes;
export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
+ export_vars.innodb_buffer_pool_bytes_dirty =
+ buf_pools_list_size.flush_list_bytes;
export_vars.innodb_buffer_pool_pages_free = free_len;
#ifdef UNIV_DEBUG
export_vars.innodb_buffer_pool_pages_latched
diff --git a/storage/innobase/sync/sync0sync.cc b/storage/innobase/sync/sync0sync.cc
index af64d011db2..c492edf89b6 100644
--- a/storage/innobase/sync/sync0sync.cc
+++ b/storage/innobase/sync/sync0sync.cc
@@ -309,9 +309,9 @@ mutex_create_func(
/* NOTE! The very first mutexes are not put to the mutex list */
- if ((mutex == &mutex_list_mutex)
+ if (mutex == &mutex_list_mutex
#ifdef UNIV_SYNC_DEBUG
- || (mutex == &sync_thread_mutex)
+ || mutex == &sync_thread_mutex
#endif /* UNIV_SYNC_DEBUG */
) {
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 62c140879aa..d050e7461e7 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -69,6 +69,10 @@ UNIV_INTERN mysql_pfs_key_t trx_purge_latch_key;
UNIV_INTERN mysql_pfs_key_t purge_sys_bh_mutex_key;
#endif /* UNIV_PFS_MUTEX */
+#ifdef UNIV_DEBUG
+UNIV_INTERN my_bool srv_purge_view_update_only_debug;
+#endif /* UNIV_DEBUG */
+
/********************************************************************//**
Fetches the next undo log record from the history list to purge. It must be
released with the corresponding release function.
@@ -1215,6 +1219,12 @@ trx_purge(
rw_lock_x_unlock(&purge_sys->latch);
+#ifdef UNIV_DEBUG
+ if (srv_purge_view_update_only_debug) {
+ return(0);
+ }
+#endif
+
/* Fetch the UNDO recs that need to be purged. */
n_pages_handled = trx_purge_attach_undo_recs(
n_purge_threads, purge_sys, &purge_sys->limit, batch_size);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index b87eac9362e..203139f23fd 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1588,6 +1588,25 @@ trx_undo_prev_version_build(
if (row_upd_changes_field_size_or_external(index, offsets, update)) {
ulint n_ext;
+ /* We should confirm the existence of disowned external data,
+ if the previous version record is delete marked. If the trx_id
+ of the previous record is seen by purge view, we should treat
+ it as missing history, because the disowned external data
+ might be purged already.
+
+ The inherited external data (BLOBs) can be freed (purged)
+ after trx_id was committed, provided that no view was started
+ before trx_id. If the purge view can see the committed
+ delete-marked record by trx_id, no transactions need to access
+ the BLOB. */
+
+ if ((update->info_bits & REC_INFO_DELETED_FLAG)
+ && read_view_sees_trx_id(purge_sys->view, trx_id)) {
+ /* treat as a fresh insert, not to
+ cause assertion error at the caller. */
+ return(DB_SUCCESS);
+ }
+
/* We have to set the appropriate extern storage bits in the
old version of the record: the extern bits in rec for those
fields that update does NOT update, as well as the bits for
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 95f37ddb12f..af5925dbeeb 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1000,12 +1000,6 @@ static const char *ha_maria_exts[]=
};
-const char **ha_maria::bas_ext() const
-{
- return ha_maria_exts;
-}
-
-
const char *ha_maria::index_type(uint key_number)
{
return ((table->key_info[key_number].flags & HA_FULLTEXT) ?
@@ -3491,6 +3485,7 @@ static int ha_maria_init(void *p)
maria_hton->db_type= DB_TYPE_UNKNOWN;
maria_hton->create= maria_create_handler;
maria_hton->panic= maria_hton_panic;
+ maria_hton->tablefile_extensions= ha_maria_exts;
maria_hton->commit= maria_commit;
maria_hton->rollback= maria_rollback;
maria_hton->checkpoint_state= maria_checkpoint_state;
@@ -3762,11 +3757,6 @@ SHOW_VAR status_variables[]= {
{NullS, NullS, SHOW_LONG}
};
-static struct st_mysql_show_var aria_status_variables[]= {
- {"Aria", (char*) &status_variables, SHOW_ARRAY},
- {NullS, NullS, SHOW_LONG}
-};
-
/****************************************************************************
* Maria MRR implementation: use DS-MRR
***************************************************************************/
@@ -3841,7 +3831,7 @@ maria_declare_plugin(aria)
ha_maria_init, /* Plugin Init */
NULL, /* Plugin Deinit */
0x0105, /* 1.5 */
- aria_status_variables, /* status variables */
+ status_variables, /* status variables */
system_variables, /* system variables */
"1.5", /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h
index 086c4088d95..7d12f1637b4 100644
--- a/storage/maria/ha_maria.h
+++ b/storage/maria/ha_maria.h
@@ -35,7 +35,6 @@ C_MODE_START
ICP_RESULT index_cond_func_maria(void *arg);
C_MODE_END
-extern ulong maria_sort_buffer_size;
extern TYPELIB maria_recover_typelib;
extern ulonglong maria_recover_options;
@@ -60,7 +59,6 @@ public:
~ha_maria() {}
handler *clone(const char *name, MEM_ROOT *mem_root);
const char *index_type(uint key_number);
- const char **bas_ext() const;
ulonglong table_flags() const
{ return int_table_flags; }
ulong index_flags(uint inx, uint part, bool all_parts) const;
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index e3668d3c8d3..d48e8df5cf1 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -1,4 +1,5 @@
/* Copyright (C) 2007 Michael Widenius
+ Copyright (c) 2010, 2013, Monty Program Ab.
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
@@ -135,8 +136,7 @@ const char *bits_to_txt[]=
"tail 00-40 % full", "tail 40-80 % full", "tail/blob full"
};
-/*#define WRONG_BITMAP_FLUSH 1*/ /*define only for provoking bugs*/
-#undef WRONG_BITMAP_FLUSH
+#define WRONG_BITMAP_FLUSH 0 /*define to 1 only for provoking bugs*/
static my_bool _ma_read_bitmap_page(MARIA_HA *info,
MARIA_FILE_BITMAP *bitmap,
@@ -164,11 +164,7 @@ static inline my_bool write_changed_bitmap(MARIA_SHARE *share,
*/
bitmap->changed_not_flushed= 1;
- if ((bitmap->non_flushable == 0)
-#ifdef WRONG_BITMAP_FLUSH
- || 1
-#endif
- )
+ if ((bitmap->non_flushable == 0) || WRONG_BITMAP_FLUSH)
{
res= pagecache_write(share->pagecache,
&bitmap->file, bitmap->page, 0,
@@ -495,7 +491,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
{
bitmap->flush_all_requested++;
bitmap->waiting_for_non_flushable++;
-#ifndef WRONG_BITMAP_FLUSH
+#if !WRONG_BITMAP_FLUSH
while (bitmap->non_flushable > 0)
{
DBUG_PRINT("info", ("waiting for bitmap to be flushable"));
@@ -1256,7 +1252,7 @@ static my_bool allocate_head(MARIA_FILE_BITMAP *bitmap, uint size,
a full page or a tail page
*/
if ((!bits && best_data) ||
- ((bits & LL(04444444444444444)) == LL(04444444444444444)))
+ ((bits & 04444444444444444LL) == 04444444444444444LL))
continue;
for (i= 0; i < 16 ; i++, bits >>= 3)
{
@@ -1344,8 +1340,8 @@ static my_bool allocate_tail(MARIA_FILE_BITMAP *bitmap, uint size,
quite common case if we have blobs.
*/
- if ((!bits && best_data) || bits == LL(0xffffffffffff) ||
- bits == LL(04444444444444444))
+ if ((!bits && best_data) || bits == 0xffffffffffffLL ||
+ bits == 04444444444444444LL)
continue;
for (i= 0; i < 16; i++, bits >>= 3)
{
@@ -1470,14 +1466,14 @@ static ulong allocate_full_pages(MARIA_FILE_BITMAP *bitmap,
bits= prefix_bits= uint6korr(data_start - 6);
DBUG_ASSERT(bits != 0);
/* 111 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 */
- if (!(bits & LL(07000000000000000)))
+ if (!(bits & 07000000000000000LL))
{
data_start-= 6;
do
{
prefix_area_size++;
bits<<= 3;
- } while (!(bits & LL(07000000000000000)));
+ } while (!(bits & 07000000000000000LL));
area_size+= prefix_area_size;
/* Calculate offset to page from data_start */
prefix_area_size= 16 - prefix_area_size;
@@ -1526,11 +1522,11 @@ static ulong allocate_full_pages(MARIA_FILE_BITMAP *bitmap,
best_prefix_area_size= 16 - best_prefix_area_size;
if (best_area_size < best_prefix_area_size)
{
- tmp= (LL(1) << best_area_size*3) - 1;
+ tmp= (1LL << best_area_size*3) - 1;
best_area_size= best_prefix_area_size; /* for easy end test */
}
else
- tmp= (LL(1) << best_prefix_area_size*3) - 1;
+ tmp= (1LL << best_prefix_area_size*3) - 1;
tmp<<= (16 - best_prefix_area_size) * 3;
DBUG_ASSERT((best_prefix_bits & tmp) == 0);
best_prefix_bits|= tmp;
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 55b9a137050..16657ba80ae 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -5454,7 +5454,7 @@ restart_bitmap_scan:
{
bits= uint6korr(data);
/* Skip not allocated pages and blob / full tail pages */
- if (bits && bits != LL(07777777777777777))
+ if (bits && bits != 07777777777777777LL)
break;
}
bit_pos= 0;
@@ -7123,7 +7123,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
memcpy(field_pos, field_length_data, size_length);
field_length_data+= size_length;
- memcpy(field_pos + size_length, &header, sizeof(&header));
+ memcpy(field_pos + size_length, &header, sizeof(header));
header+= blob_length;
*blob_lengths++= blob_length;
break;
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index ab9080c40fb..192e2ed32a1 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -4025,8 +4025,8 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS))
{
- my_off_t skr= (share->state.state.data_file_length +
- (sort_info.org_data_file_type == COMPRESSED_RECORD) ?
+ my_off_t skr= share->state.state.data_file_length +
+ ((sort_info.org_data_file_type == COMPRESSED_RECORD) ?
MEMMAP_EXTRA_MARGIN : 0);
#ifdef USE_RELOC
if (sort_info.org_data_file_type == STATIC_RECORD &&
@@ -4545,8 +4545,8 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
if (rep_quick && (param->testflag & T_FORCE_UNIQUENESS))
{
- my_off_t skr= (share->state.state.data_file_length +
- (sort_info.org_data_file_type == COMPRESSED_RECORD) ?
+ my_off_t skr= share->state.state.data_file_length +
+ ((sort_info.org_data_file_type == COMPRESSED_RECORD) ?
MEMMAP_EXTRA_MARGIN : 0);
#ifdef USE_RELOC
if (sort_info.org_data_file_type == STATIC_RECORD &&
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 28c3491730f..4ed00598c2f 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -1215,19 +1215,19 @@ uint maria_get_pointer_length(ulonglong file_length, uint def)
if (file_length) /* If not default */
{
#ifdef NOT_YET_READY_FOR_8_BYTE_POINTERS
- if (file_length >= (ULL(1) << 56))
+ if (file_length >= (1ULL << 56))
def=8;
else
#endif
- if (file_length >= (ULL(1) << 48))
+ if (file_length >= (1ULL << 48))
def=7;
- else if (file_length >= (ULL(1) << 40))
+ else if (file_length >= (1ULL << 40))
def=6;
- else if (file_length >= (ULL(1) << 32))
+ else if (file_length >= (1ULL << 32))
def=5;
- else if (file_length >= (ULL(1) << 24))
+ else if (file_length >= (1ULL << 24))
def=4;
- else if (file_length >= (ULL(1) << 16))
+ else if (file_length >= (1ULL << 16))
def=3;
else
def=2;
diff --git a/storage/maria/ma_init.c b/storage/maria/ma_init.c
index 78ca7ed9bf8..962405552f0 100644
--- a/storage/maria/ma_init.c
+++ b/storage/maria/ma_init.c
@@ -148,7 +148,7 @@ my_bool maria_upgrade()
"Converting them to Aria names",
MYF(ME_JUST_INFO));
- for (i= 0; i < dir->number_off_files; i++)
+ for (i= 0; i < dir->number_of_files; i++)
{
const char *file= dir->dir_entry[i].name;
if (strncmp(file, "maria_log.", 10) == 0 &&
diff --git a/storage/maria/ma_key.c b/storage/maria/ma_key.c
index f62ffcc49a0..a3553801eaa 100644
--- a/storage/maria/ma_key.c
+++ b/storage/maria/ma_key.c
@@ -99,7 +99,7 @@ uint transid_store_packed(MARIA_HA *info, uchar *to, ulonglong trid)
uchar *start;
uint length;
uchar buff[8];
- DBUG_ASSERT(trid < (LL(1) << (MARIA_MAX_PACK_TRANSID_SIZE*8)));
+ DBUG_ASSERT(trid < (1LL << (MARIA_MAX_PACK_TRANSID_SIZE*8)));
DBUG_ASSERT(trid >= info->s->state.create_trid);
trid= (trid - info->s->state.create_trid) << 1;
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 56926c048d8..5233e57594c 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -3274,7 +3274,7 @@ static my_bool translog_get_last_page_addr(TRANSLOG_ADDRESS *addr,
DBUG_PRINT("info", ("File size: %s", llstr(file_size, buff)));
if (file_size == MY_FILEPOS_ERROR)
DBUG_RETURN(1);
- DBUG_ASSERT(file_size < ULL(0xffffffff));
+ DBUG_ASSERT(file_size < 0xffffffffULL);
if (((uint32)file_size) > TRANSLOG_PAGE_SIZE)
{
rec_offset= (((((uint32)file_size) / TRANSLOG_PAGE_SIZE) - 1) *
@@ -3479,7 +3479,7 @@ my_bool translog_walk_filenames(const char *directory,
if (!(dirp = my_dir(directory, MYF(MY_DONT_SORT))))
return FALSE;
- for (i= 0; i < dirp->number_off_files; i++)
+ for (i= 0; i < dirp->number_of_files; i++)
{
char *file= dirp->dir_entry[i].name;
if (strncmp(file, "aria_log.", 10) == 0 &&
@@ -3785,12 +3785,12 @@ my_bool translog_init_with_table(const char *directory,
TRANSLOG_FILE *file= (TRANSLOG_FILE *)my_malloc(sizeof(TRANSLOG_FILE),
MYF(0));
- compile_time_assert(MY_FILEPOS_ERROR > ULL(0xffffffff));
+ compile_time_assert(MY_FILEPOS_ERROR > 0xffffffffULL);
if (file == NULL ||
(file->handler.file=
open_logfile_by_number_no_cache(i)) < 0 ||
mysql_file_seek(file->handler.file, 0, SEEK_END, MYF(0)) >=
- ULL(0xffffffff))
+ 0xffffffffULL)
{
int j;
for (j= i - log_descriptor.min_file - 1; j > 0; j--)
@@ -5247,7 +5247,7 @@ static uchar *translog_put_LSN_diff(LSN base_lsn, LSN lsn, uchar *dst)
dst[0]= (uchar)(0x80 | (diff >> 24));
int3store(dst + 1, diff & 0xFFFFFFL);
}
- else if (diff <= LL(0x3FFFFFFFFF))
+ else if (diff <= 0x3FFFFFFFFFLL)
{
dst-= 5;
@@ -5344,7 +5344,7 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst)
{
/* take 1 from file offset */
first_byte++;
- base_offset+= LL(0x100000000);
+ base_offset+= 0x100000000LL;
}
file_no= LSN_FILE_NO(base_lsn) - first_byte;
DBUG_ASSERT(base_offset - diff <= UINT_MAX);
diff --git a/storage/maria/ma_loghandler_lsn.h b/storage/maria/ma_loghandler_lsn.h
index 7fa53bc0a50..f618429f6f3 100644
--- a/storage/maria/ma_loghandler_lsn.h
+++ b/storage/maria/ma_loghandler_lsn.h
@@ -83,8 +83,8 @@ typedef TRANSLOG_ADDRESS LSN;
other bytes are a LSN.
*/
typedef LSN LSN_WITH_FLAGS;
-#define LSN_WITH_FLAGS_TO_LSN(x) (x & ULL(0x00FFFFFFFFFFFFFF))
-#define LSN_WITH_FLAGS_TO_FLAGS(x) (x & ULL(0xFF00000000000000))
+#define LSN_WITH_FLAGS_TO_LSN(x) (x & 0x00FFFFFFFFFFFFFFULL)
+#define LSN_WITH_FLAGS_TO_FLAGS(x) (x & 0xFF00000000000000ULL)
#define FILENO_IMPOSSIBLE 0 /**< log file's numbering starts at 1 */
#define LOG_OFFSET_IMPOSSIBLE 0 /**< log always has a header */
@@ -106,6 +106,6 @@ typedef LSN LSN_WITH_FLAGS;
Unlike ULONGLONG_MAX, it can be safely used in comparison with valid LSNs
(ULONGLONG_MAX is too big for correctness of cmp_translog_addr()).
*/
-#define LSN_MAX (LSN)ULL(0x00FFFFFFFFFFFFFF)
+#define LSN_MAX (LSN)0x00FFFFFFFFFFFFFFULL
#endif
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 6aaccea219f..4a3c3efd3fb 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -1650,7 +1650,7 @@ static void unlink_hash(PAGECACHE *pagecache, PAGECACHE_HASH_LINK *hash_link)
struct st_my_thread_var *thread;
hash_link->file= first_page->file;
- DBUG_ASSERT(first_page->pageno < ((ULL(1)) << 40));
+ DBUG_ASSERT(first_page->pageno < ((1ULL) << 40));
hash_link->pageno= first_page->pageno;
do
{
@@ -1813,7 +1813,7 @@ restart:
goto restart;
}
hash_link->file= *file;
- DBUG_ASSERT(pageno < ((ULL(1)) << 40));
+ DBUG_ASSERT(pageno < ((1ULL) << 40));
hash_link->pageno= pageno;
link_hash(start, hash_link);
/* Register the request for the page */
@@ -3357,7 +3357,7 @@ uchar *pagecache_read(PAGECACHE *pagecache,
page_cache_page_pin_str[unlock_pin]));
DBUG_ASSERT(buff != 0 || (buff == 0 && (unlock_pin == PAGECACHE_PIN ||
unlock_pin == PAGECACHE_PIN_LEFT_PINNED)));
- DBUG_ASSERT(pageno < ((ULL(1)) << 40));
+ DBUG_ASSERT(pageno < ((1ULL) << 40));
#endif
if (!page_link)
@@ -3797,7 +3797,7 @@ my_bool pagecache_delete(PAGECACHE *pagecache,
pin == PAGECACHE_PIN_LEFT_PINNED);
restart:
- DBUG_ASSERT(pageno < ((ULL(1)) << 40));
+ DBUG_ASSERT(pageno < ((1ULL) << 40));
if (pagecache->can_be_used)
{
/* Key cache is used */
@@ -3977,7 +3977,7 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
DBUG_ASSERT(lock != PAGECACHE_LOCK_LEFT_READLOCKED);
DBUG_ASSERT(lock != PAGECACHE_LOCK_READ_UNLOCK);
DBUG_ASSERT(offset + size <= pagecache->block_size);
- DBUG_ASSERT(pageno < ((ULL(1)) << 40));
+ DBUG_ASSERT(pageno < ((1ULL) << 40));
#endif
if (!page_link)
@@ -4974,7 +4974,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
ptr+= 2;
ptr[0]= (share->kfile.file == block->hash_link->file.file);
ptr++;
- DBUG_ASSERT(block->hash_link->pageno < ((ULL(1)) << 40));
+ DBUG_ASSERT(block->hash_link->pageno < ((1ULL) << 40));
page_store(ptr, block->hash_link->pageno);
ptr+= PAGE_STORE_SIZE;
lsn_store(ptr, block->rec_lsn);
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 9ac42f885b5..aeeda26b791 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2006, 2007 MySQL AB
- Copyright (C) 2010-2011 Monty Program Ab
+ Copyright (C) 2010, 2013, Monty Program Ab.
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
@@ -3683,7 +3683,7 @@ static void print_redo_phase_progress(TRANSLOG_ADDRESS addr)
end_offset);
if (initial_remainder == (ulonglong)(-1))
initial_remainder= local_remainder;
- percentage_done= (uint) ((initial_remainder - local_remainder) * ULL(100) /
+ percentage_done= (uint) ((initial_remainder - local_remainder) * 100ULL /
initial_remainder);
if ((percentage_done - percentage_printed) >= 10)
{
diff --git a/storage/maria/ma_test3.c b/storage/maria/ma_test3.c
index c11de6f8242..64b22e45c1b 100644
--- a/storage/maria/ma_test3.c
+++ b/storage/maria/ma_test3.c
@@ -114,7 +114,7 @@ int main(int argc,char **argv)
sleep(1);
return 0;
}
- rnd(1);
+ (void)rnd(1);
}
for (i=0 ; i < forks ; i++)
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index e983f561bbb..d1d52441588 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -855,7 +855,7 @@ struct st_maria_handler
#define MARIA_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */
/* Marker for impossible delete link */
-#define IMPOSSIBLE_PAGE_NO LL(0xFFFFFFFFFF)
+#define IMPOSSIBLE_PAGE_NO 0xFFFFFFFFFFLL
/* The UNIQUE check is done with a hashed long key */
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 40686995378..788bc5c2ad3 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -1905,7 +1905,7 @@ static int make_huff_decode_table(HUFF_TREE *huff_tree, uint trees)
return 1;
huff_tree->code_len=(uchar*) (huff_tree->code+elements);
make_traverse_code_tree(huff_tree, huff_tree->root,
- 8 * sizeof(ulonglong), LL(0));
+ 8 * sizeof(ulonglong), 0);
}
}
return 0;
diff --git a/storage/maria/trnman.h b/storage/maria/trnman.h
index f28345908f2..77e2916390a 100644
--- a/storage/maria/trnman.h
+++ b/storage/maria/trnman.h
@@ -56,7 +56,7 @@ struct st_ma_transaction
uint16 flags; /**< Various flags */
};
-#define TRANSACTION_LOGGED_LONG_ID ULL(0x8000000000000000)
+#define TRANSACTION_LOGGED_LONG_ID 0x8000000000000000ULL
#define MAX_TRID (~(TrID)0)
extern WT_RESOURCE_TYPE ma_rc_dup_unique;
diff --git a/storage/maria/unittest/ma_control_file-t.c b/storage/maria/unittest/ma_control_file-t.c
index b4e757788c2..1d52dee6ece 100644
--- a/storage/maria/unittest/ma_control_file-t.c
+++ b/storage/maria/unittest/ma_control_file-t.c
@@ -277,7 +277,7 @@ static int test_five_logs_and_max_trid(void)
RET_ERR_UNLESS(open_file() == CONTROL_FILE_OK);
expect_logno= 100;
- expect_max_trid= ULL(14111978111);
+ expect_max_trid= 14111978111ULL;
for (i= 0; i<5; i++)
{
expect_logno*= 3;
diff --git a/storage/maria/unittest/ma_maria_log_cleanup.c b/storage/maria/unittest/ma_maria_log_cleanup.c
index 60e4fdb02fd..3e4bc755832 100644
--- a/storage/maria/unittest/ma_maria_log_cleanup.c
+++ b/storage/maria/unittest/ma_maria_log_cleanup.c
@@ -38,7 +38,7 @@ my_bool maria_log_remove(const char *testdir)
if (!(dirp = my_dir(maria_data_root, MYF(MY_DONT_SORT))))
return 1;
- for (i= 0; i < dirp->number_off_files; i++)
+ for (i= 0; i < dirp->number_of_files; i++)
{
char *file= dirp->dir_entry[i].name;
if (strncmp(file, "aria_log.", 9) == 0 &&
diff --git a/storage/maria/unittest/trnman-t.c b/storage/maria/unittest/trnman-t.c
index c2bc993e2ff..78740eac9c1 100644
--- a/storage/maria/unittest/trnman-t.c
+++ b/storage/maria/unittest/trnman-t.c
@@ -45,7 +45,7 @@ pthread_handler_t test_trnman(void *arg)
for (x= ((int)(intptr)(&m)); m > 0; )
{
- y= x= (x*LL(3628273133) + LL(1500450271)) % LL(9576890767); /* three prime numbers */
+ y= x= (x*3628273133LL + 1500450271LL) % 9576890767LL; /* three prime numbers */
m-= n= x % MAX_ITER;
for (i= 0; i < n; i++)
{
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index f649de8bd5c..4caffdd5fe3 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -77,7 +77,7 @@ static MYSQL_THDVAR_ULONG(repair_threads, PLUGIN_VAR_RQCMDARG,
static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
"The buffer that is allocated when sorting the index when doing "
"a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL,
- 8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1);
+ 8192 * 1024, MIN_SORT_BUFFER + MALLOC_OVERHEAD, SIZE_T_MAX, 1);
static MYSQL_SYSVAR_BOOL(use_mmap, opt_myisam_use_mmap, PLUGIN_VAR_NOCMDARG,
"Use memory mapping for reading and writing MyISAM tables", NULL, NULL, FALSE);
@@ -677,12 +677,6 @@ static const char *ha_myisam_exts[] = {
NullS
};
-const char **ha_myisam::bas_ext() const
-{
- return ha_myisam_exts;
-}
-
-
const char *ha_myisam::index_type(uint key_number)
{
return ((table->key_info[key_number].flags & HA_FULLTEXT) ?
@@ -2209,6 +2203,7 @@ static int myisam_init(void *p)
myisam_hton->create= myisam_create_handler;
myisam_hton->panic= myisam_panic;
myisam_hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
+ myisam_hton->tablefile_extensions= ha_myisam_exts;
mi_killed= mi_killed_in_mariadb;
return 0;
diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h
index b558f504071..63fb0ea5a2a 100644
--- a/storage/myisam/ha_myisam.h
+++ b/storage/myisam/ha_myisam.h
@@ -26,9 +26,6 @@
#include "handler.h" /* handler */
#include "table.h" /* TABLE_SHARE */
-struct TABLE_SHARE;
-typedef struct st_ha_create_information HA_CREATE_INFO;
-
#define HA_RECOVER_DEFAULT 1 /* Automatic recover active */
#define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */
#define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */
@@ -57,7 +54,6 @@ class ha_myisam: public handler
~ha_myisam() {}
handler *clone(const char *name, MEM_ROOT *mem_root);
const char *index_type(uint key_number);
- const char **bas_ext() const;
ulonglong table_flags() const { return int_table_flags; }
int index_init(uint idx, bool sorted);
int index_end();
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index ad97fba2cbb..0792d90cfaa 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -862,19 +863,19 @@ uint mi_get_pointer_length(ulonglong file_length, uint def)
if (file_length) /* If not default */
{
#ifdef NOT_YET_READY_FOR_8_BYTE_POINTERS
- if (file_length >= ULL(1) << 56)
+ if (file_length >= 1ULL << 56)
def=8;
else
#endif
- if (file_length >= ULL(1) << 48)
+ if (file_length >= 1ULL << 48)
def=7;
- else if (file_length >= ULL(1) << 40)
+ else if (file_length >= 1ULL << 40)
def=6;
- else if (file_length >= ULL(1) << 32)
+ else if (file_length >= 1ULL << 32)
def=5;
- else if (file_length >= ULL(1) << 24)
+ else if (file_length >= 1ULL << 24)
def=4;
- else if (file_length >= ULL(1) << 16)
+ else if (file_length >= 1ULL << 16)
def=3;
else
def=2;
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 438057e22df..22225303bae 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -349,6 +349,12 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
else if (pos->type == HA_KEYTYPE_BINARY)
pos->charset= &my_charset_bin;
+ if (!(share->keyinfo[i].flag & HA_SPATIAL) &&
+ pos->start > share->base.reclength)
+ {
+ my_errno= HA_ERR_CRASHED;
+ goto err;
+ }
}
if (share->keyinfo[i].flag & HA_SPATIAL)
{
diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c
index 968cb9624a6..01fa10de7a3 100644
--- a/storage/myisam/mi_search.c
+++ b/storage/myisam/mi_search.c
@@ -949,9 +949,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
("Found too long binary packed key: %u of %u at 0x%lx",
length, keyinfo->maxlength, (long) *page_pos));
DBUG_DUMP("key", *page_pos, 16);
- mi_print_error(keyinfo->share, HA_ERR_CRASHED);
- my_errno=HA_ERR_CRASHED;
- DBUG_RETURN(0); /* Wrong key */
+ goto crashed; /* Wrong key */
}
/* Key is packed against prev key, take prefix from prev key. */
from= key;
@@ -994,6 +992,8 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
if (from == from_end) { from=page; from_end=page_end; }
length+= (uint) ((*key++ = *from++));
}
+ if (length > keyseg->length)
+ goto crashed;
}
else
length=keyseg->length;
@@ -1033,15 +1033,18 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
if (from_end != page_end)
{
DBUG_PRINT("error",("Error when unpacking key"));
- mi_print_error(keyinfo->share, HA_ERR_CRASHED);
- my_errno=HA_ERR_CRASHED;
- DBUG_RETURN(0); /* Error */
+ goto crashed; /* Error */
}
/* Copy data pointer and, if appropriate, key block pointer. */
memcpy((uchar*) key,(uchar*) from,(size_t) length);
*page_pos= from+length;
}
DBUG_RETURN((uint) (key-start_key)+keyseg->length);
+
+ crashed:
+ mi_print_error(keyinfo->share, HA_ERR_CRASHED);
+ my_errno= HA_ERR_CRASHED;
+ DBUG_RETURN(0);
}
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index c8546ee56f5..7be84599d86 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -284,25 +284,25 @@ static struct my_option my_long_options[] =
{ "read_buffer_size", OPT_READ_BUFFER_SIZE, "",
&check_param.read_buffer_length,
&check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
- (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
- INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ READ_BUFFER_INIT, MALLOC_OVERHEAD,
+ INT_MAX32, MALLOC_OVERHEAD, 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE, "",
&check_param.write_buffer_length,
&check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
- (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
- INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ READ_BUFFER_INIT, MALLOC_OVERHEAD,
+ INT_MAX32, MALLOC_OVERHEAD, 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE,
"Deprecated. myisam_sort_buffer_size alias is being used",
&check_param.sort_buffer_length,
&check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG,
- (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
- SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ SORT_BUFFER_INIT, MIN_SORT_BUFFER + MALLOC_OVERHEAD,
+ SIZE_T_MAX, MALLOC_OVERHEAD, 1L, 0},
{ "myisam_sort_buffer_size", OPT_SORT_BUFFER_SIZE,
"Alias of sort_buffer_size parameter",
&check_param.sort_buffer_length,
&check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG,
- (long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
- SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ SORT_BUFFER_INIT, MIN_SORT_BUFFER + MALLOC_OVERHEAD,
+ SIZE_T_MAX, MALLOC_OVERHEAD, 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
&check_param.sort_key_blocks,
&check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 6ce88db87f5..1985a53acf8 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates
+ Copyright (c) 2009, 2013, Monty Program Ab.
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
@@ -1931,7 +1932,7 @@ static int make_huff_decode_table(HUFF_TREE *huff_tree, uint trees)
return 1;
huff_tree->code_len=(uchar*) (huff_tree->code+elements);
make_traverse_code_tree(huff_tree, huff_tree->root,
- 8 * sizeof(ulonglong), LL(0));
+ 8 * sizeof(ulonglong), 0);
}
}
return 0;
diff --git a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff
index 3caf2ad6c3a..07c03fc8d3e 100644
--- a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff
@@ -7,15 +7,15 @@
-DROP TABLE t1;
-CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-INSERT INTO t1 (a) VALUES (1),(2);
--SELECT * FROM t1;
+-SELECT a FROM t1;
-a
-1
-2
-ALTER TABLE t1 DISCARD TABLESPACE;
--SELECT * FROM t1;
+-SELECT a FROM t1;
-ERROR HY000: Got error -1 from storage engine
-ALTER TABLE t1 IMPORT TABLESPACE;
--SELECT * FROM t1;
+-SELECT a FROM t1;
-a
-1
-2
diff --git a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
index 67157754c04..31da75e5ea5 100644
--- a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff
@@ -44,12 +44,12 @@
+# Also, this problem may cause a chain effect (more errors of different kinds in the test).
+# -------------------------------------------
DELETE FROM t2 WHERE a=2;
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
a b
1 c
-2 d
+3 d
- SELECT * FROM t2;
+ SELECT a,b FROM t2;
a b
-1 a
+3 b
@@ -90,7 +90,7 @@
+# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+# Also, this problem may cause a chain effect (more errors of different kinds in the test).
+# -------------------------------------------
- SELECT * FROM t2;
+ SELECT a,b FROM t2;
a b
-5 a
-5 a
@@ -117,7 +117,7 @@
+# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
+# Also, this problem may cause a chain effect (more errors of different kinds in the test).
+# -------------------------------------------
- SELECT * FROM t2;
+ SELECT a,b FROM t2;
a b
+1 a
+1 a
diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
index 8d1434ad2fe..b460b5b4763 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
@@ -1,9 +1,20 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MyISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-13a20
-> 1
+--- suite/storage_engine/trx/cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400
++++ suite/storage_engine/trx/cons_snapshot_repeatable_read.reject 2013-01-23 02:44:05.336711176 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ connect con2,localhost,root,,;
+@@ -11,6 +17,7 @@
+ # If consistent read works on this isolation level (REPEATABLE READ), the following SELECT should not return the value we inserted (1)
+ SELECT a FROM t1;
+ a
++1
+ COMMIT;
+ connection default;
+ disconnect con1;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
index 8d1434ad2fe..d5f1a03084e 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
@@ -1,9 +1,20 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MyISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-13a20
-> 1
+--- suite/storage_engine/trx/cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400
++++ suite/storage_engine/trx/cons_snapshot_serializable.reject 2013-01-23 02:44:05.928703734 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ connect con2,localhost,root,,;
+@@ -11,6 +17,7 @@
+ # If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1)
+ SELECT a FROM t1;
+ a
++1
+ COMMIT;
+ connection default;
+ disconnect con1;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff
index 491b4636796..d7111ab28fc 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff
@@ -22,7 +22,7 @@
ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
a b
-10000 foobar
-10000 foobar
diff --git a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff
index 4619db1d095..cee69633860 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff
@@ -22,7 +22,7 @@
ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
a b
+0 test
1 a
@@ -44,7 +44,7 @@
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
INSERT INTO t1 (b,a) VALUES ('test1',10);
COMMIT;
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
a b
+0 test
1 a
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff
index c0cc9ff9351..94e3fc83e1e 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff
@@ -1,44 +1,94 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MyISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-18a25
-> 1
-25a33,34
-> 1
-> 2
-30a40,43
-> 1
-> 101
-> 102
-> 2
-34a48,49
-> 101
-> 102
-39a55,56
-> 101
-> 102
-44a62,63
-> 101
-> 102
-51a71,72
-> 101
-> 102
-54a76,77
-> 301
-> 302
-58a82,83
-> 101
-> 102
-61a87,88
-> 301
-> 302
-65a93,94
-> 101
-> 102
-68a98,99
-> 301
-> 302
+--- suite/storage_engine/trx/level_read_committed.result 2013-01-22 22:05:05.246633000 +0400
++++ suite/storage_engine/trx/level_read_committed.reject 2013-01-23 02:44:06.572695636 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+@@ -16,6 +22,7 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+ # WARNING: Statement ended with errno 0, errname ''.
+@@ -23,25 +30,37 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ INSERT INTO t1 (a) SELECT a+100 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ connection con1;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ INSERT INTO t1 (a) SELECT a+200 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+@@ -49,23 +68,35 @@
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection default;
+ disconnect con1;
+ disconnect con2;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
index 2a7ddd33c8c..91a2786cb68 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
@@ -1,7 +1,12 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MyISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
+--- suite/storage_engine/trx/level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400
++++ suite/storage_engine/trx/level_read_uncommitted.reject 2013-01-23 02:44:07.196687792 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
index 8b8df802275..2c265900004 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
@@ -1,53 +1,96 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MyISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-18a25
-> 1
-25a33,34
-> 1
-> 2
-27,28c36
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
----
-> # WARNING: Statement ended with errno 0, errname ''.
-31a40,43
-> 1
-> 101
-> 102
-> 2
-35a48,49
-> 101
-> 102
-40a55,56
-> 101
-> 102
-44a61,64
-> 1
-> 101
-> 102
-> 2
-49a70,73
-> 1
-> 101
-> 102
-> 2
-51a76,77
-> 301
-> 302
-55a82,83
-> 101
-> 102
-58a87,88
-> 301
-> 302
-62a93,94
-> 101
-> 102
-65a98,99
-> 301
-> 302
+--- suite/storage_engine/trx/level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400
++++ suite/storage_engine/trx/level_repeatable_read.reject 2013-01-23 02:44:07.776680499 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+@@ -16,6 +22,7 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+ # WARNING: Statement ended with errno 0, errname ''.
+@@ -23,46 +30,73 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ INSERT INTO t1 (a) SELECT a+100 FROM t1;
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
++# WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ INSERT INTO t1 (a) SELECT a+200 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ 201
+ 202
++301
++302
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection default;
+ disconnect con1;
+ disconnect con2;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff
index bbcb8ac1838..7955036e000 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff
@@ -1,69 +1,103 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MyISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-14,15c20
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
----
-> # WARNING: Statement ended with errno 0, errname ''.
-19a25
-> 1
-22,23c28
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
----
-> # WARNING: Statement ended with errno 0, errname ''.
-27a33,34
-> 1
-> 2
-32a40,43
-> 1
-> 101
-> 102
-> 2
-35a47,50
-> 1
-> 101
-> 102
-> 2
-38a54,57
-> 1
-> 101
-> 102
-> 2
-41a61,64
-> 1
-> 101
-> 102
-> 2
-46a70,77
-> 1
-> 101
-> 102
-> 2
-> 201
-> 202
-> 301
-> 302
-49a81,88
-> 1
-> 101
-> 102
-> 2
-> 201
-> 202
-> 301
-> 302
-52a92,99
-> 1
-> 101
-> 102
-> 2
-> 201
-> 202
-> 301
-> 302
+--- suite/storage_engine/trx/level_serializable.result 2013-01-22 22:05:05.246633000 +0400
++++ suite/storage_engine/trx/level_serializable.reject 2013-01-23 02:44:08.384672856 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MyISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+@@ -11,45 +17,86 @@
+ connection con2;
+ BEGIN;
+ INSERT INTO t1 (a) VALUES(1);
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
++# WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
++# WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ INSERT INTO t1 (a) SELECT a+100 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con2;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ COMMIT;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ INSERT INTO t1 (a) SELECT a+200 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
++201
++202
++301
++302
+ COMMIT;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
++201
++202
++301
++302
+ connection con2;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
++201
++202
++301
++302
+ connection default;
+ disconnect con1;
+ disconnect con2;
diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff
index 08e0802a28f..044ce56da43 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff
@@ -13,7 +13,7 @@
@@ -14,16 +20,33 @@
1 a
3 a
- SELECT * FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+ SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+a b
+1 a
@@ -38,7 +38,7 @@
+# -------------------------------------------
connection con1;
COMMIT;
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
a b
-1 a
+1 c
diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
index 97941bbdb13..e1e8d3050e7 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
@@ -25,7 +25,7 @@
+# -------------------------------------------
connection con1;
COMMIT;
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
a b
-1 a
+1 c
diff --git a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff
index 131286d613c..ca3b77e7cec 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff
@@ -31,7 +31,7 @@
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
UPDATE t1 SET b = 'upd' WHERE a = 10050;
COMMIT;
- SELECT * FROM t1;
+ SELECT a,b FROM t1;
a b
10050 upd
10050 upd
diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff
index f445ad909f3..73c3796b13b 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff
@@ -12,21 +12,21 @@
connect con2,localhost,root,,;
@@ -9,17 +15,22 @@
connection con1;
- SELECT * FROM t1;
+ SELECT a FROM t1;
a
+1
connection con2;
INSERT INTO t1 (a) VALUES (2);
XA END 'xa1';
connection con1;
- SELECT * FROM t1;
+ SELECT a FROM t1;
a
+1
+2
connection con2;
XA PREPARE 'xa1';
connection con1;
- SELECT * FROM t1;
+ SELECT a FROM t1;
a
+1
+2
@@ -78,7 +78,7 @@
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
connection con1;
- SELECT * FROM t1;
+ SELECT a FROM t1;
a
@@ -93,4 +114,6 @@
2
diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff
index f4629fb19a0..e637643d59d 100644
--- a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff
+++ b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff
@@ -20,7 +20,7 @@
+ERROR XAE04: XAER_NOTA: Unknown XID
XA COMMIT 'xa2';
+ERROR XAE04: XAER_NOTA: Unknown XID
- SELECT * FROM t1;
+ SELECT a FROM t1;
a
+1
+2
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 7bb7990d9a3..41bba55c397 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -171,12 +171,6 @@ extern "C" void myrg_print_wrong_table(const char *table_name)
}
-const char **ha_myisammrg::bas_ext() const
-{
- return ha_myisammrg_exts;
-}
-
-
const char *ha_myisammrg::index_type(uint key_number)
{
return ((table->key_info[key_number].flags & HA_FULLTEXT) ?
@@ -331,6 +325,19 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param,
CPP_UNNAMED_NS_END
+/*
+ Set external_ref for the child MyISAM tables. They need this to be set in
+ order to check for killed status.
+*/
+static void myrg_set_external_ref(MYRG_INFO *m_info, void *ext_ref_arg)
+{
+ int i;
+ for (i= 0; i < (int)m_info->tables; i++)
+ {
+ m_info->open_tables[i].table->external_ref= ext_ref_arg;
+ }
+}
+
/**
Open a MERGE parent table, but not its children.
@@ -394,6 +401,7 @@ int ha_myisammrg::open(const char *name, int mode __attribute__((unused)),
}
file->children_attached= TRUE;
+ myrg_set_external_ref(file, (void*)table);
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
}
@@ -1697,6 +1705,7 @@ static int myisammrg_init(void *p)
myisammrg_hton->create= myisammrg_create_handler;
myisammrg_hton->panic= myisammrg_panic;
myisammrg_hton->flags= HTON_NO_PARTITION;
+ myisammrg_hton->tablefile_extensions= ha_myisammrg_exts;
return 0;
}
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index 8007e7d04e8..455819c5526 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -82,7 +82,6 @@ public:
ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg);
~ha_myisammrg();
- const char **bas_ext() const;
const char *index_type(uint key_number);
ulonglong table_flags() const
{
diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff
index 447a38a5b2b..b2ec2129d04 100644
--- a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff
@@ -1,68 +1,151 @@
-11c11
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-19c19
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-27c27
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-35c35
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-43c43
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-51c51
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-59c59
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-67c67
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-75c75
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-82c82
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-91c91
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
-100c100
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-107c107
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-122c122
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-130c130
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-138c138
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-146c146
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- alter_table.result 2013-01-22 22:05:05.246633000 +0400
++++ alter_table.reject 2013-01-23 02:50:10.652118538 +0400
+@@ -8,7 +8,7 @@
+ `a` int(11) DEFAULT NULL,
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 ALTER COLUMN a SET DEFAULT '0';
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -16,7 +16,7 @@
+ `a` int(11) DEFAULT '0',
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 ALTER a DROP DEFAULT;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -24,7 +24,7 @@
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 CHANGE COLUMN b b1 <CHAR_COLUMN> FIRST;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -32,7 +32,7 @@
+ `b1` char(8) DEFAULT NULL,
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 CHANGE b1 b <INT_COLUMN> AFTER c;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -40,7 +40,7 @@
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 CHANGE b b <CHAR_COLUMN>;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -48,7 +48,7 @@
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 MODIFY COLUMN b <INT_COLUMN>;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -56,7 +56,7 @@
+ `a` int(11),
+ `c` char(8) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 MODIFY COLUMN b <CHAR_COLUMN> FIRST;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -64,7 +64,7 @@
+ `b` char(8) DEFAULT NULL,
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 MODIFY COLUMN b <INT_COLUMN> AFTER a;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -72,14 +72,14 @@
+ `a` int(11),
+ `b` int(11) DEFAULT NULL,
+ `c` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 DROP COLUMN b;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 RENAME TO t2;
+ SHOW CREATE TABLE t1;
+ ERROR 42S02: Table 'test.t1' doesn't exist
+@@ -88,7 +88,7 @@
+ t2 CREATE TABLE `t2` (
+ `a` int(11),
+ `c` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
+ DROP TABLE t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,5),(2,2),(4,3);
+@@ -97,14 +97,14 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 ORDER BY b ASC, a DESC;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ SELECT a,b FROM t1;
+ a b
+ 2 2
+@@ -119,7 +119,7 @@
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) COLLATE latin1_general_cs DEFAULT NULL,
+ `c` char(8) COLLATE latin1_general_cs DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -127,7 +127,7 @@
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+ `c` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 DEFAULT CHARACTER SET = latin1 COLLATE latin1_general_ci;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -135,7 +135,7 @@
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) CHARACTER SET utf8 DEFAULT NULL,
+ `c` char(8) CHARACTER SET utf8 DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 FORCE;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+@@ -143,5 +143,5 @@
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) CHARACTER SET utf8 DEFAULT NULL,
+ `c` char(8) CHARACTER SET utf8 DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff
index cfc821582ed..1091d6250b9 100644
--- a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff
@@ -1,27 +1,32 @@
-4,18c4,13
-< DROP TABLE t1;
-< CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< INSERT INTO t1 (a) VALUES (1),(2);
-< SELECT * FROM t1;
-< a
-< 1
-< 2
-< ALTER TABLE t1 DISCARD TABLESPACE;
-< SELECT * FROM t1;
-< ERROR HY000: Got error -1 from storage engine
-< ALTER TABLE t1 IMPORT TABLESPACE;
-< SELECT * FROM t1;
-< a
-< 1
-< 2
----
-> ERROR HY000: 'test.t1' is not BASE TABLE
-> # ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ ALTER TABLE t1 DISCARD TABLESPACE ]
-> # The statement|command finished with ER_WRONG_OBJECT.
-> # Tablespace operations or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- alter_tablespace.result 2013-01-22 22:05:05.246633000 +0400
++++ alter_tablespace.reject 2013-01-23 02:50:11.288110543 +0400
+@@ -1,19 +1,14 @@
+ DROP TABLE IF EXISTS t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ ALTER TABLE t1 DISCARD TABLESPACE;
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-INSERT INTO t1 (a) VALUES (1),(2);
+-SELECT a FROM t1;
+-a
+-1
+-2
+-ALTER TABLE t1 DISCARD TABLESPACE;
+-SELECT a FROM t1;
+-ERROR HY000: Got error -1 from storage engine
+-ALTER TABLE t1 IMPORT TABLESPACE;
+-SELECT a FROM t1;
+-a
+-1
+-2
++ERROR HY000: 'test.t1' is not BASE TABLE
++# ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ ALTER TABLE t1 DISCARD TABLESPACE ]
++# The statement|command finished with ER_WRONG_OBJECT.
++# Tablespace operations or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff
index 139bcc00a81..9854a986cc5 100644
--- a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff
@@ -1,22 +1,34 @@
-8c8
-< test.t1 analyze status OK
----
-> test.t1 analyze note The storage engine for the table doesn't support analyze
-12c12
-< test.t2 analyze status OK
----
-> test.t2 analyze note The storage engine for the table doesn't support analyze
-17,18c17,18
-< test.t1 analyze status OK
-< test.t2 analyze status OK
----
-> test.t1 analyze note The storage engine for the table doesn't support analyze
-> test.t2 analyze note The storage engine for the table doesn't support analyze
-24c24
-< test.t1 analyze status OK
----
-> test.t1 analyze note The storage engine for the table doesn't support analyze
-28c28
-< test.t1 analyze status OK
----
-> test.t1 analyze note The storage engine for the table doesn't support analyze
+--- analyze_table.result 2013-01-22 22:05:05.246633000 +0400
++++ analyze_table.reject 2013-01-23 02:50:11.912102699 +0400
+@@ -5,25 +5,25 @@
+ INSERT INTO t1 (a,b) VALUES (3,'c');
+ ANALYZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
++test.t1 analyze note The storage engine for the table doesn't support analyze
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 analyze status OK
++test.t2 analyze note The storage engine for the table doesn't support analyze
+ INSERT INTO t1 (a,b) VALUES (5,'e');
+ INSERT INTO t2 (a,b) VALUES (6,'f');
+ ANALYZE LOCAL TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
+-test.t2 analyze status OK
++test.t1 analyze note The storage engine for the table doesn't support analyze
++test.t2 analyze note The storage engine for the table doesn't support analyze
+ DROP TABLE t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a) VALUES (1),(2),(4),(7);
+ ANALYZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
++test.t1 analyze note The storage engine for the table doesn't support analyze
+ INSERT INTO t1 (a) VALUES (8),(10),(11),(12);
+ ANALYZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
++test.t1 analyze note The storage engine for the table doesn't support analyze
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff
index e9095aa3944..68264bdeb8d 100644
--- a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff
@@ -1,34 +1,64 @@
-9c9
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-55c55
-< t1 <STORAGE_ENGINE> # # # # # # # # 6 # # # # # # #
----
-> t1 <STORAGE_ENGINE> # # # # # # # # 0 # # # # # # #
-62c62
-< t1 # # # # # # # # # 8 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-81c81
-< t1 # # # # # # # # # 10 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-85c85
-< t1 # # # # # # # # # 21 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-106c106
-< t1 # # # # # # # # # 22 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-128,129c128,129
-< 100 a
-< 101 b
----
-> 1 a
-> 2 b
-132c132
-< 100
----
-> 1
+--- autoincrement.result 2013-01-22 22:05:05.246633000 +0400
++++ autoincrement.reject 2013-01-23 02:50:12.848090932 +0400
+@@ -6,7 +6,7 @@
+ `a` int(11) NOT NULL AUTO_INCREMENT,
+ `b` char(8) DEFAULT NULL,
+ KEY `a` (`a`)
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ INSERT INTO t1 (b) VALUES ('a'),('b');
+ SELECT a,b FROM t1 ORDER BY a;
+ a b
+@@ -52,14 +52,14 @@
+ SET sql_mode = '<INITIAL_SQL_MODE>';
+ SHOW TABLE STATUS FROM test LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 <STORAGE_ENGINE> # # # # # # # # 6 # # # # # # #
++t1 <STORAGE_ENGINE> # # # # # # # # 0 # # # # # # #
+ INSERT INTO t1 (a,b) VALUES (6,'g'),(7,'h');
+ SELECT LAST_INSERT_ID();
+ LAST_INSERT_ID()
+ 5
+ SHOW TABLE STATUS FROM test LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 8 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ INSERT INTO t1 (a,b) VALUES (NULL,'i'),(9,'j');
+ SELECT a,b FROM t1 ORDER BY a;
+ a b
+@@ -78,11 +78,11 @@
+ 8
+ SHOW TABLE STATUS FROM test LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 10 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ INSERT INTO t1 (a,b) VALUES (20,'k');
+ SHOW TABLE STATUS FROM test LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 21 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ INSERT INTO t1 (a,b) VALUES (NULL,'l');
+ SELECT a,b FROM t1 ORDER BY a;
+ a b
+@@ -103,7 +103,7 @@
+ 21
+ SHOW TABLE STATUS FROM test LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 22 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ INSERT INTO t1 (a,b) VALUES (-5,'m');
+ SELECT a,b FROM t1 ORDER BY a;
+ a b
+@@ -125,9 +125,9 @@
+ INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b');
+ SELECT a,b FROM t1;
+ a b
+-100 a
+-101 b
++1 a
++2 b
+ SELECT LAST_INSERT_ID();
+ LAST_INSERT_ID()
+-100
++1
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff
index e10b22a8e66..612c8d38311 100644
--- a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff
@@ -1,46 +1,71 @@
-15,16c15,16
-< test.t1 assign_to_keycache status OK
-< test.t2 assign_to_keycache status OK
----
-> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
-> test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
-19,20c19,20
-< test.t1 preload_keys status OK
-< test.t2 preload_keys status OK
----
-> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
-> test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
-25,26c25,26
-< test.t1 preload_keys status OK
-< test.t2 preload_keys status OK
----
-> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
-> test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
-31c31
-< test.t1 preload_keys status OK
----
-> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
-35c35
-< test.t1 assign_to_keycache status OK
----
-> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
-39c39
-< test.t1 preload_keys status OK
----
-> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
-50c50
-< test.t1 assign_to_keycache status OK
----
-> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
-54c54
-< test.t1 preload_keys status OK
----
-> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
-62c62
-< test.t1 assign_to_keycache status OK
----
-> test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
-66c66
-< test.t1 preload_keys status OK
----
-> test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+--- cache_index.result 2013-01-22 22:05:05.246633000 +0400
++++ cache_index.reject 2013-01-23 02:50:13.468083137 +0400
+@@ -12,31 +12,31 @@
+ SET GLOBAL <CACHE_NAME>.key_buffer_size=128*1024;
+ CACHE INDEX t1 INDEX (a), t2 IN <CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
+-test.t2 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
++test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ LOAD INDEX INTO CACHE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
+-test.t2 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
++test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ SET GLOBAL <CACHE_NAME>.key_buffer_size=8*1024;
+ LOAD INDEX INTO CACHE t1, t2 IGNORE LEAVES;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
+-test.t2 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
++test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
+ SET GLOBAL <CACHE_NAME>.key_cache_age_threshold = 100, <CACHE_NAME>.key_cache_block_size = 512, <CACHE_NAME>.key_cache_division_limit = 1, <CACHE_NAME>.key_cache_segments=2;
+ INSERT INTO t1 (a,b) VALUES (5,'e'),(6,'f');
+ LOAD INDEX INTO CACHE t1;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ SET GLOBAL new_<CACHE_NAME>.key_buffer_size=128*1024;
+ CACHE INDEX t1 IN new_<CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ LOAD INDEX INTO CACHE t1 IGNORE LEAVES;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ INSERT INTO t1 (a,b) VALUES (9,'i');
+ DROP TABLE t2;
+ DROP TABLE t1;
+@@ -47,11 +47,11 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ CACHE INDEX t1 IN <CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ LOAD INDEX INTO CACHE t1;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -59,11 +59,11 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ CACHE INDEX t1 IN <CACHE_NAME>;
+ Table Op Msg_type Msg_text
+-test.t1 assign_to_keycache status OK
++test.t1 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ LOAD INDEX INTO CACHE t1;
+ Table Op Msg_type Msg_text
+-test.t1 preload_keys status OK
++test.t1 preload_keys note The storage engine for the table doesn't support preload_keys
+ DROP TABLE t1;
+ SET GLOBAL <CACHE_NAME>.key_buffer_size=0;
+ SET GLOBAL new_<CACHE_NAME>.key_buffer_size=0;
diff --git a/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/storage/myisammrg/mysql-test/storage_engine/char_indexes.rdiff
+++ /dev/null
diff --git a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff
index 1710cc18fea..f09aec971a9 100644
--- a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff
@@ -1,6 +1,13 @@
-14,15c14,15
-< test.t1 4272806499
-< test.t2 0
----
-> test.t1 NULL
-> test.t2 NULL
+--- checksum_table_live.result 2013-01-22 22:05:05.246633000 +0400
++++ checksum_table_live.reject 2013-01-23 02:50:14.440070917 +0400
+@@ -11,8 +11,8 @@
+ test.t1 4272806499
+ CHECKSUM TABLE t1, t2 QUICK;
+ Table Checksum
+-test.t1 4272806499
+-test.t2 0
++test.t1 NULL
++test.t2 NULL
+ CHECKSUM TABLE t1, t2 EXTENDED;
+ Table Checksum
+ test.t1 4272806499
diff --git a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff
index 5d3578ad3cd..585e5c915ba 100644
--- a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff
@@ -1,37 +1,57 @@
-7c7
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-16c16
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-22c22
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-27,36c27,35
-< SHOW CREATE TABLE t1;
-< Table Create Table
-< t1 CREATE TABLE `t1` (
-< `1` bigint(20) NOT NULL DEFAULT '0'
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
-< SELECT * FROM t1;
-< 1
-< 1
-< 2
-< DROP TABLE t1;
----
-> ERROR HY000: 'test.t1' is not BASE TABLE
-> # ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_WRONG_OBJECT.
-> # CREATE TABLE .. AS SELECT or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-43c42
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- create_table.result 2013-01-22 22:05:05.246633000 +0400
++++ create_table.reject 2013-01-23 02:50:19.544006752 +0400
+@@ -4,7 +4,7 @@
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ CREATE TABLE IF NOT EXISTS t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ Warnings:
+ Note 1050 Table 't1' already exists
+@@ -13,33 +13,32 @@
+ Table Create Table
+ t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ CREATE TEMPORARY TABLE t2 LIKE t1;
+ SHOW CREATE TABLE t2;
+ Table Create Table
+ t2 CREATE TEMPORARY TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TEMPORARY TABLE t2;
+ DROP TABLE t2;
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AS SELECT 1 UNION SELECT 2;
+-SHOW CREATE TABLE t1;
+-Table Create Table
+-t1 CREATE TABLE `t1` (
+- `1` bigint(20) NOT NULL DEFAULT '0'
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+-SELECT * FROM t1;
+-1
+-1
+-2
+-DROP TABLE t1;
++ERROR HY000: 'test.t1' is not BASE TABLE
++# ERROR: Statement ended with errno 1347, errname ER_WRONG_OBJECT (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_WRONG_OBJECT.
++# CREATE TABLE .. AS SELECT or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ SET storage_engine = <STORAGE_ENGINE>;
+ CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ FLUSH LOGS;
+ DROP TABLE IF EXISTS t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
index 7362bd282a5..f716b7f2fe8 100644
--- a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff
@@ -1,138 +1,147 @@
-15,17c15,16
-< KEY `a` (`a`),
-< CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> KEY `a` (`a`)
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
-19c18,25
-< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
----
-> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command succeeded unexpectedly.
-> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-23c29,36
-< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
----
-> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command succeeded unexpectedly.
-> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-25c38
-< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
----
-> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
-27c40,47
-< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
----
-> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command succeeded unexpectedly.
-> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-32c52
-< 2 d
----
-> 3 d
-35c55,56
-< 1 a
----
-> 3 b
-> 3 b
-37c58,65
-< ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
----
-> # ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command succeeded unexpectedly.
-> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-49,51c77,78
-< KEY `a` (`a`),
-< CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> KEY `a` (`a`)
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
-53c80
-< ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
----
-> # ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
-54a82
-> ERROR 42S02: Table 'test.t1' doesn't exist
-56a85,92
-> ERROR 42S02: Table 'test.t1' doesn't exist
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_NO_SUCH_TABLE.
-> # UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-59,64c95,104
-< 5 a
-< 5 a
-< 5 b
-< 5 c
-< 5 d
-< 5 e
----
-> 1 a
-> 1 a
-> 2 b
-> 2 b
-> 3 a
-> 3 c
-> 3 c
-> 4 d
-> 4 d
-> 4 e
-65a106,113
-> ERROR 42S02: Table 'test.t1' doesn't exist
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_NO_SUCH_TABLE.
-> # DELETE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-67a116,125
-> 1 a
-> 1 a
-> 2 b
-> 2 b
-> 3 a
-> 3 c
-> 3 c
-> 4 d
-> 4 d
-> 4 e
-69c127,135
-< ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`))
----
-> ERROR 42S02: Table 'test.t1' doesn't exist
-> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TRUNCATE_ILLEGAL_FK)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_NO_SUCH_TABLE.
-> # Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-71a138
-> ERROR 42S02: Unknown table 't1'
+--- foreign_keys.result 2013-01-22 22:05:05.246633000 +0400
++++ foreign_keys.reject 2013-01-23 02:50:28.187898084 +0400
+@@ -12,29 +12,57 @@
+ t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+- KEY `a` (`a`),
+- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++ KEY `a` (`a`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'d');
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b');
+ UPDATE t2 SET a=a+1;
+-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ UPDATE t1 SET a=3 WHERE a=2;
+-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
+ DELETE FROM t1 WHERE a=2;
+-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED_2)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DELETE FROM t2 WHERE a=2;
+ SELECT a,b FROM t1;
+ a b
+ 1 c
+-2 d
++3 d
+ SELECT a,b FROM t2;
+ a b
+-1 a
++3 b
++3 b
+ DROP TABLE t1;
+-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
++# ERROR: Statement succeeded (expected results: ER_ROW_IS_REFERENCED)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t2;
+ CREATE TABLE t2 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -46,26 +74,65 @@
+ t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL,
+- KEY `a` (`a`),
+- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++ KEY `a` (`a`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t2`)
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d');
+-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) ON DELETE CASCADE ON UPDATE CASCADE)
++# ERROR: Statement succeeded (expected results: ER_NO_REFERENCED_ROW_2)
+ INSERT INTO t1 (a,b) VALUES (3,'a'),(4,'a');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(4,'e'),(3,'a');
+ UPDATE t1 SET a=a+1;
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_NO_SUCH_TABLE.
++# UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ SELECT a,b FROM t2;
+ a b
+-5 a
+-5 a
+-5 b
+-5 c
+-5 d
+-5 e
++1 a
++1 a
++2 b
++2 b
++3 a
++3 c
++3 c
++4 d
++4 d
++4 e
+ DELETE FROM t1 WHERE b='a' LIMIT 2;
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_NO_SUCH_TABLE.
++# DELETE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ SELECT a,b FROM t2;
+ a b
++1 a
++1 a
++2 b
++2 b
++3 a
++3 c
++3 c
++4 d
++4 d
++4 e
+ TRUNCATE TABLE t1;
+-ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `test`.`t1` (`a`))
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TRUNCATE_ILLEGAL_FK)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_NO_SUCH_TABLE.
++# Foreign keys or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t2;
+ DROP TABLE t1;
++ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff
index 262370f01ed..7234cdfd2fa 100644
--- a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff
@@ -1,142 +1,150 @@
-7,64c7,15
-< SHOW INDEXES IN t1;
-< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-< t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
-< INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
-< If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
-< For developers who want to code on MariaDB or MySQL
-< * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
-< o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
-< o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
-< * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
-< o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
-< For MariaDB / MySQL end users
-< * MariaDB Crash Course by Ben Forta
-< o First MariaDB book!
-< o For people who want to learn SQL and the basics of MariaDB.
-< o Now shipping. Purchase at Amazon.com or your favorite bookseller.
-< * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
-< o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
-< o Free to read in the Knowledgebase!
-< * MySQL (4th Edition) by Paul DuBois
-< o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
-< * MySQL Cookbook by Paul DuBois
-< o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
-< * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
-< o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
-<
-< * MySQL Admin Cookbook
-< o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
-<
-< * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
-< o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
-< 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
-<
-< 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
-< 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
-< 3. With MariaDB everyone has access to the latest code.
-< 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
-< 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
-< The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
-< ), ('text2','test1','test2');
-< SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
-< v0
-< INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
-< SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
-< v0 rating
-< INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
-< SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
-< v0 rating
-< text4 1.3705332279205322
-< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
-< v0
-< text1
-< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
-< v0
-< SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION);
-< v0 rating
-< text1 178.11756896972656
-< DROP TABLE t1;
----
-> ERROR HY000: The used table type doesn't support FULLTEXT indexes
-> # ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
-> # FULLTEXT indexes or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-71,132c22,30
-< SHOW INDEXES IN t1;
-< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-< t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
-< t1 1 v1_v2 1 v1 # # NULL NULL YES FULLTEXT
-< t1 1 v1_v2 2 v2 # # NULL NULL YES FULLTEXT
-< INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
-< If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
-< For developers who want to code on MariaDB or MySQL
-< * Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
-< o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
-< o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
-< * MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
-< o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
-< For MariaDB / MySQL end users
-< * MariaDB Crash Course by Ben Forta
-< o First MariaDB book!
-< o For people who want to learn SQL and the basics of MariaDB.
-< o Now shipping. Purchase at Amazon.com or your favorite bookseller.
-< * SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
-< o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
-< o Free to read in the Knowledgebase!
-< * MySQL (4th Edition) by Paul DuBois
-< o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
-< * MySQL Cookbook by Paul DuBois
-< o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
-< * High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
-< o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
-<
-< * MySQL Admin Cookbook
-< o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
-<
-< * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
-< o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
-< 'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
-<
-< 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
-< 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
-< 3. With MariaDB everyone has access to the latest code.
-< 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
-< 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
-< The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
-< ), ('text2','test1','test2');
-< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
-< v0
-< INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
-< SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
-< v0 rating
-< text1 0.2809644043445587
-< INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
-< SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
-< v0 rating
-< text4 1.3705332279205322
-< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
-< v0
-< text1
-< SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
-< v0
-< SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION);
-< v0 rating
-< text1 190.56150817871094
-< text4 1.1758291721343994
-< DROP TABLE t1;
----
-> ERROR HY000: The used table type doesn't support FULLTEXT indexes
-> # ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
-> # FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- fulltext_search.result 2013-01-22 22:05:05.246633000 +0400
++++ fulltext_search.reject 2013-01-23 02:50:28.807890289 +0400
+@@ -4,129 +4,27 @@
+ v2 TEXT <CUSTOM_COL_OPTIONS>,
+ FULLTEXT v1 (v1)
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW INDEXES IN t1;
+-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+-If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+-For developers who want to code on MariaDB or MySQL
+-* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+-o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+-o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+-* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+-o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+-For MariaDB / MySQL end users
+-* MariaDB Crash Course by Ben Forta
+-o First MariaDB book!
+-o For people who want to learn SQL and the basics of MariaDB.
+-o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+-* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+-o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+-o Free to read in the Knowledgebase!
+-* MySQL (4th Edition) by Paul DuBois
+-o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+-* MySQL Cookbook by Paul DuBois
+-o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+-* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+-o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+-
+- * MySQL Admin Cookbook
+- o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+-
+- * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+- o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+-'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+-
+- 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+- 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+- 3. With MariaDB everyone has access to the latest code.
+- 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+- 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+-The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+- ), ('text2','test1','test2');
+-SELECT v0 FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+-SELECT v0, MATCH(v1) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0 rating
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+-SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+-v0 rating
+-text4 1.3705332279205322
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-text1
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-SELECT v0, MATCH(v1) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1) AGAINST ('database' WITH QUERY EXPANSION);
+-v0 rating
+-text1 178.11756896972656
+-DROP TABLE t1;
++ERROR HY000: The used table type doesn't support FULLTEXT indexes
++# ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
++# FULLTEXT indexes or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (v0 VARCHAR(64) <CUSTOM_COL_OPTIONS>,
+ v1 VARCHAR(16384) <CUSTOM_COL_OPTIONS>,
+ v2 TEXT <CUSTOM_COL_OPTIONS>,
+ FULLTEXT v1 (v1),
+ FULLTEXT v1_v2 (v1,v2)
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW INDEXES IN t1;
+-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 v1 1 v1 # # NULL NULL YES FULLTEXT
+-t1 1 v1_v2 1 v1 # # NULL NULL YES FULLTEXT
+-t1 1 v1_v2 2 v2 # # NULL NULL YES FULLTEXT
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text1','Here is a list of recommended books on MariaDB and MySQL. We\'ve provided links to Amazon.com here for convenience, but they can be found at many other bookstores, both online and off.
+-If you want to have your favorite MySQL / MariaDB book listed here, please leave a comment.
+-For developers who want to code on MariaDB or MySQL
+-* Understanding MySQL Internals by Sasha Pachev, former MySQL developer at MySQL AB.
+-o This is the only book we know about that describes the internals of MariaDB / MySQL. A must have for anyone who wants to understand and develop on MariaDB!
+-o Not all topics are covered and some parts are slightly outdated, but still the best book on this topic.
+-* MySQL 5.1 Plugin Development by Sergei Golubchik and Andrew Hutchings
+-o A must read for anyone wanting to write a plugin for MariaDB, written by the Sergei who designed the plugin interface for MySQL and MariaDB!
+-For MariaDB / MySQL end users
+-* MariaDB Crash Course by Ben Forta
+-o First MariaDB book!
+-o For people who want to learn SQL and the basics of MariaDB.
+-o Now shipping. Purchase at Amazon.com or your favorite bookseller.
+-* SQL-99 Complete, Really by Peter Gulutzan & Trudy Pelzer.
+-o Everything you wanted to know about the SQL 99 standard. Excellent reference book!
+-o Free to read in the Knowledgebase!
+-* MySQL (4th Edition) by Paul DuBois
+-o The \'default\' book to read if you wont to learn to use MySQL / MariaDB.
+-* MySQL Cookbook by Paul DuBois
+-o A lot of examples of how to use MySQL. As with all of Paul\'s books, it\'s worth its weight in gold and even enjoyable reading for such a \'dry\' subject.
+-* High Performance MySQL, Second Edition, By Baron Schwartz, Peter Zaitsev, Vadim Tkachenko, Jeremy D. Zawodny, Arjen Lentz, Derek J. Balling, et al.
+-o \"High Performance MySQL is the definitive guide to building fast, reliable systems with MySQL. Written by noted experts with years of real-world experience building very large systems, this book covers every aspect of MySQL performance in detail, and focuses on robustness, security, and data integrity. Learn advanced techniques in depth so you can bring out MySQL\'s full power.\" (From the book description at O\'Reilly)
+-
+- * MySQL Admin Cookbook
+- o A quick step-by-step guide for MySQL users and database administrators to tackle real-world challenges with MySQL configuration and administration
+-
+- * MySQL 5.0 Certification Study Guide, By Paul DuBois, Stefan Hinz, Carsten Pedersen
+- o This is the official guide to cover the passing of the two MySQL Certification examinations. It is valid till version 5.0 of the server, so while it misses all the features available in MySQL 5.1 and greater (including MariaDB 5.1 and greater), it provides a good basic understanding of MySQL for the end-user. ',
+-'There are several reasons why contributing code is one of the easiest and most rewarding ways to contribute to MariaDB:
+-
+- 1. We are very responsive toward reviews of submitted code and as soon as the review is done, the submitted code is merged into an existing MariaDB tree and made available to everyone, not just select customers.
+- 2. Code reviews are performed by the MariaDB core development team and the quality, detail, and timeliness of our reviews are better than you will find elsewhere.
+- 3. With MariaDB everyone has access to the latest code.
+- 4. If a patch is very safe and/or very useful we are willing to push it into the stable code (as long as it can\'t break any existing applications). We are willing to do this to ensure the freedom to add small, needed fixes on a stable release so users don\'t have to wait a year for something to be added which is critical to their business.
+- 5. If you are an active contributor, you can become a member of maria-captains, even if you aren\'t working for Monty Program Ab. All captains have the same rights as any other captain to accept and reject patches. Our development model is truly open for everyone.
+-The Contributing Code page details many of the actual steps involved in working with the MariaDB source code. It\'s important that you use the same tools and submit patches in the same way as other developers to keep development running smoothly.'
+- ), ('text2','test1','test2');
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text3','test','test');
+-SELECT v0, MATCH(v1,v2) AGAINST('contributing' IN NATURAL LANGUAGE MODE) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('contributing' IN NATURAL LANGUAGE MODE);
+-v0 rating
+-text1 0.2809644043445587
+-INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test');
+-SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing');
+-v0 rating
+-text4 1.3705332279205322
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-test1 +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-text1
+-SELECT v0 FROM t1 WHERE MATCH(v1,v2) AGAINST ('-patch +critical +Cook*' IN BOOLEAN MODE);
+-v0
+-SELECT v0, MATCH(v1,v2) AGAINST('database' WITH QUERY EXPANSION) AS rating FROM t1 WHERE MATCH(v1,v2) AGAINST ('database' WITH QUERY EXPANSION);
+-v0 rating
+-text1 190.56150817871094
+-text4 1.1758291721343994
+-DROP TABLE t1;
++ERROR HY000: The used table type doesn't support FULLTEXT indexes
++# ERROR: Statement ended with errno 1214, errname ER_TABLE_CANT_HANDLE_FT (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_TABLE_CANT_HANDLE_FT.
++# FULLTEXT indexes or multiple keys or VARCHAR|TEXT data types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff
index f0c01085ad9..c56cfae0e3a 100644
--- a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff
@@ -1,79 +1,88 @@
-5,47c5,12
-< HANDLER t1 READ FIRST;
-< ERROR 42S02: Unknown table 't1' in HANDLER
-< HANDLER h1 READ FIRST;
-< a b
-< foobar 1000
-< HANDLER h1 READ NEXT;
-< a b
-< a 1
-< HANDLER h1 READ FIRST WHERE a < 'foo';
-< a b
-< a 1
-< HANDLER h1 READ NEXT;
-< a b
-< bar 200
-< HANDLER h1 READ NEXT;
-< a b
-< foo 100
-< HANDLER h1 READ NEXT;
-< a b
-< HANDLER h1 READ FIRST LIMIT 2;
-< a b
-< foobar 1000
-< a 1
-< HANDLER h1 READ NEXT;
-< a b
-< bar 200
-< HANDLER h1 READ NEXT WHERE b>500 LIMIT 2;
-< a b
-< HANDLER t1 OPEN;
-< HANDLER h1 READ FIRST WHERE b>500 LIMIT 5;
-< a b
-< foobar 1000
-< HANDLER t1 READ NEXT;
-< a b
-< foobar 1000
-< HANDLER h1 READ NEXT WHERE b<100;
-< a b
-< HANDLER t1 CLOSE;
-< HANDLER h1 READ FIRST;
-< a b
-< foobar 1000
-< HANDLER t1 CLOSE;
-< ERROR 42S02: Unknown table 't1' in HANDLER
----
-> ERROR HY000: Table storage engine for 'h1' doesn't have this option
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_ILLEGAL_HA.
-> # Functionality or the syntax or the mix could be unsupported.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-54,76c19
-< HANDLER h1 READ a = (100);
-< a b
-< 100 f
-< HANDLER h1 READ a <= (100) WHERE b < 'f';
-< a b
-< 2 c
-< HANDLER h1 READ a > (2) WHERE b IS NOT NULL LIMIT 2;
-< a b
-< 100 f
-< 101 b
-< HANDLER h1 READ a FIRST;
-< a b
-< 1 a
-< HANDLER h1 READ a LAST;
-< a b
-< 200 b
-< HANDLER h1 READ a PREV;
-< a b
-< 101 b
-< HANDLER h1 READ a NEXT;
-< a b
-< 200 b
-< HANDLER h1 CLOSE;
----
-> ERROR HY000: Table storage engine for 'h1' doesn't have this option
+--- handler.result 2013-01-22 22:05:05.246633000 +0400
++++ handler.reject 2013-01-23 02:50:29.411882697 +0400
+@@ -2,76 +2,19 @@
+ CREATE TABLE t1 (a <CHAR_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES ('foobar',1000),('a',1),('bar',200),('foo',100);
+ HANDLER t1 OPEN AS h1;
+-HANDLER t1 READ FIRST;
+-ERROR 42S02: Unknown table 't1' in HANDLER
+-HANDLER h1 READ FIRST;
+-a b
+-foobar 1000
+-HANDLER h1 READ NEXT;
+-a b
+-a 1
+-HANDLER h1 READ FIRST WHERE a < 'foo';
+-a b
+-a 1
+-HANDLER h1 READ NEXT;
+-a b
+-bar 200
+-HANDLER h1 READ NEXT;
+-a b
+-foo 100
+-HANDLER h1 READ NEXT;
+-a b
+-HANDLER h1 READ FIRST LIMIT 2;
+-a b
+-foobar 1000
+-a 1
+-HANDLER h1 READ NEXT;
+-a b
+-bar 200
+-HANDLER h1 READ NEXT WHERE b>500 LIMIT 2;
+-a b
+-HANDLER t1 OPEN;
+-HANDLER h1 READ FIRST WHERE b>500 LIMIT 5;
+-a b
+-foobar 1000
+-HANDLER t1 READ NEXT;
+-a b
+-foobar 1000
+-HANDLER h1 READ NEXT WHERE b<100;
+-a b
+-HANDLER t1 CLOSE;
+-HANDLER h1 READ FIRST;
+-a b
+-foobar 1000
+-HANDLER t1 CLOSE;
+-ERROR 42S02: Unknown table 't1' in HANDLER
++ERROR HY000: Table storage engine for 'h1' doesn't have this option
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_ILLEGAL_HA.
++# Functionality or the syntax or the mix could be unsupported.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t1;
+ HANDLER h1 CLOSE;
+ ERROR 42S02: Unknown table 'h1' in HANDLER
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (b,a) VALUES ('a',1),('b',200),('f',100),('b',101),('c',2);
+ HANDLER t1 OPEN AS h1;
+-HANDLER h1 READ a = (100);
+-a b
+-100 f
+-HANDLER h1 READ a <= (100) WHERE b < 'f';
+-a b
+-2 c
+-HANDLER h1 READ a > (2) WHERE b IS NOT NULL LIMIT 2;
+-a b
+-100 f
+-101 b
+-HANDLER h1 READ a FIRST;
+-a b
+-1 a
+-HANDLER h1 READ a LAST;
+-a b
+-200 b
+-HANDLER h1 READ a PREV;
+-a b
+-101 b
+-HANDLER h1 READ a NEXT;
+-a b
+-200 b
+-HANDLER h1 CLOSE;
++ERROR HY000: Table storage engine for 'h1' doesn't have this option
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/index.rdiff b/storage/myisammrg/mysql-test/storage_engine/index.rdiff
index 6e6f18e39bc..bf6806979ec 100644
--- a/storage/myisammrg/mysql-test/storage_engine/index.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/index.rdiff
@@ -1,6 +1,11 @@
-64,66c64
-< ERROR 23000: Duplicate entry '1' for key 'a'
-< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
-< # If you got a difference in error message, just add it to rdiff file
----
-> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
+--- index.result 2013-01-22 22:05:05.246633000 +0400
++++ index.reject 2013-01-23 02:50:30.111873897 +0400
+@@ -61,7 +61,5 @@
+ ALTER TABLE t1 DROP INDEX a;
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ALTER TABLE t1 ADD UNIQUE INDEX a(a) ;
+-ERROR 23000: Duplicate entry '1' for key 'a'
+-# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+-# If you got a difference in error message, just add it to rdiff file
++# ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff
index 8913f17a2a6..7b89e177ffb 100644
--- a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff
@@ -1,17 +1,33 @@
-13a14,15
-> Warnings:
-> Note 1031 Table storage engine for 't1' doesn't have this option
-16c18
-< t1 1 a 1 a # # NULL NULL YES BTREE disabled
----
-> t1 1 a 1 a # # NULL NULL YES BTREE
-19c21
-< 1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort
----
-> 1 SIMPLE t1 index NULL a 5 NULL 19 Using index
-22a25,26
-> Warnings:
-> Note 1031 Table storage engine for 't1' doesn't have this option
-34a39,40
-> Warnings:
-> Note 1031 Table storage engine for 't1' doesn't have this option
+--- index_enable_disable.result 2013-01-22 22:05:05.246633000 +0400
++++ index_enable_disable.reject 2013-01-23 02:50:30.723866202 +0400
+@@ -11,15 +11,19 @@
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+ t1 1 a 1 a # # NULL NULL YES BTREE
+ ALTER TABLE t1 DISABLE KEYS;
++Warnings:
++Note 1031 Table storage engine for 't1' doesn't have this option
+ SHOW INDEX IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL YES BTREE disabled
++t1 1 a 1 a # # NULL NULL YES BTREE
+ EXPLAIN SELECT a FROM t1 ORDER BY a;
+ id select_type table type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 ALL NULL NULL NULL NULL 19 Using filesort
++1 SIMPLE t1 index NULL a 5 NULL 19 Using index
+ INSERT INTO t1 (a) VALUES
+ (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
+ ALTER TABLE t1 ENABLE KEYS;
++Warnings:
++Note 1031 Table storage engine for 't1' doesn't have this option
+ SHOW INDEX IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+ t1 1 a 1 a # # NULL NULL YES BTREE
+@@ -32,6 +36,8 @@
+ (1),(2),(3),(4),(5),(6),(7),(8),(9),
+ (21),(22),(23),(24),(25),(26),(27),(28),(29);
+ ALTER TABLE t1 DISABLE KEYS;
++Warnings:
++Note 1031 Table storage engine for 't1' doesn't have this option
+ INSERT INTO t1 (a) VALUES (29);
+ ERROR 23000: Duplicate entry '29' for key 'a'
+ # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff
index 6e6f18e39bc..1874b0d5891 100644
--- a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff
@@ -1,6 +1,11 @@
-64,66c64
-< ERROR 23000: Duplicate entry '1' for key 'a'
-< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
-< # If you got a difference in error message, just add it to rdiff file
----
-> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
+--- index_type_btree.result 2013-01-22 22:05:05.246633000 +0400
++++ index_type_btree.reject 2013-01-23 02:50:31.963850614 +0400
+@@ -61,7 +61,5 @@
+ ALTER TABLE t1 DROP INDEX a;
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ALTER TABLE t1 ADD UNIQUE INDEX a(a) USING BTREE;
+-ERROR 23000: Duplicate entry '1' for key 'a'
+-# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+-# If you got a difference in error message, just add it to rdiff file
++# ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff
index 1b57afe5b64..f6fd1e391aa 100644
--- a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff
@@ -1,34 +1,69 @@
-7c7
-< t1 1 a 1 a # # NULL NULL # HASH
----
-> t1 1 a 1 a # # NULL NULL # BTREE
-15,16c15,16
-< t1 1 a_b 1 a # # NULL NULL # HASH a_b index
-< t1 1 a_b 2 b # # NULL NULL # HASH a_b index
----
-> t1 1 a_b 1 a # # NULL NULL # BTREE a_b index
-> t1 1 a_b 2 b # # NULL NULL # BTREE a_b index
-25,26c25,26
-< t1 1 a 1 a # # NULL NULL # HASH
-< t1 1 b 1 b # # NULL NULL # HASH
----
-> t1 1 a 1 a # # NULL NULL # BTREE
-> t1 1 b 1 b # # NULL NULL # BTREE
-34c34
-< t1 0 a 1 a # # NULL NULL # HASH
----
-> t1 0 a 1 a # # NULL NULL # BTREE
-46c46
-< t1 1 a 1 a # # NULL NULL # HASH simple index on a
----
-> t1 1 a 1 a # # NULL NULL # BTREE simple index on a
-55c55
-< t1 0 a 1 a # # NULL NULL # HASH
----
-> t1 0 a 1 a # # NULL NULL # BTREE
-64,66c64
-< ERROR 23000: Duplicate entry '1' for key 'a'
-< # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
-< # If you got a difference in error message, just add it to rdiff file
----
-> # ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
+--- index_type_hash.result 2013-01-22 22:05:05.246633000 +0400
++++ index_type_hash.reject 2013-01-23 02:50:32.647842015 +0400
+@@ -4,7 +4,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH
++t1 1 a 1 a # # NULL NULL # BTREE
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -12,8 +12,8 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a_b 1 a # # NULL NULL # HASH a_b index
+-t1 1 a_b 2 b # # NULL NULL # HASH a_b index
++t1 1 a_b 1 a # # NULL NULL # BTREE a_b index
++t1 1 a_b 2 b # # NULL NULL # BTREE a_b index
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -22,8 +22,8 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH
+-t1 1 b 1 b # # NULL NULL # HASH
++t1 1 a 1 a # # NULL NULL # BTREE
++t1 1 b 1 b # # NULL NULL # BTREE
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+ b <CHAR_COLUMN>,
+@@ -31,7 +31,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 0 a 1 a # # NULL NULL # HASH
++t1 0 a 1 a # # NULL NULL # BTREE
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ERROR 23000: Duplicate entry '1' for key 'a'
+@@ -43,7 +43,7 @@
+ ALTER TABLE t1 ADD <CUSTOM_INDEX> (a) USING HASH COMMENT 'simple index on a';
+ SHOW INDEX FROM t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # HASH simple index on a
++t1 1 a 1 a # # NULL NULL # BTREE simple index on a
+ ALTER TABLE t1 DROP KEY a;
+ DROP TABLE t1;
+ CREATE TABLE t1 (a <INT_COLUMN>,
+@@ -52,7 +52,7 @@
+ ) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW KEYS IN t1;
+ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 0 a 1 a # # NULL NULL # HASH
++t1 0 a 1 a # # NULL NULL # BTREE
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ERROR 23000: Duplicate entry '1' for key 'a'
+@@ -61,7 +61,5 @@
+ ALTER TABLE t1 DROP INDEX a;
+ INSERT INTO t1 (a,b) VALUES (1,'c');
+ ALTER TABLE t1 ADD UNIQUE INDEX a(a) USING HASH;
+-ERROR 23000: Duplicate entry '1' for key 'a'
+-# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
+-# If you got a difference in error message, just add it to rdiff file
++# ERROR: Statement succeeded (expected results: ER_DUP_ENTRY,ER_DUP_KEY)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff
index e0d0eefabe4..24ffa2ab82f 100644
--- a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff
@@ -1,14 +1,26 @@
-7a8,15
-> ERROR HY000: DELAYED option not supported for table 't1'
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_DELAYED_NOT_SUPPORTED.
-> # INSERT DELAYED or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-8a17
-> ERROR HY000: DELAYED option not supported for table 't1'
-23,24d31
-< 3 c
-< 4 d
+--- insert_delayed.result 2013-01-23 01:23:49.461254916 +0400
++++ insert_delayed.reject 2013-01-23 02:50:34.475819034 +0400
+@@ -5,7 +5,16 @@
+ connect con0,localhost,root,,;
+ SET lock_wait_timeout = 1;
+ INSERT DELAYED INTO t1 (a,b) VALUES (3,'c');
++ERROR HY000: DELAYED option not supported for table 't1'
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_DELAYED_NOT_SUPPORTED.
++# INSERT DELAYED or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ INSERT DELAYED INTO t1 SET a=4, b='d';
++ERROR HY000: DELAYED option not supported for table 't1'
+ INSERT DELAYED INTO t1 (a,b) SELECT 5, 'e';
+ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ disconnect con0;
+@@ -20,6 +29,4 @@
+ a b
+ 1 f
+ 2 b
+-3 c
+-4 d
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff
index d035648551a..598e47b6883 100644
--- a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff
@@ -1,62 +1,80 @@
-44a45,46
-> ERROR HY000: Table 't1' was not locked with LOCK TABLES
-> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
-45a48,49
-> ERROR HY000: Table 't2' was not locked with LOCK TABLES
-> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
-46a51
-> ERROR HY000: Table 't2' was not locked with LOCK TABLES
-47a53
-> ERROR HY000: Table 't2' was not locked with LOCK TABLES
-48a55
-> ERROR 42S02: Table 'test.t1' doesn't exist
-49a57
-> ERROR 42S02: Table 'test.t1' doesn't exist
-50a59
-> ERROR 42S02: Table 'test.t1' doesn't exist
-52a62
-> ERROR 42S02: Table 'test.t1' doesn't exist
-54c64,65
-< ERROR HY000: Table 't1' was not locked with LOCK TABLES
----
-> ERROR 42S02: Table 'test.t1' doesn't exist
-> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TABLE_NOT_LOCKED)
-56a68
-> ERROR 42S02: Table 'test.t1' doesn't exist
-57a70
-> ERROR 42S02: Table 'test.t1' doesn't exist
-59c72,73
-< ERROR HY000: Table 't2' was not locked with LOCK TABLES
----
-> ERROR 42S02: Unknown table 't1,t2'
-> # ERROR: Statement ended with errno 1051, errname ER_BAD_TABLE_ERROR (expected results: ER_TABLE_NOT_LOCKED)
-61a76
-> ERROR 42S02: Unknown table 't1,t2'
-67a83,84
-> ERROR HY000: Table 't1' was not locked with LOCK TABLES
-> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
-68a86,87
-> ERROR HY000: Table 't2' was not locked with LOCK TABLES
-> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
-69a89,90
-> ERROR HY000: Table 't3' was not locked with LOCK TABLES
-> # ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
-70a92
-> ERROR 42S02: Table 'test.t1' doesn't exist
-71a94,103
-> ERROR 42S02: Table 'test.t2' doesn't exist
-> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ ALTER TABLE t2 ADD COLUMN c2 INT(11) /*!*/ /*Custom column options*/ ]
-> # The statement|command finished with ER_NO_SUCH_TABLE.
-> # ALTER TABLE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-72a105
-> ERROR 42S02: Unknown table 't1,t2,t3'
-109c142
-< a b
----
-> ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+--- lock.result 2013-01-23 01:24:01.797100027 +0400
++++ lock.reject 2013-01-23 02:50:53.291582487 +0400
+@@ -42,34 +42,67 @@
+ UPDATE t1 SET id=1 WHERE id=-1;
+ DROP TABLE t1,t2;
+ CREATE TABLE t1 (i1 <INT_COLUMN>, nr <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
++ERROR HY000: Table 't1' was not locked with LOCK TABLES
++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+ CREATE TABLE t2 (nr <INT_COLUMN>, nm <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
++ERROR HY000: Table 't2' was not locked with LOCK TABLES
++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+ INSERT INTO t2 (nr,nm) VALUES (1,3);
++ERROR HY000: Table 't2' was not locked with LOCK TABLES
+ INSERT INTO t2 (nr,nm) VALUES (2,4);
++ERROR HY000: Table 't2' was not locked with LOCK TABLES
+ lock tables t1 write, t2 read;
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t1 (i1,nr) SELECT 1, nr FROM t2 WHERE nm=3;
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t1 (i1,nr) SELECT 2, nr FROM t2 WHERE nm=4;
++ERROR 42S02: Table 'test.t1' doesn't exist
+ UNLOCK TABLES;
+ LOCK TABLES t1 WRITE;
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1;
+-ERROR HY000: Table 't1' was not locked with LOCK TABLES
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: ER_TABLE_NOT_LOCKED)
+ UNLOCK TABLES;
+ LOCK TABLES t1 WRITE, t1 AS t1_alias READ;
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t1 (i1,nr) SELECT i1, nr FROM t1 AS t1_alias;
++ERROR 42S02: Table 'test.t1' doesn't exist
+ DROP TABLE t1,t2;
+-ERROR HY000: Table 't2' was not locked with LOCK TABLES
++ERROR 42S02: Unknown table 't1,t2'
++# ERROR: Statement ended with errno 1051, errname ER_BAD_TABLE_ERROR (expected results: ER_TABLE_NOT_LOCKED)
+ UNLOCK TABLES;
+ DROP TABLE t1,t2;
++ERROR 42S02: Unknown table 't1,t2'
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE;
+ DROP TABLE t2, t3, t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
++ERROR HY000: Table 't1' was not locked with LOCK TABLES
++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
++ERROR HY000: Table 't2' was not locked with LOCK TABLES
++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+ CREATE TABLE t3 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
++ERROR HY000: Table 't3' was not locked with LOCK TABLES
++# ERROR: Statement ended with errno 1100, errname ER_TABLE_NOT_LOCKED (expected to succeed)
+ LOCK TABLES t1 WRITE, t2 WRITE, t3 WRITE, t1 AS t4 READ;
++ERROR 42S02: Table 'test.t1' doesn't exist
+ ALTER TABLE t2 ADD COLUMN c2 <INT_COLUMN>;
++ERROR 42S02: Table 'test.t2' doesn't exist
++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ ALTER TABLE t2 ADD COLUMN c2 INT(11) /*!*/ /*Custom column options*/ ]
++# The statement|command finished with ER_NO_SUCH_TABLE.
++# ALTER TABLE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t1, t2, t3;
++ERROR 42S02: Unknown table 't1,t2,t3'
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ LOCK TABLE t1 READ, t2 READ;
+@@ -106,6 +139,6 @@
+ FLUSH TABLE t1;
+ DROP TEMPORARY TABLE t1;
+ SELECT a,b FROM t1;
+-a b
++ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+ UNLOCK TABLES;
+ DROP TABLE t1, t2;
diff --git a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff
index f74c49cedea..1b611adf25a 100644
--- a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff
@@ -1,24 +1,35 @@
-8c8
-< test.t1 optimize status OK
----
-> test.t1 optimize note The storage engine for the table doesn't support optimize
-12c12
-< test.t2 optimize status OK
----
-> test.t2 optimize note The storage engine for the table doesn't support optimize
-17,18c17,18
-< test.t1 optimize status OK
-< test.t2 optimize status OK
----
-> test.t1 optimize note The storage engine for the table doesn't support optimize
-> test.t2 optimize note The storage engine for the table doesn't support optimize
-21,22c21,22
-< test.t1 optimize status Table is already up to date
-< test.t2 optimize status Table is already up to date
----
-> test.t1 optimize note The storage engine for the table doesn't support optimize
-> test.t2 optimize note The storage engine for the table doesn't support optimize
-28c28
-< test.t1 optimize status OK
----
-> test.t1 optimize note The storage engine for the table doesn't support optimize
+--- optimize_table.result 2013-01-22 22:05:05.246633000 +0400
++++ optimize_table.reject 2013-01-23 02:50:54.339569313 +0400
+@@ -5,25 +5,25 @@
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status OK
++test.t1 optimize note The storage engine for the table doesn't support optimize
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 optimize status OK
++test.t2 optimize note The storage engine for the table doesn't support optimize
+ INSERT INTO t2 (a,b) VALUES (5,'e');
+ INSERT INTO t1 (a,b) VALUES (6,'f');
+ OPTIMIZE LOCAL TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status OK
+-test.t2 optimize status OK
++test.t1 optimize note The storage engine for the table doesn't support optimize
++test.t2 optimize note The storage engine for the table doesn't support optimize
+ OPTIMIZE TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status Table is already up to date
+-test.t2 optimize status Table is already up to date
++test.t1 optimize note The storage engine for the table doesn't support optimize
++test.t2 optimize note The storage engine for the table doesn't support optimize
+ DROP TABLE t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d');
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status OK
++test.t1 optimize note The storage engine for the table doesn't support optimize
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff
index a2cb0c1dcb1..4c7ba7d8232 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff
@@ -1,63 +1,68 @@
-3,36c3,12
-< INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4);
-< ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
-< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p3 # # # # # # #
-< ALTER TABLE t1 COALESCE PARTITION 1;
-< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0 # # # # # # #
-< ALTER TABLE t1 REORGANIZE PARTITION;
-< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0 # # # # # # #
-< ALTER TABLE t1 REBUILD PARTITION p0;
-< EXPLAIN PARTiTIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0 # # # # # # #
-< ALTER TABLE t1 REMOVE PARTITIONING;
-< EXPLAIN PARTiTIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 NULL # # # # # # #
-< ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102));
-< ERROR HY000: Table has no partition for value 4
-< ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102));
-< INSERT INTO t1 (a) VALUES (50);
-< ERROR HY000: Table has no partition for value 50
-< ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (50,51));
-< INSERT INTO t1 (a) VALUES (50);
-< ALTER TABLE t1 DROP PARTITION p1;
-< ALTER TABLE t1 REORGANIZE PARTITION p0, p2 INTO (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102));
-< EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0 # # # # # # #
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-41,42c17,29
-< ALTER TABLE t1 DROP PARTITION abc;
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
-> PARTITION abc VALUES IN (1,2,3),
-> PARTITION def VALUES IN (100,101,102)
-> ) ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- alter_table.result 2013-01-22 22:05:05.246633000 +0400
++++ alter_table.reject 2013-01-23 03:16:22.620356221 +0400
+@@ -1,42 +1,29 @@
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4);
+-ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p3 # # # # # # #
+-ALTER TABLE t1 COALESCE PARTITION 1;
+-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0 # # # # # # #
+-ALTER TABLE t1 REORGANIZE PARTITION;
+-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0 # # # # # # #
+-ALTER TABLE t1 REBUILD PARTITION p0;
+-EXPLAIN PARTiTIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0 # # # # # # #
+-ALTER TABLE t1 REMOVE PARTITIONING;
+-EXPLAIN PARTiTIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 NULL # # # # # # #
+-ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102));
+-ERROR HY000: Table has no partition for value 4
+-ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102));
+-INSERT INTO t1 (a) VALUES (50);
+-ERROR HY000: Table has no partition for value 50
+-ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (50,51));
+-INSERT INTO t1 (a) VALUES (50);
+-ALTER TABLE t1 DROP PARTITION p1;
+-ALTER TABLE t1 REORGANIZE PARTITION p0, p2 INTO (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102));
+-EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0 # # # # # # #
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+ PARTITION abc VALUES IN (1,2,3),
+ PARTITION def VALUES IN (100,101,102)
+ );
+-ALTER TABLE t1 DROP PARTITION abc;
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
++PARTITION abc VALUES IN (1,2,3),
++PARTITION def VALUES IN (100,101,102)
++) ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff
index ce29f3dcf52..d1934b9d2ac 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff
@@ -1,83 +1,87 @@
-3,18c3,12
-< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
-< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< INSERT INTO t2 (a,b) SELECT a,b FROM t1;
-< INSERT INTO t1 (a,b) VALUES (3,'c');
-< ALTER TABLE t1 ANALYZE PARTITION p0;
-< Table Op Msg_type Msg_text
-< test.t1 analyze status OK
-< INSERT INTO t2 (a,b) VALUES (4,'d'), (1000,'e');
-< ALTER TABLE t1 ANALYZE PARTITION LOCAL ALL;
-< Table Op Msg_type Msg_text
-< test.t1 analyze status OK
-< INSERT INTO t1 (a,b) VALUES (5,'f'),(50,'g');
-< ALTER TABLE t1 ANALYZE PARTITION NO_WRITE_TO_BINLOG p1,p0;
-< Table Op Msg_type Msg_text
-< test.t1 analyze status OK
-< DROP TABLE t1, t2;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-20a15,16
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-21a18
-> ERROR 42S02: Table 'test.t1' doesn't exist
-22a20,21
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-23a23
-> ERROR 42S02: Table 'test.t1' doesn't exist
-26c26,27
-< test.t1 analyze status OK
----
-> test.t1 analyze Error Table 'test.t1' doesn't exist
-> test.t1 analyze status Operation failed
-27a29
-> ERROR 42S02: Table 'test.t2' doesn't exist
-30c32,33
-< test.t2 analyze status OK
----
-> test.t2 analyze Error Table 'test.t2' doesn't exist
-> test.t2 analyze status Operation failed
-31a35
-> ERROR 42S02: Table 'test.t1' doesn't exist
-32a37
-> ERROR 42S02: Table 'test.t2' doesn't exist
-35,36c40,43
-< test.t1 analyze status OK
-< test.t2 analyze status OK
----
-> test.t1 analyze Error Table 'test.t1' doesn't exist
-> test.t1 analyze status Operation failed
-> test.t2 analyze Error Table 'test.t2' doesn't exist
-> test.t2 analyze status Operation failed
-37a45
-> ERROR 42S02: Unknown table 't1,t2'
-38a47,48
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-39a50
-> ERROR 42S02: Table 'test.t1' doesn't exist
-42c53,54
-< test.t1 analyze status OK
----
-> test.t1 analyze Error Table 'test.t1' doesn't exist
-> test.t1 analyze status Operation failed
-43a56
-> ERROR 42S02: Table 'test.t1' doesn't exist
-46c59,60
-< test.t1 analyze status OK
----
-> test.t1 analyze Error Table 'test.t1' doesn't exist
-> test.t1 analyze status Operation failed
-47a62
-> ERROR 42S02: Unknown table 't1'
+--- analyze_table.result 2013-01-22 22:05:05.246633000 +0400
++++ analyze_table.reject 2013-01-23 03:16:23.240348427 +0400
+@@ -1,47 +1,62 @@
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-INSERT INTO t2 (a,b) SELECT a,b FROM t1;
+-INSERT INTO t1 (a,b) VALUES (3,'c');
+-ALTER TABLE t1 ANALYZE PARTITION p0;
+-Table Op Msg_type Msg_text
+-test.t1 analyze status OK
+-INSERT INTO t2 (a,b) VALUES (4,'d'), (1000,'e');
+-ALTER TABLE t1 ANALYZE PARTITION LOCAL ALL;
+-Table Op Msg_type Msg_text
+-test.t1 analyze status OK
+-INSERT INTO t1 (a,b) VALUES (5,'f'),(50,'g');
+-ALTER TABLE t1 ANALYZE PARTITION NO_WRITE_TO_BINLOG p1,p0;
+-Table Op Msg_type Msg_text
+-test.t1 analyze status OK
+-DROP TABLE t1, t2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (3,'c');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ ANALYZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
++test.t1 analyze Error Table 'test.t1' doesn't exist
++test.t1 analyze status Operation failed
+ INSERT INTO t2 (a,b) VALUES (4,'d');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 analyze status OK
++test.t2 analyze Error Table 'test.t2' doesn't exist
++test.t2 analyze status Operation failed
+ INSERT INTO t1 (a,b) VALUES (5,'e');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (6,'f');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ ANALYZE LOCAL TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
+-test.t2 analyze status OK
++test.t1 analyze Error Table 'test.t1' doesn't exist
++test.t1 analyze status Operation failed
++test.t2 analyze Error Table 'test.t2' doesn't exist
++test.t2 analyze status Operation failed
+ DROP TABLE t1, t2;
++ERROR 42S02: Unknown table 't1,t2'
+ CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a) VALUES (1),(2),(4),(7);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ ANALYZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
++test.t1 analyze Error Table 'test.t1' doesn't exist
++test.t1 analyze status Operation failed
+ INSERT INTO t1 (a) VALUES (8),(10),(11),(12);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ ANALYZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 analyze status OK
++test.t1 analyze Error Table 'test.t1' doesn't exist
++test.t1 analyze status Operation failed
+ DROP TABLE t1;
++ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff
index 3f3db85a23e..21ccf192e08 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff
@@ -1,172 +1,176 @@
-3,36c3,12
-< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
-< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
-< PARTITION p0 VALUES LESS THAN (100),
-< PARTITION p1 VALUES LESS THAN MAXVALUE
-< );
-< INSERT INTO t2 (a,b) SELECT a, b FROM t1;
-< ALTER TABLE t1 CHECK PARTITION p0;
-< Table Op Msg_type Msg_text
-< test.t1 check status OK
-< INSERT INTO t1 (a,b) VALUES (3,'c');
-< ALTER TABLE t1 CHECK PARTITION p0, p1 FOR UPGRADE;
-< Table Op Msg_type Msg_text
-< test.t1 check status OK
-< INSERT INTO t2 (a,b) VALUES (10000,'e');
-< ALTER TABLE t2 CHECK PARTITION p0 QUICK;
-< Table Op Msg_type Msg_text
-< test.t2 check status OK
-< INSERT INTO t1 (a,b) VALUES (6,'f');
-< ALTER TABLE t1 CHECK PARTITION p1 FAST;
-< Table Op Msg_type Msg_text
-< test.t1 check status OK
-< INSERT INTO t2 (a,b) VALUES (8,'h');
-< ALTER TABLE t2 CHECK PARTITION p1 MEDIUM;
-< Table Op Msg_type Msg_text
-< test.t2 check status OK
-< INSERT INTO t1 (a,b) VALUES (9,'i');
-< ALTER TABLE t1 CHECK PARTITION ALL EXTENDED;
-< Table Op Msg_type Msg_text
-< test.t1 check status OK
-< INSERT INTO t1 (a,b) VALUES (11,'k');
-< ALTER TABLE t1 CHECK PARTITION p0 CHANGED;
-< Table Op Msg_type Msg_text
-< test.t1 check status OK
-< DROP TABLE t1, t2;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-38a15,16
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-39a18
-> ERROR 42S02: Table 'test.t1' doesn't exist
-40a20,21
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-43c24,25
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-44a27
-> ERROR 42S02: Table 'test.t1' doesn't exist
-45a29
-> ERROR 42S02: Table 'test.t2' doesn't exist
-48,49c32,35
-< test.t1 check status OK
-< test.t2 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-> test.t2 check Error Table 'test.t2' doesn't exist
-> test.t2 check status Operation failed
-50a37
-> ERROR 42S02: Table 'test.t2' doesn't exist
-53c40,41
-< test.t2 check status OK
----
-> test.t2 check Error Table 'test.t2' doesn't exist
-> test.t2 check status Operation failed
-54a43
-> ERROR 42S02: Table 'test.t1' doesn't exist
-57c46,47
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-58a49
-> ERROR 42S02: Table 'test.t1' doesn't exist
-59a51
-> ERROR 42S02: Table 'test.t2' doesn't exist
-62,63c54,57
-< test.t2 check status OK
-< test.t1 check status OK
----
-> test.t2 check Error Table 'test.t2' doesn't exist
-> test.t2 check status Operation failed
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-64a59
-> ERROR 42S02: Table 'test.t1' doesn't exist
-65a61
-> ERROR 42S02: Table 'test.t2' doesn't exist
-68,69c64,67
-< test.t1 check status OK
-< test.t2 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-> test.t2 check Error Table 'test.t2' doesn't exist
-> test.t2 check status Operation failed
-70a69
-> ERROR 42S02: Table 'test.t1' doesn't exist
-73c72,73
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-74a75
-> ERROR 42S02: Unknown table 't1,t2'
-75a77,78
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-76a80
-> ERROR 42S02: Table 'test.t1' doesn't exist
-79c83,84
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-80a86
-> ERROR 42S02: Table 'test.t1' doesn't exist
-83c89,90
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-84a92
-> ERROR 42S02: Table 'test.t1' doesn't exist
-87c95,96
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-88a98
-> ERROR 42S02: Table 'test.t1' doesn't exist
-91c101,102
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-92a104
-> ERROR 42S02: Table 'test.t1' doesn't exist
-95c107,108
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-96a110
-> ERROR 42S02: Table 'test.t1' doesn't exist
-99c113,114
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-100a116
-> ERROR 42S02: Table 'test.t1' doesn't exist
-103c119,120
-< test.t1 check status OK
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-104a122
-> ERROR 42S02: Unknown table 't1'
+--- check_table.result 2013-01-22 22:05:05.246633000 +0400
++++ check_table.reject 2013-01-23 03:16:23.872340482 +0400
+@@ -1,104 +1,122 @@
+ DROP TABLE IF EXISTS t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+-PARTITION p0 VALUES LESS THAN (100),
+-PARTITION p1 VALUES LESS THAN MAXVALUE
+-);
+-INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+-ALTER TABLE t1 CHECK PARTITION p0;
+-Table Op Msg_type Msg_text
+-test.t1 check status OK
+-INSERT INTO t1 (a,b) VALUES (3,'c');
+-ALTER TABLE t1 CHECK PARTITION p0, p1 FOR UPGRADE;
+-Table Op Msg_type Msg_text
+-test.t1 check status OK
+-INSERT INTO t2 (a,b) VALUES (10000,'e');
+-ALTER TABLE t2 CHECK PARTITION p0 QUICK;
+-Table Op Msg_type Msg_text
+-test.t2 check status OK
+-INSERT INTO t1 (a,b) VALUES (6,'f');
+-ALTER TABLE t1 CHECK PARTITION p1 FAST;
+-Table Op Msg_type Msg_text
+-test.t1 check status OK
+-INSERT INTO t2 (a,b) VALUES (8,'h');
+-ALTER TABLE t2 CHECK PARTITION p1 MEDIUM;
+-Table Op Msg_type Msg_text
+-test.t2 check status OK
+-INSERT INTO t1 (a,b) VALUES (9,'i');
+-ALTER TABLE t1 CHECK PARTITION ALL EXTENDED;
+-Table Op Msg_type Msg_text
+-test.t1 check status OK
+-INSERT INTO t1 (a,b) VALUES (11,'k');
+-ALTER TABLE t1 CHECK PARTITION p0 CHANGED;
+-Table Op Msg_type Msg_text
+-test.t1 check status OK
+-DROP TABLE t1, t2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ CHECK TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a,b) VALUES (3,'c');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (4,'d');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ CHECK TABLE t1, t2 FOR UPGRADE;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
+-test.t2 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
++test.t2 check Error Table 'test.t2' doesn't exist
++test.t2 check status Operation failed
+ INSERT INTO t2 (a,b) VALUES (5,'e');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ CHECK TABLE t2 QUICK;
+ Table Op Msg_type Msg_text
+-test.t2 check status OK
++test.t2 check Error Table 'test.t2' doesn't exist
++test.t2 check status Operation failed
+ INSERT INTO t1 (a,b) VALUES (6,'f');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 FAST;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a,b) VALUES (7,'g');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (8,'h');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ CHECK TABLE t2, t1 MEDIUM;
+ Table Op Msg_type Msg_text
+-test.t2 check status OK
+-test.t1 check status OK
++test.t2 check Error Table 'test.t2' doesn't exist
++test.t2 check status Operation failed
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a,b) VALUES (9,'i');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (10,'j');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ CHECK TABLE t1, t2 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
+-test.t2 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
++test.t2 check Error Table 'test.t2' doesn't exist
++test.t2 check status Operation failed
+ INSERT INTO t1 (a,b) VALUES (11,'k');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 CHANGED;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ DROP TABLE t1, t2;
++ERROR 42S02: Unknown table 't1,t2'
+ CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX>(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a) VALUES (1),(2),(5);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a) VALUES (6),(8),(12);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 FOR UPGRADE;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a) VALUES (13),(15),(16);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 QUICK;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a) VALUES (17),(120),(132);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 FAST;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a) VALUES (801),(900),(7714);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 MEDIUM;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a) VALUES (8760),(10023),(12000);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ INSERT INTO t1 (a) VALUES (13345),(24456),(78302),(143028);
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CHECK TABLE t1 CHANGED;
+ Table Op Msg_type Msg_text
+-test.t1 check status OK
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ DROP TABLE t1;
++ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff
index bc5b07686bf..3d9ebdfe5c4 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff
@@ -1,81 +1,89 @@
-2a3,4
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-3a6
-> ERROR 42S02: Table 'test.t1' doesn't exist
-4a8,9
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-7c12,14
-< test.t1 4272806499
----
-> test.t1 NULL
-> Warnings:
-> Error 1146 Table 'test.t1' doesn't exist
-10,11c17,21
-< test.t2 0
-< test.t1 4272806499
----
-> test.t2 NULL
-> test.t1 NULL
-> Warnings:
-> Error 1146 Table 'test.t2' doesn't exist
-> Error 1146 Table 'test.t1' doesn't exist
-15a26,28
-> Warnings:
-> Error 1146 Table 'test.t1' doesn't exist
-> Error 1146 Table 'test.t2' doesn't exist
-18,19c31,35
-< test.t1 4272806499
-< test.t2 0
----
-> test.t1 NULL
-> test.t2 NULL
-> Warnings:
-> Error 1146 Table 'test.t1' doesn't exist
-> Error 1146 Table 'test.t2' doesn't exist
-20a37
-> ERROR 42S02: Unknown table 't1,t2'
-22a40,41
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-23a43
-> ERROR 42S02: Table 'test.t1' doesn't exist
-24a45,46
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-27c49,51
-< test.t1 0
----
-> test.t1 NULL
-> Warnings:
-> Error 1146 Table 'test.t1' doesn't exist
-30,31c54,58
-< test.t2 0
-< test.t1 0
----
-> test.t2 NULL
-> test.t1 NULL
-> Warnings:
-> Error 1146 Table 'test.t2' doesn't exist
-> Error 1146 Table 'test.t1' doesn't exist
-34,35c61,65
-< test.t1 0
-< test.t2 0
----
-> test.t1 NULL
-> test.t2 NULL
-> Warnings:
-> Error 1146 Table 'test.t1' doesn't exist
-> Error 1146 Table 'test.t2' doesn't exist
-38,39c68,72
-< test.t1 4272806499
-< test.t2 0
----
-> test.t1 NULL
-> test.t2 NULL
-> Warnings:
-> Error 1146 Table 'test.t1' doesn't exist
-> Error 1146 Table 'test.t2' doesn't exist
-40a74
-> ERROR 42S02: Unknown table 't1,t2'
+--- checksum_table.result 2013-01-22 22:05:05.246633000 +0400
++++ checksum_table.reject 2013-01-23 03:16:24.496332636 +0400
+@@ -1,40 +1,74 @@
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ CHECKSUM TABLE t1;
+ Table Checksum
+-test.t1 4272806499
++test.t1 NULL
++Warnings:
++Error 1146 Table 'test.t1' doesn't exist
+ CHECKSUM TABLE t2, t1;
+ Table Checksum
+-test.t2 0
+-test.t1 4272806499
++test.t2 NULL
++test.t1 NULL
++Warnings:
++Error 1146 Table 'test.t2' doesn't exist
++Error 1146 Table 'test.t1' doesn't exist
+ CHECKSUM TABLE t1, t2 QUICK;
+ Table Checksum
+ test.t1 NULL
+ test.t2 NULL
++Warnings:
++Error 1146 Table 'test.t1' doesn't exist
++Error 1146 Table 'test.t2' doesn't exist
+ CHECKSUM TABLE t1, t2 EXTENDED;
+ Table Checksum
+-test.t1 4272806499
+-test.t2 0
++test.t1 NULL
++test.t2 NULL
++Warnings:
++Error 1146 Table 'test.t1' doesn't exist
++Error 1146 Table 'test.t2' doesn't exist
+ DROP TABLE t1, t2;
++ERROR 42S02: Unknown table 't1,t2'
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1 PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> CHECKSUM=1 PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ CHECKSUM TABLE t1;
+ Table Checksum
+-test.t1 0
++test.t1 NULL
++Warnings:
++Error 1146 Table 'test.t1' doesn't exist
+ CHECKSUM TABLE t2, t1;
+ Table Checksum
+-test.t2 0
+-test.t1 0
++test.t2 NULL
++test.t1 NULL
++Warnings:
++Error 1146 Table 'test.t2' doesn't exist
++Error 1146 Table 'test.t1' doesn't exist
+ CHECKSUM TABLE t1, t2 QUICK;
+ Table Checksum
+-test.t1 0
+-test.t2 0
++test.t1 NULL
++test.t2 NULL
++Warnings:
++Error 1146 Table 'test.t1' doesn't exist
++Error 1146 Table 'test.t2' doesn't exist
+ CHECKSUM TABLE t1, t2 EXTENDED;
+ Table Checksum
+-test.t1 4272806499
+-test.t2 0
++test.t1 NULL
++test.t2 NULL
++Warnings:
++Error 1146 Table 'test.t1' doesn't exist
++Error 1146 Table 'test.t2' doesn't exist
+ DROP TABLE t1, t2;
++ERROR 42S02: Unknown table 't1,t2'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff
index 11fbc4812dc..d6aa75f1c44 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff
@@ -1,156 +1,159 @@
-3,10c3,12
-< INSERT INTO t1 (a) VALUES (1),(2),(3),(2);
-< EXPLAIN PARTITIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0,p1 # # # # # # #
-< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0 # # # # # # #
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-12,19c14,23
-< INSERT INTO t1 (a) VALUES ('a'),('b'),('c');
-< EXPLAIN PARTITIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0,p1 # # # # # # #
-< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b';
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p1 # # # # # # #
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or CHAR types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-21,31c25,34
-< SHOW INDEX IN t1;
-< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-< t1 1 a 1 a # # NULL NULL # #
-< INSERT INTO t1 (a) VALUES (1),(2),(3),(5);
-< EXPLAIN PARTITIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0,p1 # # # # # # #
-< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3);
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0 # # # # # # #
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/, /*!INDEX*/ /*Custom index*/ (a)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-33,43c36,45
-< SHOW INDEX IN t1;
-< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-< t1 0 PRIMARY 1 a # # NULL NULL # #
-< INSERT INTO t1 (a) VALUES (1),(200),(3),(2);
-< EXPLAIN PARTITIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0,p1 # # # # # # #
-< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p1 # # # # # # #
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ PRIMARY KEY) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY() PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # PK or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-48,58c50,63
-< INSERT INTO t1 (a) VALUES (1),(2),(400);
-< EXPLAIN PARTITIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0,p1 # # # # # # #
-< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0 # # # # # # #
-< INSERT INTO t1 (a) VALUES (10000);
-< ERROR HY000: Table has no partition for value 10000
-< DROP TABLE t1;
-< CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) (
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY RANGE(a) (
-> PARTITION p0 VALUES LESS THAN (10),
-> PARTITION p1 VALUES LESS THAN (1000)
-> ) ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-> CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
-62,72c67,70
-< INSERT INTO t1 (a) VALUES (1),(101),(1);
-< EXPLAIN PARTITIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 abc,def # # # # # # #
-< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE NULL NULL # # # # # # #
-< INSERT INTO t1 (a) VALUES (50);
-< ERROR HY000: Table has no partition for value 50
-< DROP TABLE t1;
-< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
-75,91c73,79
-< );
-< SHOW INDEX IN t1;
-< Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
-< INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3);
-< EXPLAIN PARTITIONS SELECT a FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 abc_abcsp0,def_defsp0 # # # # # # #
-< EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE NULL NULL # # # # # # #
-< SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD
-< FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1';
-< TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_METHOD SUBPARTITION_METHOD
-< test t1 abc abcsp0 LIST HASH
-< test t1 def defsp0 LIST HASH
-< SELECT * FROM INFORMATION_SCHEMA.PARTITIONS;
-< DROP TABLE t1;
----
-> ) ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- create_table.result 2013-01-22 22:05:05.246633000 +0400
++++ create_table.reject 2013-01-23 03:16:25.160324290 +0400
+@@ -1,91 +1,79 @@
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-INSERT INTO t1 (a) VALUES (1),(2),(3),(2);
+-EXPLAIN PARTITIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0,p1 # # # # # # #
+-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0 # # # # # # #
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY(a) PARTITIONS 2;
+-INSERT INTO t1 (a) VALUES ('a'),('b'),('c');
+-EXPLAIN PARTITIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0,p1 # # # # # # #
+-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 'b';
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p1 # # # # # # #
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or CHAR types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <INT_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY(a) PARTITIONS 2;
+-SHOW INDEX IN t1;
+-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 1 a 1 a # # NULL NULL # #
+-INSERT INTO t1 (a) VALUES (1),(2),(3),(5);
+-EXPLAIN PARTITIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0,p1 # # # # # # #
+-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a IN (1,3);
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0 # # # # # # #
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/, /*!INDEX*/ /*Custom index*/ (a)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY KEY() PARTITIONS 2;
+-SHOW INDEX IN t1;
+-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-t1 0 PRIMARY 1 a # # NULL NULL # #
+-INSERT INTO t1 (a) VALUES (1),(200),(3),(2);
+-EXPLAIN PARTITIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0,p1 # # # # # # #
+-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a=2;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p1 # # # # # # #
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ PRIMARY KEY) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY KEY() PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# PK or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+ PARTITION p0 VALUES LESS THAN (10),
+ PARTITION p1 VALUES LESS THAN (1000)
+ );
+-INSERT INTO t1 (a) VALUES (1),(2),(400);
+-EXPLAIN PARTITIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0,p1 # # # # # # #
+-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 2;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0 # # # # # # #
+-INSERT INTO t1 (a) VALUES (10000);
+-ERROR HY000: Table has no partition for value 10000
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) (
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY RANGE(a) (
++PARTITION p0 VALUES LESS THAN (10),
++PARTITION p1 VALUES LESS THAN (1000)
++) ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
++CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+ PARTITION abc VALUES IN (1,2,3),
+ PARTITION def VALUES IN (100,101,102)
+ );
+-INSERT INTO t1 (a) VALUES (1),(101),(1);
+-EXPLAIN PARTITIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 abc,def # # # # # # #
+-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE NULL NULL # # # # # # #
+-INSERT INTO t1 (a) VALUES (50);
+-ERROR HY000: Table has no partition for value 50
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
+ PARTITION abc VALUES IN (1,2,3),
+ PARTITION def VALUES IN (100,101,102)
+-);
+-SHOW INDEX IN t1;
+-Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+-INSERT INTO t1 (a,b) VALUES (1,1),(101,2),(1,3);
+-EXPLAIN PARTITIONS SELECT a FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 abc_abcsp0,def_defsp0 # # # # # # #
+-EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE NULL NULL # # # # # # #
+-SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, PARTITION_METHOD, SUBPARTITION_METHOD
+-FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1';
+-TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_METHOD SUBPARTITION_METHOD
+-test t1 abc abcsp0 LIST HASH
+-test t1 def defsp0 LIST HASH
+-SELECT * FROM INFORMATION_SCHEMA.PARTITIONS;
+-DROP TABLE t1;
++) ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or subpartitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff
index 350d93fe91f..242b3778846 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff
@@ -1,91 +1,95 @@
-3,25c3,12
-< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
-< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
-< PARTITION p0 VALUES LESS THAN (100),
-< PARTITION p1 VALUES LESS THAN MAXVALUE
-< );
-< INSERT INTO t2 (a,b) SELECT a, b FROM t1;
-< INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
-< ALTER TABLE t1 OPTIMIZE PARTITION p1;
-< Table Op Msg_type Msg_text
-< test.t1 optimize status OK
-< INSERT INTO t2 (a,b) VALUES (4,'d');
-< ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG;
-< Table Op Msg_type Msg_text
-< test.t2 optimize status OK
-< INSERT INTO t1 (a,b) VALUES (6,'f');
-< ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL;
-< Table Op Msg_type Msg_text
-< test.t1 optimize status OK
-< INSERT INTO t2 (a,b) VALUES (5,'e');
-< ALTER TABLE t2 OPTIMIZE PARTITION p1,p0;
-< Table Op Msg_type Msg_text
-< test.t2 optimize status OK
-< DROP TABLE t1, t2;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-27a15,16
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-28a18
-> ERROR 42S02: Table 'test.t1' doesn't exist
-29a20,21
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-30a23
-> ERROR 42S02: Table 'test.t1' doesn't exist
-33c26,27
-< test.t1 optimize status OK
----
-> test.t1 optimize Error Table 'test.t1' doesn't exist
-> test.t1 optimize status Operation failed
-34a29
-> ERROR 42S02: Table 'test.t2' doesn't exist
-37c32,33
-< test.t2 optimize status OK
----
-> test.t2 optimize Error Table 'test.t2' doesn't exist
-> test.t2 optimize status Operation failed
-38a35
-> ERROR 42S02: Table 'test.t2' doesn't exist
-39a37
-> ERROR 42S02: Table 'test.t1' doesn't exist
-42,43c40,43
-< test.t1 optimize status OK
-< test.t2 optimize status OK
----
-> test.t1 optimize Error Table 'test.t1' doesn't exist
-> test.t1 optimize status Operation failed
-> test.t2 optimize Error Table 'test.t2' doesn't exist
-> test.t2 optimize status Operation failed
-46,47c46,49
-< test.t1 optimize status OK
-< test.t2 optimize status OK
----
-> test.t1 optimize Error Table 'test.t1' doesn't exist
-> test.t1 optimize status Operation failed
-> test.t2 optimize Error Table 'test.t2' doesn't exist
-> test.t2 optimize status Operation failed
-48a51
-> ERROR 42S02: Unknown table 't1,t2'
-49a53,54
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-50a56
-> ERROR 42S02: Table 'test.t1' doesn't exist
-53c59,60
-< test.t1 optimize status OK
----
-> test.t1 optimize Error Table 'test.t1' doesn't exist
-> test.t1 optimize status Operation failed
-54a62
-> ERROR 42S02: Unknown table 't1'
+--- optimize_table.result 2013-01-22 22:05:05.246633000 +0400
++++ optimize_table.reject 2013-01-23 03:16:25.780316495 +0400
+@@ -1,54 +1,62 @@
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+-PARTITION p0 VALUES LESS THAN (100),
+-PARTITION p1 VALUES LESS THAN MAXVALUE
+-);
+-INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+-INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
+-ALTER TABLE t1 OPTIMIZE PARTITION p1;
+-Table Op Msg_type Msg_text
+-test.t1 optimize status OK
+-INSERT INTO t2 (a,b) VALUES (4,'d');
+-ALTER TABLE t2 OPTIMIZE PARTITION p0 NO_WRITE_TO_BINLOG;
+-Table Op Msg_type Msg_text
+-test.t2 optimize status OK
+-INSERT INTO t1 (a,b) VALUES (6,'f');
+-ALTER TABLE t1 OPTIMIZE PARTITION ALL LOCAL;
+-Table Op Msg_type Msg_text
+-test.t1 optimize status OK
+-INSERT INTO t2 (a,b) VALUES (5,'e');
+-ALTER TABLE t2 OPTIMIZE PARTITION p1,p0;
+-Table Op Msg_type Msg_text
+-test.t2 optimize status OK
+-DROP TABLE t1, t2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status OK
++test.t1 optimize Error Table 'test.t1' doesn't exist
++test.t1 optimize status Operation failed
+ INSERT INTO t2 (a,b) VALUES (4,'d');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ OPTIMIZE NO_WRITE_TO_BINLOG TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 optimize status OK
++test.t2 optimize Error Table 'test.t2' doesn't exist
++test.t2 optimize status Operation failed
+ INSERT INTO t2 (a,b) VALUES (5,'e');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ INSERT INTO t1 (a,b) VALUES (6,'f');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ OPTIMIZE LOCAL TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status OK
+-test.t2 optimize status OK
++test.t1 optimize Error Table 'test.t1' doesn't exist
++test.t1 optimize status Operation failed
++test.t2 optimize Error Table 'test.t2' doesn't exist
++test.t2 optimize status Operation failed
+ OPTIMIZE TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status OK
+-test.t2 optimize status OK
++test.t1 optimize Error Table 'test.t1' doesn't exist
++test.t1 optimize status Operation failed
++test.t2 optimize Error Table 'test.t2' doesn't exist
++test.t2 optimize status Operation failed
+ DROP TABLE t1, t2;
++ERROR 42S02: Unknown table 't1,t2'
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(100,'b'),(2,'c'),(3,'d');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ OPTIMIZE TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 optimize status OK
++test.t1 optimize Error Table 'test.t1' doesn't exist
++test.t1 optimize status Operation failed
+ DROP TABLE t1;
++ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff
index 4c39421261c..2b5d5f68346 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff
@@ -1,295 +1,303 @@
-4,33c4,13
-< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
-< CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
-< PARTITION p0 VALUES LESS THAN (100),
-< PARTITION p1 VALUES LESS THAN MAXVALUE
-< );
-< INSERT INTO t2 (a,b) SELECT a, b FROM t1;
-< ALTER TABLE t1 REPAIR PARTITION p0;
-< Table Op Msg_type Msg_text
-< test.t1 repair status OK
-< INSERT INTO t1 VALUES (3,'c');
-< ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
-< Table Op Msg_type Msg_text
-< test.t1 repair status OK
-< INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
-< ALTER TABLE t2 REPAIR PARTITION LOCAL p1;
-< Table Op Msg_type Msg_text
-< test.t2 repair status OK
-< INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
-< ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED;
-< Table Op Msg_type Msg_text
-< test.t1 repair status OK
-< INSERT INTO t1 VALUES (10,'j');
-< ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM;
-< Table Op Msg_type Msg_text
-< test.t1 repair status OK
-< INSERT INTO t2 (a,b) VALUES (12,'l');
-< ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM;
-< Table Op Msg_type Msg_text
-< test.t2 repair status OK
-< DROP TABLE t1, t2;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-35a16,17
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-36a19
-> ERROR 42S02: Table 'test.t1' doesn't exist
-37a21,22
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-40c25,26
-< test.t1 repair status OK
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-41a28
-> ERROR 42S02: Table 'test.t1' doesn't exist
-42a30
-> ERROR 42S02: Table 'test.t2' doesn't exist
-45,46c33,36
-< test.t1 repair status OK
-< test.t2 repair status OK
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-> test.t2 repair Error Table 'test.t2' doesn't exist
-> test.t2 repair status Operation failed
-47a38
-> ERROR 42S02: Table 'test.t2' doesn't exist
-50c41,42
-< test.t2 repair status OK
----
-> test.t2 repair Error Table 'test.t2' doesn't exist
-> test.t2 repair status Operation failed
-51a44
-> ERROR 42S02: Table 'test.t1' doesn't exist
-52a46
-> ERROR 42S02: Table 'test.t2' doesn't exist
-55,56c49,52
-< test.t2 repair status OK
-< test.t1 repair status OK
----
-> test.t2 repair Error Table 'test.t2' doesn't exist
-> test.t2 repair status Operation failed
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-57a54
-> ERROR 42S02: Table 'test.t1' doesn't exist
-58a56
-> ERROR 42S02: Table 'test.t2' doesn't exist
-61,62c59,62
-< test.t1 repair status OK
-< test.t2 repair status OK
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-> test.t2 repair Error Table 'test.t2' doesn't exist
-> test.t2 repair status Operation failed
-63a64
-> ERROR 42S02: Table 'test.t1' doesn't exist
-64a66
-> ERROR 42S02: Table 'test.t2' doesn't exist
-67,68c69,72
-< test.t1 repair status OK
-< test.t2 repair status OK
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-> test.t2 repair Error Table 'test.t2' doesn't exist
-> test.t2 repair status Operation failed
-71,73c75,76
-< ERROR HY000: Failed to read from the .par file
-< # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
-< # If you got a difference in error message, just add it to rdiff file
----
-> ERROR 42S02: Table 'test.t1' doesn't exist
-> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY)
-76,78c79,80
-< test.t1 check Error Failed to read from the .par file
-< test.t1 check Error Incorrect information in file: './test/t1.frm'
-< test.t1 check error Corrupt
----
-> test.t1 check Error Table 'test.t1' doesn't exist
-> test.t1 check status Operation failed
-80,82c82,83
-< ERROR HY000: Failed to read from the .par file
-< # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
-< # If you got a difference in error message, just add it to rdiff file
----
-> ERROR 42S02: Table 'test.t1' doesn't exist
-> # ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY)
-85,87c86,87
-< test.t1 repair Error Failed to read from the .par file
-< test.t1 repair Error Incorrect information in file: './test/t1.frm'
-< test.t1 repair error Corrupt
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-88a89
-> ERROR 42S02: Unknown table 't1,t2'
-93a95,96
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-96c99,100
-< test.t1 repair status OK
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-97a102
-> ERROR 42S02: Table 'test.t1' doesn't exist
-100c105,106
-< test.t1 repair status OK
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-101a108
-> ERROR 42S02: Table 'test.t1' doesn't exist
-104,235c111,112
-< test.t1 repair status OK
-< t1#P#p0.MYD
-< t1#P#p0.MYI
-< t1#P#p1.MYD
-< t1#P#p1.MYI
-< t1.frm
-< t1.par
-< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
-< # Statement ended with one of expected results (0,144).
-< # If you got a difference in error message, just add it to rdiff file
-< FLUSH TABLE t1;
-< Restoring <DATADIR>/test/t1#P#p0.MYD
-< CHECK TABLE t1;
-< Table Op Msg_type Msg_text
-< test.t1 check error Size of datafile is: 26 Should be: 39
-< test.t1 check error Partition p0 returned error
-< test.t1 check error Corrupt
-< SELECT * FROM t1;
-< a b
-< 8 h
-< 10 j
-< 7 g
-< 15 o
-< Warnings:
-< Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
-< Error 1194 Table 't1' is marked as crashed and should be repaired
-< Error 1034 Number of rows changed from 3 to 2
-< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-< # If you got a difference in error message, just add it to rdiff file
-< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
-< # Statement ended with one of expected results (0,144).
-< # If you got a difference in error message, just add it to rdiff file
-< FLUSH TABLE t1;
-< Restoring <DATADIR>/test/t1#P#p0.MYI
-< CHECK TABLE t1;
-< Table Op Msg_type Msg_text
-< test.t1 check warning Size of datafile is: 39 Should be: 26
-< test.t1 check error Record-count is not ok; is 3 Should be: 2
-< test.t1 check warning Found 3 key parts. Should be: 2
-< test.t1 check error Partition p0 returned error
-< test.t1 check error Corrupt
-< SELECT * FROM t1;
-< a b
-< 8 h
-< 10 j
-< 14 n
-< 7 g
-< 15 o
-< 15 o
-< Warnings:
-< Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
-< Error 1194 Table 't1' is marked as crashed and should be repaired
-< Error 1034 Number of rows changed from 2 to 3
-< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-< # If you got a difference in error message, just add it to rdiff file
-< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
-< # Statement ended with one of expected results (0,144).
-< # If you got a difference in error message, just add it to rdiff file
-< FLUSH TABLE t1;
-< Restoring <DATADIR>/test/t1#P#p1.MYD
-< CHECK TABLE t1;
-< Table Op Msg_type Msg_text
-< test.t1 check error Size of datafile is: 39 Should be: 52
-< test.t1 check error Partition p1 returned error
-< test.t1 check error Corrupt
-< SELECT * FROM t1;
-< a b
-< 8 h
-< 10 j
-< 14 n
-< 14 n
-< 7 g
-< 15 o
-< 15 o
-< Warnings:
-< Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
-< Error 1194 Table 't1' is marked as crashed and should be repaired
-< Error 1034 Number of rows changed from 4 to 3
-< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-< # If you got a difference in error message, just add it to rdiff file
-< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
-< # Statement ended with one of expected results (0,144).
-< # If you got a difference in error message, just add it to rdiff file
-< FLUSH TABLE t1;
-< Restoring <DATADIR>/test/t1#P#p1.MYI
-< CHECK TABLE t1;
-< Table Op Msg_type Msg_text
-< test.t1 check warning Size of datafile is: 52 Should be: 39
-< test.t1 check error Record-count is not ok; is 4 Should be: 3
-< test.t1 check warning Found 4 key parts. Should be: 3
-< test.t1 check error Partition p1 returned error
-< test.t1 check error Corrupt
-< SELECT * FROM t1;
-< a b
-< 8 h
-< 10 j
-< 14 n
-< 14 n
-< 14 n
-< 7 g
-< 15 o
-< 15 o
-< 15 o
-< Warnings:
-< Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
-< Error 1194 Table 't1' is marked as crashed and should be repaired
-< Error 1034 Number of rows changed from 3 to 4
-< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-< # If you got a difference in error message, just add it to rdiff file
-< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
-< # Statement ended with one of expected results (0,144).
-< # If you got a difference in error message, just add it to rdiff file
-< FLUSH TABLE t1;
-< Restoring <DATADIR>/test/t1.par
-< CHECK TABLE t1;
-< Table Op Msg_type Msg_text
-< test.t1 check status OK
-< SELECT * FROM t1;
-< a b
-< 8 h
-< 10 j
-< 14 n
-< 14 n
-< 14 n
-< 14 n
-< 7 g
-< 15 o
-< 15 o
-< 15 o
-< 15 o
-< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-< # If you got a difference in error message, just add it to rdiff file
----
-> test.t1 repair Error Table 'test.t1' doesn't exist
-> test.t1 repair status Operation failed
-236a114
-> ERROR 42S02: Unknown table 't1'
+--- repair_table.result 2013-01-23 01:35:44.388267080 +0400
++++ repair_table.reject 2013-01-23 03:16:26.468307847 +0400
+@@ -1,236 +1,114 @@
+ call mtr.add_suppression("Table '.*t1.*' is marked as crashed and should be repaired");
+ DROP TABLE IF EXISTS t1, t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+-CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY RANGE(a) (
+-PARTITION p0 VALUES LESS THAN (100),
+-PARTITION p1 VALUES LESS THAN MAXVALUE
+-);
+-INSERT INTO t2 (a,b) SELECT a, b FROM t1;
+-ALTER TABLE t1 REPAIR PARTITION p0;
+-Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-INSERT INTO t1 (a,b) VALUES (3,'c');
+-ALTER TABLE t1 REPAIR PARTITION NO_WRITE_TO_BINLOG p0, p1;
+-Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+-ALTER TABLE t2 REPAIR PARTITION LOCAL p1;
+-Table Op Msg_type Msg_text
+-test.t2 repair status OK
+-INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+-ALTER TABLE t1 REPAIR PARTITION LOCAL ALL EXTENDED;
+-Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-INSERT INTO t1 (a,b) VALUES (10,'j');
+-ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM;
+-Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-INSERT INTO t2 (a,b) VALUES (12,'l');
+-ALTER TABLE t2 REPAIR PARTITION NO_WRITE_TO_BINLOG ALL QUICK EXTENDED USE_FRM;
+-Table Op Msg_type Msg_text
+-test.t2 repair status OK
+-DROP TABLE t1, t2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE IF EXISTS t1,t2;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
+ INSERT INTO t1 (a,b) VALUES (3,'c');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (4,'d');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
++test.t2 repair Error Table 'test.t2' doesn't exist
++test.t2 repair status Operation failed
+ INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ REPAIR LOCAL TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
++test.t2 repair Error Table 'test.t2' doesn't exist
++test.t2 repair status Operation failed
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (9,'i');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ REPAIR LOCAL TABLE t2, t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
+-test.t1 repair status OK
++test.t2 repair Error Table 'test.t2' doesn't exist
++test.t2 repair status Operation failed
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
+ INSERT INTO t1 (a,b) VALUES (10,'j');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (11,'k');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ REPAIR TABLE t1, t2 QUICK USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
++test.t2 repair Error Table 'test.t2' doesn't exist
++test.t2 repair status Operation failed
+ INSERT INTO t1 (a,b) VALUES (12,'l');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ INSERT INTO t2 (a,b) VALUES (13,'m');
++ERROR 42S02: Table 'test.t2' doesn't exist
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
++test.t2 repair Error Table 'test.t2' doesn't exist
++test.t2 repair status Operation failed
+ FLUSH TABLE t1;
+ INSERT INTO t1 (a,b) VALUES (14,'n');
+-ERROR HY000: Failed to read from the .par file
+-# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+-# If you got a difference in error message, just add it to rdiff file
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY)
+ CHECK TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 check Error Failed to read from the .par file
+-test.t1 check Error Incorrect information in file: './test/t1.frm'
+-test.t1 check error Corrupt
++test.t1 check Error Table 'test.t1' doesn't exist
++test.t1 check status Operation failed
+ SELECT a,b FROM t1;
+-ERROR HY000: Failed to read from the .par file
+-# Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+-# If you got a difference in error message, just add it to rdiff file
++ERROR 42S02: Table 'test.t1' doesn't exist
++# ERROR: Statement ended with errno 1146, errname ER_NO_SUCH_TABLE (expected results: 0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY)
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair Error Failed to read from the .par file
+-test.t1 repair Error Incorrect information in file: './test/t1.frm'
+-test.t1 repair error Corrupt
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
+ DROP TABLE t1, t2;
++ERROR 42S02: Unknown table 't1,t2'
+ call mtr.add_suppression("Got an error from thread_id=.*");
+ call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+ call mtr.add_suppression(" '\..test.t1'");
+ call mtr.add_suppression("Couldn't repair table: test.t1");
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ REPAIR TABLE t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
+ INSERT INTO t1 (a,b) VALUES (10,'j');
++ERROR 42S02: Table 'test.t1' doesn't exist
+ REPAIR TABLE t1 USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-t1#P#p0.MYD
+-t1#P#p0.MYI
+-t1#P#p1.MYD
+-t1#P#p1.MYI
+-t1.frm
+-t1.par
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p0.MYD
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check error Size of datafile is: 26 Should be: 39
+-test.t1 check error Partition p0 returned error
+-test.t1 check error Corrupt
+-SELECT a,b FROM t1;
+-a b
+-8 h
+-10 j
+-7 g
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 3 to 2
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p0.MYI
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check warning Size of datafile is: 39 Should be: 26
+-test.t1 check error Record-count is not ok; is 3 Should be: 2
+-test.t1 check warning Found 3 key parts. Should be: 2
+-test.t1 check error Partition p0 returned error
+-test.t1 check error Corrupt
+-SELECT a,b FROM t1;
+-a b
+-8 h
+-10 j
+-14 n
+-7 g
+-15 o
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p0' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 2 to 3
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p1.MYD
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check error Size of datafile is: 39 Should be: 52
+-test.t1 check error Partition p1 returned error
+-test.t1 check error Corrupt
+-SELECT a,b FROM t1;
+-a b
+-8 h
+-10 j
+-14 n
+-14 n
+-7 g
+-15 o
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 4 to 3
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1#P#p1.MYI
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check warning Size of datafile is: 52 Should be: 39
+-test.t1 check error Record-count is not ok; is 4 Should be: 3
+-test.t1 check warning Found 4 key parts. Should be: 3
+-test.t1 check error Partition p1 returned error
+-test.t1 check error Corrupt
+-SELECT a,b FROM t1;
+-a b
+-8 h
+-10 j
+-14 n
+-14 n
+-14 n
+-7 g
+-15 o
+-15 o
+-15 o
+-Warnings:
+-Error 145 Table './test/t1#P#p1' is marked as crashed and should be repaired
+-Error 1194 Table 't1' is marked as crashed and should be repaired
+-Error 1034 Number of rows changed from 3 to 4
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1.par
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check status OK
+-SELECT a,b FROM t1;
+-a b
+-8 h
+-10 j
+-14 n
+-14 n
+-14 n
+-14 n
+-7 g
+-15 o
+-15 o
+-15 o
+-15 o
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
++test.t1 repair Error Table 'test.t1' doesn't exist
++test.t1 repair status Operation failed
+ DROP TABLE t1;
++ERROR 42S02: Unknown table 't1'
diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff
index 2c1364d52e1..01bf3702a3f 100644
--- a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff
@@ -1,100 +1,101 @@
-3,8c3,12
-< TRUNCATE TABLE t1;
-< INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
-< TRUNCATE TABLE t1;
-< SELECT * FROM t1;
-< a b
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-10,52c14,23
-< SHOW CREATE TABLE t1;
-< Table Create Table
-< t1 CREATE TABLE `t1` (
-< `a` int(11) NOT NULL AUTO_INCREMENT,
-< `c` char(8) DEFAULT NULL,
-< PRIMARY KEY (`a`)
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
-< /*!50100 PARTITION BY HASH (a)
-< PARTITIONS 2 */
-< INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
-< SHOW CREATE TABLE t1;
-< Table Create Table
-< t1 CREATE TABLE `t1` (
-< `a` int(11) NOT NULL AUTO_INCREMENT,
-< `c` char(8) DEFAULT NULL,
-< PRIMARY KEY (`a`)
-< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
-< /*!50100 PARTITION BY HASH (a)
-< PARTITIONS 2 */
-< TRUNCATE TABLE t1;
-< SHOW CREATE TABLE t1;
-< Table Create Table
-< t1 CREATE TABLE `t1` (
-< `a` int(11) NOT NULL AUTO_INCREMENT,
-< `c` char(8) DEFAULT NULL,
-< PRIMARY KEY (`a`)
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
-< /*!50100 PARTITION BY HASH (a)
-< PARTITIONS 2 */
-< INSERT INTO t1 (c) VALUES ('d');
-< SHOW CREATE TABLE t1;
-< Table Create Table
-< t1 CREATE TABLE `t1` (
-< `a` int(11) NOT NULL AUTO_INCREMENT,
-< `c` char(8) DEFAULT NULL,
-< PRIMARY KEY (`a`)
-< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
-< /*!50100 PARTITION BY HASH (a)
-< PARTITIONS 2 */
-< SELECT * FROM t1;
-< a c
-< 1 d
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ KEY AUTO_INCREMENT, c CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or PK or auto-increment or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-54,68c25,34
-< INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
-< ALTER TABLE t1 TRUNCATE PARTITION p0;
-< SELECT * FROM t1;
-< a b
-< 1 a
-< 101 g
-< 3 c
-< EXPLAIN PARTITIONS SELECT * FROM t1;
-< id select_type table partitions type possible_keys key key_len ref rows Extra
-< 1 SIMPLE t1 p0,p1 # # # # # #
-< INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
-< ALTER TABLE t1 TRUNCATE PARTITION ALL;
-< SELECT * FROM t1;
-< a b
-< DROP TABLE t1;
----
-> ERROR HY000: Engine cannot be used in partitioned tables
-> # ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
-> # The statement|command finished with ER_PARTITION_MERGE_ERROR.
-> # Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- truncate_table.result 2013-01-22 22:05:05.246633000 +0400
++++ truncate_table.reject 2013-01-23 03:16:27.076300201 +0400
+@@ -1,68 +1,34 @@
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-TRUNCATE TABLE t1;
+-INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+-TRUNCATE TABLE t1;
+-SELECT a,b FROM t1;
+-a b
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-SHOW CREATE TABLE t1;
+-Table Create Table
+-t1 CREATE TABLE `t1` (
+- `a` int(11) NOT NULL AUTO_INCREMENT,
+- `c` char(8) DEFAULT NULL,
+- PRIMARY KEY (`a`)
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+-/*!50100 PARTITION BY HASH (a)
+-PARTITIONS 2 */
+-INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
+-SHOW CREATE TABLE t1;
+-Table Create Table
+-t1 CREATE TABLE `t1` (
+- `a` int(11) NOT NULL AUTO_INCREMENT,
+- `c` char(8) DEFAULT NULL,
+- PRIMARY KEY (`a`)
+-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+-/*!50100 PARTITION BY HASH (a)
+-PARTITIONS 2 */
+-TRUNCATE TABLE t1;
+-SHOW CREATE TABLE t1;
+-Table Create Table
+-t1 CREATE TABLE `t1` (
+- `a` int(11) NOT NULL AUTO_INCREMENT,
+- `c` char(8) DEFAULT NULL,
+- PRIMARY KEY (`a`)
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
+-/*!50100 PARTITION BY HASH (a)
+-PARTITIONS 2 */
+-INSERT INTO t1 (c) VALUES ('d');
+-SHOW CREATE TABLE t1;
+-Table Create Table
+-t1 CREATE TABLE `t1` (
+- `a` int(11) NOT NULL AUTO_INCREMENT,
+- `c` char(8) DEFAULT NULL,
+- PRIMARY KEY (`a`)
+-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+-/*!50100 PARTITION BY HASH (a)
+-PARTITIONS 2 */
+-SELECT a,c FROM t1;
+-a c
+-1 d
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom indexed column options*/ KEY AUTO_INCREMENT, c CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or PK or auto-increment or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
+-INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(2,'d'),(4,'e'),(100,'f'),(101,'g');
+-ALTER TABLE t1 TRUNCATE PARTITION p0;
+-SELECT a,b FROM t1;
+-a b
+-1 a
+-101 g
+-3 c
+-EXPLAIN PARTITIONS SELECT a,b FROM t1;
+-id select_type table partitions type possible_keys key key_len ref rows Extra
+-1 SIMPLE t1 p0,p1 # # # # # #
+-INSERT INTO t1 (a,b) VALUES (1,'a'), (2,'b'), (3,'c');
+-ALTER TABLE t1 TRUNCATE PARTITION ALL;
+-SELECT a,b FROM t1;
+-a b
+-DROP TABLE t1;
++ERROR HY000: Engine cannot be used in partitioned tables
++# ERROR: Statement ended with errno 1572, errname ER_PARTITION_MERGE_ERROR (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b CHAR(8) /*!*/ /*Custom column options*/) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST PARTITION BY HASH(a) PARTITIONS 2 ]
++# The statement|command finished with ER_PARTITION_MERGE_ERROR.
++# Partitions or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
diff --git a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff
index 180647323bc..9ff8f906511 100644
--- a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff
@@ -1,103 +1,131 @@
-7c7
-< test.t1 repair status OK
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-12,13c12,13
-< test.t1 repair status OK
-< test.t2 repair status OK
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-> test.t2 repair note The storage engine for the table doesn't support repair
-17c17
-< test.t2 repair status OK
----
-> test.t2 repair note The storage engine for the table doesn't support repair
-22,23c22,23
-< test.t2 repair status OK
-< test.t1 repair status OK
----
-> test.t2 repair note The storage engine for the table doesn't support repair
-> test.t1 repair note The storage engine for the table doesn't support repair
-28,31c28,29
-< test.t1 repair warning Number of rows changed from 0 to 6
-< test.t1 repair status OK
-< test.t2 repair warning Number of rows changed from 0 to 5
-< test.t2 repair status OK
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-> test.t2 repair note The storage engine for the table doesn't support repair
-36,39c34,35
-< test.t1 repair warning Number of rows changed from 0 to 7
-< test.t1 repair status OK
-< test.t2 repair warning Number of rows changed from 0 to 6
-< test.t2 repair status OK
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-> test.t2 repair note The storage engine for the table doesn't support repair
-42c38
-< ERROR HY000: Incorrect file format 't1'
----
-> ERROR HY000: Table 't1' is read only
-47,48c43
-< test.t1 check Error Incorrect file format 't1'
-< test.t1 check error Corrupt
----
-> test.t1 check status OK
-50c45
-< ERROR HY000: Incorrect file format 't1'
----
-> a b
-55,56c50
-< test.t1 repair Error Incorrect file format 't1'
-< test.t1 repair error Corrupt
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-65c59
-< test.t1 repair status OK
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-69c63
-< test.t1 repair status OK
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-73,76c67,68
-< test.t1 repair warning Number of rows changed from 0 to 3
-< test.t1 repair status OK
-< t1.MYD
-< t1.MYI
----
-> test.t1 repair note The storage engine for the table doesn't support repair
-> t1.MRG
-82c74
-< Restoring <DATADIR>/test/t1.MYD
----
-> Restoring <DATADIR>/test/t1.MRG
-85,86c77
-< test.t1 check error Size of datafile is: 39 Should be: 65
-< test.t1 check error Corrupt
----
-> test.t1 check status OK
-88,103c79,84
-< ERROR HY000: Incorrect key file for table 't1'; try to repair it
-< # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
-< # If you got a difference in error message, just add it to rdiff file
-< INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
-< ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
-< # Statement ended with one of expected results (0,144).
-< # If you got a difference in error message, just add it to rdiff file
-< FLUSH TABLE t1;
-< Restoring <DATADIR>/test/t1.MYI
-< CHECK TABLE t1;
-< Table Op Msg_type Msg_text
-< test.t1 check warning Table is marked as crashed and last repair failed
-< test.t1 check error Size of datafile is: 39 Should be: 65
-< test.t1 check error Corrupt
-< SELECT * FROM t1;
-< ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
----
-> a b
-> 7 g
-> 8 h
-> 10 j
-> 14 n
-> 15 o
+--- repair_table.result 2013-01-23 01:26:05.995538460 +0400
++++ repair_table.reject 2013-01-23 02:50:55.035560564 +0400
+@@ -4,56 +4,50 @@
+ CREATE TABLE t2 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (3,'c');
+ INSERT INTO t2 (a,b) VALUES (4,'d');
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t2 (a,b) VALUES (5,'e'),(6,'f');
+ REPAIR LOCAL TABLE t2;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ INSERT INTO t2 (a,b) VALUES (9,'i');
+ REPAIR LOCAL TABLE t2, t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t2 repair status OK
+-test.t1 repair status OK
++test.t2 repair note The storage engine for the table doesn't support repair
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (10,'j');
+ INSERT INTO t2 (a,b) VALUES (11,'k');
+ REPAIR TABLE t1, t2 QUICK USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair warning Number of rows changed from 0 to 6
+-test.t1 repair status OK
+-test.t2 repair warning Number of rows changed from 0 to 5
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (12,'l');
+ INSERT INTO t2 (a,b) VALUES (13,'m');
+ REPAIR NO_WRITE_TO_BINLOG TABLE t1, t2 QUICK EXTENDED USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair warning Number of rows changed from 0 to 7
+-test.t1 repair status OK
+-test.t2 repair warning Number of rows changed from 0 to 6
+-test.t2 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
++test.t2 repair note The storage engine for the table doesn't support repair
+ FLUSH TABLE t1;
+ INSERT INTO t1 (a,b) VALUES (14,'n');
+-ERROR HY000: Incorrect file format 't1'
++ERROR HY000: Table 't1' is read only
+ # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+ # If you got a difference in error message, just add it to rdiff file
+ CHECK TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 check Error Incorrect file format 't1'
+-test.t1 check error Corrupt
++test.t1 check status OK
+ SELECT a,b FROM t1;
+-ERROR HY000: Incorrect file format 't1'
++a b
+ # Statement ended with one of expected results (0,130,ER_FAILED_READ_FROM_PAR_FILE,ER_OPEN_AS_READONLY).
+ # If you got a difference in error message, just add it to rdiff file
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair Error Incorrect file format 't1'
+-test.t1 repair error Corrupt
++test.t1 repair note The storage engine for the table doesn't support repair
+ DROP TABLE t1, t2;
+ call mtr.add_suppression("Got an error from thread_id=.*");
+ call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
+@@ -62,45 +56,32 @@
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ REPAIR TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (7,'g'),(8,'h');
+ REPAIR TABLE t1 EXTENDED;
+ Table Op Msg_type Msg_text
+-test.t1 repair status OK
++test.t1 repair note The storage engine for the table doesn't support repair
+ INSERT INTO t1 (a,b) VALUES (10,'j');
+ REPAIR TABLE t1 USE_FRM;
+ Table Op Msg_type Msg_text
+-test.t1 repair warning Number of rows changed from 0 to 3
+-test.t1 repair status OK
+-t1.MYD
+-t1.MYI
++test.t1 repair note The storage engine for the table doesn't support repair
++t1.MRG
+ t1.frm
+ INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+ # Statement ended with one of expected results (0,144).
+ # If you got a difference in error message, just add it to rdiff file
+ FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1.MYD
++Restoring <DATADIR>/test/t1.MRG
+ CHECK TABLE t1;
+ Table Op Msg_type Msg_text
+-test.t1 check error Size of datafile is: 39 Should be: 65
+-test.t1 check error Corrupt
++test.t1 check status OK
+ SELECT a,b FROM t1;
+-ERROR HY000: Incorrect key file for table 't1'; try to repair it
+-# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+-# If you got a difference in error message, just add it to rdiff file
+-INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
+-ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
+-# Statement ended with one of expected results (0,144).
+-# If you got a difference in error message, just add it to rdiff file
+-FLUSH TABLE t1;
+-Restoring <DATADIR>/test/t1.MYI
+-CHECK TABLE t1;
+-Table Op Msg_type Msg_text
+-test.t1 check warning Table is marked as crashed and last repair failed
+-test.t1 check error Size of datafile is: 39 Should be: 65
+-test.t1 check error Corrupt
+-SELECT a,b FROM t1;
+-ERROR HY000: Table './test/t1' is marked as crashed and last (automatic?) repair failed
++a b
++7 g
++8 h
++10 j
++14 n
++15 o
+ # Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
+ # If you got a difference in error message, just add it to rdiff file
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff
index e7c9b0176b6..e78e6fdad53 100644
--- a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff
@@ -1,2 +1,10 @@
-7d6
-< <STORAGE_ENGINE> ### Engine status, can be long and changeable ###
+--- show_engine.result 2013-01-22 22:05:05.246633000 +0400
++++ show_engine.reject 2013-01-23 02:50:56.871537482 +0400
+@@ -4,7 +4,6 @@
+ # volatile data (timestamps, memory info, etc.)
+ SHOW ENGINE <STORAGE_ENGINE> STATUS;
+ Type Name Status
+-<STORAGE_ENGINE> ### Engine status, can be long and changeable ###
+ # For SHOW MUTEX even the number of lines is volatile, so the result logging is disabled,
+ # the test only checks that the command does not produce any errors
+ SHOW ENGINE <STORAGE_ENGINE> MUTEX;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff
index bca6fa60d13..4de7e81ffba 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff
@@ -1,8 +1,16 @@
-7c7
-< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-13c13
-< ) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=100 DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_ai.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_ai.reject 2013-01-23 02:50:57.547528984 +0400
+@@ -4,11 +4,11 @@
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 AUTO_INCREMENT=100;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> AUTO_INCREMENT=100 DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff
index 7a3ac54fd3e..2632fabf89d 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_avg_row_length.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_avg_row_length.reject 2013-01-23 02:50:58.123521742 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=300 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 AVG_ROW_LENGTH=30000000;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 AVG_ROW_LENGTH=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff
index ecb3fadb479..baad32dd4db 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_checksum.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_checksum.reject 2013-01-23 02:50:58.739513998 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CHECKSUM=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 CHECKSUM=0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff
index d3ebd87ad1e..3dc06fb2704 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff
@@ -1,8 +1,19 @@
-13c13
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection'
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection'
-20c20
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection2'
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection2'
+--- tbl_opt_connection.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_connection.reject 2013-01-23 02:50:59.335506506 +0400
+@@ -10,14 +10,14 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection'
+ ALTER TABLE t1 CONNECTION='test_connection2';
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 CONNECTION='test_connection2'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) CONNECTION='test_connection2'
+ DROP TABLE t1;
+ DROP SERVER test_connection;
+ DROP SERVER test_connection2;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff
index 3c15e10d1f1..e6055278b3c 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_index_dir.rdiff
@@ -1,8 +1,18 @@
-7c7
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_data_index_dir.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_data_index_dir.reject 2013-01-23 02:50:59.951498762 +0400
+@@ -4,7 +4,7 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ Warnings:
+ Warning 1618 <INDEX DIRECTORY> option ignored
+ SHOW CREATE TABLE t1;
+@@ -12,5 +12,5 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff
index 5723e425b4d..2c2e40fa4b7 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_delay_key_write.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_delay_key_write.reject 2013-01-23 02:51:00.591490716 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DELAY_KEY_WRITE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 DELAY_KEY_WRITE=0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
index 2ced7647483..f5dc536c7ee 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`mrg`.`t1`)
+--- tbl_opt_insert_method.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_insert_method.reject 2013-01-23 02:51:01.211482922 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 INSERT_METHOD=NO;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff
index 8378f04ebcb..be90252f0b9 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_key_block_size.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_key_block_size.reject 2013-01-23 02:51:01.787475681 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 KEY_BLOCK_SIZE=1;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff
index f89147826c6..3eebf8cce9b 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_max_rows.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_max_rows.reject 2013-01-23 02:51:02.403467936 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=10000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 MAX_ROWS=30000000;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MAX_ROWS=30000000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff
index 3ce28480dcf..48c7124ca36 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_min_rows.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_min_rows.reject 2013-01-23 02:51:02.983460644 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 MIN_ROWS=10000;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 MIN_ROWS=10000 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff
index 246c7397a96..ab16cbcb0dc 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_pack_keys.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_pack_keys.reject 2013-01-23 02:51:03.563453353 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 PACK_KEYS=0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 PACK_KEYS=0 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff
index b1ef20c6f30..dc8303682db 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_password.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_password.reject 2013-01-23 02:51:04.155445910 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 PASSWORD='new_password';
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff
index 9c72c7c06ba..f7e0905d4e7 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff
@@ -1,8 +1,17 @@
-8c8
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
-15c15
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_opt_row_format.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_row_format.reject 2013-01-23 02:51:04.743438518 +0400
+@@ -5,12 +5,12 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff
index f77753f4d6b..e4e098a1b94 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff
@@ -1,8 +1,16 @@
-7c7
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`)
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`)
-13c13
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`)
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`,`child2`)
+--- tbl_opt_union.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_opt_union.reject 2013-01-23 02:51:05.375430573 +0400
+@@ -4,11 +4,11 @@
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`)
+ ALTER TABLE t1 UNION = (child1,child2);
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 UNION=(`child1`,`child2`)
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`child1`,`child2`)
+ DROP TABLE t1, child1, child2;
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff
index 9b7ffc6af76..a929b6df54b 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff
@@ -1,8 +1,19 @@
-11c11
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='standard table options'
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='standard table options'
-18c18
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='table altered'
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='table altered'
+--- tbl_standard_opts.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_standard_opts.reject 2013-01-23 02:51:05.991422829 +0400
+@@ -8,14 +8,14 @@
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='standard table options'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='standard table options'
+ ALTER TABLE t1 COMMENT = 'table altered';
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 COMMENT='table altered'
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=utf8 INSERT_METHOD=LAST UNION=(`mrg`.`t1`) COMMENT='table altered'
+ ALTER TABLE t1 ENGINE=MEMORY;
+ SHOW CREATE TABLE t1;
+ Table Create Table
diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff
index 45a229c98eb..d2c7d4f2836 100644
--- a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff
@@ -1,4 +1,10 @@
-9c9
-< ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
----
-> ) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+--- tbl_temporary.result 2013-01-22 22:05:05.246633000 +0400
++++ tbl_temporary.reject 2013-01-23 02:51:06.599415185 +0400
+@@ -6,6 +6,6 @@
+ t1 CREATE TEMPORARY TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
++) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`mrg`.`t1`)
+ DROP TEMPORARY TABLE t1;
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff
index 3a89f730540..e4de81bae70 100644
--- a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff
@@ -1,35 +1,48 @@
-12c12
-< t1 # # # # # # # # # 1 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-16c16
-< t1 # # # # # # # # # 4 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-20c20
-< t1 # # # # # # # # # 1 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-24c24
-< t1 # # # # # # # # # 2 # # # # # # #
----
-> t1 # # # # # # # # # 0 # # # # # # #
-32,40c32,39
-< HANDLER h1 READ FIRST;
-< a b
-< 1 a
-< TRUNCATE TABLE t1;
-< HANDLER h1 READ NEXT;
-< ERROR 42S02: Unknown table 'h1' in HANDLER
-< HANDLER t1 OPEN AS h2;
-< HANDLER h2 READ FIRST;
-< a b
----
-> ERROR HY000: Table storage engine for 'h1' doesn't have this option
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command finished with ER_ILLEGAL_HA.
-> # HANDLER or the syntax or the mix could be unsupported.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- truncate_table.result 2013-01-22 22:05:05.246633000 +0400
++++ truncate_table.reject 2013-01-23 02:51:07.507403770 +0400
+@@ -9,19 +9,19 @@
+ CREATE TABLE t1 (a <INT_COLUMN> KEY AUTO_INCREMENT, c <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ SHOW TABLE STATUS LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 1 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ INSERT INTO t1 (c) VALUES ('a'),('b'),('c');
+ SHOW TABLE STATUS LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 4 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ TRUNCATE TABLE t1;
+ SHOW TABLE STATUS LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 1 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ INSERT INTO t1 (c) VALUES ('d');
+ SHOW TABLE STATUS LIKE 't1';
+ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+-t1 # # # # # # # # # 2 # # # # # # #
++t1 # # # # # # # # # 0 # # # # # # #
+ SELECT a,c FROM t1;
+ a c
+ 1 d
+@@ -29,13 +29,12 @@
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
+ HANDLER t1 OPEN AS h1;
+-HANDLER h1 READ FIRST;
+-a b
+-1 a
+-TRUNCATE TABLE t1;
+-HANDLER h1 READ NEXT;
+-ERROR 42S02: Unknown table 'h1' in HANDLER
+-HANDLER t1 OPEN AS h2;
+-HANDLER h2 READ FIRST;
+-a b
++ERROR HY000: Table storage engine for 'h1' doesn't have this option
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command finished with ER_ILLEGAL_HA.
++# HANDLER or the syntax or the mix could be unsupported.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
index 018b28bd24c..94cfa74f384 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff
@@ -1,9 +1,20 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-13a20
-> 1
+--- cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400
++++ cons_snapshot_repeatable_read.reject 2013-01-23 03:22:34.255684132 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ connect con2,localhost,root,,;
+@@ -11,6 +17,7 @@
+ # If consistent read works on this isolation level (REPEATABLE READ), the following SELECT should not return the value we inserted (1)
+ SELECT a FROM t1;
+ a
++1
+ COMMIT;
+ connection default;
+ disconnect con1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
index 018b28bd24c..a9b9ba7f94b 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff
@@ -1,9 +1,20 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-13a20
-> 1
+--- cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400
++++ cons_snapshot_serializable.reject 2013-01-23 03:22:34.847676690 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ connect con2,localhost,root,,;
+@@ -11,6 +17,7 @@
+ # If consistent read works on this isolation level (SERIALIZABLE), the following SELECT should not return the value we inserted (1)
+ SELECT a FROM t1;
+ a
++1
+ COMMIT;
+ connection default;
+ disconnect con1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff
index 45a3e5fb52d..e4249478c76 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff
@@ -1,34 +1,50 @@
-0a1,12
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file (recommended), or add the test to disabled.def.
-> # If savepoints should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-48a61,62
-> Warnings:
-> Warning 1196 Some non-transactional changed tables couldn't be rolled back
-51,64d64
-< 10000 foobar
-< 10000 foobar
-< 2 b
-< 2 b
-< 4 d
-< 4 d
-< 5 e
-< 5 e
-< 6 f
-< 6 f
-< 7 g
-< 7 g
-< 8 h
-< 8 h
-70a71,72
-> Warnings:
-> Warning 1196 Some non-transactional changed tables couldn't be rolled back
+--- delete.result 2013-01-22 22:05:05.246633000 +0400
++++ delete.reject 2013-01-23 03:22:35.419669500 +0400
+@@ -1,3 +1,15 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file (recommended), or add the test to disabled.def.
++# If savepoints should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(10000,'foobar');
+@@ -46,27 +58,17 @@
+ DELETE FROM t1;
+ RELEASE SAVEPOINT spt1;
+ ROLLBACK;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ SELECT a,b FROM t1;
+ a b
+-10000 foobar
+-10000 foobar
+-2 b
+-2 b
+-4 d
+-4 d
+-5 e
+-5 e
+-6 f
+-6 f
+-7 g
+-7 g
+-8 h
+-8 h
+ BEGIN;
+ DELETE FROM t1 WHERE a <= 4 ORDER BY b DESC LIMIT 1;
+ SAVEPOINT spt1;
+ DELETE FROM t1;
+ INSERT INTO t1 (a,b) VALUES (1,'a');
+ ROLLBACK TO SAVEPOINT spt1;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ COMMIT;
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff
index 69981f90e13..d5e99b6d7dc 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff
@@ -1,32 +1,65 @@
-0a1,12
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file (recommended), or add the test to disabled.def.
-> # If savepoints should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-23a36,37
-> Warnings:
-> Warning 1196 Some non-transactional changed tables couldn't be rolled back
-25a40
-> 0 test
-33a49,50
-> NULL NULL
-> NULL NULL
-39a57,58
-> Warnings:
-> Warning 1196 Some non-transactional changed tables couldn't be rolled back
-43a63
-> 0 test
-49a70
-> 11 f
-54a76,78
-> NULL NULL
-> NULL NULL
-> NULL NULL
+--- insert.result 2013-01-22 22:05:05.246633000 +0400
++++ insert.reject 2013-01-23 03:22:35.987662359 +0400
+@@ -1,3 +1,15 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file (recommended), or add the test to disabled.def.
++# If savepoints should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ BEGIN;
+@@ -21,8 +33,11 @@
+ RELEASE SAVEPOINT spt1;
+ INSERT INTO t1 (a,b) VALUES (DEFAULT,DEFAULT);
+ ROLLBACK;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ SELECT a,b FROM t1;
+ a b
++0 test
+ 1 a
+ 10 foo
+ 100 foo
+@@ -31,25 +46,34 @@
+ 3 c
+ 4 d
+ 5 e
++NULL NULL
++NULL NULL
+ BEGIN;
+ INSERT t1 (a) VALUE (10),(20);
+ SAVEPOINT spt1;
+ INSERT INTO t1 SET a = 11, b = 'f';
+ INSERT t1 SET b = DEFAULT;
+ ROLLBACK TO SAVEPOINT spt1;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ INSERT INTO t1 (b,a) VALUES ('test1',10);
+ COMMIT;
+ SELECT a,b FROM t1;
+ a b
++0 test
+ 1 a
+ 10 NULL
+ 10 foo
+ 10 test1
+ 100 foo
+ 11 abc
++11 f
+ 2 b
+ 20 NULL
+ 3 c
+ 4 d
+ 5 e
++NULL NULL
++NULL NULL
++NULL NULL
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff
index 0837c74f5ff..9e7c340c524 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff
@@ -1,44 +1,94 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-18a25
-> 1
-25a33,34
-> 1
-> 2
-30a40,43
-> 1
-> 101
-> 102
-> 2
-34a48,49
-> 101
-> 102
-39a55,56
-> 101
-> 102
-44a62,63
-> 101
-> 102
-51a71,72
-> 101
-> 102
-54a76,77
-> 301
-> 302
-58a82,83
-> 101
-> 102
-61a87,88
-> 301
-> 302
-65a93,94
-> 101
-> 102
-68a98,99
-> 301
-> 302
+--- level_read_committed.result 2013-01-22 22:05:05.246633000 +0400
++++ level_read_committed.reject 2013-01-23 03:22:36.603654615 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+@@ -16,6 +22,7 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+ # WARNING: Statement ended with errno 0, errname ''.
+@@ -23,25 +30,37 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ INSERT INTO t1 (a) SELECT a+100 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ connection con1;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ INSERT INTO t1 (a) SELECT a+200 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+@@ -49,23 +68,35 @@
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection default;
+ disconnect con1;
+ disconnect con2;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
index bd9569267e5..d44e4aa7a12 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff
@@ -1,7 +1,12 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
+--- level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400
++++ level_read_uncommitted.reject 2013-01-23 03:22:37.263646318 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
index 82f7c5c5ba6..b24376a9c28 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff
@@ -1,53 +1,96 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-18a25
-> 1
-25a33,34
-> 1
-> 2
-27,28c36
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
----
-> # WARNING: Statement ended with errno 0, errname ''.
-31a40,43
-> 1
-> 101
-> 102
-> 2
-35a48,49
-> 101
-> 102
-40a55,56
-> 101
-> 102
-44a61,64
-> 1
-> 101
-> 102
-> 2
-49a70,73
-> 1
-> 101
-> 102
-> 2
-51a76,77
-> 301
-> 302
-55a82,83
-> 101
-> 102
-58a87,88
-> 301
-> 302
-62a93,94
-> 101
-> 102
-65a98,99
-> 301
-> 302
+--- level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400
++++ level_repeatable_read.reject 2013-01-23 03:22:37.867638724 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+@@ -16,6 +22,7 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+ # WARNING: Statement ended with errno 0, errname ''.
+@@ -23,46 +30,73 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ INSERT INTO t1 (a) SELECT a+100 FROM t1;
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
++# WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ INSERT INTO t1 (a) SELECT a+200 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ 201
+ 202
++301
++302
+ COMMIT;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection con2;
+ SELECT a FROM t1;
+ a
+ 1
++101
++102
+ 2
+ 201
+ 202
++301
++302
+ connection default;
+ disconnect con1;
+ disconnect con2;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff
index 3924b3784a9..3567e718459 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff
@@ -1,69 +1,103 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-14,15c20
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
----
-> # WARNING: Statement ended with errno 0, errname ''.
-19a25
-> 1
-22,23c28
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-< # WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
----
-> # WARNING: Statement ended with errno 0, errname ''.
-27a33,34
-> 1
-> 2
-32a40,43
-> 1
-> 101
-> 102
-> 2
-35a47,50
-> 1
-> 101
-> 102
-> 2
-38a54,57
-> 1
-> 101
-> 102
-> 2
-41a61,64
-> 1
-> 101
-> 102
-> 2
-46a70,77
-> 1
-> 101
-> 102
-> 2
-> 201
-> 202
-> 301
-> 302
-49a81,88
-> 1
-> 101
-> 102
-> 2
-> 201
-> 202
-> 301
-> 302
-52a92,99
-> 1
-> 101
-> 102
-> 2
-> 201
-> 202
-> 301
-> 302
+--- level_serializable.result 2013-01-22 22:05:05.246633000 +0400
++++ level_serializable.reject 2013-01-23 03:22:38.471631132 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+@@ -11,45 +17,86 @@
+ connection con2;
+ BEGIN;
+ INSERT INTO t1 (a) VALUES(1);
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
++# WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+-# WARNING: Statement ended with errno 1205, errname 'ER_LOCK_WAIT_TIMEOUT'.
++# WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ INSERT INTO t1 (a) SELECT a+100 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con2;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ COMMIT;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
+ INSERT INTO t1 (a) SELECT a+200 FROM t1;
+ # WARNING: Statement ended with errno 0, errname ''.
+ # If it differs from the result file, it might indicate a problem.
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
++201
++202
++301
++302
+ COMMIT;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
++201
++202
++301
++302
+ connection con2;
+ SELECT a FROM t1;
+ a
++1
++101
++102
++2
++201
++202
++301
++302
+ connection default;
+ disconnect con1;
+ disconnect con2;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff
index f8ffe67586d..bad014d87ed 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff
@@ -1,40 +1,50 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-17c23,33
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
----
-> a b
-> 1 a
-> 3 a
-> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command succeeded unexpectedly.
-> # SELECT .. FOR UPDATE or LOCK IN SHARE MODE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-19c35,42
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
----
-> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command succeeded unexpectedly.
-> # UPDATE or SELECT .. FOR UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-24c47
-< 1 a
----
-> 1 c
-26c49
-< 3 a
----
-> 3 c
+--- select_for_update.result 2013-01-22 22:05:05.246633000 +0400
++++ select_for_update.reject 2013-01-23 03:22:39.123622935 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+@@ -14,16 +20,33 @@
+ 1 a
+ 3 a
+ SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++a b
++1 a
++3 a
++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# SELECT .. FOR UPDATE or LOCK IN SHARE MODE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ UPDATE t1 SET b='c' WHERE b='a';
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# UPDATE or SELECT .. FOR UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ connection con1;
+ COMMIT;
+ SELECT a,b FROM t1;
+ a b
+-1 a
++1 c
+ 2 b
+-3 a
++3 c
+ disconnect con1;
+ connection default;
+ UPDATE t1 SET b='c' WHERE b='a';
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
index e316993830a..db3eec1bc24 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff
@@ -1,26 +1,37 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-21c27,34
-< ERROR HY000: Lock wait timeout exceeded; try restarting transaction
----
-> # ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
-> # ------------ UNEXPECTED RESULT ------------
-> # The statement|command succeeded unexpectedly.
-> # LOCK IN SHARE MODE or UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-26c39
-< 1 a
----
-> 1 c
-28c41
-< 3 a
----
-> 3 c
+--- select_lock_in_share_mode.result 2013-01-22 22:05:05.246633000 +0400
++++ select_lock_in_share_mode.reject 2013-01-23 03:22:39.739615191 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
+@@ -18,14 +24,21 @@
+ 1 a
+ 3 a
+ UPDATE t1 SET b='c' WHERE b='a';
+-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
++# ERROR: Statement succeeded (expected results: ER_LOCK_WAIT_TIMEOUT)
++# ------------ UNEXPECTED RESULT ------------
++# The statement|command succeeded unexpectedly.
++# LOCK IN SHARE MODE or UPDATE or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ connection con1;
+ COMMIT;
+ SELECT a,b FROM t1;
+ a b
+-1 a
++1 c
+ 2 b
+-3 a
++3 c
+ disconnect con1;
+ connection default;
+ UPDATE t1 SET b='c' WHERE b='a';
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff
index 7ad463053eb..baac054766b 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff
@@ -1,41 +1,58 @@
-0a1,12
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support transactions.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If transactions should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file (recommended), or add the test to disabled.def.
-> # If savepoints should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-26a39,40
-> Warnings:
-> Warning 1196 Some non-transactional changed tables couldn't be rolled back
-31a46,47
-> Warnings:
-> Warning 1196 Some non-transactional changed tables couldn't be rolled back
-38,47c54,63
-< 51 update2
-< 51 update2
-< 52 update2
-< 52 update2
-< 53 update2
-< 53 update2
-< 54 update2
-< 54 update2
-< 55 update2
-< 55 update2
----
-> 51
-> 51
-> 52
-> 52
-> 53
-> 53
-> 54
-> 54
-> 55
-> 55
+--- update.result 2013-01-22 22:05:05.246633000 +0400
++++ update.reject 2013-01-23 03:22:40.355607446 +0400
+@@ -1,3 +1,15 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support transactions.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If transactions should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support savepoints.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file (recommended), or add the test to disabled.def.
++# If savepoints should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+ INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(10000,'foobar');
+@@ -24,25 +36,29 @@
+ UPDATE t1 SET b = 'update' WHERE a <= 4 ORDER BY a DESC, b ASC LIMIT 3;
+ UPDATE t1 SET b = '';
+ ROLLBACK;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ BEGIN;
+ UPDATE t1 SET b = 'update2' WHERE a <= 100;
+ SAVEPOINT spt1;
+ UPDATE t1 SET b = '';
+ ROLLBACK TO SAVEPOINT spt1;
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ UPDATE t1 SET b = 'upd' WHERE a = 10050;
+ COMMIT;
+ SELECT a,b FROM t1;
+ a b
+ 10050 upd
+ 10050 upd
+-51 update2
+-51 update2
+-52 update2
+-52 update2
+-53 update2
+-53 update2
+-54 update2
+-54 update2
+-55 update2
+-55 update2
++51
++51
++52
++52
++53
++53
++54
++54
++55
++55
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff
index ee7c2a984be..a491287337d 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff
@@ -1,34 +1,89 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support XA.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If XA should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-11a18
-> 1
-17a25,26
-> 1
-> 2
-22a32,33
-> 1
-> 2
-40a52
-> 3
-48a61,62
-> 3
-> 4
-67a82
-> 5
-77a93,94
-> 5
-> 6
-86a104,105
-> 5
-> 6
-88a108,109
-> Warnings:
-> Warning 1196 Some non-transactional changed tables couldn't be rolled back
-95a117,118
-> 5
-> 6
+--- xa.result 2013-01-22 22:05:05.246633000 +0400
++++ xa.reject 2013-01-23 03:22:41.047598747 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support XA.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If XA should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ DROP TABLE IF EXISTS t1;
+ connect con1,localhost,root,,;
+ connect con2,localhost,root,,;
+@@ -9,17 +15,22 @@
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
+ connection con2;
+ INSERT INTO t1 (a) VALUES (2);
+ XA END 'xa1';
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ connection con2;
+ XA PREPARE 'xa1';
+ connection con1;
+ SELECT a FROM t1;
+ a
++1
++2
+ connection con2;
+ XA RECOVER;
+ formatID gtrid_length bqual_length data
+@@ -38,6 +49,7 @@
+ a
+ 1
+ 2
++3
+ connection con2;
+ INSERT INTO t1 (a) VALUES (4);
+ XA END 'xa2';
+@@ -46,6 +58,8 @@
+ a
+ 1
+ 2
++3
++4
+ connection con2;
+ XA COMMIT 'xa2' ONE PHASE;
+ connection con1;
+@@ -65,6 +79,7 @@
+ 2
+ 3
+ 4
++5
+ connection con2;
+ INSERT INTO t1 (a) VALUES (6);
+ XA END 'xa3';
+@@ -75,6 +90,8 @@
+ 2
+ 3
+ 4
++5
++6
+ connection con2;
+ XA PREPARE 'xa3';
+ connection con1;
+@@ -84,8 +101,12 @@
+ 2
+ 3
+ 4
++5
++6
+ connection con2;
+ XA ROLLBACK 'xa3';
++Warnings:
++Warning 1196 Some non-transactional changed tables couldn't be rolled back
+ connection con1;
+ SELECT a FROM t1;
+ a
+@@ -93,4 +114,6 @@
+ 2
+ 3
+ 4
++5
++6
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff
index 362e3a8914a..8dc888a1d58 100644
--- a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff
@@ -1,22 +1,33 @@
-0a1,6
-> # -- WARNING ----------------------------------------------------------------
-> # According to I_S.ENGINES, MRG_MYISAM does not support XA.
-> # If it is true, the test will most likely fail; you can
-> # either create an rdiff file, or add the test to disabled.def.
-> # If XA should be supported, check the data in Information Schema.
-> # ---------------------------------------------------------------------------
-21,22d26
-< 1 3 0 xa1
-< 1 3 0 xa2
-23a28
-> ERROR XAE04: XAER_NOTA: Unknown XID
-24a30
-> ERROR XAE04: XAER_NOTA: Unknown XID
-26a33,34
-> 1
-> 2
-28a37,40
-> Warnings:
-> Error 145 Table './mrg/t1' is marked as crashed and should be repaired
-> Error 1194 Table 't1' is marked as crashed and should be repaired
-> Error 1034 1 client is using or hasn't closed the table properly
+--- xa_recovery.result 2013-01-22 22:05:05.246633000 +0400
++++ xa_recovery.reject 2013-01-23 03:22:43.247571090 +0400
+@@ -1,3 +1,9 @@
++# -- WARNING ----------------------------------------------------------------
++# According to I_S.ENGINES, MRG_MYISAM does not support XA.
++# If it is true, the test will most likely fail; you can
++# either create an rdiff file, or add the test to disabled.def.
++# If XA should be supported, check the data in Information Schema.
++# ---------------------------------------------------------------------------
+ call mtr.add_suppression("Found 2 prepared XA transactions");
+ FLUSH TABLES;
+ DROP TABLE IF EXISTS t1;
+@@ -18,12 +24,18 @@
+ connection default;
+ XA RECOVER;
+ formatID gtrid_length bqual_length data
+-1 3 0 xa1
+-1 3 0 xa2
+ XA ROLLBACK 'xa1';
++ERROR XAE04: XAER_NOTA: Unknown XID
+ XA COMMIT 'xa2';
++ERROR XAE04: XAER_NOTA: Unknown XID
+ SELECT a FROM t1;
+ a
++1
++2
+ 3
+ 4
++Warnings:
++Error 145 Table './mrg/t1' is marked as crashed and should be repaired
++Error 1194 Table 't1' is marked as crashed and should be repaired
++Error 1034 1 client is using or hasn't closed the table properly
+ DROP TABLE t1;
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff
index a0a418e0bcc..c80d4acced5 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff
@@ -1,8 +1,20 @@
-101c101
-< # # # range c_v c_v # # # Using index condition
----
-> # # # ALL c_v NULL # # # Using where
-138c138
-< # # # range # v16 # # # #
----
-> # # # ALL # NULL # # # #
+--- type_char_indexes.result 2013-01-22 22:05:05.246633000 +0400
++++ type_char_indexes.reject 2013-01-23 02:51:10.055371738 +0400
+@@ -98,7 +98,7 @@
+ SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
+ EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
+ id select_type table type possible_keys key key_len ref rows Extra
+-# # # range c_v c_v # # # Using index condition
++# # # ALL c_v NULL # # # Using where
+ SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
+ c c20 v16 v128
+ b char3 varchar1a varchar1b
+@@ -135,7 +135,7 @@
+ r3a
+ EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ id select_type table type possible_keys key key_len ref rows Extra
+-# # # range # v16 # # # #
++# # # ALL # NULL # # # #
+ SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16;
+ c c20 v16 v128
+ a char1 varchar1a varchar1b
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff
index 640e1050a99..eb4da4db951 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff
@@ -1,4 +1,11 @@
-63c63
-< # # # # # d # # # #
----
-> # # # # # NULL # # # #
+--- type_float_indexes.result 2013-01-22 22:05:05.246633000 +0400
++++ type_float_indexes.reject 2013-01-23 02:51:13.059333973 +0400
+@@ -60,7 +60,7 @@
+ ALTER TABLE t1 ADD UNIQUE KEY(d);
+ EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+ id select_type table type possible_keys key key_len ref rows Extra
+-# # # # # d # # # #
++# # # # # NULL # # # #
+ SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d;
+ d
+ 1.2345
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
index a4d7d4390b8..dbf29fb8d00 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff
@@ -1,706 +1,712 @@
-5,698c5,14
-< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< USE gis_ogs;
-< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< shore POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
-< num_lanes INT <CUSTOM_COL_OPTIONS>,
-< centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< num_lanes INT <CUSTOM_COL_OPTIONS>,
-< centerlines MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< boundary MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< position POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< position POINT,
-< footprint POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< type CHAR(64) <CUSTOM_COL_OPTIONS>,
-< shores MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< boundary POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
-< neatline POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< USE test;
-< SHOW FIELDS FROM gis_point;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g point YES NULL
-< SHOW FIELDS FROM gis_line;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g linestring YES NULL
-< SHOW FIELDS FROM gis_polygon;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g polygon YES NULL
-< SHOW FIELDS FROM gis_multi_point;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multipoint YES NULL
-< SHOW FIELDS FROM gis_multi_line;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multilinestring YES NULL
-< SHOW FIELDS FROM gis_multi_polygon;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multipolygon YES NULL
-< SHOW FIELDS FROM gis_geometrycollection;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g geometrycollection YES NULL
-< SHOW FIELDS FROM gis_geometry;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g geometry YES NULL
-< INSERT INTO gis_point VALUES
-< (101, PointFromText('POINT(10 10)')),
-< (102, PointFromText('POINT(20 10)')),
-< (103, PointFromText('POINT(20 20)')),
-< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-< INSERT INTO gis_line VALUES
-< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
-< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
-< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
-< INSERT INTO gis_polygon VALUES
-< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
-< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
-< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
-< INSERT INTO gis_multi_point VALUES
-< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
-< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
-< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
-< INSERT INTO gis_multi_line VALUES
-< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
-< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
-< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
-< INSERT INTO gis_multi_polygon VALUES
-< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-< INSERT INTO gis_geometrycollection VALUES
-< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
-< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
-< (122, GeomFromText('GeometryCollection()')),
-< (123, GeomFromText('GeometryCollection EMPTY'));
-< INSERT into gis_geometry SELECT * FROM gis_point;
-< INSERT into gis_geometry SELECT * FROM gis_line;
-< INSERT into gis_geometry SELECT * FROM gis_polygon;
-< INSERT into gis_geometry SELECT * FROM gis_multi_point;
-< INSERT into gis_geometry SELECT * FROM gis_multi_line;
-< INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
-< INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
-< SELECT fid, AsText(g) FROM gis_point;
-< fid AsText(g)
-< 101 POINT(10 10)
-< 102 POINT(20 10)
-< 103 POINT(20 20)
-< 104 POINT(10 20)
-< SELECT fid, AsText(g) FROM gis_line;
-< fid AsText(g)
-< 105 LINESTRING(0 0,0 10,10 0)
-< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 107 LINESTRING(10 10,40 10)
-< SELECT fid, AsText(g) FROM gis_polygon;
-< fid AsText(g)
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-< 110 POLYGON((0 0,30 0,30 30,0 0))
-< SELECT fid, AsText(g) FROM gis_multi_point;
-< fid AsText(g)
-< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
-< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
-< 113 MULTIPOINT(3 6,4 10)
-< SELECT fid, AsText(g) FROM gis_multi_line;
-< fid AsText(g)
-< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-< 115 MULTILINESTRING((10 48,10 21,10 0))
-< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-< SELECT fid, AsText(g) FROM gis_multi_polygon;
-< fid AsText(g)
-< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-< SELECT fid, AsText(g) FROM gis_geometrycollection;
-< fid AsText(g)
-< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, AsText(g) FROM gis_geometry;
-< fid AsText(g)
-< 101 POINT(10 10)
-< 102 POINT(20 10)
-< 103 POINT(20 20)
-< 104 POINT(10 20)
-< 105 LINESTRING(0 0,0 10,10 0)
-< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 107 LINESTRING(10 10,40 10)
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-< 110 POLYGON((0 0,30 0,30 30,0 0))
-< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
-< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
-< 113 MULTIPOINT(3 6,4 10)
-< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-< 115 MULTILINESTRING((10 48,10 21,10 0))
-< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, Dimension(g) FROM gis_geometry;
-< fid Dimension(g)
-< 101 0
-< 102 0
-< 103 0
-< 104 0
-< 105 1
-< 106 1
-< 107 1
-< 108 2
-< 109 2
-< 110 2
-< 111 0
-< 112 0
-< 113 0
-< 114 1
-< 115 1
-< 116 1
-< 117 2
-< 118 2
-< 119 2
-< 120 1
-< 121 1
-< 122 0
-< 123 0
-< SELECT fid, GeometryType(g) FROM gis_geometry;
-< fid GeometryType(g)
-< 101 POINT
-< 102 POINT
-< 103 POINT
-< 104 POINT
-< 105 LINESTRING
-< 106 LINESTRING
-< 107 LINESTRING
-< 108 POLYGON
-< 109 POLYGON
-< 110 POLYGON
-< 111 MULTIPOINT
-< 112 MULTIPOINT
-< 113 MULTIPOINT
-< 114 MULTILINESTRING
-< 115 MULTILINESTRING
-< 116 MULTILINESTRING
-< 117 MULTIPOLYGON
-< 118 MULTIPOLYGON
-< 119 MULTIPOLYGON
-< 120 GEOMETRYCOLLECTION
-< 121 GEOMETRYCOLLECTION
-< 122 GEOMETRYCOLLECTION
-< 123 GEOMETRYCOLLECTION
-< SELECT fid, IsEmpty(g) FROM gis_geometry;
-< fid IsEmpty(g)
-< 101 0
-< 102 0
-< 103 0
-< 104 0
-< 105 0
-< 106 0
-< 107 0
-< 108 0
-< 109 0
-< 110 0
-< 111 0
-< 112 0
-< 113 0
-< 114 0
-< 115 0
-< 116 0
-< 117 0
-< 118 0
-< 119 0
-< 120 0
-< 121 0
-< 122 0
-< 123 0
-< SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
-< fid AsText(Envelope(g))
-< 101 POLYGON((10 10,10 10,10 10,10 10,10 10))
-< 102 POLYGON((20 10,20 10,20 10,20 10,20 10))
-< 103 POLYGON((20 20,20 20,20 20,20 20,20 20))
-< 104 POLYGON((10 20,10 20,10 20,10 20,10 20))
-< 105 POLYGON((0 0,10 0,10 10,0 10,0 0))
-< 106 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 107 POLYGON((10 10,40 10,40 10,10 10,10 10))
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0))
-< 110 POLYGON((0 0,30 0,30 30,0 30,0 0))
-< 111 POLYGON((0 0,20 0,20 20,0 20,0 0))
-< 112 POLYGON((1 1,21 1,21 21,1 21,1 1))
-< 113 POLYGON((3 6,4 6,4 10,3 10,3 6))
-< 114 POLYGON((10 0,16 0,16 48,10 48,10 0))
-< 115 POLYGON((10 0,10 0,10 48,10 48,10 0))
-< 116 POLYGON((1 2,21 2,21 8,1 8,1 2))
-< 117 POLYGON((28 0,84 0,84 42,28 42,28 0))
-< 118 POLYGON((28 0,84 0,84 42,28 42,28 0))
-< 119 POLYGON((0 0,3 0,3 3,0 3,0 0))
-< 120 POLYGON((0 0,10 0,10 10,0 10,0 0))
-< 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, X(g) FROM gis_point;
-< fid X(g)
-< 101 10
-< 102 20
-< 103 20
-< 104 10
-< SELECT fid, Y(g) FROM gis_point;
-< fid Y(g)
-< 101 10
-< 102 10
-< 103 20
-< 104 20
-< SELECT fid, AsText(StartPoint(g)) FROM gis_line;
-< fid AsText(StartPoint(g))
-< 105 POINT(0 0)
-< 106 POINT(10 10)
-< 107 POINT(10 10)
-< SELECT fid, AsText(EndPoint(g)) FROM gis_line;
-< fid AsText(EndPoint(g))
-< 105 POINT(10 0)
-< 106 POINT(10 10)
-< 107 POINT(40 10)
-< SELECT fid, GLength(g) FROM gis_line;
-< fid GLength(g)
-< 105 24.14213562373095
-< 106 40
-< 107 30
-< SELECT fid, NumPoints(g) FROM gis_line;
-< fid NumPoints(g)
-< 105 3
-< 106 5
-< 107 2
-< SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
-< fid AsText(PointN(g, 2))
-< 105 POINT(0 10)
-< 106 POINT(20 10)
-< 107 POINT(40 10)
-< SELECT fid, IsClosed(g) FROM gis_line;
-< fid IsClosed(g)
-< 105 0
-< 106 1
-< 107 0
-< SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
-< fid AsText(Centroid(g))
-< 108 POINT(15 15)
-< 109 POINT(25.416666666666668 25.416666666666668)
-< 110 POINT(20 10)
-< SELECT fid, Area(g) FROM gis_polygon;
-< fid Area(g)
-< 108 100
-< 109 2400
-< 110 450
-< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
-< fid AsText(ExteriorRing(g))
-< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
-< 110 LINESTRING(0 0,30 0,30 30,0 0)
-< SELECT fid, NumInteriorRings(g) FROM gis_polygon;
-< fid NumInteriorRings(g)
-< 108 0
-< 109 1
-< 110 0
-< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-< fid AsText(InteriorRingN(g, 1))
-< 108 NULL
-< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 110 NULL
-< SELECT fid, IsClosed(g) FROM gis_multi_line;
-< fid IsClosed(g)
-< 114 0
-< 115 0
-< 116 0
-< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-< fid AsText(Centroid(g))
-< 117 POINT(55.58852775304245 17.426536064113982)
-< 118 POINT(55.58852775304245 17.426536064113982)
-< 119 POINT(2 2)
-< SELECT fid, Area(g) FROM gis_multi_polygon;
-< fid Area(g)
-< 117 1684.5
-< 118 1684.5
-< 119 4.5
-< SELECT fid, NumGeometries(g) from gis_multi_point;
-< fid NumGeometries(g)
-< 111 4
-< 112 4
-< 113 2
-< SELECT fid, NumGeometries(g) from gis_multi_line;
-< fid NumGeometries(g)
-< 114 2
-< 115 1
-< 116 2
-< SELECT fid, NumGeometries(g) from gis_multi_polygon;
-< fid NumGeometries(g)
-< 117 2
-< 118 2
-< 119 1
-< SELECT fid, NumGeometries(g) from gis_geometrycollection;
-< fid NumGeometries(g)
-< 120 2
-< 121 2
-< 122 0
-< 123 0
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-< fid AsText(GeometryN(g, 2))
-< 111 POINT(10 10)
-< 112 POINT(11 11)
-< 113 POINT(4 10)
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
-< fid AsText(GeometryN(g, 2))
-< 114 LINESTRING(16 0,16 23,16 48)
-< 115 NULL
-< 116 LINESTRING(2 5,5 8,21 7)
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
-< fid AsText(GeometryN(g, 2))
-< 117 POLYGON((59 18,67 18,67 13,59 13,59 18))
-< 118 POLYGON((59 18,67 18,67 13,59 13,59 18))
-< 119 NULL
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
-< fid AsText(GeometryN(g, 2))
-< 120 LINESTRING(0 0,10 10)
-< 121 LINESTRING(3 6,7 9)
-< 122 NULL
-< 123 NULL
-< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
-< fid AsText(GeometryN(g, 1))
-< 120 POINT(0 0)
-< 121 POINT(44 6)
-< 122 NULL
-< 123 NULL
-< SELECT g1.fid as first, g2.fid as second,
-< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
-< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
-< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-< first second w c o e d t i r
-< 120 120 1 1 0 1 0 1 1 0
-< 120 121 0 0 1 0 0 0 1 0
-< 120 122 0 1 NULL 0 NULL 0 NULL 0
-< 120 123 0 1 NULL 0 NULL 0 NULL 0
-< 121 120 0 0 1 0 0 0 1 0
-< 121 121 1 1 0 1 0 1 1 0
-< 121 122 0 1 NULL 0 NULL 0 NULL 0
-< 121 123 0 1 NULL 0 NULL 0 NULL 0
-< 122 120 1 0 NULL 0 NULL 0 NULL 0
-< 122 121 1 0 NULL 0 NULL 0 NULL 0
-< 122 122 1 1 NULL 1 NULL 0 NULL 0
-< 122 123 1 1 NULL 1 NULL 0 NULL 0
-< 123 120 1 0 NULL 0 NULL 0 NULL 0
-< 123 121 1 0 NULL 0 NULL 0 NULL 0
-< 123 122 1 1 NULL 1 NULL 0 NULL 0
-< 123 123 1 1 NULL 1 NULL 0 NULL 0
-< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-< USE gis_ogs;
-< # Lakes
-< INSERT INTO lakes VALUES (
-< 101, 'BLUE LAKE',
-< PolyFromText(
-< 'POLYGON(
-< (52 18,66 23,73 9,48 6,52 18),
-< (59 18,67 18,67 13,59 13,59 18)
-< )',
-< 101));
-< # Road Segments
-< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
-< LineFromText(
-< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
-< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
-< LineFromText(
-< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
-< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
-< LineFromText(
-< 'LINESTRING( 70 38, 72 48 )' ,101));
-< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
-< LineFromText(
-< 'LINESTRING( 70 38, 84 42 )' ,101));
-< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
-< 1,
-< LineFromText(
-< 'LINESTRING( 28 26, 28 0 )',101));
-< # DividedRoutes
-< INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
-< MLineFromText(
-< 'MULTILINESTRING((10 48,10 21,10 0),
-< (16 0,16 23,16 48))', 101));
-< # Forests
-< INSERT INTO forests VALUES(109, 'Green Forest',
-< MPolyFromText(
-< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
-< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
-< 101));
-< # Bridges
-< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
-< 'POINT( 44 31 )', 101));
-< # Streams
-< INSERT INTO streams VALUES(111, 'Cam Stream',
-< LineFromText(
-< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
-< INSERT INTO streams VALUES(112, NULL,
-< LineFromText(
-< 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
-< # Buildings
-< INSERT INTO buildings VALUES(113, '123 Main Street',
-< PointFromText(
-< 'POINT( 52 30 )', 101),
-< PolyFromText(
-< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
-< INSERT INTO buildings VALUES(114, '215 Main Street',
-< PointFromText(
-< 'POINT( 64 33 )', 101),
-< PolyFromText(
-< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
-< # Ponds
-< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
-< MPolyFromText(
-< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
-< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
-< # Named Places
-< INSERT INTO named_places VALUES(117, 'Ashton',
-< PolyFromText(
-< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
-< INSERT INTO named_places VALUES(118, 'Goose Island',
-< PolyFromText(
-< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
-< # Map Neatlines
-< INSERT INTO map_neatlines VALUES(115,
-< PolyFromText(
-< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
-< SELECT Dimension(shore)
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< Dimension(shore)
-< 2
-< SELECT GeometryType(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< GeometryType(centerlines)
-< MULTILINESTRING
-< SELECT AsText(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(boundary)
-< POLYGON((67 13,67 18,59 18,59 13,67 13))
-< SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(PolyFromWKB(AsBinary(boundary),101))
-< POLYGON((67 13,67 18,59 18,59 13,67 13))
-< SELECT SRID(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< SRID(boundary)
-< 101
-< SELECT IsEmpty(centerline)
-< FROM road_segments
-< WHERE name = 'Route 5'
-< AND aliases = 'Main Street';
-< IsEmpty(centerline)
-< 0
-< SELECT AsText(Envelope(boundary))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(Envelope(boundary))
-< POLYGON((59 13,67 13,67 18,59 18,59 13))
-< SELECT X(position)
-< FROM bridges
-< WHERE name = 'Cam Bridge';
-< X(position)
-< 44
-< SELECT Y(position)
-< FROM bridges
-< WHERE name = 'Cam Bridge';
-< Y(position)
-< 31
-< SELECT AsText(StartPoint(centerline))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(StartPoint(centerline))
-< POINT(0 18)
-< SELECT AsText(EndPoint(centerline))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(EndPoint(centerline))
-< POINT(44 31)
-< SELECT GLength(centerline)
-< FROM road_segments
-< WHERE fid = 106;
-< GLength(centerline)
-< 26
-< SELECT NumPoints(centerline)
-< FROM road_segments
-< WHERE fid = 102;
-< NumPoints(centerline)
-< 5
-< SELECT AsText(PointN(centerline, 1))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(PointN(centerline, 1))
-< POINT(0 18)
-< SELECT AsText(Centroid(boundary))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(Centroid(boundary))
-< POINT(63 15.5)
-< SELECT Area(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< Area(boundary)
-< 40
-< SELECT AsText(ExteriorRing(shore))
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< AsText(ExteriorRing(shore))
-< LINESTRING(52 18,66 23,73 9,48 6,52 18)
-< SELECT NumInteriorRings(shore)
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< NumInteriorRings(shore)
-< 1
-< SELECT AsText(InteriorRingN(shore, 1))
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< AsText(InteriorRingN(shore, 1))
-< LINESTRING(59 18,67 18,67 13,59 13,59 18)
-< SELECT NumGeometries(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< NumGeometries(centerlines)
-< 2
-< SELECT AsText(GeometryN(centerlines, 2))
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< AsText(GeometryN(centerlines, 2))
-< LINESTRING(16 0,16 23,16 48)
-< SELECT IsClosed(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< IsClosed(centerlines)
-< 0
-< SELECT GLength(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< GLength(centerlines)
-< 96
-< SELECT AsText(Centroid(shores))
-< FROM ponds
-< WHERE fid = 120;
-< AsText(Centroid(shores))
-< POINT(25 42)
-< SELECT Area(shores)
-< FROM ponds
-< WHERE fid = 120;
-< Area(shores)
-< 8
-< SELECT ST_Equals(boundary,
-< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< ST_Equals(boundary,
-< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-< 1
-< SELECT ST_Disjoint(centerlines, boundary)
-< FROM divided_routes, named_places
-< WHERE divided_routes.name = 'Route 75'
-< AND named_places.name = 'Ashton';
-< ST_Disjoint(centerlines, boundary)
-< 1
-< SELECT ST_Touches(centerline, shore)
-< FROM streams, lakes
-< WHERE streams.name = 'Cam Stream'
-< AND lakes.name = 'Blue Lake';
-< ST_Touches(centerline, shore)
-< 1
-< SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
-< FROM road_segments, divided_routes
-< WHERE road_segments.fid = 102
-< AND divided_routes.name = 'Route 75';
-< Crosses(road_segments.centerline, divided_routes.centerlines)
-< 1
-< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
-< FROM road_segments, divided_routes
-< WHERE road_segments.fid = 102
-< AND divided_routes.name = 'Route 75';
-< ST_Intersects(road_segments.centerline, divided_routes.centerlines)
-< 1
-< SELECT ST_Contains(forests.boundary, named_places.boundary)
-< FROM forests, named_places
-< WHERE forests.name = 'Green Forest'
-< AND named_places.name = 'Ashton';
-< ST_Contains(forests.boundary, named_places.boundary)
-< 0
-< SELECT ST_Distance(position, boundary)
-< FROM bridges, named_places
-< WHERE bridges.name = 'Cam Bridge'
-< AND named_places.name = 'Ashton';
-< ST_Distance(position, boundary)
-< 12
-< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
-< FROM named_places, forests
-< WHERE named_places.name = 'Ashton'
-< AND forests.name = 'Green Forest';
-< AsText(ST_Difference(named_places.boundary, forests.boundary))
-< POLYGON((56 34,62 48,84 48,84 42,56 34))
-< SELECT AsText(ST_Union(shore, boundary))
-< FROM lakes, named_places
-< WHERE lakes.name = 'Blue Lake'
-< AND named_places.name = 'Goose Island';
-< AsText(ST_Union(shore, boundary))
-< POLYGON((48 6,52 18,66 23,73 9,48 6))
-< SELECT AsText(ST_SymDifference(shore, boundary))
-< FROM lakes, named_places
-< WHERE lakes.name = 'Blue Lake'
-< AND named_places.name = 'Ashton';
-< AsText(ST_SymDifference(shore, boundary))
-< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
-< SELECT count(*)
-< FROM buildings, bridges
-< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
-< count(*)
-< 1
----
-> ERROR 42000: The storage engine for the table doesn't support GEOMETRY
-> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
-> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
-> # Geometry types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- type_spatial.result 2013-01-23 01:25:39.143876032 +0400
++++ type_spatial.reject 2013-01-23 02:51:14.535315418 +0400
+@@ -2,699 +2,15 @@
+ DROP DATABASE IF EXISTS gis_ogs;
+ CREATE DATABASE gis_ogs;
+ CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE gis_ogs;
+-CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shore POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerlines MULTILINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT,
+-footprint POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-type CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shores MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+-neatline POLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE test;
+-SHOW FIELDS FROM gis_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g point YES NULL
+-SHOW FIELDS FROM gis_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g linestring YES NULL
+-SHOW FIELDS FROM gis_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g polygon YES NULL
+-SHOW FIELDS FROM gis_multi_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipoint YES NULL
+-SHOW FIELDS FROM gis_multi_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multilinestring YES NULL
+-SHOW FIELDS FROM gis_multi_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipolygon YES NULL
+-SHOW FIELDS FROM gis_geometrycollection;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometrycollection YES NULL
+-SHOW FIELDS FROM gis_geometry;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometry YES NULL
+-INSERT INTO gis_point (fid,g) VALUES
+-(101, PointFromText('POINT(10 10)')),
+-(102, PointFromText('POINT(20 10)')),
+-(103, PointFromText('POINT(20 20)')),
+-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+-INSERT INTO gis_line (fid,g) VALUES
+-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+-INSERT INTO gis_polygon (fid,g) VALUES
+-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+-INSERT INTO gis_multi_point (fid,g) VALUES
+-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+-INSERT INTO gis_multi_line (fid,g) VALUES
+-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+-INSERT INTO gis_multi_polygon (fid,g) VALUES
+-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+-INSERT INTO gis_geometrycollection (fid,g) VALUES
+-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+-(122, GeomFromText('GeometryCollection()')),
+-(123, GeomFromText('GeometryCollection EMPTY'));
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
+-SELECT fid, AsText(g) FROM gis_point;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-SELECT fid, AsText(g) FROM gis_line;
+-fid AsText(g)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-SELECT fid, AsText(g) FROM gis_polygon;
+-fid AsText(g)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-SELECT fid, AsText(g) FROM gis_multi_point;
+-fid AsText(g)
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-SELECT fid, AsText(g) FROM gis_multi_line;
+-fid AsText(g)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-SELECT fid, AsText(g) FROM gis_multi_polygon;
+-fid AsText(g)
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-SELECT fid, AsText(g) FROM gis_geometrycollection;
+-fid AsText(g)
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, AsText(g) FROM gis_geometry;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, Dimension(g) FROM gis_geometry;
+-fid Dimension(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 1
+-106 1
+-107 1
+-108 2
+-109 2
+-110 2
+-111 0
+-112 0
+-113 0
+-114 1
+-115 1
+-116 1
+-117 2
+-118 2
+-119 2
+-120 1
+-121 1
+-122 0
+-123 0
+-SELECT fid, GeometryType(g) FROM gis_geometry;
+-fid GeometryType(g)
+-101 POINT
+-102 POINT
+-103 POINT
+-104 POINT
+-105 LINESTRING
+-106 LINESTRING
+-107 LINESTRING
+-108 POLYGON
+-109 POLYGON
+-110 POLYGON
+-111 MULTIPOINT
+-112 MULTIPOINT
+-113 MULTIPOINT
+-114 MULTILINESTRING
+-115 MULTILINESTRING
+-116 MULTILINESTRING
+-117 MULTIPOLYGON
+-118 MULTIPOLYGON
+-119 MULTIPOLYGON
+-120 GEOMETRYCOLLECTION
+-121 GEOMETRYCOLLECTION
+-122 GEOMETRYCOLLECTION
+-123 GEOMETRYCOLLECTION
+-SELECT fid, IsEmpty(g) FROM gis_geometry;
+-fid IsEmpty(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 0
+-106 0
+-107 0
+-108 0
+-109 0
+-110 0
+-111 0
+-112 0
+-113 0
+-114 0
+-115 0
+-116 0
+-117 0
+-118 0
+-119 0
+-120 0
+-121 0
+-122 0
+-123 0
+-SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+-fid AsText(Envelope(g))
+-101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+-102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+-103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+-104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+-105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+-110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+-111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+-112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+-113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+-114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+-115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+-116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+-117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+-120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, X(g) FROM gis_point;
+-fid X(g)
+-101 10
+-102 20
+-103 20
+-104 10
+-SELECT fid, Y(g) FROM gis_point;
+-fid Y(g)
+-101 10
+-102 10
+-103 20
+-104 20
+-SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+-fid AsText(StartPoint(g))
+-105 POINT(0 0)
+-106 POINT(10 10)
+-107 POINT(10 10)
+-SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+-fid AsText(EndPoint(g))
+-105 POINT(10 0)
+-106 POINT(10 10)
+-107 POINT(40 10)
+-SELECT fid, GLength(g) FROM gis_line;
+-fid GLength(g)
+-105 24.14213562373095
+-106 40
+-107 30
+-SELECT fid, NumPoints(g) FROM gis_line;
+-fid NumPoints(g)
+-105 3
+-106 5
+-107 2
+-SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+-fid AsText(PointN(g, 2))
+-105 POINT(0 10)
+-106 POINT(20 10)
+-107 POINT(40 10)
+-SELECT fid, IsClosed(g) FROM gis_line;
+-fid IsClosed(g)
+-105 0
+-106 1
+-107 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+-fid AsText(Centroid(g))
+-108 POINT(15 15)
+-109 POINT(25.416666666666668 25.416666666666668)
+-110 POINT(20 10)
+-SELECT fid, Area(g) FROM gis_polygon;
+-fid Area(g)
+-108 100
+-109 2400
+-110 450
+-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+-fid AsText(ExteriorRing(g))
+-108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+-110 LINESTRING(0 0,30 0,30 30,0 0)
+-SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+-fid NumInteriorRings(g)
+-108 0
+-109 1
+-110 0
+-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+-fid AsText(InteriorRingN(g, 1))
+-108 NULL
+-109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-110 NULL
+-SELECT fid, IsClosed(g) FROM gis_multi_line;
+-fid IsClosed(g)
+-114 0
+-115 0
+-116 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+-fid AsText(Centroid(g))
+-117 POINT(55.58852775304245 17.426536064113982)
+-118 POINT(55.58852775304245 17.426536064113982)
+-119 POINT(2 2)
+-SELECT fid, Area(g) FROM gis_multi_polygon;
+-fid Area(g)
+-117 1684.5
+-118 1684.5
+-119 4.5
+-SELECT fid, NumGeometries(g) from gis_multi_point;
+-fid NumGeometries(g)
+-111 4
+-112 4
+-113 2
+-SELECT fid, NumGeometries(g) from gis_multi_line;
+-fid NumGeometries(g)
+-114 2
+-115 1
+-116 2
+-SELECT fid, NumGeometries(g) from gis_multi_polygon;
+-fid NumGeometries(g)
+-117 2
+-118 2
+-119 1
+-SELECT fid, NumGeometries(g) from gis_geometrycollection;
+-fid NumGeometries(g)
+-120 2
+-121 2
+-122 0
+-123 0
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+-fid AsText(GeometryN(g, 2))
+-111 POINT(10 10)
+-112 POINT(11 11)
+-113 POINT(4 10)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+-fid AsText(GeometryN(g, 2))
+-114 LINESTRING(16 0,16 23,16 48)
+-115 NULL
+-116 LINESTRING(2 5,5 8,21 7)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+-fid AsText(GeometryN(g, 2))
+-117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-119 NULL
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 2))
+-120 LINESTRING(0 0,10 10)
+-121 LINESTRING(3 6,7 9)
+-122 NULL
+-123 NULL
+-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 1))
+-120 POINT(0 0)
+-121 POINT(44 6)
+-122 NULL
+-123 NULL
+-SELECT g1.fid as first, g2.fid as second,
+-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+-first second w c o e d t i r
+-120 120 1 1 0 1 0 1 1 0
+-120 121 0 0 1 0 0 0 1 0
+-120 122 0 1 NULL 0 NULL 0 NULL 0
+-120 123 0 1 NULL 0 NULL 0 NULL 0
+-121 120 0 0 1 0 0 0 1 0
+-121 121 1 1 0 1 0 1 1 0
+-121 122 0 1 NULL 0 NULL 0 NULL 0
+-121 123 0 1 NULL 0 NULL 0 NULL 0
+-122 120 1 0 NULL 0 NULL 0 NULL 0
+-122 121 1 0 NULL 0 NULL 0 NULL 0
+-122 122 1 1 NULL 1 NULL 0 NULL 0
+-122 123 1 1 NULL 1 NULL 0 NULL 0
+-123 120 1 0 NULL 0 NULL 0 NULL 0
+-123 121 1 0 NULL 0 NULL 0 NULL 0
+-123 122 1 1 NULL 1 NULL 0 NULL 0
+-123 123 1 1 NULL 1 NULL 0 NULL 0
+-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+-USE gis_ogs;
+-# Lakes
+-INSERT INTO lakes (fid,name,shore) VALUES (
+-101, 'BLUE LAKE',
+-PolyFromText(
+-'POLYGON(
+- (52 18,66 23,73 9,48 6,52 18),
+- (59 18,67 18,67 13,59 13,59 18)
+- )',
+-101));
+-# Road Segments
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
+-LineFromText(
+-'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 70 38, 72 48 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
+-LineFromText(
+-'LINESTRING( 70 38, 84 42 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
+-1,
+-LineFromText(
+-'LINESTRING( 28 26, 28 0 )',101));
+-# DividedRoutes
+-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
+-MLineFromText(
+-'MULTILINESTRING((10 48,10 21,10 0),
+- (16 0,16 23,16 48))', 101));
+-# Forests
+-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
+-MPolyFromText(
+-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+-101));
+-# Bridges
+-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
+-'POINT( 44 31 )', 101));
+-# Streams
+-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
+-LineFromText(
+-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
+-LineFromText(
+-'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+-# Buildings
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
+-PointFromText(
+-'POINT( 52 30 )', 101),
+-PolyFromText(
+-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
+-PointFromText(
+-'POINT( 64 33 )', 101),
+-PolyFromText(
+-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+-# Ponds
+-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
+-MPolyFromText(
+-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+-# Named Places
+-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
+-PolyFromText(
+-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
+-PolyFromText(
+-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+-# Map Neatlines
+-INSERT INTO map_neatlines (fid,neatline) VALUES(115,
+-PolyFromText(
+-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+-SELECT Dimension(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-Dimension(shore)
+-2
+-SELECT GeometryType(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GeometryType(centerlines)
+-MULTILINESTRING
+-SELECT AsText(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(boundary)
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(PolyFromWKB(AsBinary(boundary),101))
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT SRID(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-SRID(boundary)
+-101
+-SELECT IsEmpty(centerline)
+-FROM road_segments
+-WHERE name = 'Route 5'
+-AND aliases = 'Main Street';
+-IsEmpty(centerline)
+-0
+-SELECT AsText(Envelope(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Envelope(boundary))
+-POLYGON((59 13,67 13,67 18,59 18,59 13))
+-SELECT X(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-X(position)
+-44
+-SELECT Y(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-Y(position)
+-31
+-SELECT AsText(StartPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(StartPoint(centerline))
+-POINT(0 18)
+-SELECT AsText(EndPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(EndPoint(centerline))
+-POINT(44 31)
+-SELECT GLength(centerline)
+-FROM road_segments
+-WHERE fid = 106;
+-GLength(centerline)
+-26
+-SELECT NumPoints(centerline)
+-FROM road_segments
+-WHERE fid = 102;
+-NumPoints(centerline)
+-5
+-SELECT AsText(PointN(centerline, 1))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(PointN(centerline, 1))
+-POINT(0 18)
+-SELECT AsText(Centroid(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Centroid(boundary))
+-POINT(63 15.5)
+-SELECT Area(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-Area(boundary)
+-40
+-SELECT AsText(ExteriorRing(shore))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(ExteriorRing(shore))
+-LINESTRING(52 18,66 23,73 9,48 6,52 18)
+-SELECT NumInteriorRings(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-NumInteriorRings(shore)
+-1
+-SELECT AsText(InteriorRingN(shore, 1))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(InteriorRingN(shore, 1))
+-LINESTRING(59 18,67 18,67 13,59 13,59 18)
+-SELECT NumGeometries(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-NumGeometries(centerlines)
+-2
+-SELECT AsText(GeometryN(centerlines, 2))
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-AsText(GeometryN(centerlines, 2))
+-LINESTRING(16 0,16 23,16 48)
+-SELECT IsClosed(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-IsClosed(centerlines)
+-0
+-SELECT GLength(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GLength(centerlines)
+-96
+-SELECT AsText(Centroid(shores))
+-FROM ponds
+-WHERE fid = 120;
+-AsText(Centroid(shores))
+-POINT(25 42)
+-SELECT Area(shores)
+-FROM ponds
+-WHERE fid = 120;
+-Area(shores)
+-8
+-SELECT ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-1
+-SELECT ST_Disjoint(centerlines, boundary)
+-FROM divided_routes, named_places
+-WHERE divided_routes.name = 'Route 75'
+-AND named_places.name = 'Ashton';
+-ST_Disjoint(centerlines, boundary)
+-1
+-SELECT ST_Touches(centerline, shore)
+-FROM streams, lakes
+-WHERE streams.name = 'Cam Stream'
+-AND lakes.name = 'Blue Lake';
+-ST_Touches(centerline, shore)
+-1
+-SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-Crosses(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Contains(forests.boundary, named_places.boundary)
+-FROM forests, named_places
+-WHERE forests.name = 'Green Forest'
+-AND named_places.name = 'Ashton';
+-ST_Contains(forests.boundary, named_places.boundary)
+-0
+-SELECT ST_Distance(position, boundary)
+-FROM bridges, named_places
+-WHERE bridges.name = 'Cam Bridge'
+-AND named_places.name = 'Ashton';
+-ST_Distance(position, boundary)
+-12
+-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+-FROM named_places, forests
+-WHERE named_places.name = 'Ashton'
+-AND forests.name = 'Green Forest';
+-AsText(ST_Difference(named_places.boundary, forests.boundary))
+-POLYGON((56 34,62 48,84 48,84 42,56 34))
+-SELECT AsText(ST_Union(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Goose Island';
+-AsText(ST_Union(shore, boundary))
+-POLYGON((48 6,52 18,66 23,73 9,48 6))
+-SELECT AsText(ST_SymDifference(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Ashton';
+-AsText(ST_SymDifference(shore, boundary))
+-MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+-SELECT count(*)
+-FROM buildings, bridges
+-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+-count(*)
+-1
++ERROR 42000: The storage engine for the table doesn't support GEOMETRY
++# ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
++# The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
++# Geometry types or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP DATABASE gis_ogs;
+ USE test;
diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
index 89f1100f550..20d98db1ff2 100644
--- a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff
@@ -1,1412 +1,1422 @@
-5,698c5,14
-< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON, <CUSTOM_INDEX> g(g(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< USE gis_ogs;
-< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< shore POLYGON, <CUSTOM_INDEX> s(shore(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
-< num_lanes INT <CUSTOM_COL_OPTIONS>,
-< centerline LINESTRING, <CUSTOM_INDEX> c(centerline(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< num_lanes INT <CUSTOM_COL_OPTIONS>,
-< centerlines MULTILINESTRING, <CUSTOM_INDEX> c(centerlines(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< boundary MULTIPOLYGON, <CUSTOM_INDEX> b(boundary(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< position POINT, <CUSTOM_INDEX> p(`position`(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< centerline LINESTRING, <CUSTOM_INDEX> c(centerline(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< position POINT,
-< footprint POLYGON, <CUSTOM_INDEX> p(`position`(64)), <CUSTOM_INDEX> f(footprint(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< type CHAR(64) <CUSTOM_COL_OPTIONS>,
-< shores MULTIPOLYGON, <CUSTOM_INDEX> s(shores(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< boundary POLYGON, <CUSTOM_INDEX> b(boundary(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
-< neatline POLYGON, <CUSTOM_INDEX> n(neatline(700))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< USE test;
-< SHOW FIELDS FROM gis_point;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g point YES MUL NULL
-< SHOW FIELDS FROM gis_line;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g linestring YES MUL NULL
-< SHOW FIELDS FROM gis_polygon;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g polygon YES MUL NULL
-< SHOW FIELDS FROM gis_multi_point;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multipoint YES MUL NULL
-< SHOW FIELDS FROM gis_multi_line;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multilinestring YES MUL NULL
-< SHOW FIELDS FROM gis_multi_polygon;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multipolygon YES NULL
-< SHOW FIELDS FROM gis_geometrycollection;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g geometrycollection YES NULL
-< SHOW FIELDS FROM gis_geometry;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g geometry YES NULL
-< INSERT INTO gis_point VALUES
-< (101, PointFromText('POINT(10 10)')),
-< (102, PointFromText('POINT(20 10)')),
-< (103, PointFromText('POINT(20 20)')),
-< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-< INSERT INTO gis_line VALUES
-< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
-< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
-< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
-< INSERT INTO gis_polygon VALUES
-< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
-< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
-< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
-< INSERT INTO gis_multi_point VALUES
-< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
-< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
-< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
-< INSERT INTO gis_multi_line VALUES
-< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
-< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
-< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
-< INSERT INTO gis_multi_polygon VALUES
-< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-< INSERT INTO gis_geometrycollection VALUES
-< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
-< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
-< (122, GeomFromText('GeometryCollection()')),
-< (123, GeomFromText('GeometryCollection EMPTY'));
-< INSERT into gis_geometry SELECT * FROM gis_point;
-< INSERT into gis_geometry SELECT * FROM gis_line;
-< INSERT into gis_geometry SELECT * FROM gis_polygon;
-< INSERT into gis_geometry SELECT * FROM gis_multi_point;
-< INSERT into gis_geometry SELECT * FROM gis_multi_line;
-< INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
-< INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
-< SELECT fid, AsText(g) FROM gis_point;
-< fid AsText(g)
-< 101 POINT(10 10)
-< 102 POINT(20 10)
-< 103 POINT(20 20)
-< 104 POINT(10 20)
-< SELECT fid, AsText(g) FROM gis_line;
-< fid AsText(g)
-< 105 LINESTRING(0 0,0 10,10 0)
-< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 107 LINESTRING(10 10,40 10)
-< SELECT fid, AsText(g) FROM gis_polygon;
-< fid AsText(g)
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-< 110 POLYGON((0 0,30 0,30 30,0 0))
-< SELECT fid, AsText(g) FROM gis_multi_point;
-< fid AsText(g)
-< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
-< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
-< 113 MULTIPOINT(3 6,4 10)
-< SELECT fid, AsText(g) FROM gis_multi_line;
-< fid AsText(g)
-< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-< 115 MULTILINESTRING((10 48,10 21,10 0))
-< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-< SELECT fid, AsText(g) FROM gis_multi_polygon;
-< fid AsText(g)
-< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-< SELECT fid, AsText(g) FROM gis_geometrycollection;
-< fid AsText(g)
-< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, AsText(g) FROM gis_geometry;
-< fid AsText(g)
-< 101 POINT(10 10)
-< 102 POINT(20 10)
-< 103 POINT(20 20)
-< 104 POINT(10 20)
-< 105 LINESTRING(0 0,0 10,10 0)
-< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 107 LINESTRING(10 10,40 10)
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-< 110 POLYGON((0 0,30 0,30 30,0 0))
-< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
-< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
-< 113 MULTIPOINT(3 6,4 10)
-< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-< 115 MULTILINESTRING((10 48,10 21,10 0))
-< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, Dimension(g) FROM gis_geometry;
-< fid Dimension(g)
-< 101 0
-< 102 0
-< 103 0
-< 104 0
-< 105 1
-< 106 1
-< 107 1
-< 108 2
-< 109 2
-< 110 2
-< 111 0
-< 112 0
-< 113 0
-< 114 1
-< 115 1
-< 116 1
-< 117 2
-< 118 2
-< 119 2
-< 120 1
-< 121 1
-< 122 0
-< 123 0
-< SELECT fid, GeometryType(g) FROM gis_geometry;
-< fid GeometryType(g)
-< 101 POINT
-< 102 POINT
-< 103 POINT
-< 104 POINT
-< 105 LINESTRING
-< 106 LINESTRING
-< 107 LINESTRING
-< 108 POLYGON
-< 109 POLYGON
-< 110 POLYGON
-< 111 MULTIPOINT
-< 112 MULTIPOINT
-< 113 MULTIPOINT
-< 114 MULTILINESTRING
-< 115 MULTILINESTRING
-< 116 MULTILINESTRING
-< 117 MULTIPOLYGON
-< 118 MULTIPOLYGON
-< 119 MULTIPOLYGON
-< 120 GEOMETRYCOLLECTION
-< 121 GEOMETRYCOLLECTION
-< 122 GEOMETRYCOLLECTION
-< 123 GEOMETRYCOLLECTION
-< SELECT fid, IsEmpty(g) FROM gis_geometry;
-< fid IsEmpty(g)
-< 101 0
-< 102 0
-< 103 0
-< 104 0
-< 105 0
-< 106 0
-< 107 0
-< 108 0
-< 109 0
-< 110 0
-< 111 0
-< 112 0
-< 113 0
-< 114 0
-< 115 0
-< 116 0
-< 117 0
-< 118 0
-< 119 0
-< 120 0
-< 121 0
-< 122 0
-< 123 0
-< SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
-< fid AsText(Envelope(g))
-< 101 POLYGON((10 10,10 10,10 10,10 10,10 10))
-< 102 POLYGON((20 10,20 10,20 10,20 10,20 10))
-< 103 POLYGON((20 20,20 20,20 20,20 20,20 20))
-< 104 POLYGON((10 20,10 20,10 20,10 20,10 20))
-< 105 POLYGON((0 0,10 0,10 10,0 10,0 0))
-< 106 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 107 POLYGON((10 10,40 10,40 10,10 10,10 10))
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0))
-< 110 POLYGON((0 0,30 0,30 30,0 30,0 0))
-< 111 POLYGON((0 0,20 0,20 20,0 20,0 0))
-< 112 POLYGON((1 1,21 1,21 21,1 21,1 1))
-< 113 POLYGON((3 6,4 6,4 10,3 10,3 6))
-< 114 POLYGON((10 0,16 0,16 48,10 48,10 0))
-< 115 POLYGON((10 0,10 0,10 48,10 48,10 0))
-< 116 POLYGON((1 2,21 2,21 8,1 8,1 2))
-< 117 POLYGON((28 0,84 0,84 42,28 42,28 0))
-< 118 POLYGON((28 0,84 0,84 42,28 42,28 0))
-< 119 POLYGON((0 0,3 0,3 3,0 3,0 0))
-< 120 POLYGON((0 0,10 0,10 10,0 10,0 0))
-< 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, X(g) FROM gis_point;
-< fid X(g)
-< 101 10
-< 102 20
-< 103 20
-< 104 10
-< SELECT fid, Y(g) FROM gis_point;
-< fid Y(g)
-< 101 10
-< 102 10
-< 103 20
-< 104 20
-< SELECT fid, AsText(StartPoint(g)) FROM gis_line;
-< fid AsText(StartPoint(g))
-< 105 POINT(0 0)
-< 106 POINT(10 10)
-< 107 POINT(10 10)
-< SELECT fid, AsText(EndPoint(g)) FROM gis_line;
-< fid AsText(EndPoint(g))
-< 105 POINT(10 0)
-< 106 POINT(10 10)
-< 107 POINT(40 10)
-< SELECT fid, GLength(g) FROM gis_line;
-< fid GLength(g)
-< 105 24.14213562373095
-< 106 40
-< 107 30
-< SELECT fid, NumPoints(g) FROM gis_line;
-< fid NumPoints(g)
-< 105 3
-< 106 5
-< 107 2
-< SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
-< fid AsText(PointN(g, 2))
-< 105 POINT(0 10)
-< 106 POINT(20 10)
-< 107 POINT(40 10)
-< SELECT fid, IsClosed(g) FROM gis_line;
-< fid IsClosed(g)
-< 105 0
-< 106 1
-< 107 0
-< SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
-< fid AsText(Centroid(g))
-< 108 POINT(15 15)
-< 109 POINT(25.416666666666668 25.416666666666668)
-< 110 POINT(20 10)
-< SELECT fid, Area(g) FROM gis_polygon;
-< fid Area(g)
-< 108 100
-< 109 2400
-< 110 450
-< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
-< fid AsText(ExteriorRing(g))
-< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
-< 110 LINESTRING(0 0,30 0,30 30,0 0)
-< SELECT fid, NumInteriorRings(g) FROM gis_polygon;
-< fid NumInteriorRings(g)
-< 108 0
-< 109 1
-< 110 0
-< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-< fid AsText(InteriorRingN(g, 1))
-< 108 NULL
-< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 110 NULL
-< SELECT fid, IsClosed(g) FROM gis_multi_line;
-< fid IsClosed(g)
-< 114 0
-< 115 0
-< 116 0
-< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-< fid AsText(Centroid(g))
-< 117 POINT(55.58852775304245 17.426536064113982)
-< 118 POINT(55.58852775304245 17.426536064113982)
-< 119 POINT(2 2)
-< SELECT fid, Area(g) FROM gis_multi_polygon;
-< fid Area(g)
-< 117 1684.5
-< 118 1684.5
-< 119 4.5
-< SELECT fid, NumGeometries(g) from gis_multi_point;
-< fid NumGeometries(g)
-< 111 4
-< 112 4
-< 113 2
-< SELECT fid, NumGeometries(g) from gis_multi_line;
-< fid NumGeometries(g)
-< 114 2
-< 115 1
-< 116 2
-< SELECT fid, NumGeometries(g) from gis_multi_polygon;
-< fid NumGeometries(g)
-< 117 2
-< 118 2
-< 119 1
-< SELECT fid, NumGeometries(g) from gis_geometrycollection;
-< fid NumGeometries(g)
-< 120 2
-< 121 2
-< 122 0
-< 123 0
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-< fid AsText(GeometryN(g, 2))
-< 111 POINT(10 10)
-< 112 POINT(11 11)
-< 113 POINT(4 10)
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
-< fid AsText(GeometryN(g, 2))
-< 114 LINESTRING(16 0,16 23,16 48)
-< 115 NULL
-< 116 LINESTRING(2 5,5 8,21 7)
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
-< fid AsText(GeometryN(g, 2))
-< 117 POLYGON((59 18,67 18,67 13,59 13,59 18))
-< 118 POLYGON((59 18,67 18,67 13,59 13,59 18))
-< 119 NULL
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
-< fid AsText(GeometryN(g, 2))
-< 120 LINESTRING(0 0,10 10)
-< 121 LINESTRING(3 6,7 9)
-< 122 NULL
-< 123 NULL
-< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
-< fid AsText(GeometryN(g, 1))
-< 120 POINT(0 0)
-< 121 POINT(44 6)
-< 122 NULL
-< 123 NULL
-< SELECT g1.fid as first, g2.fid as second,
-< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
-< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
-< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-< first second w c o e d t i r
-< 120 120 1 1 0 1 0 1 1 0
-< 120 121 0 0 1 0 0 0 1 0
-< 120 122 0 1 NULL 0 NULL 0 NULL 0
-< 120 123 0 1 NULL 0 NULL 0 NULL 0
-< 121 120 0 0 1 0 0 0 1 0
-< 121 121 1 1 0 1 0 1 1 0
-< 121 122 0 1 NULL 0 NULL 0 NULL 0
-< 121 123 0 1 NULL 0 NULL 0 NULL 0
-< 122 120 1 0 NULL 0 NULL 0 NULL 0
-< 122 121 1 0 NULL 0 NULL 0 NULL 0
-< 122 122 1 1 NULL 1 NULL 0 NULL 0
-< 122 123 1 1 NULL 1 NULL 0 NULL 0
-< 123 120 1 0 NULL 0 NULL 0 NULL 0
-< 123 121 1 0 NULL 0 NULL 0 NULL 0
-< 123 122 1 1 NULL 1 NULL 0 NULL 0
-< 123 123 1 1 NULL 1 NULL 0 NULL 0
-< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-< USE gis_ogs;
-< # Lakes
-< INSERT INTO lakes VALUES (
-< 101, 'BLUE LAKE',
-< PolyFromText(
-< 'POLYGON(
-< (52 18,66 23,73 9,48 6,52 18),
-< (59 18,67 18,67 13,59 13,59 18)
-< )',
-< 101));
-< # Road Segments
-< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
-< LineFromText(
-< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
-< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
-< LineFromText(
-< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
-< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
-< LineFromText(
-< 'LINESTRING( 70 38, 72 48 )' ,101));
-< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
-< LineFromText(
-< 'LINESTRING( 70 38, 84 42 )' ,101));
-< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
-< 1,
-< LineFromText(
-< 'LINESTRING( 28 26, 28 0 )',101));
-< # DividedRoutes
-< INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
-< MLineFromText(
-< 'MULTILINESTRING((10 48,10 21,10 0),
-< (16 0,16 23,16 48))', 101));
-< # Forests
-< INSERT INTO forests VALUES(109, 'Green Forest',
-< MPolyFromText(
-< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
-< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
-< 101));
-< # Bridges
-< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
-< 'POINT( 44 31 )', 101));
-< # Streams
-< INSERT INTO streams VALUES(111, 'Cam Stream',
-< LineFromText(
-< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
-< INSERT INTO streams VALUES(112, NULL,
-< LineFromText(
-< 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
-< # Buildings
-< INSERT INTO buildings VALUES(113, '123 Main Street',
-< PointFromText(
-< 'POINT( 52 30 )', 101),
-< PolyFromText(
-< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
-< INSERT INTO buildings VALUES(114, '215 Main Street',
-< PointFromText(
-< 'POINT( 64 33 )', 101),
-< PolyFromText(
-< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
-< # Ponds
-< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
-< MPolyFromText(
-< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
-< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
-< # Named Places
-< INSERT INTO named_places VALUES(117, 'Ashton',
-< PolyFromText(
-< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
-< INSERT INTO named_places VALUES(118, 'Goose Island',
-< PolyFromText(
-< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
-< # Map Neatlines
-< INSERT INTO map_neatlines VALUES(115,
-< PolyFromText(
-< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
-< SELECT Dimension(shore)
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< Dimension(shore)
-< 2
-< SELECT GeometryType(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< GeometryType(centerlines)
-< MULTILINESTRING
-< SELECT AsText(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(boundary)
-< POLYGON((67 13,67 18,59 18,59 13,67 13))
-< SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(PolyFromWKB(AsBinary(boundary),101))
-< POLYGON((67 13,67 18,59 18,59 13,67 13))
-< SELECT SRID(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< SRID(boundary)
-< 101
-< SELECT IsEmpty(centerline)
-< FROM road_segments
-< WHERE name = 'Route 5'
-< AND aliases = 'Main Street';
-< IsEmpty(centerline)
-< 0
-< SELECT AsText(Envelope(boundary))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(Envelope(boundary))
-< POLYGON((59 13,67 13,67 18,59 18,59 13))
-< SELECT X(position)
-< FROM bridges
-< WHERE name = 'Cam Bridge';
-< X(position)
-< 44
-< SELECT Y(position)
-< FROM bridges
-< WHERE name = 'Cam Bridge';
-< Y(position)
-< 31
-< SELECT AsText(StartPoint(centerline))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(StartPoint(centerline))
-< POINT(0 18)
-< SELECT AsText(EndPoint(centerline))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(EndPoint(centerline))
-< POINT(44 31)
-< SELECT GLength(centerline)
-< FROM road_segments
-< WHERE fid = 106;
-< GLength(centerline)
-< 26
-< SELECT NumPoints(centerline)
-< FROM road_segments
-< WHERE fid = 102;
-< NumPoints(centerline)
-< 5
-< SELECT AsText(PointN(centerline, 1))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(PointN(centerline, 1))
-< POINT(0 18)
-< SELECT AsText(Centroid(boundary))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(Centroid(boundary))
-< POINT(63 15.5)
-< SELECT Area(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< Area(boundary)
-< 40
-< SELECT AsText(ExteriorRing(shore))
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< AsText(ExteriorRing(shore))
-< LINESTRING(52 18,66 23,73 9,48 6,52 18)
-< SELECT NumInteriorRings(shore)
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< NumInteriorRings(shore)
-< 1
-< SELECT AsText(InteriorRingN(shore, 1))
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< AsText(InteriorRingN(shore, 1))
-< LINESTRING(59 18,67 18,67 13,59 13,59 18)
-< SELECT NumGeometries(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< NumGeometries(centerlines)
-< 2
-< SELECT AsText(GeometryN(centerlines, 2))
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< AsText(GeometryN(centerlines, 2))
-< LINESTRING(16 0,16 23,16 48)
-< SELECT IsClosed(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< IsClosed(centerlines)
-< 0
-< SELECT GLength(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< GLength(centerlines)
-< 96
-< SELECT AsText(Centroid(shores))
-< FROM ponds
-< WHERE fid = 120;
-< AsText(Centroid(shores))
-< POINT(25 42)
-< SELECT Area(shores)
-< FROM ponds
-< WHERE fid = 120;
-< Area(shores)
-< 8
-< SELECT ST_Equals(boundary,
-< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< ST_Equals(boundary,
-< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-< 1
-< SELECT ST_Disjoint(centerlines, boundary)
-< FROM divided_routes, named_places
-< WHERE divided_routes.name = 'Route 75'
-< AND named_places.name = 'Ashton';
-< ST_Disjoint(centerlines, boundary)
-< 1
-< SELECT ST_Touches(centerline, shore)
-< FROM streams, lakes
-< WHERE streams.name = 'Cam Stream'
-< AND lakes.name = 'Blue Lake';
-< ST_Touches(centerline, shore)
-< 1
-< SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
-< FROM road_segments, divided_routes
-< WHERE road_segments.fid = 102
-< AND divided_routes.name = 'Route 75';
-< Crosses(road_segments.centerline, divided_routes.centerlines)
-< 1
-< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
-< FROM road_segments, divided_routes
-< WHERE road_segments.fid = 102
-< AND divided_routes.name = 'Route 75';
-< ST_Intersects(road_segments.centerline, divided_routes.centerlines)
-< 1
-< SELECT ST_Contains(forests.boundary, named_places.boundary)
-< FROM forests, named_places
-< WHERE forests.name = 'Green Forest'
-< AND named_places.name = 'Ashton';
-< ST_Contains(forests.boundary, named_places.boundary)
-< 0
-< SELECT ST_Distance(position, boundary)
-< FROM bridges, named_places
-< WHERE bridges.name = 'Cam Bridge'
-< AND named_places.name = 'Ashton';
-< ST_Distance(position, boundary)
-< 12
-< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
-< FROM named_places, forests
-< WHERE named_places.name = 'Ashton'
-< AND forests.name = 'Green Forest';
-< AsText(ST_Difference(named_places.boundary, forests.boundary))
-< POLYGON((56 34,62 48,84 48,84 42,56 34))
-< SELECT AsText(ST_Union(shore, boundary))
-< FROM lakes, named_places
-< WHERE lakes.name = 'Blue Lake'
-< AND named_places.name = 'Goose Island';
-< AsText(ST_Union(shore, boundary))
-< POLYGON((48 6,52 18,66 23,73 9,48 6))
-< SELECT AsText(ST_SymDifference(shore, boundary))
-< FROM lakes, named_places
-< WHERE lakes.name = 'Blue Lake'
-< AND named_places.name = 'Ashton';
-< AsText(ST_SymDifference(shore, boundary))
-< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
-< SELECT count(*)
-< FROM buildings, bridges
-< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
-< count(*)
-< 1
----
-> ERROR 42000: The storage engine for the table doesn't support GEOMETRY
-> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT, /*!INDEX*/ /*Custom index*/ g(g(128))) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
-> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
-> # Geometry types or indexes on them or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
-705,1398c21,30
-< CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< USE gis_ogs;
-< CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< shore POLYGON NOT NULL, SPATIAL INDEX s(shore)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
-< num_lanes INT <CUSTOM_COL_OPTIONS>,
-< centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< num_lanes INT <CUSTOM_COL_OPTIONS>,
-< centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< position POINT NOT NULL, SPATIAL INDEX p(position)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< position POINT NOT NULL,
-< footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< type CHAR(64) <CUSTOM_COL_OPTIONS>,
-< shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
-< name CHAR(64) <CUSTOM_COL_OPTIONS>,
-< boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
-< neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< USE test;
-< SHOW FIELDS FROM gis_point;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g point NO MUL NULL
-< SHOW FIELDS FROM gis_line;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g linestring NO MUL NULL
-< SHOW FIELDS FROM gis_polygon;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g polygon NO MUL NULL
-< SHOW FIELDS FROM gis_multi_point;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multipoint NO MUL NULL
-< SHOW FIELDS FROM gis_multi_line;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multilinestring NO MUL NULL
-< SHOW FIELDS FROM gis_multi_polygon;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g multipolygon NO MUL NULL
-< SHOW FIELDS FROM gis_geometrycollection;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g geometrycollection NO MUL NULL
-< SHOW FIELDS FROM gis_geometry;
-< Field Type Null Key Default Extra
-< fid int(11) YES NULL
-< g geometry NO NULL
-< INSERT INTO gis_point VALUES
-< (101, PointFromText('POINT(10 10)')),
-< (102, PointFromText('POINT(20 10)')),
-< (103, PointFromText('POINT(20 20)')),
-< (104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
-< INSERT INTO gis_line VALUES
-< (105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
-< (106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
-< (107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
-< INSERT INTO gis_polygon VALUES
-< (108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
-< (109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
-< (110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
-< INSERT INTO gis_multi_point VALUES
-< (111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
-< (112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
-< (113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
-< INSERT INTO gis_multi_line VALUES
-< (114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
-< (115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
-< (116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
-< INSERT INTO gis_multi_polygon VALUES
-< (117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-< (118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
-< (119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
-< INSERT INTO gis_geometrycollection VALUES
-< (120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
-< (121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
-< (122, GeomFromText('GeometryCollection()')),
-< (123, GeomFromText('GeometryCollection EMPTY'));
-< INSERT into gis_geometry SELECT * FROM gis_point;
-< INSERT into gis_geometry SELECT * FROM gis_line;
-< INSERT into gis_geometry SELECT * FROM gis_polygon;
-< INSERT into gis_geometry SELECT * FROM gis_multi_point;
-< INSERT into gis_geometry SELECT * FROM gis_multi_line;
-< INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
-< INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
-< SELECT fid, AsText(g) FROM gis_point;
-< fid AsText(g)
-< 101 POINT(10 10)
-< 102 POINT(20 10)
-< 103 POINT(20 20)
-< 104 POINT(10 20)
-< SELECT fid, AsText(g) FROM gis_line;
-< fid AsText(g)
-< 105 LINESTRING(0 0,0 10,10 0)
-< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 107 LINESTRING(10 10,40 10)
-< SELECT fid, AsText(g) FROM gis_polygon;
-< fid AsText(g)
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-< 110 POLYGON((0 0,30 0,30 30,0 0))
-< SELECT fid, AsText(g) FROM gis_multi_point;
-< fid AsText(g)
-< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
-< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
-< 113 MULTIPOINT(3 6,4 10)
-< SELECT fid, AsText(g) FROM gis_multi_line;
-< fid AsText(g)
-< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-< 115 MULTILINESTRING((10 48,10 21,10 0))
-< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-< SELECT fid, AsText(g) FROM gis_multi_polygon;
-< fid AsText(g)
-< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-< SELECT fid, AsText(g) FROM gis_geometrycollection;
-< fid AsText(g)
-< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, AsText(g) FROM gis_geometry;
-< fid AsText(g)
-< 101 POINT(10 10)
-< 102 POINT(20 10)
-< 103 POINT(20 20)
-< 104 POINT(10 20)
-< 105 LINESTRING(0 0,0 10,10 0)
-< 106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 107 LINESTRING(10 10,40 10)
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
-< 110 POLYGON((0 0,30 0,30 30,0 0))
-< 111 MULTIPOINT(0 0,10 10,10 20,20 20)
-< 112 MULTIPOINT(1 1,11 11,11 21,21 21)
-< 113 MULTIPOINT(3 6,4 10)
-< 114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
-< 115 MULTILINESTRING((10 48,10 21,10 0))
-< 116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
-< 117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
-< 119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
-< 120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
-< 121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, Dimension(g) FROM gis_geometry;
-< fid Dimension(g)
-< 101 0
-< 102 0
-< 103 0
-< 104 0
-< 105 1
-< 106 1
-< 107 1
-< 108 2
-< 109 2
-< 110 2
-< 111 0
-< 112 0
-< 113 0
-< 114 1
-< 115 1
-< 116 1
-< 117 2
-< 118 2
-< 119 2
-< 120 1
-< 121 1
-< 122 0
-< 123 0
-< SELECT fid, GeometryType(g) FROM gis_geometry;
-< fid GeometryType(g)
-< 101 POINT
-< 102 POINT
-< 103 POINT
-< 104 POINT
-< 105 LINESTRING
-< 106 LINESTRING
-< 107 LINESTRING
-< 108 POLYGON
-< 109 POLYGON
-< 110 POLYGON
-< 111 MULTIPOINT
-< 112 MULTIPOINT
-< 113 MULTIPOINT
-< 114 MULTILINESTRING
-< 115 MULTILINESTRING
-< 116 MULTILINESTRING
-< 117 MULTIPOLYGON
-< 118 MULTIPOLYGON
-< 119 MULTIPOLYGON
-< 120 GEOMETRYCOLLECTION
-< 121 GEOMETRYCOLLECTION
-< 122 GEOMETRYCOLLECTION
-< 123 GEOMETRYCOLLECTION
-< SELECT fid, IsEmpty(g) FROM gis_geometry;
-< fid IsEmpty(g)
-< 101 0
-< 102 0
-< 103 0
-< 104 0
-< 105 0
-< 106 0
-< 107 0
-< 108 0
-< 109 0
-< 110 0
-< 111 0
-< 112 0
-< 113 0
-< 114 0
-< 115 0
-< 116 0
-< 117 0
-< 118 0
-< 119 0
-< 120 0
-< 121 0
-< 122 0
-< 123 0
-< SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
-< fid AsText(Envelope(g))
-< 101 POLYGON((10 10,10 10,10 10,10 10,10 10))
-< 102 POLYGON((20 10,20 10,20 10,20 10,20 10))
-< 103 POLYGON((20 20,20 20,20 20,20 20,20 20))
-< 104 POLYGON((10 20,10 20,10 20,10 20,10 20))
-< 105 POLYGON((0 0,10 0,10 10,0 10,0 0))
-< 106 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 107 POLYGON((10 10,40 10,40 10,10 10,10 10))
-< 108 POLYGON((10 10,20 10,20 20,10 20,10 10))
-< 109 POLYGON((0 0,50 0,50 50,0 50,0 0))
-< 110 POLYGON((0 0,30 0,30 30,0 30,0 0))
-< 111 POLYGON((0 0,20 0,20 20,0 20,0 0))
-< 112 POLYGON((1 1,21 1,21 21,1 21,1 1))
-< 113 POLYGON((3 6,4 6,4 10,3 10,3 6))
-< 114 POLYGON((10 0,16 0,16 48,10 48,10 0))
-< 115 POLYGON((10 0,10 0,10 48,10 48,10 0))
-< 116 POLYGON((1 2,21 2,21 8,1 8,1 2))
-< 117 POLYGON((28 0,84 0,84 42,28 42,28 0))
-< 118 POLYGON((28 0,84 0,84 42,28 42,28 0))
-< 119 POLYGON((0 0,3 0,3 3,0 3,0 0))
-< 120 POLYGON((0 0,10 0,10 10,0 10,0 0))
-< 121 POLYGON((3 6,44 6,44 9,3 9,3 6))
-< 122 GEOMETRYCOLLECTION EMPTY
-< 123 GEOMETRYCOLLECTION EMPTY
-< SELECT fid, X(g) FROM gis_point;
-< fid X(g)
-< 101 10
-< 102 20
-< 103 20
-< 104 10
-< SELECT fid, Y(g) FROM gis_point;
-< fid Y(g)
-< 101 10
-< 102 10
-< 103 20
-< 104 20
-< SELECT fid, AsText(StartPoint(g)) FROM gis_line;
-< fid AsText(StartPoint(g))
-< 105 POINT(0 0)
-< 106 POINT(10 10)
-< 107 POINT(10 10)
-< SELECT fid, AsText(EndPoint(g)) FROM gis_line;
-< fid AsText(EndPoint(g))
-< 105 POINT(10 0)
-< 106 POINT(10 10)
-< 107 POINT(40 10)
-< SELECT fid, GLength(g) FROM gis_line;
-< fid GLength(g)
-< 105 24.14213562373095
-< 106 40
-< 107 30
-< SELECT fid, NumPoints(g) FROM gis_line;
-< fid NumPoints(g)
-< 105 3
-< 106 5
-< 107 2
-< SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
-< fid AsText(PointN(g, 2))
-< 105 POINT(0 10)
-< 106 POINT(20 10)
-< 107 POINT(40 10)
-< SELECT fid, IsClosed(g) FROM gis_line;
-< fid IsClosed(g)
-< 105 0
-< 106 1
-< 107 0
-< SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
-< fid AsText(Centroid(g))
-< 108 POINT(15 15)
-< 109 POINT(25.416666666666668 25.416666666666668)
-< 110 POINT(20 10)
-< SELECT fid, Area(g) FROM gis_polygon;
-< fid Area(g)
-< 108 100
-< 109 2400
-< 110 450
-< SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
-< fid AsText(ExteriorRing(g))
-< 108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
-< 110 LINESTRING(0 0,30 0,30 30,0 0)
-< SELECT fid, NumInteriorRings(g) FROM gis_polygon;
-< fid NumInteriorRings(g)
-< 108 0
-< 109 1
-< 110 0
-< SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
-< fid AsText(InteriorRingN(g, 1))
-< 108 NULL
-< 109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
-< 110 NULL
-< SELECT fid, IsClosed(g) FROM gis_multi_line;
-< fid IsClosed(g)
-< 114 0
-< 115 0
-< 116 0
-< SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
-< fid AsText(Centroid(g))
-< 117 POINT(55.58852775304245 17.426536064113982)
-< 118 POINT(55.58852775304245 17.426536064113982)
-< 119 POINT(2 2)
-< SELECT fid, Area(g) FROM gis_multi_polygon;
-< fid Area(g)
-< 117 1684.5
-< 118 1684.5
-< 119 4.5
-< SELECT fid, NumGeometries(g) from gis_multi_point;
-< fid NumGeometries(g)
-< 111 4
-< 112 4
-< 113 2
-< SELECT fid, NumGeometries(g) from gis_multi_line;
-< fid NumGeometries(g)
-< 114 2
-< 115 1
-< 116 2
-< SELECT fid, NumGeometries(g) from gis_multi_polygon;
-< fid NumGeometries(g)
-< 117 2
-< 118 2
-< 119 1
-< SELECT fid, NumGeometries(g) from gis_geometrycollection;
-< fid NumGeometries(g)
-< 120 2
-< 121 2
-< 122 0
-< 123 0
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
-< fid AsText(GeometryN(g, 2))
-< 111 POINT(10 10)
-< 112 POINT(11 11)
-< 113 POINT(4 10)
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
-< fid AsText(GeometryN(g, 2))
-< 114 LINESTRING(16 0,16 23,16 48)
-< 115 NULL
-< 116 LINESTRING(2 5,5 8,21 7)
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
-< fid AsText(GeometryN(g, 2))
-< 117 POLYGON((59 18,67 18,67 13,59 13,59 18))
-< 118 POLYGON((59 18,67 18,67 13,59 13,59 18))
-< 119 NULL
-< SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
-< fid AsText(GeometryN(g, 2))
-< 120 LINESTRING(0 0,10 10)
-< 121 LINESTRING(3 6,7 9)
-< 122 NULL
-< 123 NULL
-< SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
-< fid AsText(GeometryN(g, 1))
-< 120 POINT(0 0)
-< 121 POINT(44 6)
-< 122 NULL
-< 123 NULL
-< SELECT g1.fid as first, g2.fid as second,
-< Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
-< Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
-< Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
-< FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
-< first second w c o e d t i r
-< 120 120 1 1 0 1 0 1 1 0
-< 120 121 0 0 1 0 0 0 1 0
-< 120 122 0 1 NULL 0 NULL 0 NULL 0
-< 120 123 0 1 NULL 0 NULL 0 NULL 0
-< 121 120 0 0 1 0 0 0 1 0
-< 121 121 1 1 0 1 0 1 1 0
-< 121 122 0 1 NULL 0 NULL 0 NULL 0
-< 121 123 0 1 NULL 0 NULL 0 NULL 0
-< 122 120 1 0 NULL 0 NULL 0 NULL 0
-< 122 121 1 0 NULL 0 NULL 0 NULL 0
-< 122 122 1 1 NULL 1 NULL 0 NULL 0
-< 122 123 1 1 NULL 1 NULL 0 NULL 0
-< 123 120 1 0 NULL 0 NULL 0 NULL 0
-< 123 121 1 0 NULL 0 NULL 0 NULL 0
-< 123 122 1 1 NULL 1 NULL 0 NULL 0
-< 123 123 1 1 NULL 1 NULL 0 NULL 0
-< DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
-< USE gis_ogs;
-< # Lakes
-< INSERT INTO lakes VALUES (
-< 101, 'BLUE LAKE',
-< PolyFromText(
-< 'POLYGON(
-< (52 18,66 23,73 9,48 6,52 18),
-< (59 18,67 18,67 13,59 13,59 18)
-< )',
-< 101));
-< # Road Segments
-< INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
-< LineFromText(
-< 'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
-< INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
-< LineFromText(
-< 'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
-< INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
-< LineFromText(
-< 'LINESTRING( 70 38, 72 48 )' ,101));
-< INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
-< LineFromText(
-< 'LINESTRING( 70 38, 84 42 )' ,101));
-< INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
-< 1,
-< LineFromText(
-< 'LINESTRING( 28 26, 28 0 )',101));
-< # DividedRoutes
-< INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
-< MLineFromText(
-< 'MULTILINESTRING((10 48,10 21,10 0),
-< (16 0,16 23,16 48))', 101));
-< # Forests
-< INSERT INTO forests VALUES(109, 'Green Forest',
-< MPolyFromText(
-< 'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
-< (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
-< 101));
-< # Bridges
-< INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
-< 'POINT( 44 31 )', 101));
-< # Streams
-< INSERT INTO streams VALUES(111, 'Cam Stream',
-< LineFromText(
-< 'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
-< INSERT INTO streams VALUES(112, NULL,
-< LineFromText(
-< 'LINESTRING( 76 0, 78 4, 73 9 )', 101));
-< # Buildings
-< INSERT INTO buildings VALUES(113, '123 Main Street',
-< PointFromText(
-< 'POINT( 52 30 )', 101),
-< PolyFromText(
-< 'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
-< INSERT INTO buildings VALUES(114, '215 Main Street',
-< PointFromText(
-< 'POINT( 64 33 )', 101),
-< PolyFromText(
-< 'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
-< # Ponds
-< INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
-< MPolyFromText(
-< 'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
-< ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
-< # Named Places
-< INSERT INTO named_places VALUES(117, 'Ashton',
-< PolyFromText(
-< 'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
-< INSERT INTO named_places VALUES(118, 'Goose Island',
-< PolyFromText(
-< 'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
-< # Map Neatlines
-< INSERT INTO map_neatlines VALUES(115,
-< PolyFromText(
-< 'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
-< SELECT Dimension(shore)
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< Dimension(shore)
-< 2
-< SELECT GeometryType(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< GeometryType(centerlines)
-< MULTILINESTRING
-< SELECT AsText(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(boundary)
-< POLYGON((67 13,67 18,59 18,59 13,67 13))
-< SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(PolyFromWKB(AsBinary(boundary),101))
-< POLYGON((67 13,67 18,59 18,59 13,67 13))
-< SELECT SRID(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< SRID(boundary)
-< 101
-< SELECT IsEmpty(centerline)
-< FROM road_segments
-< WHERE name = 'Route 5'
-< AND aliases = 'Main Street';
-< IsEmpty(centerline)
-< 0
-< SELECT AsText(Envelope(boundary))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(Envelope(boundary))
-< POLYGON((59 13,67 13,67 18,59 18,59 13))
-< SELECT X(position)
-< FROM bridges
-< WHERE name = 'Cam Bridge';
-< X(position)
-< 44
-< SELECT Y(position)
-< FROM bridges
-< WHERE name = 'Cam Bridge';
-< Y(position)
-< 31
-< SELECT AsText(StartPoint(centerline))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(StartPoint(centerline))
-< POINT(0 18)
-< SELECT AsText(EndPoint(centerline))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(EndPoint(centerline))
-< POINT(44 31)
-< SELECT GLength(centerline)
-< FROM road_segments
-< WHERE fid = 106;
-< GLength(centerline)
-< 26
-< SELECT NumPoints(centerline)
-< FROM road_segments
-< WHERE fid = 102;
-< NumPoints(centerline)
-< 5
-< SELECT AsText(PointN(centerline, 1))
-< FROM road_segments
-< WHERE fid = 102;
-< AsText(PointN(centerline, 1))
-< POINT(0 18)
-< SELECT AsText(Centroid(boundary))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< AsText(Centroid(boundary))
-< POINT(63 15.5)
-< SELECT Area(boundary)
-< FROM named_places
-< WHERE name = 'Goose Island';
-< Area(boundary)
-< 40
-< SELECT AsText(ExteriorRing(shore))
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< AsText(ExteriorRing(shore))
-< LINESTRING(52 18,66 23,73 9,48 6,52 18)
-< SELECT NumInteriorRings(shore)
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< NumInteriorRings(shore)
-< 1
-< SELECT AsText(InteriorRingN(shore, 1))
-< FROM lakes
-< WHERE name = 'Blue Lake';
-< AsText(InteriorRingN(shore, 1))
-< LINESTRING(59 18,67 18,67 13,59 13,59 18)
-< SELECT NumGeometries(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< NumGeometries(centerlines)
-< 2
-< SELECT AsText(GeometryN(centerlines, 2))
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< AsText(GeometryN(centerlines, 2))
-< LINESTRING(16 0,16 23,16 48)
-< SELECT IsClosed(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< IsClosed(centerlines)
-< 0
-< SELECT GLength(centerlines)
-< FROM divided_routes
-< WHERE name = 'Route 75';
-< GLength(centerlines)
-< 96
-< SELECT AsText(Centroid(shores))
-< FROM ponds
-< WHERE fid = 120;
-< AsText(Centroid(shores))
-< POINT(25 42)
-< SELECT Area(shores)
-< FROM ponds
-< WHERE fid = 120;
-< Area(shores)
-< 8
-< SELECT ST_Equals(boundary,
-< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-< FROM named_places
-< WHERE name = 'Goose Island';
-< ST_Equals(boundary,
-< PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
-< 1
-< SELECT ST_Disjoint(centerlines, boundary)
-< FROM divided_routes, named_places
-< WHERE divided_routes.name = 'Route 75'
-< AND named_places.name = 'Ashton';
-< ST_Disjoint(centerlines, boundary)
-< 1
-< SELECT ST_Touches(centerline, shore)
-< FROM streams, lakes
-< WHERE streams.name = 'Cam Stream'
-< AND lakes.name = 'Blue Lake';
-< ST_Touches(centerline, shore)
-< 1
-< SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
-< FROM road_segments, divided_routes
-< WHERE road_segments.fid = 102
-< AND divided_routes.name = 'Route 75';
-< Crosses(road_segments.centerline, divided_routes.centerlines)
-< 1
-< SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
-< FROM road_segments, divided_routes
-< WHERE road_segments.fid = 102
-< AND divided_routes.name = 'Route 75';
-< ST_Intersects(road_segments.centerline, divided_routes.centerlines)
-< 1
-< SELECT ST_Contains(forests.boundary, named_places.boundary)
-< FROM forests, named_places
-< WHERE forests.name = 'Green Forest'
-< AND named_places.name = 'Ashton';
-< ST_Contains(forests.boundary, named_places.boundary)
-< 0
-< SELECT ST_Distance(position, boundary)
-< FROM bridges, named_places
-< WHERE bridges.name = 'Cam Bridge'
-< AND named_places.name = 'Ashton';
-< ST_Distance(position, boundary)
-< 12
-< SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
-< FROM named_places, forests
-< WHERE named_places.name = 'Ashton'
-< AND forests.name = 'Green Forest';
-< AsText(ST_Difference(named_places.boundary, forests.boundary))
-< POLYGON((56 34,62 48,84 48,84 42,56 34))
-< SELECT AsText(ST_Union(shore, boundary))
-< FROM lakes, named_places
-< WHERE lakes.name = 'Blue Lake'
-< AND named_places.name = 'Goose Island';
-< AsText(ST_Union(shore, boundary))
-< POLYGON((48 6,52 18,66 23,73 9,48 6))
-< SELECT AsText(ST_SymDifference(shore, boundary))
-< FROM lakes, named_places
-< WHERE lakes.name = 'Blue Lake'
-< AND named_places.name = 'Ashton';
-< AsText(ST_SymDifference(shore, boundary))
-< MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
-< SELECT count(*)
-< FROM buildings, bridges
-< WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
-< count(*)
-< 1
----
-> ERROR 42000: The storage engine for the table doesn't support GEOMETRY
-> # ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
-> # The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
-> # Geometry types or spatial indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- type_spatial_indexes.result 2013-01-23 01:25:45.367797786 +0400
++++ type_spatial_indexes.reject 2013-01-23 02:51:15.247306467 +0400
+@@ -2,1399 +2,31 @@
+ DROP DATABASE IF EXISTS gis_ogs;
+ CREATE DATABASE gis_ogs;
+ CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON, <CUSTOM_INDEX> g(g(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT, <CUSTOM_INDEX> g(g(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING, <CUSTOM_INDEX> g(g(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE gis_ogs;
+-CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shore POLYGON, <CUSTOM_INDEX> s(shore(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING, <CUSTOM_INDEX> c(centerline(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerlines MULTILINESTRING, <CUSTOM_INDEX> c(centerlines(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary MULTIPOLYGON, <CUSTOM_INDEX> b(boundary(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT, <CUSTOM_INDEX> p(`position`(64))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING, <CUSTOM_INDEX> c(centerline(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT,
+-footprint POLYGON, <CUSTOM_INDEX> p(`position`(64)), <CUSTOM_INDEX> f(footprint(128))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-type CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shores MULTIPOLYGON, <CUSTOM_INDEX> s(shores(256))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary POLYGON, <CUSTOM_INDEX> b(boundary(512))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+-neatline POLYGON, <CUSTOM_INDEX> n(neatline(700))) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE test;
+-SHOW FIELDS FROM gis_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g point YES MUL NULL
+-SHOW FIELDS FROM gis_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g linestring YES MUL NULL
+-SHOW FIELDS FROM gis_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g polygon YES MUL NULL
+-SHOW FIELDS FROM gis_multi_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipoint YES MUL NULL
+-SHOW FIELDS FROM gis_multi_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multilinestring YES MUL NULL
+-SHOW FIELDS FROM gis_multi_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipolygon YES NULL
+-SHOW FIELDS FROM gis_geometrycollection;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometrycollection YES NULL
+-SHOW FIELDS FROM gis_geometry;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometry YES NULL
+-INSERT INTO gis_point (fid,g) VALUES
+-(101, PointFromText('POINT(10 10)')),
+-(102, PointFromText('POINT(20 10)')),
+-(103, PointFromText('POINT(20 20)')),
+-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+-INSERT INTO gis_line (fid,g) VALUES
+-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+-INSERT INTO gis_polygon (fid,g) VALUES
+-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+-INSERT INTO gis_multi_point (fid,g) VALUES
+-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+-INSERT INTO gis_multi_line (fid,g) VALUES
+-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+-INSERT INTO gis_multi_polygon (fid,g) VALUES
+-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+-INSERT INTO gis_geometrycollection (fid,g) VALUES
+-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+-(122, GeomFromText('GeometryCollection()')),
+-(123, GeomFromText('GeometryCollection EMPTY'));
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
+-SELECT fid, AsText(g) FROM gis_point;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-SELECT fid, AsText(g) FROM gis_line;
+-fid AsText(g)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-SELECT fid, AsText(g) FROM gis_polygon;
+-fid AsText(g)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-SELECT fid, AsText(g) FROM gis_multi_point;
+-fid AsText(g)
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-SELECT fid, AsText(g) FROM gis_multi_line;
+-fid AsText(g)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-SELECT fid, AsText(g) FROM gis_multi_polygon;
+-fid AsText(g)
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-SELECT fid, AsText(g) FROM gis_geometrycollection;
+-fid AsText(g)
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, AsText(g) FROM gis_geometry;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, Dimension(g) FROM gis_geometry;
+-fid Dimension(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 1
+-106 1
+-107 1
+-108 2
+-109 2
+-110 2
+-111 0
+-112 0
+-113 0
+-114 1
+-115 1
+-116 1
+-117 2
+-118 2
+-119 2
+-120 1
+-121 1
+-122 0
+-123 0
+-SELECT fid, GeometryType(g) FROM gis_geometry;
+-fid GeometryType(g)
+-101 POINT
+-102 POINT
+-103 POINT
+-104 POINT
+-105 LINESTRING
+-106 LINESTRING
+-107 LINESTRING
+-108 POLYGON
+-109 POLYGON
+-110 POLYGON
+-111 MULTIPOINT
+-112 MULTIPOINT
+-113 MULTIPOINT
+-114 MULTILINESTRING
+-115 MULTILINESTRING
+-116 MULTILINESTRING
+-117 MULTIPOLYGON
+-118 MULTIPOLYGON
+-119 MULTIPOLYGON
+-120 GEOMETRYCOLLECTION
+-121 GEOMETRYCOLLECTION
+-122 GEOMETRYCOLLECTION
+-123 GEOMETRYCOLLECTION
+-SELECT fid, IsEmpty(g) FROM gis_geometry;
+-fid IsEmpty(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 0
+-106 0
+-107 0
+-108 0
+-109 0
+-110 0
+-111 0
+-112 0
+-113 0
+-114 0
+-115 0
+-116 0
+-117 0
+-118 0
+-119 0
+-120 0
+-121 0
+-122 0
+-123 0
+-SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+-fid AsText(Envelope(g))
+-101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+-102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+-103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+-104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+-105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+-110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+-111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+-112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+-113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+-114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+-115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+-116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+-117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+-120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, X(g) FROM gis_point;
+-fid X(g)
+-101 10
+-102 20
+-103 20
+-104 10
+-SELECT fid, Y(g) FROM gis_point;
+-fid Y(g)
+-101 10
+-102 10
+-103 20
+-104 20
+-SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+-fid AsText(StartPoint(g))
+-105 POINT(0 0)
+-106 POINT(10 10)
+-107 POINT(10 10)
+-SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+-fid AsText(EndPoint(g))
+-105 POINT(10 0)
+-106 POINT(10 10)
+-107 POINT(40 10)
+-SELECT fid, GLength(g) FROM gis_line;
+-fid GLength(g)
+-105 24.14213562373095
+-106 40
+-107 30
+-SELECT fid, NumPoints(g) FROM gis_line;
+-fid NumPoints(g)
+-105 3
+-106 5
+-107 2
+-SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+-fid AsText(PointN(g, 2))
+-105 POINT(0 10)
+-106 POINT(20 10)
+-107 POINT(40 10)
+-SELECT fid, IsClosed(g) FROM gis_line;
+-fid IsClosed(g)
+-105 0
+-106 1
+-107 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+-fid AsText(Centroid(g))
+-108 POINT(15 15)
+-109 POINT(25.416666666666668 25.416666666666668)
+-110 POINT(20 10)
+-SELECT fid, Area(g) FROM gis_polygon;
+-fid Area(g)
+-108 100
+-109 2400
+-110 450
+-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+-fid AsText(ExteriorRing(g))
+-108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+-110 LINESTRING(0 0,30 0,30 30,0 0)
+-SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+-fid NumInteriorRings(g)
+-108 0
+-109 1
+-110 0
+-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+-fid AsText(InteriorRingN(g, 1))
+-108 NULL
+-109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-110 NULL
+-SELECT fid, IsClosed(g) FROM gis_multi_line;
+-fid IsClosed(g)
+-114 0
+-115 0
+-116 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+-fid AsText(Centroid(g))
+-117 POINT(55.58852775304245 17.426536064113982)
+-118 POINT(55.58852775304245 17.426536064113982)
+-119 POINT(2 2)
+-SELECT fid, Area(g) FROM gis_multi_polygon;
+-fid Area(g)
+-117 1684.5
+-118 1684.5
+-119 4.5
+-SELECT fid, NumGeometries(g) from gis_multi_point;
+-fid NumGeometries(g)
+-111 4
+-112 4
+-113 2
+-SELECT fid, NumGeometries(g) from gis_multi_line;
+-fid NumGeometries(g)
+-114 2
+-115 1
+-116 2
+-SELECT fid, NumGeometries(g) from gis_multi_polygon;
+-fid NumGeometries(g)
+-117 2
+-118 2
+-119 1
+-SELECT fid, NumGeometries(g) from gis_geometrycollection;
+-fid NumGeometries(g)
+-120 2
+-121 2
+-122 0
+-123 0
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+-fid AsText(GeometryN(g, 2))
+-111 POINT(10 10)
+-112 POINT(11 11)
+-113 POINT(4 10)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+-fid AsText(GeometryN(g, 2))
+-114 LINESTRING(16 0,16 23,16 48)
+-115 NULL
+-116 LINESTRING(2 5,5 8,21 7)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+-fid AsText(GeometryN(g, 2))
+-117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-119 NULL
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 2))
+-120 LINESTRING(0 0,10 10)
+-121 LINESTRING(3 6,7 9)
+-122 NULL
+-123 NULL
+-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 1))
+-120 POINT(0 0)
+-121 POINT(44 6)
+-122 NULL
+-123 NULL
+-SELECT g1.fid as first, g2.fid as second,
+-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+-first second w c o e d t i r
+-120 120 1 1 0 1 0 1 1 0
+-120 121 0 0 1 0 0 0 1 0
+-120 122 0 1 NULL 0 NULL 0 NULL 0
+-120 123 0 1 NULL 0 NULL 0 NULL 0
+-121 120 0 0 1 0 0 0 1 0
+-121 121 1 1 0 1 0 1 1 0
+-121 122 0 1 NULL 0 NULL 0 NULL 0
+-121 123 0 1 NULL 0 NULL 0 NULL 0
+-122 120 1 0 NULL 0 NULL 0 NULL 0
+-122 121 1 0 NULL 0 NULL 0 NULL 0
+-122 122 1 1 NULL 1 NULL 0 NULL 0
+-122 123 1 1 NULL 1 NULL 0 NULL 0
+-123 120 1 0 NULL 0 NULL 0 NULL 0
+-123 121 1 0 NULL 0 NULL 0 NULL 0
+-123 122 1 1 NULL 1 NULL 0 NULL 0
+-123 123 1 1 NULL 1 NULL 0 NULL 0
+-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+-USE gis_ogs;
+-# Lakes
+-INSERT INTO lakes (fid,name,shore) VALUES (
+-101, 'BLUE LAKE',
+-PolyFromText(
+-'POLYGON(
+- (52 18,66 23,73 9,48 6,52 18),
+- (59 18,67 18,67 13,59 13,59 18)
+- )',
+-101));
+-# Road Segments
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
+-LineFromText(
+-'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 70 38, 72 48 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
+-LineFromText(
+-'LINESTRING( 70 38, 84 42 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
+-1,
+-LineFromText(
+-'LINESTRING( 28 26, 28 0 )',101));
+-# DividedRoutes
+-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
+-MLineFromText(
+-'MULTILINESTRING((10 48,10 21,10 0),
+- (16 0,16 23,16 48))', 101));
+-# Forests
+-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
+-MPolyFromText(
+-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+-101));
+-# Bridges
+-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
+-'POINT( 44 31 )', 101));
+-# Streams
+-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
+-LineFromText(
+-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
+-LineFromText(
+-'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+-# Buildings
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
+-PointFromText(
+-'POINT( 52 30 )', 101),
+-PolyFromText(
+-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
+-PointFromText(
+-'POINT( 64 33 )', 101),
+-PolyFromText(
+-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+-# Ponds
+-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
+-MPolyFromText(
+-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+-# Named Places
+-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
+-PolyFromText(
+-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
+-PolyFromText(
+-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+-# Map Neatlines
+-INSERT INTO map_neatlines (fid,neatline) VALUES(115,
+-PolyFromText(
+-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+-SELECT Dimension(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-Dimension(shore)
+-2
+-SELECT GeometryType(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GeometryType(centerlines)
+-MULTILINESTRING
+-SELECT AsText(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(boundary)
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(PolyFromWKB(AsBinary(boundary),101))
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT SRID(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-SRID(boundary)
+-101
+-SELECT IsEmpty(centerline)
+-FROM road_segments
+-WHERE name = 'Route 5'
+-AND aliases = 'Main Street';
+-IsEmpty(centerline)
+-0
+-SELECT AsText(Envelope(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Envelope(boundary))
+-POLYGON((59 13,67 13,67 18,59 18,59 13))
+-SELECT X(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-X(position)
+-44
+-SELECT Y(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-Y(position)
+-31
+-SELECT AsText(StartPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(StartPoint(centerline))
+-POINT(0 18)
+-SELECT AsText(EndPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(EndPoint(centerline))
+-POINT(44 31)
+-SELECT GLength(centerline)
+-FROM road_segments
+-WHERE fid = 106;
+-GLength(centerline)
+-26
+-SELECT NumPoints(centerline)
+-FROM road_segments
+-WHERE fid = 102;
+-NumPoints(centerline)
+-5
+-SELECT AsText(PointN(centerline, 1))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(PointN(centerline, 1))
+-POINT(0 18)
+-SELECT AsText(Centroid(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Centroid(boundary))
+-POINT(63 15.5)
+-SELECT Area(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-Area(boundary)
+-40
+-SELECT AsText(ExteriorRing(shore))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(ExteriorRing(shore))
+-LINESTRING(52 18,66 23,73 9,48 6,52 18)
+-SELECT NumInteriorRings(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-NumInteriorRings(shore)
+-1
+-SELECT AsText(InteriorRingN(shore, 1))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(InteriorRingN(shore, 1))
+-LINESTRING(59 18,67 18,67 13,59 13,59 18)
+-SELECT NumGeometries(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-NumGeometries(centerlines)
+-2
+-SELECT AsText(GeometryN(centerlines, 2))
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-AsText(GeometryN(centerlines, 2))
+-LINESTRING(16 0,16 23,16 48)
+-SELECT IsClosed(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-IsClosed(centerlines)
+-0
+-SELECT GLength(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GLength(centerlines)
+-96
+-SELECT AsText(Centroid(shores))
+-FROM ponds
+-WHERE fid = 120;
+-AsText(Centroid(shores))
+-POINT(25 42)
+-SELECT Area(shores)
+-FROM ponds
+-WHERE fid = 120;
+-Area(shores)
+-8
+-SELECT ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-1
+-SELECT ST_Disjoint(centerlines, boundary)
+-FROM divided_routes, named_places
+-WHERE divided_routes.name = 'Route 75'
+-AND named_places.name = 'Ashton';
+-ST_Disjoint(centerlines, boundary)
+-1
+-SELECT ST_Touches(centerline, shore)
+-FROM streams, lakes
+-WHERE streams.name = 'Cam Stream'
+-AND lakes.name = 'Blue Lake';
+-ST_Touches(centerline, shore)
+-1
+-SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-Crosses(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Contains(forests.boundary, named_places.boundary)
+-FROM forests, named_places
+-WHERE forests.name = 'Green Forest'
+-AND named_places.name = 'Ashton';
+-ST_Contains(forests.boundary, named_places.boundary)
+-0
+-SELECT ST_Distance(position, boundary)
+-FROM bridges, named_places
+-WHERE bridges.name = 'Cam Bridge'
+-AND named_places.name = 'Ashton';
+-ST_Distance(position, boundary)
+-12
+-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+-FROM named_places, forests
+-WHERE named_places.name = 'Ashton'
+-AND forests.name = 'Green Forest';
+-AsText(ST_Difference(named_places.boundary, forests.boundary))
+-POLYGON((56 34,62 48,84 48,84 42,56 34))
+-SELECT AsText(ST_Union(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Goose Island';
+-AsText(ST_Union(shore, boundary))
+-POLYGON((48 6,52 18,66 23,73 9,48 6))
+-SELECT AsText(ST_SymDifference(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Ashton';
+-AsText(ST_SymDifference(shore, boundary))
+-MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+-SELECT count(*)
+-FROM buildings, bridges
+-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+-count(*)
+-1
++ERROR 42000: The storage engine for the table doesn't support GEOMETRY
++# ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT, /*!INDEX*/ /*Custom index*/ g(g(128))) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
++# The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
++# Geometry types or indexes on them or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP DATABASE gis_ogs;
+ USE test;
+ DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+ DROP DATABASE IF EXISTS gis_ogs;
+ CREATE DATABASE gis_ogs;
+ CREATE TABLE gis_point (fid <INT_COLUMN>, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_line (fid <INT_COLUMN>, g LINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_polygon (fid <INT_COLUMN>, g POLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_point (fid <INT_COLUMN>, g MULTIPOINT NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_line (fid <INT_COLUMN>, g MULTILINESTRING NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_multi_polygon (fid <INT_COLUMN>, g MULTIPOLYGON NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometrycollection (fid <INT_COLUMN>, g GEOMETRYCOLLECTION NOT NULL, SPATIAL INDEX(g)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE gis_geometry (fid <INT_COLUMN>, g GEOMETRY NOT NULL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE gis_ogs;
+-CREATE TABLE lakes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shore POLYGON NOT NULL, SPATIAL INDEX s(shore)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE road_segments (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-aliases CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE divided_routes (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-num_lanes INT <CUSTOM_COL_OPTIONS>,
+-centerlines MULTILINESTRING NOT NULL, SPATIAL INDEX c(centerlines)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE forests (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary MULTIPOLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE bridges (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT NOT NULL, SPATIAL INDEX p(position)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE streams (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-centerline LINESTRING NOT NULL, SPATIAL INDEX c(centerline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE buildings (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-position POINT NOT NULL,
+-footprint POLYGON NOT NULL, SPATIAL INDEX p(position), SPATIAL INDEX f(footprint)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE ponds (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-type CHAR(64) <CUSTOM_COL_OPTIONS>,
+-shores MULTIPOLYGON NOT NULL, SPATIAL INDEX s(shores)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE named_places (fid INT <CUSTOM_COL_OPTIONS>,
+-name CHAR(64) <CUSTOM_COL_OPTIONS>,
+-boundary POLYGON NOT NULL, SPATIAL INDEX b(boundary)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-CREATE TABLE map_neatlines (fid INT <CUSTOM_COL_OPTIONS>,
+-neatline POLYGON NOT NULL, SPATIAL INDEX n(neatline)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-USE test;
+-SHOW FIELDS FROM gis_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g point NO MUL NULL
+-SHOW FIELDS FROM gis_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g linestring NO MUL NULL
+-SHOW FIELDS FROM gis_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g polygon NO MUL NULL
+-SHOW FIELDS FROM gis_multi_point;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipoint NO MUL NULL
+-SHOW FIELDS FROM gis_multi_line;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multilinestring NO MUL NULL
+-SHOW FIELDS FROM gis_multi_polygon;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g multipolygon NO MUL NULL
+-SHOW FIELDS FROM gis_geometrycollection;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometrycollection NO MUL NULL
+-SHOW FIELDS FROM gis_geometry;
+-Field Type Null Key Default Extra
+-fid int(11) YES NULL
+-g geometry NO NULL
+-INSERT INTO gis_point (fid,g) VALUES
+-(101, PointFromText('POINT(10 10)')),
+-(102, PointFromText('POINT(20 10)')),
+-(103, PointFromText('POINT(20 20)')),
+-(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
+-INSERT INTO gis_line (fid,g) VALUES
+-(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
+-(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
+-(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
+-INSERT INTO gis_polygon (fid,g) VALUES
+-(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
+-(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
+-(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
+-INSERT INTO gis_multi_point (fid,g) VALUES
+-(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
+-(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
+-(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
+-INSERT INTO gis_multi_line (fid,g) VALUES
+-(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
+-(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
+-(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
+-INSERT INTO gis_multi_polygon (fid,g) VALUES
+-(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
+-(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
+-INSERT INTO gis_geometrycollection (fid,g) VALUES
+-(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
+-(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
+-(122, GeomFromText('GeometryCollection()')),
+-(123, GeomFromText('GeometryCollection EMPTY'));
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_point;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_line;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_multi_polygon;
+-INSERT into gis_geometry (fid,g) SELECT fid,g FROM gis_geometrycollection;
+-SELECT fid, AsText(g) FROM gis_point;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-SELECT fid, AsText(g) FROM gis_line;
+-fid AsText(g)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-SELECT fid, AsText(g) FROM gis_polygon;
+-fid AsText(g)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-SELECT fid, AsText(g) FROM gis_multi_point;
+-fid AsText(g)
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-SELECT fid, AsText(g) FROM gis_multi_line;
+-fid AsText(g)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-SELECT fid, AsText(g) FROM gis_multi_polygon;
+-fid AsText(g)
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-SELECT fid, AsText(g) FROM gis_geometrycollection;
+-fid AsText(g)
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, AsText(g) FROM gis_geometry;
+-fid AsText(g)
+-101 POINT(10 10)
+-102 POINT(20 10)
+-103 POINT(20 20)
+-104 POINT(10 20)
+-105 LINESTRING(0 0,0 10,10 0)
+-106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-107 LINESTRING(10 10,40 10)
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
+-110 POLYGON((0 0,30 0,30 30,0 0))
+-111 MULTIPOINT(0 0,10 10,10 20,20 20)
+-112 MULTIPOINT(1 1,11 11,11 21,21 21)
+-113 MULTIPOINT(3 6,4 10)
+-114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
+-115 MULTILINESTRING((10 48,10 21,10 0))
+-116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
+-117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
+-119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
+-120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
+-121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, Dimension(g) FROM gis_geometry;
+-fid Dimension(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 1
+-106 1
+-107 1
+-108 2
+-109 2
+-110 2
+-111 0
+-112 0
+-113 0
+-114 1
+-115 1
+-116 1
+-117 2
+-118 2
+-119 2
+-120 1
+-121 1
+-122 0
+-123 0
+-SELECT fid, GeometryType(g) FROM gis_geometry;
+-fid GeometryType(g)
+-101 POINT
+-102 POINT
+-103 POINT
+-104 POINT
+-105 LINESTRING
+-106 LINESTRING
+-107 LINESTRING
+-108 POLYGON
+-109 POLYGON
+-110 POLYGON
+-111 MULTIPOINT
+-112 MULTIPOINT
+-113 MULTIPOINT
+-114 MULTILINESTRING
+-115 MULTILINESTRING
+-116 MULTILINESTRING
+-117 MULTIPOLYGON
+-118 MULTIPOLYGON
+-119 MULTIPOLYGON
+-120 GEOMETRYCOLLECTION
+-121 GEOMETRYCOLLECTION
+-122 GEOMETRYCOLLECTION
+-123 GEOMETRYCOLLECTION
+-SELECT fid, IsEmpty(g) FROM gis_geometry;
+-fid IsEmpty(g)
+-101 0
+-102 0
+-103 0
+-104 0
+-105 0
+-106 0
+-107 0
+-108 0
+-109 0
+-110 0
+-111 0
+-112 0
+-113 0
+-114 0
+-115 0
+-116 0
+-117 0
+-118 0
+-119 0
+-120 0
+-121 0
+-122 0
+-123 0
+-SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
+-fid AsText(Envelope(g))
+-101 POLYGON((10 10,10 10,10 10,10 10,10 10))
+-102 POLYGON((20 10,20 10,20 10,20 10,20 10))
+-103 POLYGON((20 20,20 20,20 20,20 20,20 20))
+-104 POLYGON((10 20,10 20,10 20,10 20,10 20))
+-105 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-106 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-107 POLYGON((10 10,40 10,40 10,10 10,10 10))
+-108 POLYGON((10 10,20 10,20 20,10 20,10 10))
+-109 POLYGON((0 0,50 0,50 50,0 50,0 0))
+-110 POLYGON((0 0,30 0,30 30,0 30,0 0))
+-111 POLYGON((0 0,20 0,20 20,0 20,0 0))
+-112 POLYGON((1 1,21 1,21 21,1 21,1 1))
+-113 POLYGON((3 6,4 6,4 10,3 10,3 6))
+-114 POLYGON((10 0,16 0,16 48,10 48,10 0))
+-115 POLYGON((10 0,10 0,10 48,10 48,10 0))
+-116 POLYGON((1 2,21 2,21 8,1 8,1 2))
+-117 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-118 POLYGON((28 0,84 0,84 42,28 42,28 0))
+-119 POLYGON((0 0,3 0,3 3,0 3,0 0))
+-120 POLYGON((0 0,10 0,10 10,0 10,0 0))
+-121 POLYGON((3 6,44 6,44 9,3 9,3 6))
+-122 GEOMETRYCOLLECTION EMPTY
+-123 GEOMETRYCOLLECTION EMPTY
+-SELECT fid, X(g) FROM gis_point;
+-fid X(g)
+-101 10
+-102 20
+-103 20
+-104 10
+-SELECT fid, Y(g) FROM gis_point;
+-fid Y(g)
+-101 10
+-102 10
+-103 20
+-104 20
+-SELECT fid, AsText(StartPoint(g)) FROM gis_line;
+-fid AsText(StartPoint(g))
+-105 POINT(0 0)
+-106 POINT(10 10)
+-107 POINT(10 10)
+-SELECT fid, AsText(EndPoint(g)) FROM gis_line;
+-fid AsText(EndPoint(g))
+-105 POINT(10 0)
+-106 POINT(10 10)
+-107 POINT(40 10)
+-SELECT fid, GLength(g) FROM gis_line;
+-fid GLength(g)
+-105 24.14213562373095
+-106 40
+-107 30
+-SELECT fid, NumPoints(g) FROM gis_line;
+-fid NumPoints(g)
+-105 3
+-106 5
+-107 2
+-SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
+-fid AsText(PointN(g, 2))
+-105 POINT(0 10)
+-106 POINT(20 10)
+-107 POINT(40 10)
+-SELECT fid, IsClosed(g) FROM gis_line;
+-fid IsClosed(g)
+-105 0
+-106 1
+-107 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
+-fid AsText(Centroid(g))
+-108 POINT(15 15)
+-109 POINT(25.416666666666668 25.416666666666668)
+-110 POINT(20 10)
+-SELECT fid, Area(g) FROM gis_polygon;
+-fid Area(g)
+-108 100
+-109 2400
+-110 450
+-SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
+-fid AsText(ExteriorRing(g))
+-108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
+-110 LINESTRING(0 0,30 0,30 30,0 0)
+-SELECT fid, NumInteriorRings(g) FROM gis_polygon;
+-fid NumInteriorRings(g)
+-108 0
+-109 1
+-110 0
+-SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
+-fid AsText(InteriorRingN(g, 1))
+-108 NULL
+-109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
+-110 NULL
+-SELECT fid, IsClosed(g) FROM gis_multi_line;
+-fid IsClosed(g)
+-114 0
+-115 0
+-116 0
+-SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
+-fid AsText(Centroid(g))
+-117 POINT(55.58852775304245 17.426536064113982)
+-118 POINT(55.58852775304245 17.426536064113982)
+-119 POINT(2 2)
+-SELECT fid, Area(g) FROM gis_multi_polygon;
+-fid Area(g)
+-117 1684.5
+-118 1684.5
+-119 4.5
+-SELECT fid, NumGeometries(g) from gis_multi_point;
+-fid NumGeometries(g)
+-111 4
+-112 4
+-113 2
+-SELECT fid, NumGeometries(g) from gis_multi_line;
+-fid NumGeometries(g)
+-114 2
+-115 1
+-116 2
+-SELECT fid, NumGeometries(g) from gis_multi_polygon;
+-fid NumGeometries(g)
+-117 2
+-118 2
+-119 1
+-SELECT fid, NumGeometries(g) from gis_geometrycollection;
+-fid NumGeometries(g)
+-120 2
+-121 2
+-122 0
+-123 0
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
+-fid AsText(GeometryN(g, 2))
+-111 POINT(10 10)
+-112 POINT(11 11)
+-113 POINT(4 10)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
+-fid AsText(GeometryN(g, 2))
+-114 LINESTRING(16 0,16 23,16 48)
+-115 NULL
+-116 LINESTRING(2 5,5 8,21 7)
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
+-fid AsText(GeometryN(g, 2))
+-117 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-118 POLYGON((59 18,67 18,67 13,59 13,59 18))
+-119 NULL
+-SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 2))
+-120 LINESTRING(0 0,10 10)
+-121 LINESTRING(3 6,7 9)
+-122 NULL
+-123 NULL
+-SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
+-fid AsText(GeometryN(g, 1))
+-120 POINT(0 0)
+-121 POINT(44 6)
+-122 NULL
+-123 NULL
+-SELECT g1.fid as first, g2.fid as second,
+-Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
+-Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
+-Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
+-FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
+-first second w c o e d t i r
+-120 120 1 1 0 1 0 1 1 0
+-120 121 0 0 1 0 0 0 1 0
+-120 122 0 1 NULL 0 NULL 0 NULL 0
+-120 123 0 1 NULL 0 NULL 0 NULL 0
+-121 120 0 0 1 0 0 0 1 0
+-121 121 1 1 0 1 0 1 1 0
+-121 122 0 1 NULL 0 NULL 0 NULL 0
+-121 123 0 1 NULL 0 NULL 0 NULL 0
+-122 120 1 0 NULL 0 NULL 0 NULL 0
+-122 121 1 0 NULL 0 NULL 0 NULL 0
+-122 122 1 1 NULL 1 NULL 0 NULL 0
+-122 123 1 1 NULL 1 NULL 0 NULL 0
+-123 120 1 0 NULL 0 NULL 0 NULL 0
+-123 121 1 0 NULL 0 NULL 0 NULL 0
+-123 122 1 1 NULL 1 NULL 0 NULL 0
+-123 123 1 1 NULL 1 NULL 0 NULL 0
+-DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
+-USE gis_ogs;
+-# Lakes
+-INSERT INTO lakes (fid,name,shore) VALUES (
+-101, 'BLUE LAKE',
+-PolyFromText(
+-'POLYGON(
+- (52 18,66 23,73 9,48 6,52 18),
+- (59 18,67 18,67 13,59 13,59 18)
+- )',
+-101));
+-# Road Segments
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(102, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(103, 'Route 5', 'Main Street', 4,
+-LineFromText(
+-'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(104, 'Route 5', NULL, 2,
+-LineFromText(
+-'LINESTRING( 70 38, 72 48 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(105, 'Main Street', NULL, 4,
+-LineFromText(
+-'LINESTRING( 70 38, 84 42 )' ,101));
+-INSERT INTO road_segments (fid,name,aliases,num_lanes,centerline) VALUES(106, 'Dirt Road by Green Forest', NULL,
+-1,
+-LineFromText(
+-'LINESTRING( 28 26, 28 0 )',101));
+-# DividedRoutes
+-INSERT INTO divided_routes (fid,name,num_lanes,centerlines) VALUES(119, 'Route 75', 4,
+-MLineFromText(
+-'MULTILINESTRING((10 48,10 21,10 0),
+- (16 0,16 23,16 48))', 101));
+-# Forests
+-INSERT INTO forests (fid,name,boundary) VALUES(109, 'Green Forest',
+-MPolyFromText(
+-'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
+- (52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
+-101));
+-# Bridges
+-INSERT INTO bridges (fid,name,position) VALUES(110, 'Cam Bridge', PointFromText(
+-'POINT( 44 31 )', 101));
+-# Streams
+-INSERT INTO streams (fid,name,centerline) VALUES(111, 'Cam Stream',
+-LineFromText(
+-'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
+-INSERT INTO streams (fid,name,centerline) VALUES(112, NULL,
+-LineFromText(
+-'LINESTRING( 76 0, 78 4, 73 9 )', 101));
+-# Buildings
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(113, '123 Main Street',
+-PointFromText(
+-'POINT( 52 30 )', 101),
+-PolyFromText(
+-'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
+-INSERT INTO buildings (fid,name,position,footprint) VALUES(114, '215 Main Street',
+-PointFromText(
+-'POINT( 64 33 )', 101),
+-PolyFromText(
+-'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
+-# Ponds
+-INSERT INTO ponds (fid,name,type,shores) VALUES(120, NULL, 'Stock Pond',
+-MPolyFromText(
+-'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
+- ( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
+-# Named Places
+-INSERT INTO named_places (fid,name,boundary) VALUES(117, 'Ashton',
+-PolyFromText(
+-'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
+-INSERT INTO named_places (fid,name,boundary) VALUES(118, 'Goose Island',
+-PolyFromText(
+-'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
+-# Map Neatlines
+-INSERT INTO map_neatlines (fid,neatline) VALUES(115,
+-PolyFromText(
+-'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
+-SELECT Dimension(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-Dimension(shore)
+-2
+-SELECT GeometryType(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GeometryType(centerlines)
+-MULTILINESTRING
+-SELECT AsText(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(boundary)
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(PolyFromWKB(AsBinary(boundary),101))
+-POLYGON((67 13,67 18,59 18,59 13,67 13))
+-SELECT SRID(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-SRID(boundary)
+-101
+-SELECT IsEmpty(centerline)
+-FROM road_segments
+-WHERE name = 'Route 5'
+-AND aliases = 'Main Street';
+-IsEmpty(centerline)
+-0
+-SELECT AsText(Envelope(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Envelope(boundary))
+-POLYGON((59 13,67 13,67 18,59 18,59 13))
+-SELECT X(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-X(position)
+-44
+-SELECT Y(position)
+-FROM bridges
+-WHERE name = 'Cam Bridge';
+-Y(position)
+-31
+-SELECT AsText(StartPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(StartPoint(centerline))
+-POINT(0 18)
+-SELECT AsText(EndPoint(centerline))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(EndPoint(centerline))
+-POINT(44 31)
+-SELECT GLength(centerline)
+-FROM road_segments
+-WHERE fid = 106;
+-GLength(centerline)
+-26
+-SELECT NumPoints(centerline)
+-FROM road_segments
+-WHERE fid = 102;
+-NumPoints(centerline)
+-5
+-SELECT AsText(PointN(centerline, 1))
+-FROM road_segments
+-WHERE fid = 102;
+-AsText(PointN(centerline, 1))
+-POINT(0 18)
+-SELECT AsText(Centroid(boundary))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-AsText(Centroid(boundary))
+-POINT(63 15.5)
+-SELECT Area(boundary)
+-FROM named_places
+-WHERE name = 'Goose Island';
+-Area(boundary)
+-40
+-SELECT AsText(ExteriorRing(shore))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(ExteriorRing(shore))
+-LINESTRING(52 18,66 23,73 9,48 6,52 18)
+-SELECT NumInteriorRings(shore)
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-NumInteriorRings(shore)
+-1
+-SELECT AsText(InteriorRingN(shore, 1))
+-FROM lakes
+-WHERE name = 'Blue Lake';
+-AsText(InteriorRingN(shore, 1))
+-LINESTRING(59 18,67 18,67 13,59 13,59 18)
+-SELECT NumGeometries(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-NumGeometries(centerlines)
+-2
+-SELECT AsText(GeometryN(centerlines, 2))
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-AsText(GeometryN(centerlines, 2))
+-LINESTRING(16 0,16 23,16 48)
+-SELECT IsClosed(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-IsClosed(centerlines)
+-0
+-SELECT GLength(centerlines)
+-FROM divided_routes
+-WHERE name = 'Route 75';
+-GLength(centerlines)
+-96
+-SELECT AsText(Centroid(shores))
+-FROM ponds
+-WHERE fid = 120;
+-AsText(Centroid(shores))
+-POINT(25 42)
+-SELECT Area(shores)
+-FROM ponds
+-WHERE fid = 120;
+-Area(shores)
+-8
+-SELECT ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-FROM named_places
+-WHERE name = 'Goose Island';
+-ST_Equals(boundary,
+-PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1))
+-1
+-SELECT ST_Disjoint(centerlines, boundary)
+-FROM divided_routes, named_places
+-WHERE divided_routes.name = 'Route 75'
+-AND named_places.name = 'Ashton';
+-ST_Disjoint(centerlines, boundary)
+-1
+-SELECT ST_Touches(centerline, shore)
+-FROM streams, lakes
+-WHERE streams.name = 'Cam Stream'
+-AND lakes.name = 'Blue Lake';
+-ST_Touches(centerline, shore)
+-1
+-SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-Crosses(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-FROM road_segments, divided_routes
+-WHERE road_segments.fid = 102
+-AND divided_routes.name = 'Route 75';
+-ST_Intersects(road_segments.centerline, divided_routes.centerlines)
+-1
+-SELECT ST_Contains(forests.boundary, named_places.boundary)
+-FROM forests, named_places
+-WHERE forests.name = 'Green Forest'
+-AND named_places.name = 'Ashton';
+-ST_Contains(forests.boundary, named_places.boundary)
+-0
+-SELECT ST_Distance(position, boundary)
+-FROM bridges, named_places
+-WHERE bridges.name = 'Cam Bridge'
+-AND named_places.name = 'Ashton';
+-ST_Distance(position, boundary)
+-12
+-SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
+-FROM named_places, forests
+-WHERE named_places.name = 'Ashton'
+-AND forests.name = 'Green Forest';
+-AsText(ST_Difference(named_places.boundary, forests.boundary))
+-POLYGON((56 34,62 48,84 48,84 42,56 34))
+-SELECT AsText(ST_Union(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Goose Island';
+-AsText(ST_Union(shore, boundary))
+-POLYGON((48 6,52 18,66 23,73 9,48 6))
+-SELECT AsText(ST_SymDifference(shore, boundary))
+-FROM lakes, named_places
+-WHERE lakes.name = 'Blue Lake'
+-AND named_places.name = 'Ashton';
+-AsText(ST_SymDifference(shore, boundary))
+-MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
+-SELECT count(*)
+-FROM buildings, bridges
+-WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
+-count(*)
+-1
++ERROR 42000: The storage engine for the table doesn't support GEOMETRY
++# ERROR: Statement ended with errno 1178, errname ER_CHECK_NOT_IMPLEMENTED (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE gis_point (fid INT(11) /*!*/ /*Custom column options*/, g POINT NOT NULL, SPATIAL INDEX(g)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.gis_point) INSERT_METHOD=LAST ]
++# The statement|command finished with ER_CHECK_NOT_IMPLEMENTED.
++# Geometry types or spatial indexes or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
+ DROP DATABASE gis_ogs;
+ USE test;
diff --git a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff
index 094b26668c1..8b2710be221 100644
--- a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff
+++ b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff
@@ -1,79 +1,82 @@
-3,69c3,12
-< SHOW COLUMNS IN t1;
-< Field Type Null Key Default Extra
-< a int(11) # #
-< b int(11) # # VIRTUAL
-< INSERT INTO t1 (a) VALUES (1),(2);
-< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
-< Warnings:
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< SELECT * FROM t1;
-< a b
-< 1 2
-< 2 3
-< 3 4
-< 4 5
-< DROP TABLE t1;
-< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< SHOW COLUMNS IN t1;
-< Field Type Null Key Default Extra
-< a int(11) # #
-< b int(11) # # PERSISTENT
-< INSERT INTO t1 (a) VALUES (1),(2);
-< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
-< Warnings:
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< SELECT * FROM t1;
-< a b
-< 1 2
-< 2 3
-< 3 4
-< 4 5
-< DROP TABLE t1;
-< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< SHOW COLUMNS IN t1;
-< Field Type Null Key Default Extra
-< a int(11) # #
-< b int(11) # # VIRTUAL
-< INSERT INTO t1 (a) VALUES (1),(2);
-< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
-< Warnings:
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< SELECT * FROM t1;
-< a b
-< 1 2
-< 2 3
-< 3 4
-< 4 5
-< DROP TABLE t1;
-< CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
-< SHOW COLUMNS IN t1;
-< Field Type Null Key Default Extra
-< a int(11) # #
-< b int(11) # # PERSISTENT
-< INSERT INTO t1 (a) VALUES (1),(2);
-< INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
-< Warnings:
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-< SELECT * FROM t1;
-< a b
-< 1 2
-< 2 3
-< 3 4
-< 4 5
-< DROP TABLE t1;
----
-> ERROR HY000: MRG_MyISAM storage engine does not support computed columns
-> # ERROR: Statement ended with errno 1910, errname ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS (expected to succeed)
-> # ------------ UNEXPECTED RESULT ------------
-> # [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/ GENERATED ALWAYS AS (a+1)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST ]
-> # The statement|command finished with ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS.
-> # Virtual columns or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
-> # You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
-> # Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
-> # Also, this problem may cause a chain effect (more errors of different kinds in the test).
-> # -------------------------------------------
+--- vcol.result 2013-01-22 22:05:05.246633000 +0400
++++ vcol.reject 2013-01-23 02:51:26.851160587 +0400
+@@ -1,69 +1,12 @@
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # VIRTUAL
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT a,b FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # PERSISTENT
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT a,b FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUAL) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # VIRTUAL
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT a,b FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
+-CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
+-SHOW COLUMNS IN t1;
+-Field Type Null Key Default Extra
+-a int(11) # #
+-b int(11) # # PERSISTENT
+-INSERT INTO t1 (a) VALUES (1),(2);
+-INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
+-Warnings:
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+-SELECT a,b FROM t1;
+-a b
+-1 2
+-2 3
+-3 4
+-4 5
+-DROP TABLE t1;
++ERROR HY000: MRG_MYISAM storage engine does not support computed columns
++# ERROR: Statement ended with errno 1910, errname ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS (expected to succeed)
++# ------------ UNEXPECTED RESULT ------------
++# [ CREATE TABLE t1 (a INT(11) /*!*/ /*Custom column options*/, b INT(11) /*!*/ /*Custom column options*/ GENERATED ALWAYS AS (a+1)) ENGINE=MRG_MYISAM /*!*/ /*Custom table options*/ UNION(mrg.t1) INSERT_METHOD=LAST ]
++# The statement|command finished with ER_UNSUPPORTED_ENGINE_FOR_VIRTUAL_COLUMNS.
++# Virtual columns or the mix could be unsupported|malfunctioning, or the problem was caused by previous errors.
++# You can change the engine code, or create an rdiff, or disable the test by adding it to disabled.def.
++# Further in this test, the message might sometimes be suppressed; a part of the test might be skipped.
++# Also, this problem may cause a chain effect (more errors of different kinds in the test).
++# -------------------------------------------
diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt
index 83acb99b2a2..593fced6235 100644
--- a/storage/oqgraph/CMakeLists.txt
+++ b/storage/oqgraph/CMakeLists.txt
@@ -3,6 +3,7 @@ IF(NOT Boost_FOUND)
RETURN()
ENDIF()
INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
+SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Boost_INCLUDE_DIRS})
IF(MSVC)
# lp:756966 OQGRAPH on Win64 does not compile
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index ffbe00a1caf..b4292f33066 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -58,10 +58,7 @@ static HASH oqgraph_open_tables;
static mysql_mutex_t LOCK_oqgraph;
static bool oqgraph_init_done= 0;
-#define HASH_KEY_LENGTH size_t
-
-static uchar* get_key(const uchar *ptr, HASH_KEY_LENGTH *length,
- my_bool)
+static uchar* get_key(const uchar *ptr, size_t *length, my_bool)
{
const OQGRAPH_INFO *share= (const OQGRAPH_INFO*) ptr;
*length= strlen(share->name);
@@ -83,7 +80,6 @@ static void init_psi_keys()
#define init_psi_keys() /* no-op */
#endif /* HAVE_PSI_INTERFACE */
-
static handler* oqgraph_create_handler(handlerton *hton, TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
@@ -292,16 +288,6 @@ ha_oqgraph::ha_oqgraph(handlerton *hton, TABLE_SHARE *table_arg)
{ }
-static const char *ha_oqgraph_exts[] =
-{
- NullS
-};
-
-const char **ha_oqgraph::bas_ext() const
-{
- return ha_oqgraph_exts;
-}
-
ulonglong ha_oqgraph::table_flags() const
{
return (HA_NO_BLOBS | HA_NULL_IN_KEY |
diff --git a/storage/oqgraph/ha_oqgraph.h b/storage/oqgraph/ha_oqgraph.h
index ee88e38c526..9f55fb233d8 100644
--- a/storage/oqgraph/ha_oqgraph.h
+++ b/storage/oqgraph/ha_oqgraph.h
@@ -68,7 +68,6 @@ public:
}
/* Rows also use a fixed-size format */
enum row_type get_row_type() const { return ROW_TYPE_FIXED; }
- const char **bas_ext() const;
ulong index_flags(uint inx, uint part, bool all_parts) const;
uint max_supported_keys() const { return MAX_KEY; }
uint max_supported_key_part_length() const { return MAX_KEY_LENGTH; }
diff --git a/storage/pbxt/src/discover_xt.cc b/storage/pbxt/src/discover_xt.cc
index 05891bdf19d..23941374fb1 100644
--- a/storage/pbxt/src/discover_xt.cc
+++ b/storage/pbxt/src/discover_xt.cc
@@ -1196,7 +1196,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
else if (length == 0)
{
- my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name);
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0), file->table_type(),
+ column->field_name);
DBUG_RETURN(TRUE);
}
if (length > file->max_key_part_length() && key->type != Key::FULLTEXT)
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index 773d822af2b..c6c967ceb9d 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -217,15 +217,6 @@ ha_perfschema::ha_perfschema(handlerton *hton, TABLE_SHARE *share)
ha_perfschema::~ha_perfschema()
{}
-static const char *ha_pfs_exts[]= {
- NullS
-};
-
-const char **ha_perfschema::bas_ext() const
-{
- return ha_pfs_exts;
-}
-
int ha_perfschema::open(const char *name, int mode, uint test_if_locked)
{
DBUG_ENTER("ha_perfschema::open");
diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h
index dc465da3758..e088c79b26f 100644
--- a/storage/perfschema/ha_perfschema.h
+++ b/storage/perfschema/ha_perfschema.h
@@ -46,8 +46,6 @@ public:
const char *index_type(uint) { return ""; }
- const char **bas_ext(void) const;
-
/** Capabilities of the performance schema tables. */
ulonglong table_flags(void) const
{
diff --git a/storage/sequence/CMakeLists.txt b/storage/sequence/CMakeLists.txt
new file mode 100644
index 00000000000..9a68901520c
--- /dev/null
+++ b/storage/sequence/CMakeLists.txt
@@ -0,0 +1 @@
+MYSQL_ADD_PLUGIN(sequence sequence.cc STORAGE_ENGINE)
diff --git a/storage/sequence/mysql-test/sequence/inc.inc b/storage/sequence/mysql-test/sequence/inc.inc
new file mode 100644
index 00000000000..702e90b2890
--- /dev/null
+++ b/storage/sequence/mysql-test/sequence/inc.inc
@@ -0,0 +1,4 @@
+if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'sequence' AND support='YES'`)
+{
+ --skip Test requires sequence engine
+}
diff --git a/storage/sequence/mysql-test/sequence/inc.opt b/storage/sequence/mysql-test/sequence/inc.opt
new file mode 100644
index 00000000000..5b96925ff59
--- /dev/null
+++ b/storage/sequence/mysql-test/sequence/inc.opt
@@ -0,0 +1,2 @@
+--plugin-load=$HA_SEQUENCE_SO
+--loose-sequence
diff --git a/storage/sequence/mysql-test/sequence/simple.result b/storage/sequence/mysql-test/sequence/simple.result
new file mode 100644
index 00000000000..b14fde2cfef
--- /dev/null
+++ b/storage/sequence/mysql-test/sequence/simple.result
@@ -0,0 +1,270 @@
+select * from information_schema.engines where engine='sequence';
+ENGINE SEQUENCE
+SUPPORT YES
+COMMENT Generated tables filled with sequential values
+TRANSACTIONS YES
+XA YES
+SAVEPOINTS YES
+set sql_quote_show_create=0;
+show create table seq_1_to_15_step_2;
+Table Create Table
+seq_1_to_15_step_2 CREATE TABLE seq_1_to_15_step_2 (
+ seq bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (seq)
+) ENGINE=SEQUENCE DEFAULT CHARSET=latin1
+show create table seq_1_to_15_step;
+ERROR 42S02: Table 'test.seq_1_to_15_step' doesn't exist
+show create table seq_1_to_15_st;
+ERROR 42S02: Table 'test.seq_1_to_15_st' doesn't exist
+show create table seq_1_to_15;
+Table Create Table
+seq_1_to_15 CREATE TABLE seq_1_to_15 (
+ seq bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (seq)
+) ENGINE=SEQUENCE DEFAULT CHARSET=latin1
+show create table seq_1_to_1;
+Table Create Table
+seq_1_to_1 CREATE TABLE seq_1_to_1 (
+ seq bigint(20) unsigned NOT NULL,
+ PRIMARY KEY (seq)
+) ENGINE=SEQUENCE DEFAULT CHARSET=latin1
+show create table seq_1_to_;
+ERROR 42S02: Table 'test.seq_1_to_' doesn't exist
+show create table seq_1_t;
+ERROR 42S02: Table 'test.seq_1_t' doesn't exist
+show create table seq_1;
+ERROR 42S02: Table 'test.seq_1' doesn't exist
+show create table seq_;
+ERROR 42S02: Table 'test.seq_' doesn't exist
+show create table se;
+ERROR 42S02: Table 'test.se' doesn't exist
+show create table seq_1_to_15_step_0;
+ERROR HY000: Got error 140 "Wrong create options" from storage engine SEQUENCE
+select * from seq_1_to_15_step_2;
+seq
+1
+3
+5
+7
+9
+11
+13
+15
+select * from seq_1_to_15;
+seq
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+select * from seq_1_to_1;
+seq
+1
+select * from seq_15_to_1;
+seq
+15
+14
+13
+12
+11
+10
+9
+8
+7
+6
+5
+4
+3
+2
+1
+select * from seq_15_to_1_step_2;
+seq
+15
+13
+11
+9
+7
+5
+3
+1
+select * from seq_1_to_15_step_12345;
+seq
+1
+select * from seq_15_to_1_step_12345;
+seq
+15
+explain select * from seq_15_to_1_step_12345;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE seq_15_to_1_step_12345 ALL NULL NULL NULL NULL 1
+show open tables from test;
+Database Table In_use Name_locked
+test seq_15_to_1 0 0
+test seq_15_to_1_step_12345 0 0
+test seq_15_to_1_step_2 0 0
+test seq_1_to_1 0 0
+test seq_1_to_15 0 0
+test seq_1_to_15_step_12345 0 0
+test seq_1_to_15_step_2 0 0
+show tables;
+Tables_in_test
+explain select * from seq_1_to_15_step_2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE seq_1_to_15_step_2 index NULL PRIMARY 8 NULL 8 Using index
+explain select * from seq_1_to_15_step_2 where seq > 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE seq_1_to_15_step_2 range PRIMARY PRIMARY 8 NULL 6 Using where; Using index
+explain select * from seq_1_to_15_step_2 where seq between 4 and 9;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE seq_1_to_15_step_2 range PRIMARY PRIMARY 8 NULL 3 Using where; Using index
+explain select * from seq_1_to_15_step_2 where seq between 20 and 30;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain select * from seq_1_to_15_step_2 where seq between 4 and 6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE seq_1_to_15_step_2 range PRIMARY PRIMARY 8 NULL 1 Using where; Using index
+explain select * from seq_1_to_15_step_2 where seq between 4 and 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE seq_1_to_15_step_2 range PRIMARY PRIMARY 8 NULL 1 Using where; Using index
+explain select * from seq_1_to_15_step_2 where seq between 4 and 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+explain select * from seq_1_to_15_step_2 where seq between 5 and 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE seq_1_to_15_step_2 const PRIMARY PRIMARY 8 const 1 Using index
+create table t1 (a int, aa int, b varchar(100));
+insert t1 select seq, seq*seq, if (seq % 2, 'odd', 'even') from seq_1_to_20;
+select * from t1;
+a aa b
+1 1 odd
+2 4 even
+3 9 odd
+4 16 even
+5 25 odd
+6 36 even
+7 49 odd
+8 64 even
+9 81 odd
+10 100 even
+11 121 odd
+12 144 even
+13 169 odd
+14 196 even
+15 225 odd
+16 256 even
+17 289 odd
+18 324 even
+19 361 odd
+20 400 even
+select aa, b from t1, seq_1_to_20_step_3 as seq where a=seq;
+aa b
+1 odd
+16 even
+49 odd
+100 even
+169 odd
+256 even
+361 odd
+insert t1
+select seq, seq*seq, if (seq % 2, 'odd', 'even') from seq_1_to_30
+where seq > (select max(a) from t1);
+select * from t1;
+a aa b
+1 1 odd
+2 4 even
+3 9 odd
+4 16 even
+5 25 odd
+6 36 even
+7 49 odd
+8 64 even
+9 81 odd
+10 100 even
+11 121 odd
+12 144 even
+13 169 odd
+14 196 even
+15 225 odd
+16 256 even
+17 289 odd
+18 324 even
+19 361 odd
+20 400 even
+21 441 odd
+22 484 even
+23 529 odd
+24 576 even
+25 625 odd
+26 676 even
+27 729 odd
+28 784 even
+29 841 odd
+30 900 even
+drop table t1;
+select seq from seq_2_to_50 s1 where 0 not in
+(select s1.seq % s2.seq from seq_2_to_50 s2 where s2.seq <= sqrt(s1.seq));
+seq
+2
+3
+5
+7
+11
+13
+17
+19
+23
+29
+31
+37
+41
+43
+47
+explain select seq from seq_2_to_50 s1 where 0 not in
+(select s1.seq % s2.seq from seq_2_to_50 s2 where s2.seq <= sqrt(s1.seq));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY s1 index NULL PRIMARY 8 NULL 49 Using where; Using index
+2 DEPENDENT SUBQUERY s2 index PRIMARY PRIMARY 8 NULL 49 Using where; Using index
+select year(dt) from
+(select '1901-02-28' + interval seq year as dt from seq_0_to_99) as seqdt
+where weekday(dt) = 0;
+year(dt)
+1910
+1916
+1921
+1927
+1938
+1944
+1949
+1955
+1966
+1972
+1977
+1983
+1994
+2000
+create table t1 (a int) engine=innodb;
+reset master;
+start transaction;
+insert t1 select * from seq_1_to_10;
+savepoint s1;
+insert t1 select * from seq_11_to_20;
+rollback to savepoint s1;
+commit;
+select count(*) from t1;
+count(*)
+10
+show binlog events limit 2,10;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 286 Query 1 354 BEGIN
+master-bin.000001 354 Query 1 452 use test; insert t1 select * from seq_1_to_10
+master-bin.000001 452 Xid 1 479 COMMIT /* xid */
+drop table t1;
diff --git a/storage/sequence/mysql-test/sequence/simple.test b/storage/sequence/mysql-test/sequence/simple.test
new file mode 100644
index 00000000000..9559e42fafd
--- /dev/null
+++ b/storage/sequence/mysql-test/sequence/simple.test
@@ -0,0 +1,93 @@
+--source inc.inc
+--source include/have_xtradb.inc
+--source include/have_binlog_format_statement.inc
+
+--query_vertical select * from information_schema.engines where engine='sequence'
+
+set sql_quote_show_create=0;
+
+show create table seq_1_to_15_step_2;
+--error ER_NO_SUCH_TABLE
+show create table seq_1_to_15_step;
+--error ER_NO_SUCH_TABLE
+show create table seq_1_to_15_st;
+show create table seq_1_to_15;
+show create table seq_1_to_1;
+--error ER_NO_SUCH_TABLE
+show create table seq_1_to_;
+--error ER_NO_SUCH_TABLE
+show create table seq_1_t;
+--error ER_NO_SUCH_TABLE
+show create table seq_1;
+--error ER_NO_SUCH_TABLE
+show create table seq_;
+--error ER_NO_SUCH_TABLE
+show create table se;
+--error ER_GET_ERRNO
+show create table seq_1_to_15_step_0;
+
+# simple select
+select * from seq_1_to_15_step_2;
+select * from seq_1_to_15;
+select * from seq_1_to_1;
+# backwards
+select * from seq_15_to_1;
+select * from seq_15_to_1_step_2;
+
+# step > |to - from|
+select * from seq_1_to_15_step_12345;
+select * from seq_15_to_1_step_12345;
+explain select * from seq_15_to_1_step_12345;
+
+--sorted_result
+show open tables from test;
+show tables;
+# row estimates
+explain select * from seq_1_to_15_step_2;
+explain select * from seq_1_to_15_step_2 where seq > 4;
+explain select * from seq_1_to_15_step_2 where seq between 4 and 9;
+explain select * from seq_1_to_15_step_2 where seq between 20 and 30;
+explain select * from seq_1_to_15_step_2 where seq between 4 and 6;
+explain select * from seq_1_to_15_step_2 where seq between 4 and 5;
+explain select * from seq_1_to_15_step_2 where seq between 4 and 4;
+explain select * from seq_1_to_15_step_2 where seq between 5 and 5;
+
+# join
+create table t1 (a int, aa int, b varchar(100));
+insert t1 select seq, seq*seq, if (seq % 2, 'odd', 'even') from seq_1_to_20;
+select * from t1;
+select aa, b from t1, seq_1_to_20_step_3 as seq where a=seq;
+# adding more rows, example
+insert t1
+ select seq, seq*seq, if (seq % 2, 'odd', 'even') from seq_1_to_30
+ where seq > (select max(a) from t1);
+select * from t1;
+drop table t1;
+
+# Prime Numbers from 2 to 50 :)
+select seq from seq_2_to_50 s1 where 0 not in
+ (select s1.seq % s2.seq from seq_2_to_50 s2 where s2.seq <= sqrt(s1.seq));
+explain select seq from seq_2_to_50 s1 where 0 not in
+ (select s1.seq % s2.seq from seq_2_to_50 s2 where s2.seq <= sqrt(s1.seq));
+
+# Years of XX-th century where 28th of February was Monday
+select year(dt) from
+ (select '1901-02-28' + interval seq year as dt from seq_0_to_99) as seqdt
+ where weekday(dt) = 0;
+
+# transactions and XA
+create table t1 (a int) engine=innodb;
+reset master;
+start transaction;
+# No warning about "accesses nontransactional table"
+insert t1 select * from seq_1_to_10;
+savepoint s1;
+insert t1 select * from seq_11_to_20;
+rollback to savepoint s1;
+commit;
+select count(*) from t1;
+# must show Xid event
+--replace_regex /xid=[0-9]+/xid/
+show binlog events limit 2,10;
+drop table t1;
+
diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc
new file mode 100644
index 00000000000..2349f7aae63
--- /dev/null
+++ b/storage/sequence/sequence.cc
@@ -0,0 +1,343 @@
+/*
+ Copyright (c) 2013 Monty Program Ab
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; version 2 of
+ the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+/*
+ a engine that auto-creates tables with rows filled with sequential values
+*/
+
+#include <mysql_version.h>
+#include <handler.h>
+#include <table.h>
+#include <field.h>
+
+typedef struct st_share {
+ const char *name;
+ THR_LOCK lock;
+ uint use_count;
+ struct st_share *next;
+
+ ulonglong from, to, step;
+ bool reverse;
+} SHARE;
+
+class ha_seq: public handler
+{
+private:
+ THR_LOCK_DATA lock;
+ SHARE *seqs;
+ ulonglong cur;
+
+public:
+ ha_seq(handlerton *hton, TABLE_SHARE *table_arg)
+ : handler(hton, table_arg), seqs(0) { }
+ ulonglong table_flags() const { return 0; }
+
+ /* open/close/locking */
+ int create(const char *name, TABLE *table_arg,
+ HA_CREATE_INFO *create_info) { return HA_ERR_WRONG_COMMAND; }
+
+ int open(const char *name, int mode, uint test_if_locked);
+ int close(void);
+ THR_LOCK_DATA **store_lock(THD *, THR_LOCK_DATA **, enum thr_lock_type);
+
+ /* table scan */
+ int rnd_init(bool scan);
+ int rnd_next(unsigned char *buf);
+ void position(const uchar *record);
+ int rnd_pos(uchar *buf, uchar *pos);
+ int info(uint flag);
+
+ /* indexes */
+ ulong index_flags(uint inx, uint part, bool all_parts) const
+ { return HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER |
+ HA_READ_RANGE | HA_KEYREAD_ONLY; }
+ uint max_supported_keys() const { return 1; }
+ int index_read_map(uchar *buf, const uchar *key, key_part_map keypart_map,
+ enum ha_rkey_function find_flag);
+ int index_next(uchar *buf);
+ int index_prev(uchar *buf);
+ int index_first(uchar *buf);
+ int index_last(uchar *buf);
+ ha_rows records_in_range(uint inx, key_range *min_key,
+ key_range *max_key);
+
+ double scan_time() { return nvalues(); }
+ double read_time(uint index, uint ranges, ha_rows rows) { return rows; }
+ double keyread_time(uint index, uint ranges, ha_rows rows) { return rows; }
+
+private:
+ void set(uchar *buf);
+ ulonglong nvalues() { return (seqs->to - seqs->from)/seqs->step; }
+};
+
+THR_LOCK_DATA **ha_seq::store_lock(THD *thd, THR_LOCK_DATA **to,
+ enum thr_lock_type lock_type)
+{
+ if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
+ lock.type= TL_WRITE_ALLOW_WRITE;
+ *to ++= &lock;
+ return to;
+}
+
+void ha_seq::set(unsigned char *buf)
+{
+ my_bitmap_map *old_map = dbug_tmp_use_all_columns(table, table->write_set);
+ my_ptrdiff_t offset = (my_ptrdiff_t) (buf - table->record[0]);
+ Field *field = table->field[0];
+ field->move_field_offset(offset);
+ field->store(cur, true);
+ field->move_field_offset(-offset);
+ dbug_tmp_restore_column_map(table->write_set, old_map);
+}
+
+int ha_seq::rnd_init(bool scan)
+{
+ cur= seqs->reverse ? seqs->to : seqs->from;
+ return 0;
+}
+
+int ha_seq::rnd_next(unsigned char *buf)
+{
+ if (seqs->reverse)
+ return index_prev(buf);
+ else
+ return index_next(buf);
+}
+
+void ha_seq::position(const uchar *record)
+{
+ *(ulonglong*)ref= cur;
+}
+
+int ha_seq::rnd_pos(uchar *buf, uchar *pos)
+{
+ cur= *(ulonglong*)pos;
+ return rnd_next(buf);
+}
+
+int ha_seq::info(uint flag)
+{
+ if (flag & HA_STATUS_VARIABLE)
+ stats.records = nvalues();
+ return 0;
+}
+
+int ha_seq::index_read_map(uchar *buf, const uchar *key_arg,
+ key_part_map keypart_map,
+ enum ha_rkey_function find_flag)
+{
+ ulonglong key= uint8korr(key_arg);
+ switch (find_flag) {
+ case HA_READ_AFTER_KEY:
+ key++;
+ // fall through
+ case HA_READ_KEY_OR_NEXT:
+ if (key <= seqs->from)
+ cur= seqs->from;
+ else
+ {
+ cur= (key - seqs->from + seqs->step - 1) / seqs->step * seqs->step + seqs->from;
+ if (cur >= seqs->to)
+ return HA_ERR_KEY_NOT_FOUND;
+ }
+ return index_next(buf);
+
+ case HA_READ_KEY_EXACT:
+ if ((key - seqs->from) % seqs->step != 0 || key < seqs->from || key >= seqs->to)
+ return HA_ERR_KEY_NOT_FOUND;
+ cur= key;
+ return index_next(buf);
+
+ case HA_READ_BEFORE_KEY:
+ key--;
+ // fall through
+ case HA_READ_PREFIX_LAST_OR_PREV:
+ if (key >= seqs->to)
+ cur= seqs->to;
+ else
+ {
+ if (key < seqs->from)
+ return HA_ERR_KEY_NOT_FOUND;
+ cur= (key - seqs->from) / seqs->step * seqs->step + seqs->from;
+ }
+ return index_prev(buf);
+ default: return HA_ERR_WRONG_COMMAND;
+ }
+}
+
+
+int ha_seq::index_next(uchar *buf)
+{
+ if (cur == seqs->to)
+ return HA_ERR_END_OF_FILE;
+ set(buf);
+ cur+= seqs->step;
+ return 0;
+}
+
+
+int ha_seq::index_prev(uchar *buf)
+{
+ if (cur == seqs->from)
+ return HA_ERR_END_OF_FILE;
+ cur-= seqs->step;
+ set(buf);
+ return 0;
+}
+
+
+int ha_seq::index_first(uchar *buf)
+{
+ cur= seqs->from;
+ return index_next(buf);
+}
+
+
+int ha_seq::index_last(uchar *buf)
+{
+ cur= seqs->to;
+ return index_prev(buf);
+}
+
+ha_rows ha_seq::records_in_range(uint inx, key_range *min_key,
+ key_range *max_key)
+{
+ ulonglong kmin= min_key ? uint8korr(min_key->key) : seqs->from;
+ ulonglong kmax= max_key ? uint8korr(max_key->key) : seqs->to - 1;
+ if (kmin >= seqs->to || kmax < seqs->from || kmin > kmax)
+ return 0;
+ return (kmax - seqs->from) / seqs->step -
+ (kmin - seqs->from + seqs->step - 1) / seqs->step + 1;
+}
+
+
+int ha_seq::open(const char *name, int mode, uint test_if_locked)
+{
+ mysql_mutex_lock(&table->s->LOCK_ha_data);
+ seqs= (SHARE*)table->s->ha_data;
+ DBUG_ASSERT(my_strcasecmp(table_alias_charset, name, seqs->name) == 0);
+ if (seqs->use_count++ == 0)
+ thr_lock_init(&seqs->lock);
+ mysql_mutex_unlock(&table->s->LOCK_ha_data);
+
+ ref_length= sizeof(cur);
+ thr_lock_data_init(&seqs->lock,&lock,NULL);
+ return 0;
+}
+
+int ha_seq::close(void)
+{
+ mysql_mutex_lock(&table->s->LOCK_ha_data);
+ if (--seqs->use_count == 0)
+ thr_lock_delete(&seqs->lock);
+ mysql_mutex_unlock(&table->s->LOCK_ha_data);
+ return 0;
+}
+
+static handler *create_handler(handlerton *hton, TABLE_SHARE *table,
+ MEM_ROOT *mem_root)
+{
+ return new (mem_root) ha_seq(hton, table);
+}
+
+static int discover_table(handlerton *hton, THD *thd, TABLE_SHARE *share)
+{
+ // the table is discovered if it has the pattern of seq_1_to_10 or
+ // seq_1_to_10_step_3
+ ulonglong from, to, step= 1;
+ uint n1= 0, n2= 0;
+ bool reverse;
+ sscanf(share->table_name.str, "seq_%llu_to_%llu%n_step_%llu%n",
+ &from, &to, &n1, &step, &n2);
+ if (n1 != share->table_name.length && n2 != share->table_name.length)
+ return HA_ERR_NO_SUCH_TABLE;
+
+ if (step == 0)
+ return HA_WRONG_CREATE_OPTION;
+
+ const char *sql="create table seq (seq bigint unsigned primary key)";
+ int res= share->init_from_sql_statement_string(thd, 0, sql, strlen(sql));
+ if (res)
+ return res;
+
+ if ((reverse = from > to))
+ {
+ if (step > from - to)
+ to = from;
+ else
+ swap_variables(ulonglong, from, to);
+ /*
+ when keyread is allowed, optimizer will always prefer an index to a
+ table scan for our tables, and we'll never see the range reversed.
+ */
+ share->keys_for_keyread.clear_all();
+ }
+
+ to= (to - from) / step * step + step + from;
+
+ SHARE *seqs= (SHARE*)alloc_root(&share->mem_root, sizeof(*seqs));
+ bzero(seqs, sizeof(*seqs));
+ seqs->name = share->normalized_path.str;
+ seqs->from= from;
+ seqs->to= to;
+ seqs->step= step;
+ seqs->reverse= reverse;
+
+ share->ha_data = seqs;
+ return 0;
+}
+
+
+static int dummy_ret_int() { return 0; }
+
+static int init(void *p)
+{
+ handlerton *hton = (handlerton *)p;
+ hton->create = create_handler;
+ hton->discover_table = discover_table;
+ hton->discover_table_existence =
+ (int (*)(handlerton *, const char *, const char *)) &dummy_ret_int;
+ hton->commit= hton->rollback= hton->prepare=
+ (int (*)(handlerton *, THD *, bool)) &dummy_ret_int;
+ hton->savepoint_set= hton->savepoint_rollback= hton->savepoint_release=
+ (int (*)(handlerton *, THD *, void *)) &dummy_ret_int;
+
+ return 0;
+}
+
+static struct st_mysql_storage_engine descriptor =
+{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+
+maria_declare_plugin(sequence)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &descriptor,
+ "SEQUENCE",
+ "Sergei Golubchik",
+ "Generated tables filled with sequential values",
+ PLUGIN_LICENSE_GPL,
+ init,
+ NULL,
+ 0x0100,
+ NULL,
+ NULL,
+ "0.1",
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
+}
+maria_declare_plugin_end;
+
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 3305875c124..23bf21b6cbe 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -1285,7 +1285,7 @@ CSphSEQuery::~CSphSEQuery ()
SafeDeleteArray ( m_sQueryBuffer );
SafeDeleteArray ( m_pWeights );
SafeDeleteArray ( m_pBuf );
- for ( int i=0; i<m_dOverrides.elements(); i++ )
+ for ( size_t i=0; i<m_dOverrides.elements(); i++ )
SafeDelete ( m_dOverrides.at(i) );
SPH_VOID_RET();
}
@@ -1865,7 +1865,7 @@ int CSphSEQuery::BuildRequest ( char ** ppBuffer )
iReqSize += 8 + strlen(m_sFieldWeight[i] );
// overrides
iReqSize += 4;
- for ( int i=0; i<m_dOverrides.elements(); i++ )
+ for ( size_t i=0; i<m_dOverrides.elements(); i++ )
{
CSphSEQuery::Override_t * pOverride = m_dOverrides.at(i);
const uint32 uSize = pOverride->m_iType==SPH_ATTR_BIGINT ? 16 : 12; // id64 + value
@@ -1972,13 +1972,13 @@ int CSphSEQuery::BuildRequest ( char ** ppBuffer )
// overrides
SendInt ( m_dOverrides.elements() );
- for ( int i=0; i<m_dOverrides.elements(); i++ )
+ for ( size_t i=0; i<m_dOverrides.elements(); i++ )
{
CSphSEQuery::Override_t * pOverride = m_dOverrides.at(i);
SendString ( pOverride->m_sName );
SendDword ( pOverride->m_iType );
SendInt ( pOverride->m_dIds.elements() );
- for ( int j=0; j<pOverride->m_dIds.elements(); j++ )
+ for ( size_t j=0; j<pOverride->m_dIds.elements(); j++ )
{
SendUint64 ( pOverride->m_dIds.at(j) );
if ( pOverride->m_iType==SPH_ATTR_FLOAT )
@@ -2005,9 +2005,6 @@ int CSphSEQuery::BuildRequest ( char ** ppBuffer )
// SPHINX HANDLER
//////////////////////////////////////////////////////////////////////////////
-static const char * ha_sphinx_exts[] = { NullS };
-
-
#if MYSQL_VERSION_ID<50100
ha_sphinx::ha_sphinx ( TABLE_ARG * table )
: handler ( &sphinx_hton, table )
@@ -2047,16 +2044,6 @@ ha_sphinx::~ha_sphinx()
}
}
-
-// If frm_error() is called then we will use this to to find out what file extentions
-// exist for the storage engine. This is also used by the default rename_table and
-// delete_table method in handler.cc.
-const char ** ha_sphinx::bas_ext() const
-{
- return ha_sphinx_exts;
-}
-
-
// Used for opening tables. The name will be the name of the file.
// A table is opened when it needs to be opened. For instance
// when a request comes in for a select on the table (tables are not
@@ -3437,7 +3424,8 @@ int ha_sphinx::create ( const char * name, TABLE * table, HA_CREATE_INFO * )
// report and bail
if ( sError[0] )
{
- my_error ( ER_CANT_CREATE_TABLE, MYF(0), sError, -1 );
+ my_error ( ER_CANT_CREATE_TABLE, MYF(0),
+ table->s->db.str, table->s->table_name, sError );
SPH_RET(-1);
}
diff --git a/storage/sphinx/ha_sphinx.h b/storage/sphinx/ha_sphinx.h
index f2aa726791b..f650e1641da 100644
--- a/storage/sphinx/ha_sphinx.h
+++ b/storage/sphinx/ha_sphinx.h
@@ -57,7 +57,6 @@ public:
const char * table_type () const { return "SPHINX"; } ///< SE name for display purposes
const char * index_type ( uint ) { return "HASH"; } ///< index type name for display purposes
- const char ** bas_ext () const; ///< my file extensions
#if MYSQL_VERSION_ID>50100
ulonglong table_flags () const { return HA_CAN_INDEX_BLOBS |
diff --git a/storage/test_sql_discovery/CMakeLists.txt b/storage/test_sql_discovery/CMakeLists.txt
new file mode 100644
index 00000000000..2039b08123c
--- /dev/null
+++ b/storage/test_sql_discovery/CMakeLists.txt
@@ -0,0 +1,2 @@
+MYSQL_ADD_PLUGIN(test_sql_discovery test_sql_discovery.cc STORAGE_ENGINE
+ COMPONENT Test)
diff --git a/storage/test_sql_discovery/mysql-test/archive/discover.rdiff b/storage/test_sql_discovery/mysql-test/archive/discover.rdiff
new file mode 100644
index 00000000000..3148999079f
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/archive/discover.rdiff
@@ -0,0 +1,35 @@
+--- suite/archive/discover.result 2013-04-08 00:06:37.000000000 +0200
++++ /usr/home/serg/Abk/mysql/10.0-serg/storage/test_sql_discovery/mysql-test/archive/discover.reject 2013-04-08 00:07:02.000000000 +0200
+@@ -42,6 +42,7 @@
+ t1 BASE TABLE
+ t2 BASE TABLE
+ t1.ARZ
++t1.frm
+ t2.ARZ
+ t2.frm
+ #
+@@ -60,6 +61,7 @@
+ flush tables;
+ rename table t2 to t0;
+ t0.ARZ
++t0.frm
+ t1.ARZ
+ t1.frm
+ #
+@@ -77,6 +79,7 @@
+ flush tables;
+ drop table t1;
+ t0.ARZ
++t0.frm
+ #
+ # discover of table non-existance on drop
+ #
+@@ -86,7 +89,7 @@
+ drop table t0;
+ show status like 'Handler_discover';
+ Variable_name Value
+-Handler_discover 7
++Handler_discover 8
+ #
+ # Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
+ #
diff --git a/storage/test_sql_discovery/mysql-test/archive/discover.test b/storage/test_sql_discovery/mysql-test/archive/discover.test
new file mode 100644
index 00000000000..6d7414280c5
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/archive/discover.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source discover.test
diff --git a/storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff b/storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff
new file mode 100644
index 00000000000..b9288d70f4b
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/r/plugin.rdiff
@@ -0,0 +1,11 @@
+--- r/plugin.result 2013-02-21 19:46:59.000000000 +0100
++++ r/plugin.reject 2013-02-27 11:13:22.000000000 +0100
+@@ -71,6 +71,8 @@
+ SELECT * FROM t2;
+ ERROR 42000: Unknown storage engine 'EXAMPLE'
+ DROP TABLE t2;
++Warnings:
++Error 1286 Unknown storage engine 'EXAMPLE'
+ UNINSTALL PLUGIN EXAMPLE;
+ ERROR 42000: PLUGIN EXAMPLE does not exist
+ UNINSTALL PLUGIN non_exist;
diff --git a/storage/test_sql_discovery/mysql-test/main/t/create.test b/storage/test_sql_discovery/mysql-test/main/t/create.test
new file mode 100644
index 00000000000..4b3dd16c0a2
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/create.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source create.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/drop.test b/storage/test_sql_discovery/mysql-test/main/t/drop.test
new file mode 100644
index 00000000000..2b3f864ec6b
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/drop.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source drop.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test b/storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test
new file mode 100644
index 00000000000..9c052839d93
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/mdl_sync.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source mdl_sync.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test b/storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test
new file mode 100644
index 00000000000..7fccc33fdbd
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/partition_disabled.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source partition_disabled.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/plugin.test b/storage/test_sql_discovery/mysql-test/main/t/plugin.test
new file mode 100644
index 00000000000..52315af0645
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/plugin.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source plugin.test
diff --git a/storage/test_sql_discovery/mysql-test/main/t/rename.test b/storage/test_sql_discovery/mysql-test/main/t/rename.test
new file mode 100644
index 00000000000..ba645131401
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/main/t/rename.test
@@ -0,0 +1,3 @@
+# run the normal test file with need_full_discover_for_existence>0
+--source ../sql_discovery/inc.inc
+--source rename.test
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc
new file mode 100644
index 00000000000..b13cbd7d12b
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.inc
@@ -0,0 +1,4 @@
+if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'test_sql_discovery' AND support='YES'`)
+{
+ --skip Test requires test_sql_discovery engine
+}
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt
new file mode 100644
index 00000000000..7d5c2404a50
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/inc.opt
@@ -0,0 +1,2 @@
+--plugin-load=$HA_TEST_SQL_DISCOVERY_SO
+--loose-test-sql-discovery
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result
new file mode 100644
index 00000000000..4fee0a983ed
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.result
@@ -0,0 +1,199 @@
+show variables like 'test_sql_discovery%';
+Variable_name Value
+test_sql_discovery_statement
+test_sql_discovery_write_frm ON
+set sql_quote_show_create=0;
+create table t1 (a int) engine=test_sql_discovery;
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by database")
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+set @@test_sql_discovery_statement='t1:foobar bwa-ha-ha';
+select * from t0;
+ERROR 42S02: Table 'test.t0' doesn't exist
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'foobar bwa-ha-ha' at line 1
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:select 1';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'select 1'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1290 The MariaDB server is running with the --skip-partition option so it cannot execute this statement
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) union=(t3,t4)'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 like t2';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 like t2'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 select * from t2';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 select * from t2'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) index directory="/tmp"';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) index directory="/tmp"'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) data directory="/tmp"';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) data directory="/tmp"'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=myisam';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table t1 (a int) engine=myisam'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create temporary table t1 (a int)';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create temporary table t1 (a int)'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table if not exists t1 (a int)';
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+show warnings;
+Level Code Message
+Error 1939 Engine TEST_SQL_DISCOVERY failed to discover table `test`.`t1` with 'create table if not exists t1 (a int)'
+Error 1146 Table 'test.t1' doesn't exist
+Error 1030 Got error 130 "Incorrect file format" from storage engine TEST_SQL_DISCOVERY
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+select * from t1;
+a
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ a int(11) DEFAULT NULL
+) ENGINE=TEST_SQL_DISCOVERY DEFAULT CHARSET=latin1
+drop table t1;
+set @@test_sql_discovery_statement='t1:create table t2 (a int)';
+select * from t1;
+a
+select * from t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+drop table t1;
+set @@test_sql_discovery_statement='t1:
+create table t1 (
+ a int not null default 5 primary key,
+ b timestamp,
+ c tinyblob,
+ d decimal(5,2),
+ e varchar(30) character set ascii,
+ f geometry not null,
+ index (d,b),
+ unique index (c(10)),
+ fulltext (e),
+ spatial (f)
+) comment="abc" default character set utf8 max_rows=100 min_rows=10 checksum=1';
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 13
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ a int(11) NOT NULL DEFAULT '5',
+ b timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ c tinyblob,
+ d decimal(5,2) DEFAULT NULL,
+ e varchar(30) CHARACTER SET ascii DEFAULT NULL,
+ f geometry NOT NULL,
+ PRIMARY KEY (a),
+ UNIQUE KEY c (c(10)),
+ KEY d (d,b),
+ SPATIAL KEY f (f),
+ FULLTEXT KEY e (e)
+) ENGINE=TEST_SQL_DISCOVERY DEFAULT CHARSET=utf8 MIN_ROWS=10 MAX_ROWS=100 CHECKSUM=1 COMMENT='abc'
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+----
+t1.frm
+----
+show open tables from test;
+Database Table In_use Name_locked
+test t1 0 0
+select * from t1;
+a b c d e f
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+flush tables;
+select * from t1;
+a b c d e f
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+drop table t1;
+set @@test_sql_discovery_write_frm=0;
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 14
+show create table t1;
+Table Create Table
+t1 CREATE TABLE t1 (
+ a int(11) DEFAULT NULL
+) ENGINE=TEST_SQL_DISCOVERY DEFAULT CHARSET=latin1
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 15
+----
+----
+show open tables from test;
+Database Table In_use Name_locked
+test t1 0 0
+select * from t1;
+a
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 15
+flush tables;
+select * from t1;
+a
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 16
+drop table t1;
+show status like 'handler_discover';
+Variable_name Value
+Handler_discover 16
diff --git a/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test
new file mode 100644
index 00000000000..4aa5ac2864e
--- /dev/null
+++ b/storage/test_sql_discovery/mysql-test/sql_discovery/simple.test
@@ -0,0 +1,133 @@
+--source inc.inc
+
+show variables like 'test_sql_discovery%';
+set sql_quote_show_create=0;
+let $mysqld_datadir= `select @@datadir`;
+
+--error ER_CANT_CREATE_TABLE
+create table t1 (a int) engine=test_sql_discovery;
+
+--error ER_NO_SUCH_TABLE
+select * from t1;
+
+set @@test_sql_discovery_statement='t1:foobar bwa-ha-ha';
+--error ER_NO_SUCH_TABLE
+select * from t0;
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+#
+# test different invalid discovering statements
+#
+
+set @@test_sql_discovery_statement='t1:select 1';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int primary key) partition by hash(id) partitions 2';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) union=(t3,t4)';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 like t2';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 select * from t2';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) index directory="/tmp"';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) data directory="/tmp"';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table t1 (a int) engine=myisam';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create temporary table t1 (a int)';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+set @@test_sql_discovery_statement='t1:create table if not exists t1 (a int)';
+--error ER_NO_SUCH_TABLE
+select * from t1;
+show warnings;
+
+#
+# this should work:
+#
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+select * from t1;
+show create table t1;
+drop table t1;
+
+# table name in the create table statement is ignored
+set @@test_sql_discovery_statement='t1:create table t2 (a int)';
+select * from t1;
+--error ER_NO_SUCH_TABLE
+select * from t2;
+drop table t1;
+
+# and something more complex
+set @@test_sql_discovery_statement='t1:
+create table t1 (
+ a int not null default 5 primary key,
+ b timestamp,
+ c tinyblob,
+ d decimal(5,2),
+ e varchar(30) character set ascii,
+ f geometry not null,
+ index (d,b),
+ unique index (c(10)),
+ fulltext (e),
+ spatial (f)
+) comment="abc" default character set utf8 max_rows=100 min_rows=10 checksum=1';
+show status like 'handler_discover';
+show create table t1;
+show status like 'handler_discover';
+--echo ----
+--list_files $mysqld_datadir/test t*
+--echo ----
+show open tables from test;
+select * from t1;
+show status like 'handler_discover';
+flush tables;
+select * from t1;
+show status like 'handler_discover';
+drop table t1;
+
+set @@test_sql_discovery_write_frm=0;
+set @@test_sql_discovery_statement='t1:create table t1 (a int)';
+show status like 'handler_discover';
+show create table t1;
+show status like 'handler_discover';
+--echo ----
+--list_files $mysqld_datadir/test t*
+--echo ----
+show open tables from test;
+select * from t1;
+show status like 'handler_discover';
+flush tables;
+select * from t1;
+show status like 'handler_discover';
+drop table t1;
+show status like 'handler_discover';
+
diff --git a/storage/test_sql_discovery/test_sql_discovery.cc b/storage/test_sql_discovery/test_sql_discovery.cc
new file mode 100644
index 00000000000..33438035b8d
--- /dev/null
+++ b/storage/test_sql_discovery/test_sql_discovery.cc
@@ -0,0 +1,175 @@
+/*
+ Copyright (c) 2013 Monty Program Ab
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; version 2 of
+ the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+/*
+ a really minimal engine to test table discovery via sql statements.
+ See the archive engine if you're interested in real-life usable engine that
+ uses discovery via frm shipping.
+*/
+
+#include <mysql_version.h>
+#include <handler.h>
+#include <table.h>
+
+static MYSQL_THDVAR_STR(statement, PLUGIN_VAR_MEMALLOC,
+ "The table name and the SQL statement to discover the next table",
+ NULL, NULL, 0);
+
+static MYSQL_THDVAR_BOOL(write_frm, 0,
+ "Whether to cache discovered table metadata in frm files",
+ NULL, NULL, TRUE);
+
+static struct st_mysql_sys_var *sysvars[] = {
+ MYSQL_SYSVAR(statement),
+ MYSQL_SYSVAR(write_frm),
+ NULL
+};
+
+typedef struct st_share {
+ const char *name;
+ THR_LOCK lock;
+ uint use_count;
+ struct st_share *next;
+} SHARE;
+
+class ha_tsd: public handler
+{
+private:
+ THR_LOCK_DATA lock;
+ SHARE *share;
+
+public:
+ ha_tsd(handlerton *hton, TABLE_SHARE *table_arg)
+ : handler(hton, table_arg) { }
+ ulonglong table_flags() const
+ { // NO_TRANSACTIONS and everything that affects CREATE TABLE
+ return HA_NO_TRANSACTIONS | HA_CAN_GEOMETRY | HA_NULL_IN_KEY |
+ HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_CAN_RTREEKEYS |
+ HA_CAN_FULLTEXT;
+ }
+
+ ulong index_flags(uint inx, uint part, bool all_parts) const { return 0; }
+
+ THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to,
+ enum thr_lock_type lock_type)
+ {
+ if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK)
+ lock.type = lock_type;
+ *to ++= &lock;
+ return to;
+ }
+
+ int rnd_init(bool scan) { return 0; }
+ int rnd_next(unsigned char *buf) { return HA_ERR_END_OF_FILE; }
+ void position(const uchar *record) { }
+ int rnd_pos(uchar *buf, uchar *pos) { return HA_ERR_END_OF_FILE; }
+ int info(uint flag) { return 0; }
+ uint max_supported_keys() const { return 16; }
+ int create(const char *name, TABLE *table_arg,
+ HA_CREATE_INFO *create_info) { return HA_ERR_WRONG_COMMAND; }
+
+ int open(const char *name, int mode, uint test_if_locked);
+ int close(void);
+};
+
+static SHARE *find_or_create_share(const char *table_name, TABLE *table)
+{
+ SHARE *share;
+ for (share = (SHARE*)table->s->ha_data; share; share = share->next)
+ if (my_strcasecmp(table_alias_charset, table_name, share->name) == 0)
+ return share;
+
+ share = (SHARE*)alloc_root(&table->s->mem_root, sizeof(*share));
+ bzero(share, sizeof(*share));
+ share->name = strdup_root(&table->s->mem_root, table_name);
+ share->next = (SHARE*)table->s->ha_data;
+ table->s->ha_data = share;
+ return share;
+}
+
+int ha_tsd::open(const char *name, int mode, uint test_if_locked)
+{
+ mysql_mutex_lock(&table->s->LOCK_ha_data);
+ share = find_or_create_share(name, table);
+ if (share->use_count++ == 0)
+ thr_lock_init(&share->lock);
+ mysql_mutex_unlock(&table->s->LOCK_ha_data);
+ thr_lock_data_init(&share->lock,&lock,NULL);
+
+ return 0;
+}
+
+int ha_tsd::close(void)
+{
+ mysql_mutex_lock(&table->s->LOCK_ha_data);
+ if (--share->use_count == 0)
+ thr_lock_delete(&share->lock);
+ mysql_mutex_unlock(&table->s->LOCK_ha_data);
+ return 0;
+}
+
+static handler *create_handler(handlerton *hton, TABLE_SHARE *table,
+ MEM_ROOT *mem_root)
+{
+ return new (mem_root) ha_tsd(hton, table);
+}
+
+static int discover_table(handlerton *hton, THD* thd, TABLE_SHARE *share)
+{
+ const char *sql= THDVAR(thd, statement);
+
+ // the table is discovered if sql starts from "table_name:"
+ if (!sql ||
+ strncmp(sql, share->table_name.str, share->table_name.length) ||
+ sql[share->table_name.length] != ':')
+ return HA_ERR_NO_SUCH_TABLE;
+
+ sql+= share->table_name.length + 1;
+ return share->init_from_sql_statement_string(thd, THDVAR(thd, write_frm),
+ sql, strlen(sql));
+}
+
+static int init(void *p)
+{
+ handlerton *hton = (handlerton *)p;
+ hton->create = create_handler;
+ hton->discover_table = discover_table;
+ return 0;
+}
+
+struct st_mysql_storage_engine descriptor =
+{ MYSQL_HANDLERTON_INTERFACE_VERSION };
+
+maria_declare_plugin(test_sql_discovery)
+{
+ MYSQL_STORAGE_ENGINE_PLUGIN,
+ &descriptor,
+ "TEST_SQL_DISCOVERY",
+ "Sergei Golubchik",
+ "Minimal engine to test table discovery via sql statements",
+ PLUGIN_LICENSE_GPL,
+ init,
+ NULL,
+ 0x0001,
+ NULL,
+ sysvars,
+ "0.1",
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
+}
+maria_declare_plugin_end;
+
diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c
index ed97fc5bd58..a3e57d632a0 100644
--- a/storage/xtradb/btr/btr0btr.c
+++ b/storage/xtradb/btr/btr0btr.c
@@ -1641,7 +1641,7 @@ btr_page_reorganize_low(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
btr_assert_not_corrupted(block, index);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
data_size1 = page_get_data_size(page);
max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
@@ -1760,7 +1760,7 @@ btr_page_reorganize_low(
func_exit:
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
#ifndef UNIV_HOTBACKUP
buf_block_free(temp_block);
@@ -1835,7 +1835,7 @@ btr_page_empty(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_zip == buf_block_get_page_zip(block));
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
btr_search_drop_page_hash_index(block);
@@ -1892,10 +1892,10 @@ btr_root_raise_and_insert(
root_block = btr_cur_get_block(cursor);
root_page_zip = buf_block_get_page_zip(root_block);
ut_ad(page_get_n_recs(root) > 0);
+ index = btr_cur_get_index(cursor);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!root_page_zip || page_zip_validate(root_page_zip, root));
+ ut_a(!root_page_zip || page_zip_validate(root_page_zip, root, index));
#endif /* UNIV_ZIP_DEBUG */
- index = btr_cur_get_index(cursor);
#ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) {
ulint space = dict_index_get_space(index);
@@ -2825,8 +2825,8 @@ insert_empty:
#ifdef UNIV_ZIP_DEBUG
if (UNIV_LIKELY_NULL(page_zip)) {
- ut_a(page_zip_validate(page_zip, page));
- ut_a(page_zip_validate(new_page_zip, new_page));
+ ut_a(page_zip_validate(page_zip, page, cursor->index));
+ ut_a(page_zip_validate(new_page_zip, new_page, cursor->index));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -2860,7 +2860,8 @@ insert_empty:
= buf_block_get_page_zip(insert_block);
ut_a(!insert_page_zip
- || page_zip_validate(insert_page_zip, insert_page));
+ || page_zip_validate(insert_page_zip, insert_page,
+ cursor->index));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -3140,6 +3141,8 @@ btr_lift_page_up(
buf_block_t* blocks[BTR_MAX_LEVELS];
ulint n_blocks; /*!< last used index in blocks[] */
ulint i;
+ ibool lift_father_up = FALSE;
+ buf_block_t* block_orig = block;
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
@@ -3150,11 +3153,13 @@ btr_lift_page_up(
{
btr_cur_t cursor;
- mem_heap_t* heap = mem_heap_create(100);
- ulint* offsets;
+ ulint* offsets = NULL;
+ mem_heap_t* heap = mem_heap_create(
+ sizeof(*offsets)
+ * (REC_OFFS_HEADER_SIZE + 1 + 1 + index->n_fields));
buf_block_t* b;
- offsets = btr_page_get_father_block(NULL, heap, index,
+ offsets = btr_page_get_father_block(offsets, heap, index,
block, mtr, &cursor);
father_block = btr_cur_get_block(&cursor);
father_page_zip = buf_block_get_page_zip(father_block);
@@ -3178,6 +3183,29 @@ btr_lift_page_up(
blocks[n_blocks++] = b = btr_cur_get_block(&cursor);
}
+ if (n_blocks && page_level == 0) {
+ /* The father page also should be the only on its level (not
+ root). We should lift up the father page at first.
+ Because the leaf page should be lifted up only for root page.
+ The freeing page is based on page_level (==0 or !=0)
+ to choose segment. If the page_level is changed ==0 from !=0,
+ later freeing of the page doesn't find the page allocation
+ to be freed.*/
+
+ lift_father_up = TRUE;
+ block = father_block;
+ page = buf_block_get_frame(block);
+ page_level = btr_page_get_level(page, mtr);
+
+ ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
+ ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
+ ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
+
+ father_block = blocks[0];
+ father_page_zip = buf_block_get_page_zip(father_block);
+ father_page = buf_block_get_frame(father_block);
+ }
+
mem_heap_free(heap);
}
@@ -3185,6 +3213,7 @@ btr_lift_page_up(
/* Make the father empty */
btr_page_empty(father_block, father_page_zip, index, page_level, mtr);
+ page_level++;
/* Copy the records to the father page one by one. */
if (0
@@ -3217,7 +3246,7 @@ btr_lift_page_up(
lock_update_copy_and_discard(father_block, block);
/* Go upward to root page, decrementing levels by one. */
- for (i = 0; i < n_blocks; i++, page_level++) {
+ for (i = lift_father_up ? 1 : 0; i < n_blocks; i++, page_level++) {
page_t* page = buf_block_get_frame(blocks[i]);
page_zip_des_t* page_zip= buf_block_get_page_zip(blocks[i]);
@@ -3225,7 +3254,7 @@ btr_lift_page_up(
btr_page_set_level(page, page_zip, page_level, mtr);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -3239,7 +3268,7 @@ btr_lift_page_up(
ut_ad(page_validate(father_page, index));
ut_ad(btr_check_node_ptr(index, father_block, mtr));
- return(father_block);
+ return(lift_father_up ? block_orig : father_block);
}
/*************************************************************//**
@@ -3310,6 +3339,7 @@ btr_compress(
if (adjust) {
nth_rec = page_rec_get_n_recs_before(btr_cur_get_rec(cursor));
+ ut_ad(nth_rec > 0);
}
/* Decide the page to which we try to merge and which will inherit
@@ -3400,8 +3430,8 @@ err_exit:
const page_zip_des_t* page_zip
= buf_block_get_page_zip(block);
ut_a(page_zip);
- ut_a(page_zip_validate(merge_page_zip, merge_page));
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(merge_page_zip, merge_page, index));
+ ut_a(page_zip_validate(page_zip, page, index));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -3534,7 +3564,8 @@ err_exit:
ut_ad(page_validate(merge_page, index));
#ifdef UNIV_ZIP_DEBUG
- ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page));
+ ut_a(!merge_page_zip || page_zip_validate(merge_page_zip, merge_page,
+ index));
#endif /* UNIV_ZIP_DEBUG */
/* Free the file page */
@@ -3545,6 +3576,7 @@ func_exit:
mem_heap_free(heap);
if (adjust) {
+ ut_ad(nth_rec > 0);
btr_cur_position(
index,
page_rec_get_nth(merge_block->frame, nth_rec),
@@ -3716,7 +3748,7 @@ btr_discard_page(
page_zip_des_t* merge_page_zip
= buf_block_get_page_zip(merge_block);
ut_a(!merge_page_zip
- || page_zip_validate(merge_page_zip, merge_page));
+ || page_zip_validate(merge_page_zip, merge_page, index));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -4058,8 +4090,22 @@ btr_index_page_validate(
{
page_cur_t cur;
ibool ret = TRUE;
+#ifndef DBUG_OFF
+ ulint nth = 1;
+#endif /* !DBUG_OFF */
page_cur_set_before_first(block, &cur);
+
+ /* Directory slot 0 should only contain the infimum record. */
+ DBUG_EXECUTE_IF("check_table_rec_next",
+ ut_a(page_rec_get_nth_const(
+ page_cur_get_page(&cur), 0)
+ == cur.rec);
+ ut_a(page_dir_slot_get_n_owned(
+ page_dir_get_nth_slot(
+ page_cur_get_page(&cur), 0))
+ == 1););
+
page_cur_move_to_next(&cur);
for (;;) {
@@ -4073,6 +4119,16 @@ btr_index_page_validate(
return(FALSE);
}
+ /* Verify that page_rec_get_nth_const() is correctly
+ retrieving each record. */
+ DBUG_EXECUTE_IF("check_table_rec_next",
+ ut_a(cur.rec == page_rec_get_nth_const(
+ page_cur_get_page(&cur),
+ page_rec_get_n_recs_before(
+ cur.rec)));
+ ut_a(nth++ == page_rec_get_n_recs_before(
+ cur.rec)););
+
page_cur_move_to_next(&cur);
}
@@ -4170,7 +4226,7 @@ btr_validate_level(
ut_a(space == page_get_space_id(page));
#ifdef UNIV_ZIP_DEBUG
page_zip = buf_block_get_page_zip(block);
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
ut_a(!page_is_leaf(page));
@@ -4198,7 +4254,7 @@ loop:
#ifdef UNIV_ZIP_DEBUG
page_zip = buf_block_get_page_zip(block);
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
/* Check ordering etc. of records */
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index 687853a422e..d089fb5ad22 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -97,6 +97,11 @@ srv_refresh_innodb_monitor_stats(). Referenced by
srv_printf_innodb_monitor(). */
UNIV_INTERN ulint btr_cur_n_sea_old = 0;
+#ifdef UNIV_DEBUG
+/* Flag to limit optimistic insert records */
+UNIV_INTERN uint btr_cur_limit_optimistic_insert_debug = 0;
+#endif /* UNIV_DEBUG */
+
/** In the optimistic insert, if the insert does not fit, but this much space
can be released by page reorganize, then it is reorganized */
#define BTR_CUR_PAGE_REORGANIZE_LIMIT (UNIV_PAGE_SIZE / 32)
@@ -748,7 +753,7 @@ retry_page_get:
#ifdef UNIV_ZIP_DEBUG
const page_zip_des_t* page_zip
= buf_block_get_page_zip(block);
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
buf_block_dbg_add_level(
@@ -1378,6 +1383,9 @@ btr_cur_optimistic_insert(
}
}
+ LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page),
+ goto fail);
+
/* If there have been many consecutive inserts, and we are on the leaf
level, check if we have to split the page to reserve enough free space
for future updates of records. */
@@ -2189,7 +2197,7 @@ any_extern:
page_zip = buf_block_get_page_zip(block);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
if (page_zip
@@ -2406,7 +2414,7 @@ btr_cur_pessimistic_update(
MTR_MEMO_X_LOCK));
ut_ad((thr && thr_get_trx(thr)->fake_changes) || mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
/* The insert buffer tree should never be updated in place. */
ut_ad(!dict_index_is_ibuf(index));
@@ -2561,7 +2569,7 @@ make_external:
btr_search_update_hash_on_delete(cursor);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
page_cursor = btr_cur_get_page_cur(cursor);
@@ -2668,7 +2676,7 @@ make_external:
buf_block_t* rec_block = btr_cur_get_block(cursor);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
page = buf_block_get_frame(rec_block);
#endif /* UNIV_ZIP_DEBUG */
page_zip = buf_block_get_page_zip(rec_block);
@@ -2694,7 +2702,7 @@ make_external:
return_after_reservations:
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
if (n_extents > 0) {
@@ -3066,7 +3074,7 @@ btr_cur_set_deleted_flag_for_ibuf(
when the tablespace is
uncompressed */
ibool val, /*!< in: value to set */
- mtr_t* mtr) /*!< in: mtr */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
/* We do not need to reserve btr_search_latch, as the page
has just been read to the buffer pool and there cannot be
@@ -3171,12 +3179,14 @@ btr_cur_optimistic_delete(
page, 1);
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip
+ || page_zip_validate(page_zip, page, cursor->index));
#endif /* UNIV_ZIP_DEBUG */
page_cur_delete_rec(btr_cur_get_page_cur(cursor),
cursor->index, offsets, mtr);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip
+ || page_zip_validate(page_zip, page, cursor->index));
#endif /* UNIV_ZIP_DEBUG */
if (dict_index_is_clust(cursor->index)
@@ -3273,7 +3283,7 @@ btr_cur_pessimistic_delete(
rec = btr_cur_get_rec(cursor);
page_zip = buf_block_get_page_zip(block);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
@@ -3283,7 +3293,7 @@ btr_cur_pessimistic_delete(
rec, offsets, page_zip,
rb_ctx, mtr);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -3344,7 +3354,7 @@ btr_cur_pessimistic_delete(
page_cur_delete_rec(btr_cur_get_page_cur(cursor), index, offsets, mtr);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
ut_ad(btr_check_node_ptr(index, block, mtr));
diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c
index bbc1042ca78..5bcfb0f51b9 100644
--- a/storage/xtradb/buf/buf0buf.c
+++ b/storage/xtradb/buf/buf0buf.c
@@ -66,9 +66,7 @@ _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
byte block_hash_offset;
ut_ad(block);
-
- if (!innobase_get_slow_log() || !trx || !trx->take_stats)
- return;
+ ut_ad(trx && trx->take_stats);
if (!trx->distinct_page_access_hash) {
trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE);
@@ -279,7 +277,7 @@ the read requests for the whole area.
#ifndef UNIV_HOTBACKUP
/** Value in microseconds */
-static const int WAIT_FOR_READ = 5000;
+static const int WAIT_FOR_READ = 100;
/** Number of attemtps made to read in a page in the buffer pool */
static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
@@ -412,6 +410,33 @@ buf_get_total_list_len(
}
/********************************************************************//**
+Get total list size in bytes from all buffer pools. */
+UNIV_INTERN
+void
+buf_get_total_list_size_in_bytes(
+/*=============================*/
+ buf_pools_list_size_t* buf_pools_list_size) /*!< out: list sizes
+ in all buffer pools */
+{
+ ulint i;
+ ut_ad(buf_pools_list_size);
+ memset(buf_pools_list_size, 0, sizeof(*buf_pools_list_size));
+
+ for (i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool;
+
+ buf_pool = buf_pool_from_array(i);
+ /* We don't need mutex protection since this is
+ for statistics purpose */
+ buf_pools_list_size->LRU_bytes += buf_pool->stat.LRU_bytes;
+ buf_pools_list_size->unzip_LRU_bytes +=
+ UT_LIST_GET_LEN(buf_pool->unzip_LRU) * UNIV_PAGE_SIZE;
+ buf_pools_list_size->flush_list_bytes +=
+ buf_pool->stat.flush_list_bytes;
+ }
+}
+
+/********************************************************************//**
Get total buffer pool statistics. */
UNIV_INTERN
void
@@ -1807,40 +1832,24 @@ buf_page_make_young(
}
/********************************************************************//**
-Sets the time of the first access of a page and moves a page to the
-start of the buffer pool LRU list if it is too old. This high-level
-function can be used to prevent an important page from slipping
-out of the buffer pool. */
+Moves a page to the start of the buffer pool LRU list if it is too old.
+This high-level function can be used to prevent an important page from
+slipping out of the buffer pool. */
static
void
-buf_page_set_accessed_make_young(
-/*=============================*/
- buf_page_t* bpage, /*!< in/out: buffer block of a
+buf_page_make_young_if_needed(
+/*==========================*/
+ buf_page_t* bpage) /*!< in/out: buffer block of a
file page */
- unsigned access_time) /*!< in: bpage->access_time
- read under mutex protection,
- or 0 if unknown */
{
+#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
-
ut_ad(!buf_pool_mutex_own(buf_pool));
+#endif /* UNIV_DEBUG */
ut_a(buf_page_in_file(bpage));
if (buf_page_peek_if_too_old(bpage)) {
- //buf_pool_mutex_enter(buf_pool);
- mutex_enter(&buf_pool->LRU_list_mutex);
- buf_LRU_make_block_young(bpage);
- //buf_pool_mutex_exit(buf_pool);
- mutex_exit(&buf_pool->LRU_list_mutex);
- } else if (!access_time) {
- ulint time_ms = ut_time_ms();
- mutex_t* block_mutex = buf_page_get_mutex_enter(bpage);
- //buf_pool_mutex_enter(buf_pool);
- if (block_mutex) {
- buf_page_set_accessed(bpage, time_ms);
- mutex_exit(block_mutex);
- }
- //buf_pool_mutex_exit(buf_pool);
+ buf_page_make_young(bpage);
}
}
@@ -1959,7 +1968,6 @@ buf_page_get_zip(
buf_page_t* bpage;
mutex_t* block_mutex;
ibool must_read;
- unsigned access_time;
trx_t* trx = NULL;
ulint sec;
ulint ms;
@@ -1967,7 +1975,7 @@ buf_page_get_zip(
ib_uint64_t finish_time;
buf_pool_t* buf_pool = buf_pool_get(space, offset);
- if (innobase_get_slow_log()) {
+ if (UNIV_UNLIKELY(innobase_get_slow_log())) {
trx = innobase_get_trx();
}
buf_pool->stat.n_page_gets++;
@@ -2089,13 +2097,14 @@ err_exit:
got_block:
must_read = buf_page_get_io_fix(bpage) == BUF_IO_READ;
- access_time = buf_page_is_accessed(bpage);
//buf_pool_mutex_exit(buf_pool);
+ buf_page_set_accessed(bpage);
+
mutex_exit(block_mutex);
- buf_page_set_accessed_make_young(bpage, access_time);
+ buf_page_make_young_if_needed(bpage);
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(!bpage->file_page_was_freed);
@@ -2111,7 +2120,7 @@ got_block:
/* Let us wait until the read operation
completes */
- if (innobase_get_slow_log() && trx && trx->take_stats)
+ if (UNIV_UNLIKELY(trx && trx->take_stats))
{
ut_usectime(&sec, &ms);
start_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -2132,7 +2141,7 @@ got_block:
break;
}
}
- if (innobase_get_slow_log() && trx && trx->take_stats && start_time)
+ if (UNIV_UNLIKELY(start_time != 0))
{
ut_usectime(&sec, &ms);
finish_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -2487,7 +2496,7 @@ buf_page_get_gen(
|| ibuf_page_low(space, zip_size, offset,
FALSE, file, line, NULL));
#endif
- if (innobase_get_slow_log()) {
+ if (UNIV_UNLIKELY(innobase_get_slow_log())) {
trx = innobase_get_trx();
}
buf_pool->stat.n_page_gets++;
@@ -2774,6 +2783,8 @@ wait_until_unfixed:
UNIV_MEM_INVALID(bpage, sizeof *bpage);
+ access_time = buf_page_is_accessed(&block->page);
+
mutex_exit(block_mutex);
mutex_exit(&buf_pool->zip_mutex);
@@ -2781,18 +2792,22 @@ wait_until_unfixed:
buf_pool->n_pend_unzip++;
buf_pool_mutex_exit(buf_pool);
- //buf_pool_mutex_exit(buf_pool);
-
buf_page_free_descriptor(bpage);
- /* Decompress the page and apply buffered operations
- while not holding buf_pool->mutex or block->mutex. */
+ /* Decompress the page while not holding
+ buf_pool->mutex or block->mutex. */
success = buf_zip_decompress(block, srv_use_checksums);
ut_a(success);
if (UNIV_LIKELY(!recv_no_ibuf_operations)) {
- ibuf_merge_or_delete_for_page(block, space, offset,
- zip_size, TRUE);
+ if (access_time) {
+#ifdef UNIV_IBUF_COUNT_DEBUG
+ ut_a(ibuf_count_get(space, offset) == 0);
+#endif /* UNIV_IBUF_COUNT_DEBUG */
+ } else {
+ ibuf_merge_or_delete_for_page(
+ block, space, offset, zip_size, TRUE);
+ }
}
/* Unfix and unlatch the block. */
@@ -2888,17 +2903,16 @@ wait_until_unfixed:
ut_a(mode == BUF_GET_POSSIBLY_FREED
|| !block->page.file_page_was_freed);
#endif
- //mutex_exit(&block->mutex);
/* Check if this is the first access to the page */
-
access_time = buf_page_is_accessed(&block->page);
- //buf_pool_mutex_exit(buf_pool);
- mutex_exit(block_mutex);
+ buf_page_set_accessed(&block->page);
+
+ mutex_exit(&block->mutex);
- if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL)) {
- buf_page_set_accessed_make_young(&block->page, access_time);
+ if (mode != BUF_PEEK_IF_IN_POOL) {
+ buf_page_make_young_if_needed(&block->page);
}
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -2913,7 +2927,7 @@ wait_until_unfixed:
/* Let us wait until the read operation
completes */
- if (innobase_get_slow_log() && trx && trx->take_stats)
+ if (UNIV_UNLIKELY(trx && trx->take_stats))
{
ut_usectime(&sec, &ms);
start_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -2928,13 +2942,14 @@ wait_until_unfixed:
mutex_exit(&block->mutex);
if (io_fix == BUF_IO_READ) {
-
- os_thread_sleep(WAIT_FOR_READ);
+ /* wait by temporaly s-latch */
+ rw_lock_s_lock(&(block->lock));
+ rw_lock_s_unlock(&(block->lock));
} else {
break;
}
}
- if (innobase_get_slow_log() && trx && trx->take_stats && start_time)
+ if (UNIV_UNLIKELY(start_time != 0))
{
ut_usectime(&sec, &ms);
finish_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -2961,7 +2976,7 @@ wait_until_unfixed:
mtr_memo_push(mtr, block, fix_type);
- if (UNIV_LIKELY(mode != BUF_PEEK_IF_IN_POOL) && !access_time) {
+ if (mode != BUF_PEEK_IF_IN_POOL && !access_time) {
/* In the case of a first access, try to apply linear
read-ahead */
@@ -2973,7 +2988,7 @@ wait_until_unfixed:
ut_a(ibuf_count_get(buf_block_get_space(block),
buf_block_get_page_no(block)) == 0);
#endif
- if (innobase_get_slow_log()) {
+ if (UNIV_UNLIKELY(trx && trx->take_stats)) {
_increment_page_get_statistics(block, trx);
}
@@ -3018,15 +3033,13 @@ buf_page_optimistic_get(
buf_block_buf_fix_inc(block, file, line);
- mutex_exit(&block->mutex);
+ access_time = buf_page_is_accessed(&block->page);
- /* Check if this is the first access to the page.
- We do a dirty read on purpose, to avoid mutex contention.
- This field is only used for heuristic purposes; it does not
- affect correctness. */
+ buf_page_set_accessed(&block->page);
- access_time = buf_page_is_accessed(&block->page);
- buf_page_set_accessed_make_young(&block->page, access_time);
+ mutex_exit(&block->mutex);
+
+ buf_page_make_young_if_needed(&block->page);
ut_ad(!ibuf_inside(mtr)
|| ibuf_page(buf_block_get_space(block),
@@ -3078,11 +3091,11 @@ buf_page_optimistic_get(
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ut_a(block->page.file_page_was_freed == FALSE);
#endif
- if (innobase_get_slow_log()) {
+ if (UNIV_UNLIKELY(innobase_get_slow_log())) {
trx = innobase_get_trx();
}
- if (UNIV_UNLIKELY(!access_time)) {
+ if (!access_time) {
/* In the case of a first access, try to apply linear
read-ahead */
@@ -3099,7 +3112,7 @@ buf_page_optimistic_get(
buf_pool = buf_pool_from_block(block);
buf_pool->stat.n_page_gets++;
- if (innobase_get_slow_log()) {
+ if (UNIV_UNLIKELY(trx && trx->take_stats)) {
_increment_page_get_statistics(block, trx);
}
return(TRUE);
@@ -3149,28 +3162,14 @@ buf_page_get_known_nowait(
buf_block_buf_fix_inc(block, file, line);
+ buf_page_set_accessed(&block->page);
+
mutex_exit(&block->mutex);
buf_pool = buf_pool_from_block(block);
- if (mode == BUF_MAKE_YOUNG && buf_page_peek_if_too_old(&block->page)) {
- //buf_pool_mutex_enter(buf_pool);
- mutex_enter(&buf_pool->LRU_list_mutex);
- buf_LRU_make_block_young(&block->page);
- //buf_pool_mutex_exit(buf_pool);
- mutex_exit(&buf_pool->LRU_list_mutex);
- } else if (!buf_page_is_accessed(&block->page)) {
- /* Above, we do a dirty read on purpose, to avoid
- mutex contention. The field buf_page_t::access_time
- is only used for heuristic purposes. Writes to the
- field must be protected by mutex, however. */
- ulint time_ms = ut_time_ms();
-
- //buf_pool_mutex_enter(buf_pool);
- mutex_enter(&block->mutex);
- buf_page_set_accessed(&block->page, time_ms);
- //buf_pool_mutex_exit(buf_pool);
- mutex_exit(&block->mutex);
+ if (mode == BUF_MAKE_YOUNG) {
+ buf_page_make_young_if_needed(&block->page);
}
ut_ad(!ibuf_inside(mtr) || mode == BUF_KEEP_OLD);
@@ -3211,9 +3210,13 @@ buf_page_get_known_nowait(
#endif
buf_pool->stat.n_page_gets++;
- if (innobase_get_slow_log()) {
+ if (UNIV_UNLIKELY(innobase_get_slow_log())) {
+
trx = innobase_get_trx();
- _increment_page_get_statistics(block, trx);
+ if (trx != NULL && trx->take_stats) {
+
+ _increment_page_get_statistics(block, trx);
+ }
}
return(TRUE);
@@ -3342,6 +3345,7 @@ buf_page_init(
ulint offset, /*!< in: offset of the page within space
in units of a page */
ulint fold, /*!< in: buf_page_address_fold(space,offset) */
+ ulint zip_size,/*!< in: compressed page size, or 0 */
buf_block_t* block) /*!< in/out: block to init */
{
buf_page_t* hash_page;
@@ -3411,6 +3415,9 @@ buf_page_init(
ut_d(block->page.in_page_hash = TRUE);
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
fold, &block->page);
+ if (zip_size) {
+ page_zip_set_size(&block->page.zip, zip_size);
+ }
}
/********************************************************************//**
@@ -3537,7 +3544,7 @@ err_exit:
ut_ad(buf_pool_from_bpage(bpage) == buf_pool);
- buf_page_init(buf_pool, space, offset, fold, block);
+ buf_page_init(buf_pool, space, offset, fold, zip_size, block);
rw_lock_x_unlock(&buf_pool->page_hash_latch);
@@ -3557,8 +3564,6 @@ err_exit:
buf_page_set_io_fix(bpage, BUF_IO_READ);
if (UNIV_UNLIKELY(zip_size)) {
- page_zip_set_size(&block->page.zip, zip_size);
-
/* buf_pool->mutex may be released and
reacquired by buf_buddy_alloc(). Thus, we
must release block->mutex in order not to
@@ -3658,7 +3663,8 @@ err_exit:
rw_lock_x_unlock(&buf_pool->page_hash_latch);
- /* The block must be put to the LRU list, to the old blocks */
+ /* The block must be put to the LRU list, to the old blocks
+ The zip_size is already set into the page zip */
buf_LRU_add_block(bpage, TRUE/* to old blocks */);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(bpage);
@@ -3706,7 +3712,6 @@ buf_page_create(
buf_block_t* block;
ulint fold;
buf_block_t* free_block = NULL;
- ulint time_ms = ut_time_ms();
buf_pool_t* buf_pool = buf_pool_get(space, offset);
ut_ad(mtr);
@@ -3774,7 +3779,7 @@ retry:
mutex_enter(&block->mutex);
- buf_page_init(buf_pool, space, offset, fold, block);
+ buf_page_init(buf_pool, space, offset, fold, zip_size,block);
rw_lock_x_unlock(&buf_pool->page_hash_latch);
/* The block must be put to the LRU list */
@@ -3793,8 +3798,6 @@ retry:
buf_page_set_io_fix(&block->page, BUF_IO_READ);
rw_lock_x_lock(&block->lock);
-
- page_zip_set_size(&block->page.zip, zip_size);
mutex_exit(&block->mutex);
/* buf_pool->mutex may be released and reacquired by
buf_buddy_alloc(). Thus, we must release block->mutex
@@ -3818,13 +3821,12 @@ retry:
rw_lock_x_unlock(&block->lock);
}
- buf_page_set_accessed(&block->page, time_ms);
-
- //buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->LRU_list_mutex);
mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
+ buf_page_set_accessed(&block->page);
+
mutex_exit(&block->mutex);
/* Delete possible entries for the page from the insert buffer:
@@ -3937,7 +3939,7 @@ buf_page_io_complete(
ensures that this is the only thread that handles the i/o for this
block. */
- io_type = buf_page_get_io_fix(bpage);
+ io_type = buf_page_get_io_fix_unlocked(bpage);
ut_ad(io_type == BUF_IO_READ || io_type == BUF_IO_WRITE);
if (io_type == BUF_IO_READ) {
diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c
index 39351cd3678..663e2d8f537 100644
--- a/storage/xtradb/buf/buf0flu.c
+++ b/storage/xtradb/buf/buf0flu.c
@@ -79,6 +79,23 @@ static buf_flush_stat_t buf_flush_stat_sum;
/* @} */
+/******************************************************************//**
+Increases flush_list size in bytes with zip_size for compressed page,
+UNIV_PAGE_SIZE for uncompressed page in inline function */
+static inline
+void
+incr_flush_list_size_in_bytes(
+/*==========================*/
+ buf_block_t* block, /*!< in: control block */
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
+{
+ ulint zip_size;
+ ut_ad(buf_flush_list_mutex_own(buf_pool));
+ zip_size = page_zip_get_size(&block->page.zip);
+ buf_pool->stat.flush_list_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE;
+ ut_ad(buf_pool->stat.flush_list_bytes <= buf_pool->curr_pool_size);
+}
+
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/******************************************************************//**
Validates the flush list.
@@ -308,6 +325,7 @@ buf_flush_insert_into_flush_list(
ut_d(block->page.in_flush_list = TRUE);
block->page.oldest_modification = lsn;
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, &block->page);
+ incr_flush_list_size_in_bytes(block, buf_pool);
#ifdef UNIV_DEBUG_VALGRIND
{
@@ -412,6 +430,8 @@ buf_flush_insert_sorted_into_flush_list(
prev_b, &block->page);
}
+ incr_flush_list_size_in_bytes(block, buf_pool);
+
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_low(buf_pool));
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
@@ -514,6 +534,7 @@ buf_flush_remove(
buf_page_t* bpage) /*!< in: pointer to the block in question */
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ ulint zip_size;
//ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
@@ -552,6 +573,9 @@ buf_flush_remove(
because we assert on in_flush_list in comparison function. */
ut_d(bpage->in_flush_list = FALSE);
+ zip_size = page_zip_get_size(&bpage->zip);
+ buf_pool->stat.flush_list_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE;
+
bpage->oldest_modification = 0;
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
@@ -915,7 +939,7 @@ flush:
"InnoDB: Page buf fix count %lu,"
" io fix %lu, state %lu\n",
(ulong)block->page.buf_fix_count,
- (ulong)buf_block_get_io_fix(block),
+ (ulong)buf_block_get_io_fix_unlocked(block),
(ulong)buf_block_get_state(block));
}
@@ -1115,7 +1139,7 @@ buf_flush_write_block_low(
ut_ad(!mutex_own(&buf_pool->LRU_list_mutex));
ut_ad(!buf_flush_list_mutex_own(buf_pool));
ut_ad(!mutex_own(buf_page_get_mutex(bpage)));
- ut_ad(buf_page_get_io_fix(bpage) == BUF_IO_WRITE);
+ ut_ad(buf_page_get_io_fix_unlocked(bpage) == BUF_IO_WRITE);
ut_ad(bpage->oldest_modification != 0);
#ifdef UNIV_IBUF_COUNT_DEBUG
@@ -1181,10 +1205,10 @@ buf_flush_write_block_low(
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/********************************************************************//**
Writes a flushable page asynchronously from the buffer pool to a file.
-NOTE: buf_pool->mutex and block->mutex must be held upon entering this
-function, and they will be released by this function after flushing.
+NOTE: block->mutex must be held upon entering this function, and it will be
+released by this function after flushing.
This is loosely based on buf_flush_batch() and buf_flush_page().
-@return TRUE if the page was flushed and the mutexes released */
+@return TRUE if the page was flushed and the mutex released */
UNIV_INTERN
ibool
buf_flush_page_try(
@@ -1553,16 +1577,14 @@ scan:
Check if the block is modified and ready for flushing. If the the block
is ready to flush then flush the page and try o flush its neighbors.
-@return TRUE if buf_pool mutex was not released during this function.
+@return TRUE if LRU list mutex was not released during this function.
This does not guarantee that some pages were written as well.
Number of pages written are incremented to the count. */
static
ibool
buf_flush_page_and_try_neighbors(
/*=============================*/
- buf_page_t* bpage, /*!< in: buffer control block,
- must be
- buf_page_in_file(bpage) */
+ buf_page_t* bpage, /*!< in: buffer control block */
enum buf_flush flush_type, /*!< in: BUF_FLUSH_LRU
or BUF_FLUSH_LIST */
ulint n_to_flush, /*!< in: number of pages to
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index 14b5c65132c..cd99d3e4e13 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -153,6 +153,23 @@ buf_LRU_block_free_hashed_page(
ibool have_page_hash_mutex);
/******************************************************************//**
+Increases LRU size in bytes with zip_size for compressed page,
+UNIV_PAGE_SIZE for uncompressed page in inline function */
+static inline
+void
+incr_LRU_size_in_bytes(
+/*===================*/
+ buf_page_t* bpage, /*!< in: control block */
+ buf_pool_t* buf_pool) /*!< in: buffer pool instance */
+{
+ ulint zip_size;
+ ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
+ zip_size = page_zip_get_size(&bpage->zip);
+ buf_pool->stat.LRU_bytes += zip_size ? zip_size : UNIV_PAGE_SIZE;
+ ut_ad(buf_pool->stat.LRU_bytes <= buf_pool->curr_pool_size);
+}
+
+/******************************************************************//**
Determines if the unzip_LRU list should be used for evicting a victim
instead of the general LRU list.
@return TRUE if should use unzip_LRU */
@@ -393,18 +410,18 @@ buf_flush_yield(
{
mutex_t* block_mutex;
+ block_mutex = buf_page_get_mutex(bpage);
+
+ ut_ad(mutex_own(block_mutex));
ut_ad(mutex_own(&buf_pool->LRU_list_mutex));
ut_ad(buf_page_in_file(bpage));
- block_mutex = buf_page_get_mutex(bpage);
-
- mutex_enter(block_mutex);
/* "Fix" the block so that the position cannot be
changed after we release the buffer pool and
block mutexes. */
buf_page_set_sticky(bpage);
- /* Now it is safe to release the buf_pool->mutex. */
+ /* Now it is safe to release the LRU list mutex. */
mutex_exit(&buf_pool->LRU_list_mutex);
mutex_exit(block_mutex);
@@ -415,7 +432,7 @@ buf_flush_yield(
mutex_enter(block_mutex);
/* "Unfix" the block now that we have both the
- buffer pool and block mutex again. */
+ LRU list and block mutex again. */
buf_page_unset_sticky(bpage);
mutex_exit(block_mutex);
}
@@ -431,7 +448,9 @@ buf_flush_try_yield(
/*================*/
buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
buf_page_t* bpage, /*!< in/out: bpage to remove */
- ulint processed) /*!< in: number of pages processed */
+ ulint processed, /*!< in: number of pages processed */
+ ibool* must_restart) /*!< in/out: if TRUE, we have to
+ restart the flush list scan */
{
/* Every BUF_LRU_DROP_SEARCH_SIZE iterations in the
loop we release buf_pool->mutex to let other threads
@@ -441,10 +460,40 @@ buf_flush_try_yield(
if (bpage != NULL
&& processed >= BUF_LRU_DROP_SEARCH_SIZE
- && buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
+ && buf_page_get_io_fix_unlocked(bpage) == BUF_IO_NONE) {
+
+ mutex_t* block_mutex;
buf_flush_list_mutex_exit(buf_pool);
+ /* We don't have to worry about bpage becoming a dangling
+ pointer by a compressed page flush list relocation because
+ buf_page_get_gen() won't be called for pages from this
+ tablespace. */
+
+ block_mutex = buf_page_get_mutex_enter(bpage);
+ if (UNIV_UNLIKELY(block_mutex == NULL)) {
+
+ buf_flush_list_mutex_enter(buf_pool);
+
+ *must_restart = TRUE;
+ return FALSE;
+ }
+
+ /* Recheck the I/O fix and the flush list presence now that we
+ hold the right mutex */
+ if (UNIV_UNLIKELY(buf_page_get_io_fix(bpage) != BUF_IO_NONE
+ || bpage->oldest_modification == 0)) {
+
+ mutex_exit(block_mutex);
+ buf_flush_list_mutex_enter(buf_pool);
+
+ *must_restart = TRUE;
+ return FALSE;
+ }
+
+ *must_restart = FALSE;
+
/* Release the LRU list and block mutex
to give the other threads a go. */
@@ -473,7 +522,9 @@ ibool
buf_flush_or_remove_page(
/*=====================*/
buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
- buf_page_t* bpage) /*!< in/out: bpage to remove */
+ buf_page_t* bpage, /*!< in/out: bpage to remove */
+ ibool* must_restart) /*!< in/out: if TRUE, must restart the
+ flush list scan */
{
mutex_t* block_mutex;
ibool processed = FALSE;
@@ -487,7 +538,8 @@ buf_flush_or_remove_page(
buf_pool->mutex and block_mutex. It is safe to check
them while holding buf_pool->mutex only. */
- if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
+ if (UNIV_UNLIKELY(buf_page_get_io_fix_unlocked(bpage)
+ != BUF_IO_NONE)) {
/* We cannot remove this page during this scan
yet; maybe the system is currently reading it
@@ -496,21 +548,38 @@ buf_flush_or_remove_page(
} else {
/* We have to release the flush_list_mutex to obey the
- latching order. We are however guaranteed that the page
- will stay in the flush_list because buf_flush_remove()
- needs buf_pool->mutex as well (for the non-flush case). */
+ latching order. We are not however guaranteed that the page
+ will stay in the flush_list. */
buf_flush_list_mutex_exit(buf_pool);
+ /* We don't have to worry about bpage becoming a dangling
+ pointer by a compressed page flush list relocation because
+ buf_page_get_gen() won't be called for pages from this
+ tablespace. */
+
mutex_enter(block_mutex);
- ut_ad(bpage->oldest_modification != 0);
+ /* Recheck the page I/O fix and the flush list presence now
+ thatwe hold the right mutex. */
+ if (UNIV_UNLIKELY(buf_page_get_io_fix(bpage) != BUF_IO_NONE
+ || bpage->oldest_modification == 0)) {
- if (bpage->buf_fix_count == 0) {
+ /* The page became I/O-fixed or is not on the flush
+ list anymore, this invalidates any flush-list-page
+ pointers we have. */
+ *must_restart = TRUE;
- buf_flush_remove(bpage);
+ } else {
+
+ ut_ad(bpage->oldest_modification != 0);
+
+ if (bpage->buf_fix_count == 0) {
+
+ buf_flush_remove(bpage);
- processed = TRUE;
+ processed = TRUE;
+ }
}
mutex_exit(block_mutex);
@@ -541,11 +610,12 @@ buf_flush_or_remove_pages(
buf_page_t* bpage;
ulint processed = 0;
ibool all_freed = TRUE;
+ ibool must_restart = FALSE;
buf_flush_list_mutex_enter(buf_pool);
for (bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
- bpage != NULL;
+ !must_restart && bpage != NULL;
bpage = prev) {
ut_a(buf_page_in_file(bpage));
@@ -561,22 +631,31 @@ buf_flush_or_remove_pages(
/* Skip this block, as it does not belong to
the target space. */
- } else if (!buf_flush_or_remove_page(buf_pool, bpage)) {
+ } else if (!buf_flush_or_remove_page(buf_pool, bpage,
+ &must_restart)) {
/* Remove was unsuccessful, we have to try again
by scanning the entire list from the end. */
all_freed = FALSE;
}
+ if (UNIV_UNLIKELY(must_restart)) {
+ ut_ad(!all_freed);
+ break;
+ }
++processed;
/* Yield if we have hogged the CPU and mutexes for too long. */
- if (buf_flush_try_yield(buf_pool, prev, processed)) {
+ if (buf_flush_try_yield(buf_pool, prev, processed,
+ &must_restart)) {
+ ut_ad(!must_restart);
/* Reset the batch size counter if we had to yield. */
processed = 0;
+ } else if (UNIV_UNLIKELY(must_restart)) {
+ all_freed = FALSE;
}
}
@@ -641,41 +720,39 @@ scan_again:
/* No op */) {
buf_page_t* prev_bpage;
- mutex_t* block_mutex = NULL;
+ mutex_t* block_mutex;
ut_a(buf_page_in_file(bpage));
ut_ad(bpage->in_LRU_list);
prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
- /* bpage->space and bpage->io_fix are protected by
- buf_pool->mutex and the block_mutex. It is safe to check
- them while holding buf_pool->mutex only. */
+ block_mutex = buf_page_get_mutex_enter(bpage);
+
+ if (!block_mutex) {
+ /* It may be impossible case...
+ Something wrong, so will be scan_again */
+
+ all_freed = FALSE;
+ goto next_page;
+ }
if (buf_page_get_space(bpage) != id) {
/* Skip this block, as it does not belong to
the space that is being invalidated. */
+
+ mutex_exit(block_mutex);
goto next_page;
} else if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
/* We cannot remove this page during this scan
yet; maybe the system is currently reading it
in, or flushing the modifications to the file */
+ mutex_exit(block_mutex);
all_freed = FALSE;
goto next_page;
} else {
- block_mutex = buf_page_get_mutex_enter(bpage);
-
- if (!block_mutex) {
- /* It may be impossible case...
- Something wrong, so will be scan_again */
-
- all_freed = FALSE;
- goto next_page;
- }
-
-
if (bpage->buf_fix_count > 0) {
mutex_exit(block_mutex);
@@ -1491,6 +1568,7 @@ buf_LRU_remove_block(
buf_page_t* bpage) /*!< in: control block */
{
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ ulint zip_size;
ut_ad(buf_pool);
ut_ad(bpage);
@@ -1527,6 +1605,9 @@ buf_LRU_remove_block(
UT_LIST_REMOVE(LRU, buf_pool->LRU, bpage);
bpage->in_LRU_list = FALSE;
+ zip_size = page_zip_get_size(&bpage->zip);
+ buf_pool->stat.LRU_bytes -= zip_size ? zip_size : UNIV_PAGE_SIZE;
+
buf_unzip_LRU_remove_block_if_needed(bpage);
/* If the LRU list is so short that LRU_old is not defined,
@@ -1588,7 +1669,10 @@ buf_unzip_LRU_add_block(
}
/******************************************************************//**
-Adds a block to the LRU list end. */
+Adds a block to the LRU list end. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INLINE
void
buf_LRU_add_block_to_end_low(
@@ -1608,6 +1692,8 @@ buf_LRU_add_block_to_end_low(
UT_LIST_ADD_LAST(LRU, buf_pool->LRU, bpage);
bpage->in_LRU_list = TRUE;
+ incr_LRU_size_in_bytes(bpage, buf_pool);
+
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old);
@@ -1636,7 +1722,10 @@ buf_LRU_add_block_to_end_low(
}
/******************************************************************//**
-Adds a block to the LRU list. */
+Adds a block to the LRU list. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INLINE
void
buf_LRU_add_block_low(
@@ -1679,6 +1768,8 @@ buf_LRU_add_block_low(
bpage->in_LRU_list = TRUE;
+ incr_LRU_size_in_bytes(bpage, buf_pool);
+
if (UT_LIST_GET_LEN(buf_pool->LRU) > BUF_LRU_OLD_MIN_LEN) {
ut_ad(buf_pool->LRU_old);
@@ -1706,7 +1797,10 @@ buf_LRU_add_block_low(
}
/******************************************************************//**
-Adds a block to the LRU list. */
+Adds a block to the LRU list. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INTERN
void
buf_LRU_add_block(
@@ -1853,7 +1947,7 @@ alloc:
|| !buf_page_can_relocate(bpage)) {
not_freed:
if (b) {
- buf_buddy_free(buf_pool, b, sizeof *b, TRUE);
+ buf_page_free_descriptor(b);
}
if (!have_LRU_mutex)
mutex_exit(&buf_pool->LRU_list_mutex);
@@ -1935,6 +2029,8 @@ not_freed:
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU,
prev_b, b);
+ incr_LRU_size_in_bytes(b, buf_pool);
+
if (buf_page_is_old(b)) {
buf_pool->LRU_old_len++;
if (UNIV_UNLIKELY
@@ -2196,7 +2292,9 @@ buf_LRU_block_remove_hashed_page(
break;
case FIL_PAGE_INDEX:
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(&bpage->zip, page));
+ ut_a(page_zip_validate(
+ &bpage->zip, page,
+ ((buf_block_t*) bpage)->index));
#endif /* UNIV_ZIP_DEBUG */
break;
default:
diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c
index 6d76a488af7..cf0a029df92 100644
--- a/storage/xtradb/buf/buf0rea.c
+++ b/storage/xtradb/buf/buf0rea.c
@@ -235,7 +235,8 @@ not_to_recover:
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage, trx);
}
- if(sync) {
+
+ if (sync) {
thd_wait_end(NULL);
}
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index 516b6e927e0..29063f028f1 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -525,6 +525,20 @@ dict_index_get_nth_col_or_prefix_pos(
return(ULINT_UNDEFINED);
}
+/********************************************************************//**
+Looks for column n in an index.
+@return position in internal representation of the index;
+ULINT_UNDEFINED if not contained */
+UNIV_INTERN
+ulint
+dict_index_get_nth_col_pos(
+/*=======================*/
+ const dict_index_t* index, /*!< in: index */
+ ulint n) /*!< in: column number */
+{
+ return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE));
+}
+
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
Returns TRUE if the index contains a column or a prefix of that column.
@@ -2088,7 +2102,6 @@ dict_index_build_internal_clust(
{
dict_index_t* new_index;
dict_field_t* field;
- ulint fixed_size;
ulint trx_id_pos;
ulint i;
ibool* indexed;
@@ -2165,7 +2178,7 @@ dict_index_build_internal_clust(
for (i = 0; i < trx_id_pos; i++) {
- fixed_size = dict_col_get_fixed_size(
+ ulint fixed_size = dict_col_get_fixed_size(
dict_index_get_nth_col(new_index, i),
dict_table_is_comp(table));
@@ -2182,7 +2195,20 @@ dict_index_build_internal_clust(
break;
}
- new_index->trx_id_offset += (unsigned int) fixed_size;
+ /* Add fixed_size to new_index->trx_id_offset.
+ Because the latter is a bit-field, an overflow
+ can theoretically occur. Check for it. */
+ fixed_size += new_index->trx_id_offset;
+
+ new_index->trx_id_offset = fixed_size;
+
+ if (new_index->trx_id_offset != fixed_size) {
+ /* Overflow. Pretend that this is a
+ variable-length PRIMARY KEY. */
+ ut_ad(0);
+ new_index->trx_id_offset = 0;
+ break;
+ }
}
}
diff --git a/storage/xtradb/dict/dict0load.c b/storage/xtradb/dict/dict0load.c
index 0ef74ea8b7c..cdef0d1b270 100644
--- a/storage/xtradb/dict/dict0load.c
+++ b/storage/xtradb/dict/dict0load.c
@@ -2399,7 +2399,8 @@ dict_load_foreigns(
ibool check_charsets) /*!< in: TRUE=check charset
compatibility */
{
- char tuple_buf[DTUPLE_EST_ALLOC(1)];
+ ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1)
+ / sizeof(ulint)];
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index 4ab2c16d41f..397c4de4b6e 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -195,14 +195,16 @@ struct fil_space_struct {
requests on the file */
ibool stop_new_ops;
/*!< we set this TRUE when we start
- deleting a single-table tablespace */
- ibool is_being_deleted;
- /*!< this is set to TRUE when we start
- deleting a single-table tablespace and its
- file; when this flag is set no further i/o
- or flush requests can be placed on this space,
- though there may be such requests still being
- processed on this space */
+ deleting a single-table tablespace.
+ When this is set following new ops
+ are not allowed:
+ * read IO request
+ * ibuf merge
+ * file flush
+ Note that we can still possibly have
+ new write operations because we don't
+ check this flag when doing flush
+ batches. */
ulint purpose;/*!< FIL_TABLESPACE, FIL_LOG, or
FIL_ARCH_LOG */
UT_LIST_BASE_NODE_T(fil_node_t) chain;
@@ -865,7 +867,7 @@ fil_node_close_file(
ut_ad(node && system);
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->open);
- ut_a(node->n_pending == 0 || node->space->is_being_deleted);
+ ut_a(node->n_pending == 0 || node->space->stop_new_ops);
ut_a(node->n_pending_flushes == 0);
#ifndef UNIV_HOTBACKUP
ut_a(node->modification_counter == node->flush_counter
@@ -1099,7 +1101,7 @@ fil_node_free(
ut_ad(node && system && space);
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->magic_n == FIL_NODE_MAGIC_N);
- ut_a(node->n_pending == 0 || space->is_being_deleted);
+ ut_a(node->n_pending == 0 || space->stop_new_ops);
if (node->open) {
/* We fool the assertion in fil_node_close_file() to think
@@ -1297,7 +1299,6 @@ try_again:
space->stop_ios = FALSE;
space->stop_new_ops = FALSE;
- space->is_being_deleted = FALSE;
space->purpose = purpose;
space->size = 0;
space->flags = flags;
@@ -1478,7 +1479,7 @@ fil_space_get_size(
ut_ad(fil_system);
- fil_mutex_enter_and_prepare_for_io(id);
+ mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
@@ -1493,6 +1494,23 @@ fil_space_get_size(
ut_a(1 == UT_LIST_GET_LEN(space->chain));
+ mutex_exit(&fil_system->mutex);
+
+ /* It is possible that the space gets evicted at this point
+ before the fil_mutex_enter_and_prepare_for_io() acquires
+ the fil_system->mutex. Check for this after completing the
+ call to fil_mutex_enter_and_prepare_for_io(). */
+ fil_mutex_enter_and_prepare_for_io(id);
+
+ /* We are still holding the fil_system->mutex. Check if
+ the space is still in memory cache. */
+ space = fil_space_get_by_id(id);
+
+ if (space == NULL) {
+ mutex_exit(&fil_system->mutex);
+ return(0);
+ }
+
node = UT_LIST_GET_FIRST(space->chain);
/* It must be a single-table tablespace and we have not opened
@@ -1530,7 +1548,7 @@ fil_space_get_flags(
return(0);
}
- fil_mutex_enter_and_prepare_for_io(id);
+ mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
@@ -1545,6 +1563,23 @@ fil_space_get_flags(
ut_a(1 == UT_LIST_GET_LEN(space->chain));
+ mutex_exit(&fil_system->mutex);
+
+ /* It is possible that the space gets evicted at this point
+ before the fil_mutex_enter_and_prepare_for_io() acquires
+ the fil_system->mutex. Check for this after completing the
+ call to fil_mutex_enter_and_prepare_for_io(). */
+ fil_mutex_enter_and_prepare_for_io(id);
+
+ /* We are still holding the fil_system->mutex. Check if
+ the space is still in memory cache. */
+ space = fil_space_get_by_id(id);
+
+ if (space == NULL) {
+ mutex_exit(&fil_system->mutex);
+ return(0);
+ }
+
node = UT_LIST_GET_FIRST(space->chain);
/* It must be a single-table tablespace and we have not opened
@@ -2325,11 +2360,9 @@ try_again:
return(FALSE);
}
- ut_a(space);
+ ut_a(space->stop_new_ops);
ut_a(space->n_pending_ops == 0);
- space->is_being_deleted = TRUE;
-
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
node = UT_LIST_GET_FIRST(space->chain);
@@ -2372,12 +2405,26 @@ try_again:
rw_lock_x_lock(&space->latch);
#ifndef UNIV_HOTBACKUP
- /* Invalidate in the buffer pool all pages belonging to the
- tablespace. Since we have set space->is_being_deleted = TRUE, readahead
- or ibuf merge can no longer read more pages of this tablespace to the
- buffer pool. Thus we can clean the tablespace out of the buffer pool
- completely and permanently. The flag is_being_deleted also prevents
- fil_flush() from being applied to this tablespace. */
+ /* IMPORTANT: Because we have set space::stop_new_ops there
+ can't be any new ibuf merges, reads or flushes. We are here
+ because node::n_pending was zero above. However, it is still
+ possible to have pending read and write requests:
+
+ A read request can happen because the reader thread has
+ gone through the ::stop_new_ops check in buf_page_init_for_read()
+ before the flag was set and has not yet incremented ::n_pending
+ when we checked it above.
+
+ A write request can be issued any time because we don't check
+ the ::stop_new_ops flag when queueing a block for write.
+
+ We deal with pending write requests in the following function
+ where we'd minimally evict all dirty pages belonging to this
+ space from the flush_list. Not that if a block is IO-fixed
+ we'll wait for IO to complete.
+
+ To deal with potential read requests by checking the
+ ::stop_new_ops flag in fil_io() */
if (srv_lazy_drop_table) {
buf_LRU_mark_space_was_deleted(id);
@@ -2393,6 +2440,15 @@ try_again:
mutex_enter(&fil_system->mutex);
+ /* Double check the sanity of pending ops after reacquiring
+ the fil_system::mutex. */
+ if (fil_space_get_by_id(id)) {
+ ut_a(space->n_pending_ops == 0);
+ ut_a(UT_LIST_GET_LEN(space->chain) == 1);
+ node = UT_LIST_GET_FIRST(space->chain);
+ ut_a(node->n_pending == 0);
+ }
+
success = fil_space_free(id, TRUE);
mutex_exit(&fil_system->mutex);
@@ -2450,7 +2506,7 @@ fil_tablespace_is_being_deleted(
ut_a(space != NULL);
- is_being_deleted = space->is_being_deleted;
+ is_being_deleted = space->stop_new_ops;
mutex_exit(&fil_system->mutex);
@@ -2710,7 +2766,7 @@ retry:
mutex_exit(&fil_system->mutex);
#ifndef UNIV_HOTBACKUP
- if (success) {
+ if (success && !recv_recovery_on) {
mtr_t mtr;
mtr_start(&mtr);
@@ -4531,7 +4587,7 @@ fil_tablespace_deleted_or_being_deleted_in_mem(
space = fil_space_get_by_id(id);
- if (space == NULL || space->is_being_deleted) {
+ if (space == NULL || space->stop_new_ops) {
mutex_exit(&fil_system->mutex);
return(TRUE);
@@ -4809,6 +4865,24 @@ fil_extend_space_to_desired_size(
start_page_no = space->size;
file_start_page_no = space->size - node->size;
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ offset_high = size_after_extend * page_size / (4ULL*1024*1024*1024);
+ offset_low = size_after_extend * page_size % (4ULL*1024*1024*1024);
+
+ mutex_exit(&fil_system->mutex);
+ success = os_file_set_size(node->name, node->handle,
+ offset_low, offset_high);
+ mutex_enter(&fil_system->mutex);
+ if (success) {
+ node->size += (size_after_extend - start_page_no);
+ space->size += (size_after_extend - start_page_no);
+ os_has_said_disk_full = FALSE;
+ }
+ goto complete_io;
+ }
+#endif
+
/* Extend at most 64 pages at a time */
buf_size = ut_min(64, size_after_extend - start_page_no) * page_size;
buf2 = mem_alloc(buf_size + page_size);
@@ -4865,6 +4939,10 @@ fil_extend_space_to_desired_size(
mem_free(buf2);
+#ifdef HAVE_POSIX_FALLOCATE
+complete_io:
+#endif
+
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
*actual_size = space->size;
@@ -5271,7 +5349,9 @@ _fil_io(
space = fil_space_get_by_id(space_id);
- if (!space) {
+ /* If we are deleting a tablespace we don't allow any read
+ operations on that. However, we do allow write operations. */
+ if (!space || (type == OS_FILE_READ && space->stop_new_ops)) {
mutex_exit(&fil_system->mutex);
ut_print_timestamp(stderr);
@@ -5362,8 +5442,8 @@ _fil_io(
/* Do aio */
- ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
- ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
+ ut_a(byte_offset % OS_MIN_LOG_BLOCK_SIZE == 0);
+ ut_a((len % OS_MIN_LOG_BLOCK_SIZE) == 0);
if (srv_pass_corrupt_table == 1 && space->is_corrupt) {
/* should ignore i/o for the crashed space */
@@ -5551,7 +5631,7 @@ fil_aio_wait(
&& ((buf_page_t*)message)->space_was_being_deleted) {
/* intended not to be uncompress read page */
- ut_a(buf_page_get_io_fix(message) == BUF_IO_WRITE
+ ut_a(buf_page_get_io_fix_unlocked(message) == BUF_IO_WRITE
|| !buf_page_get_zip_size(message)
|| buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);
@@ -5612,7 +5692,7 @@ fil_flush(
space = fil_space_get_by_id(space_id);
- if (!space || space->is_being_deleted) {
+ if (!space || space->stop_new_ops) {
mutex_exit(&fil_system->mutex);
return;
@@ -5743,7 +5823,7 @@ fil_flush_file_spaces(
space;
space = UT_LIST_GET_NEXT(unflushed_spaces, space)) {
- if (space->purpose == purpose && !space->is_being_deleted) {
+ if (space->purpose == purpose && !space->stop_new_ops) {
space_ids[n_space_ids++] = space->id;
}
@@ -5982,3 +6062,26 @@ fil_space_set_corrupt(
mutex_exit(&fil_system->mutex);
}
+/****************************************************************//**
+Generate redo logs for swapping two .ibd files */
+UNIV_INTERN
+void
+fil_mtr_rename_log(
+/*===============*/
+ ulint old_space_id, /*!< in: tablespace id of the old
+ table. */
+ const char* old_name, /*!< in: old table name */
+ ulint new_space_id, /*!< in: tablespace id of the new
+ table */
+ const char* new_name, /*!< in: new table name */
+ const char* tmp_name) /*!< in: temp table name used while
+ swapping */
+{
+ mtr_t mtr;
+ mtr_start(&mtr);
+ fil_op_write_log(MLOG_FILE_RENAME, old_space_id,
+ 0, 0, old_name, tmp_name, &mtr);
+ fil_op_write_log(MLOG_FILE_RENAME, new_space_id,
+ 0, 0, new_name, old_name, &mtr);
+ mtr_commit(&mtr);
+}
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 12f6f5134d2..8b824bc994d 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -85,6 +85,7 @@ extern "C" {
#include "row0sel.h"
#include "row0upd.h"
#include "log0log.h"
+#include "log0online.h"
#include "lock0lock.h"
#include "dict0crea.h"
#include "btr0cur.h"
@@ -185,6 +186,8 @@ static my_bool innobase_file_format_check = TRUE;
static my_bool innobase_log_archive = FALSE;
static char* innobase_log_arch_dir = NULL;
#endif /* UNIV_LOG_ARCHIVE */
+static my_bool innobase_use_atomic_writes = FALSE;
+static my_bool innobase_use_fallocate = TRUE;
static my_bool innobase_use_doublewrite = TRUE;
static my_bool innobase_use_checksums = TRUE;
static my_bool innobase_fast_checksum = FALSE;
@@ -297,6 +300,7 @@ static PSI_mutex_info all_innodb_mutexes[] = {
{&ibuf_pessimistic_insert_mutex_key,
"ibuf_pessimistic_insert_mutex", 0},
{&kernel_mutex_key, "kernel_mutex", 0},
+ {&log_bmp_sys_mutex_key, "log_bmp_sys_mutex", 0},
{&log_sys_mutex_key, "log_sys_mutex", 0},
# ifdef UNIV_MEM_DEBUG
{&mem_hash_mutex_key, "mem_hash_mutex", 0},
@@ -437,6 +441,25 @@ uint
innobase_alter_table_flags(
/*=======================*/
uint flags);
+/************************************************************//**
+Synchronously read and parse the redo log up to the last
+checkpoint to write the changed page bitmap.
+@return 0 to indicate success. Current implementation cannot fail. */
+static
+my_bool
+innobase_flush_changed_page_bitmaps() __attribute__((unused));
+/*==================================*/
+/************************************************************//**
+Delete all the bitmap files for data less than the specified LSN.
+If called with lsn == 0 (i.e. set by RESET request) or
+IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise
+continue it.
+@return 0 to indicate success, 1 for failure. */
+static
+my_bool
+innobase_purge_changed_page_bitmaps(
+/*================================*/
+ ulonglong lsn) __attribute__((unused)); /*!< in: LSN to purge files up to */
static const char innobase_hton_name[]= "InnoDB";
@@ -688,8 +711,12 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_background_log_sync, SHOW_LONG},
{"buffer_pool_pages_data",
(char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
+ {"buffer_pool_bytes_data",
+ (char*) &export_vars.innodb_buffer_pool_bytes_data, SHOW_LONG},
{"buffer_pool_pages_dirty",
(char*) &export_vars.innodb_buffer_pool_pages_dirty, SHOW_LONG},
+ {"buffer_pool_bytes_dirty",
+ (char*) &export_vars.innodb_buffer_pool_bytes_dirty, SHOW_LONG},
{"buffer_pool_pages_flushed",
(char*) &export_vars.innodb_buffer_pool_pages_flushed, SHOW_LONG},
{"buffer_pool_pages_LRU_flushed",
@@ -870,6 +897,12 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_x_lock_spin_rounds, SHOW_LONGLONG},
{"x_lock_spin_waits",
(char*) &export_vars.innodb_x_lock_spin_waits, SHOW_LONGLONG},
+#ifdef UNIV_DEBUG
+ {"purge_trx_id_age",
+ (char*) &export_vars.innodb_purge_trx_id_age, SHOW_LONG},
+ {"purge_view_trx_id_age",
+ (char*) &export_vars.innodb_purge_view_trx_id_age, SHOW_LONG},
+#endif /* UNIV_DEBUG */
{NullS, NullS, SHOW_LONG}
};
@@ -1219,11 +1252,23 @@ convert_error_code_to_mysql(
case DB_TABLE_NOT_FOUND:
return(HA_ERR_NO_SUCH_TABLE);
- case DB_TOO_BIG_RECORD:
- my_error(ER_TOO_BIG_ROWSIZE, MYF(0),
- page_get_free_space_of_empty(flags
- & DICT_TF_COMPACT) / 2);
+ case DB_TOO_BIG_RECORD: {
+ /* If prefix is true then a 768-byte prefix is stored
+ locally for BLOB fields. Refer to dict_table_get_format() */
+ bool prefix = ((flags & DICT_TF_FORMAT_MASK)
+ >> DICT_TF_FORMAT_SHIFT) < UNIV_FORMAT_B;
+ my_printf_error(ER_TOO_BIG_ROWSIZE,
+ "Row size too large (> %lu). Changing some columns "
+ "to TEXT or BLOB %smay help. In current row "
+ "format, BLOB prefix of %d bytes is stored inline.",
+ MYF(0),
+ page_get_free_space_of_empty(flags &
+ DICT_TF_COMPACT) / 2,
+ prefix ? "or using ROW_FORMAT=DYNAMIC "
+ "or ROW_FORMAT=COMPRESSED ": "",
+ prefix ? DICT_MAX_FIXED_COL_LEN : 0);
return(HA_ERR_TO_BIG_ROW);
+ }
case DB_TOO_BIG_INDEX_COL:
my_error(ER_INDEX_COLUMN_TOO_LONG, MYF(0),
@@ -1262,6 +1307,8 @@ convert_error_code_to_mysql(
return(HA_ERR_INDEX_CORRUPT);
case DB_UNDO_RECORD_TOO_BIG:
return(HA_ERR_UNDO_REC_TOO_BIG);
+ case DB_OUT_OF_MEMORY:
+ return(HA_ERR_OUT_OF_MEM);
}
}
@@ -1439,16 +1486,6 @@ innobase_get_lower_case_table_names(void)
return(lower_case_table_names);
}
-#if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
-extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
-/*******************************************************************//**
-Map an OS error to an errno value. The OS error number is stored in
-_doserrno and the mapped value is stored in errno) */
-extern "C"
-void __cdecl
-_dosmaperr(
- unsigned long); /*!< in: OS error value */
-
/*********************************************************************//**
Creates a temporary file.
@return temporary file descriptor, or < 0 on error */
@@ -1457,92 +1494,16 @@ int
innobase_mysql_tmpfile(void)
/*========================*/
{
- int fd; /* handle of opened file */
- HANDLE osfh; /* OS handle of opened file */
- char* tmpdir; /* point to the directory
- where to create file */
- TCHAR path_buf[MAX_PATH - 14]; /* buffer for tmp file path.
- The length cannot be longer
- than MAX_PATH - 14, or
- GetTempFileName will fail. */
- char filename[MAX_PATH]; /* name of the tmpfile */
- DWORD fileaccess = GENERIC_READ /* OS file access */
- | GENERIC_WRITE
- | DELETE;
- DWORD fileshare = FILE_SHARE_READ /* OS file sharing mode */
- | FILE_SHARE_WRITE
- | FILE_SHARE_DELETE;
- DWORD filecreate = CREATE_ALWAYS; /* OS method of open/create */
- DWORD fileattrib = /* OS file attribute flags */
- FILE_ATTRIBUTE_NORMAL
- | FILE_FLAG_DELETE_ON_CLOSE
- | FILE_ATTRIBUTE_TEMPORARY
- | FILE_FLAG_SEQUENTIAL_SCAN;
-
- DBUG_ENTER("innobase_mysql_tmpfile");
-
- tmpdir = my_tmpdir(&mysql_tmpdir_list);
-
- /* The tmpdir parameter can not be NULL for GetTempFileName. */
- if (!tmpdir) {
- uint ret;
-
- /* Use GetTempPath to determine path for temporary files. */
- ret = GetTempPath(sizeof(path_buf), path_buf);
- if (ret > sizeof(path_buf) || (ret == 0)) {
-
- _dosmaperr(GetLastError()); /* map error */
- DBUG_RETURN(-1);
- }
-
- tmpdir = path_buf;
- }
-
- /* Use GetTempFileName to generate a unique filename. */
- if (!GetTempFileName(tmpdir, "ib", 0, filename)) {
-
- _dosmaperr(GetLastError()); /* map error */
- DBUG_RETURN(-1);
- }
-
- DBUG_PRINT("info", ("filename: %s", filename));
-
- /* Open/Create the file. */
- osfh = CreateFile(filename, fileaccess, fileshare, NULL,
- filecreate, fileattrib, NULL);
- if (osfh == INVALID_HANDLE_VALUE) {
-
- /* open/create file failed! */
- _dosmaperr(GetLastError()); /* map error */
- DBUG_RETURN(-1);
- }
-
- do {
- /* Associates a CRT file descriptor with the OS file handle. */
- fd = _open_osfhandle((intptr_t) osfh, 0);
- } while (fd == -1 && errno == EINTR);
+ int fd2 = -1;
+ File fd;
- if (fd == -1) {
- /* Open failed, close the file handle. */
+ DBUG_EXECUTE_IF(
+ "innobase_tmpfile_creation_failure",
+ return(-1);
+ );
- _dosmaperr(GetLastError()); /* map error */
- CloseHandle(osfh); /* no need to check if
- CloseHandle fails */
- }
+ fd = mysql_tmpfile("ib");
- DBUG_RETURN(fd);
-}
-#else
-/*********************************************************************//**
-Creates a temporary file.
-@return temporary file descriptor, or < 0 on error */
-extern "C" UNIV_INTERN
-int
-innobase_mysql_tmpfile(void)
-/*========================*/
-{
- int fd2 = -1;
- File fd = mysql_tmpfile("ib");
if (fd >= 0) {
/* Copy the file descriptor, so that the additional resources
allocated by create_temp_file() can be freed by invoking
@@ -1586,7 +1547,6 @@ innobase_mysql_tmpfile(void)
}
return(fd2);
}
-#endif /* defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN) */
/*********************************************************************//**
Wrapper around MySQL's copy_and_convert function.
@@ -1702,10 +1662,13 @@ innobase_next_autoinc(
offset = 0;
}
- /* Check for overflow. */
+ /* Check for overflow. Current can be > max_value if the value is
+ in reality a negative value.The visual studio compilers converts
+ large double values automatically into unsigned long long datatype
+ maximum value */
if (block >= max_value
|| offset > max_value
- || current == max_value
+ || current >= max_value
|| max_value - offset <= offset) {
next_value = max_value;
@@ -1778,7 +1741,7 @@ innobase_trx_init(
trx->fake_changes = THDVAR(thd, fake_changes);
#ifdef EXTENDED_SLOWLOG
- if (thd_log_slow_verbosity(thd) & SLOG_V_INNODB) {
+ if (thd_log_slow_verbosity(thd) & (1ULL << SLOG_V_INNODB)) {
trx->take_stats = TRUE;
} else {
trx->take_stats = FALSE;
@@ -2599,6 +2562,13 @@ skip_overwrite:
}
+/****************************************************************//**
+Gives the file extension of an InnoDB single-table tablespace. */
+static const char* ha_innobase_exts[] = {
+ ".ibd",
+ NullS
+};
+
/*********************************************************************//**
Opens an InnoDB database.
@return 0 on success, error code on failure */
@@ -2648,6 +2618,9 @@ innobase_init(
innobase_hton->alter_table_flags = innobase_alter_table_flags;
innobase_hton->kill_query = innobase_kill_query;
+ if (srv_file_per_table)
+ innobase_hton->tablefile_extensions = ha_innobase_exts;
+
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
#ifndef DBUG_OFF
@@ -2717,6 +2690,7 @@ innobase_init(
} else {
srv_log_block_size = 512;
}
+ ut_ad (srv_log_block_size >= OS_MIN_LOG_BLOCK_SIZE);
if (!srv_log_block_size) {
fprintf(stderr,
@@ -3107,6 +3081,38 @@ innobase_change_buffering_inited_ok:
srv_kill_idle_transaction = 0;
#endif
+#ifdef HAVE_POSIX_FALLOCATE
+ srv_use_posix_fallocate = (ibool) innobase_use_fallocate;
+#endif
+ srv_use_atomic_writes = (ibool) innobase_use_atomic_writes;
+ if (innobase_use_atomic_writes) {
+ fprintf(stderr, "InnoDB: using atomic writes.\n");
+
+ /* Force doublewrite buffer off, atomic writes replace it. */
+ if (srv_use_doublewrite_buf) {
+ fprintf(stderr, "InnoDB: Switching off doublewrite buffer "
+ "because of atomic writes.\n");
+ innobase_use_doublewrite = srv_use_doublewrite_buf = FALSE;
+ }
+
+ /* Force O_DIRECT on Unixes (on Windows writes are always unbuffered)*/
+#ifndef _WIN32
+ if(!innobase_file_flush_method ||
+ !strstr(innobase_file_flush_method, "O_DIRECT")) {
+ innobase_file_flush_method =
+ srv_file_flush_method_str = (char*)"O_DIRECT";
+ fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n");
+ }
+#endif
+#ifdef HAVE_POSIX_FALLOCATE
+ /* Due to a bug in directFS, using atomics needs
+ * posix_fallocate to extend the file
+ * pwrite() past end of the file won't work
+ */
+ srv_use_posix_fallocate = TRUE;
+#endif
+ }
+
#ifdef HAVE_PSI_INTERFACE
/* Register keys with MySQL performance schema */
if (PSI_server) {
@@ -3267,6 +3273,36 @@ innobase_alter_table_flags(
| HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE);
}
+/************************************************************//**
+Synchronously read and parse the redo log up to the last
+checkpoint to write the changed page bitmap.
+@return 0 to indicate success. Current implementation cannot fail. */
+static
+my_bool
+innobase_flush_changed_page_bitmaps()
+/*=================================*/
+{
+ if (srv_track_changed_pages) {
+ os_event_reset(srv_checkpoint_completed_event);
+ log_online_follow_redo_log();
+ }
+ return FALSE;
+}
+
+/************************************************************//**
+Delete all the bitmap files for data less than the specified LSN.
+If called with lsn == IB_ULONGLONG_MAX (i.e. set by RESET request),
+restart the bitmap file sequence, otherwise continue it.
+@return 0 to indicate success, 1 for failure. */
+static
+my_bool
+innobase_purge_changed_page_bitmaps(
+/*================================*/
+ ulonglong lsn) /*!< in: LSN to purge files up to */
+{
+ return (my_bool)log_online_purge_changed_page_bitmaps(lsn);
+}
+
/****************************************************************//**
Copy the current replication position from MySQL to a transaction. */
static
@@ -3330,7 +3366,7 @@ innobase_commit_low(
header for undo purposes, see the comment at corresponding call
at innobase_xa_prepare(). */
- innobase_copy_repl_coords_to_trx(current_thd, trx);
+ innobase_copy_repl_coords_to_trx((THD *) trx->mysql_thd, trx);
trx_commit_for_mysql(trx);
}
@@ -4041,13 +4077,6 @@ ha_innobase::table_flags() const
}
/****************************************************************//**
-Gives the file extension of an InnoDB single-table tablespace. */
-static const char* ha_innobase_exts[] = {
- ".ibd",
- NullS
-};
-
-/****************************************************************//**
Returns the index type. */
UNIV_INTERN
const char*
@@ -4060,17 +4089,6 @@ ha_innobase::index_type(
}
/****************************************************************//**
-Returns the table file name extension.
-@return file extension string */
-UNIV_INTERN
-const char**
-ha_innobase::bas_ext() const
-/*========================*/
-{
- return(ha_innobase_exts);
-}
-
-/****************************************************************//**
Returns the operations supported for indexes.
@return flags of supported operations */
UNIV_INTERN
@@ -10646,23 +10664,26 @@ ha_innobase::external_lock(
if (trx->n_mysql_tables_in_use == 0) {
#ifdef EXTENDED_SLOWLOG
- increment_thd_innodb_stats(thd,
- (unsigned long long) trx->id,
- trx->io_reads,
- trx->io_read,
- trx->io_reads_wait_timer,
- trx->lock_que_wait_timer,
- trx->innodb_que_wait_timer,
- trx->distinct_page_access);
-
- trx->io_reads = 0;
- trx->io_read = 0;
- trx->io_reads_wait_timer = 0;
- trx->lock_que_wait_timer = 0;
- trx->innodb_que_wait_timer = 0;
- trx->distinct_page_access = 0;
- if (trx->distinct_page_access_hash)
- memset(trx->distinct_page_access_hash, 0, DPAH_SIZE);
+ if (UNIV_UNLIKELY(trx->take_stats)) {
+ increment_thd_innodb_stats(thd,
+ (unsigned long long) trx->id,
+ trx->io_reads,
+ trx->io_read,
+ trx->io_reads_wait_timer,
+ trx->lock_que_wait_timer,
+ trx->innodb_que_wait_timer,
+ trx->distinct_page_access);
+
+ trx->io_reads = 0;
+ trx->io_read = 0;
+ trx->io_reads_wait_timer = 0;
+ trx->lock_que_wait_timer = 0;
+ trx->innodb_que_wait_timer = 0;
+ trx->distinct_page_access = 0;
+ if (trx->distinct_page_access_hash)
+ memset(trx->distinct_page_access_hash, 0,
+ DPAH_SIZE);
+ }
#endif
trx->mysql_n_tables_locked = 0;
@@ -12740,7 +12761,8 @@ static MYSQL_SYSVAR_ULONG(page_size, innobase_page_size,
static MYSQL_SYSVAR_ULONG(log_block_size, innobase_log_block_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!",
- NULL, NULL, (1 << 9)/*512*/, (1 << 9)/*512*/, (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0);
+ NULL, NULL, (1 << 9)/*512*/, OS_MIN_LOG_BLOCK_SIZE,
+ (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0);
static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
PLUGIN_VAR_READONLY,
@@ -12764,6 +12786,20 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
"Disable with --skip-innodb-doublewrite.",
NULL, NULL, TRUE);
+static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Prevent partial page writes, via atomic writes."
+ "The option is used to prevent partial writes in case of a crash/poweroff, "
+ "as faster alternative to doublewrite buffer."
+ "Currently this option works only "
+ "on Linux only with FusionIO device, and directFS filesystem.",
+ NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.",
+ NULL, NULL, TRUE);
+
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG,
"Number of IOPs the server can do. Tunes the background IO rate",
@@ -13163,7 +13199,7 @@ static MYSQL_SYSVAR_ULONGLONG(max_bitmap_file_size, srv_max_bitmap_file_size,
"The maximum size of changed page bitmap files",
NULL, NULL, 100*1024*1024ULL, 4096ULL, ULONGLONG_MAX, 0);
-static MYSQL_SYSVAR_ULONGLONG(changed_pages_limit, srv_changed_pages_limit,
+static MYSQL_SYSVAR_ULONGLONG(max_changed_pages, srv_max_changed_pages,
PLUGIN_VAR_RQCMDARG,
"The maximum number of rows for "
"INFORMATION_SCHEMA.INNODB_CHANGED_PAGES table, "
@@ -13173,8 +13209,8 @@ static MYSQL_SYSVAR_ULONGLONG(changed_pages_limit, srv_changed_pages_limit,
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug,
PLUGIN_VAR_RQCMDARG,
- "Debug flags for InnoDB change buffering (0=none)",
- NULL, NULL, 0, 0, 1, 0);
+ "Debug flags for InnoDB change buffering (0=none, 2=crash at merge)",
+ NULL, NULL, 0, 0, 2, 0);
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
static MYSQL_SYSVAR_BOOL(random_read_ahead, srv_random_read_ahead,
@@ -13188,11 +13224,23 @@ static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
"trigger a readahead.",
NULL, NULL, 56, 0, 64, 0);
-#ifdef UNIV_DEBUG_never
+#ifdef UNIV_DEBUG
static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT,
"Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()",
NULL, NULL, 0, 0, 1024, 0);
+
+static MYSQL_SYSVAR_UINT(limit_optimistic_insert_debug,
+ btr_cur_limit_optimistic_insert_debug, PLUGIN_VAR_RQCMDARG,
+ "Artificially limit the number of records per B-tree page (0=unlimited).",
+ NULL, NULL, 0, 0, UINT_MAX32, 0);
+
+static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug,
+ srv_purge_view_update_only_debug, PLUGIN_VAR_NOCMDOPT,
+ "Pause actual purging any delete-marked records, but merely update the purge view. "
+ "It is to create artificially the situation the purge view have been updated "
+ "but the each purges were not done yet.",
+ NULL, NULL, FALSE);
#endif /* UNIV_DEBUG */
static MYSQL_SYSVAR_LONGLONG(ibuf_max_size, srv_ibuf_max_size,
@@ -13372,6 +13420,11 @@ static MYSQL_SYSVAR_BOOL(locking_fake_changes, srv_fake_changes_locks,
"not take any locks at all.",
NULL, NULL, TRUE);
+static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks,
+ PLUGIN_VAR_OPCMDARG,
+ "Print all deadlocks to MySQL error log (off by default)",
+ NULL, NULL, FALSE);
+
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(page_size),
MYSQL_SYSVAR(log_block_size),
@@ -13391,6 +13444,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(doublewrite_file),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
+ MYSQL_SYSVAR(use_atomic_writes),
+ MYSQL_SYSVAR(use_fallocate),
MYSQL_SYSVAR(recovery_stats),
MYSQL_SYSVAR(fast_shutdown),
MYSQL_SYSVAR(file_io_threads),
@@ -13464,7 +13519,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(change_buffering),
MYSQL_SYSVAR(track_changed_pages),
MYSQL_SYSVAR(max_bitmap_file_size),
- MYSQL_SYSVAR(changed_pages_limit),
+ MYSQL_SYSVAR(max_changed_pages),
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
MYSQL_SYSVAR(change_buffering_debug),
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
@@ -13476,14 +13531,17 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(purge_threads),
MYSQL_SYSVAR(purge_batch_size),
MYSQL_SYSVAR(rollback_segments),
-#ifdef UNIV_DEBUG_never /* disable this flag. --innodb-trx becomes ambiguous */
+#ifdef UNIV_DEBUG
MYSQL_SYSVAR(trx_rseg_n_slots_debug),
+ MYSQL_SYSVAR(limit_optimistic_insert_debug),
+ MYSQL_SYSVAR(trx_purge_view_update_only_debug),
#endif /* UNIV_DEBUG */
MYSQL_SYSVAR(corrupt_table_action),
MYSQL_SYSVAR(lazy_drop_table),
MYSQL_SYSVAR(fake_changes),
MYSQL_SYSVAR(locking_fake_changes),
MYSQL_SYSVAR(merge_sort_block_size),
+ MYSQL_SYSVAR(print_all_deadlocks),
NULL
};
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 359d0b95367..439be10fddb 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -81,12 +81,13 @@ class ha_innobase: public handler
uchar* upd_buf; /*!< buffer used in updates */
ulint upd_buf_size; /*!< the size of upd_buf in bytes */
- uchar srch_key_val1[REC_VERSION_56_MAX_INDEX_COL_LEN + 2];
- uchar srch_key_val2[REC_VERSION_56_MAX_INDEX_COL_LEN + 2];
+ uchar srch_key_val1[MAX_KEY_LENGTH + MAX_REF_PARTS*2];
+ uchar srch_key_val2[MAX_KEY_LENGTH + MAX_REF_PARTS*2];
/*!< buffers used in converting
search key values from MySQL format
- to InnoDB format. "+ 2" for the two
- bytes where the length is stored */
+ to InnoDB format. For each column
+ 2 bytes are used to store length,
+ hence MAX_REF_PARTS*2. */
Table_flags int_table_flags;
uint primary_key;
ulong start_of_scan; /*!< this is set to 1 when we are
@@ -124,7 +125,6 @@ class ha_innobase: public handler
enum row_type get_row_type() const;
const char* index_type(uint key_number);
- const char** bas_ext() const;
Table_flags table_flags() const;
ulong index_flags(uint idx, uint part, bool all_parts) const;
uint max_supported_keys() const;
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 0496cb98080..9886e8f6bd9 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -102,8 +102,6 @@ innobase_col_to_mysql(
ut_ad(flen >= len);
ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
>= DATA_MBMINLEN(col->mbminmaxlen));
- ut_ad(DATA_MBMAXLEN(col->mbminmaxlen)
- > DATA_MBMINLEN(col->mbminmaxlen) || flen == len);
memcpy(dest, data, len);
break;
@@ -113,13 +111,17 @@ innobase_col_to_mysql(
/* These column types should never be shipped to MySQL. */
ut_ad(0);
- case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_FLOAT:
case DATA_DOUBLE:
case DATA_DECIMAL:
/* Above are the valid column types for MySQL data. */
ut_ad(flen == len);
+ /* fall through */
+ case DATA_CHAR:
+ /* We may have flen > len when there is a shorter
+ prefix on a CHAR column. */
+ ut_ad(flen >= len);
#else /* UNIV_DEBUG */
default:
#endif /* UNIV_DEBUG */
@@ -152,7 +154,7 @@ innobase_rec_to_mysql(
field->reset();
- ipos = dict_index_get_nth_col_pos(index, i);
+ ipos = dict_index_get_nth_col_or_prefix_pos(index, i, TRUE);
if (UNIV_UNLIKELY(ipos == ULINT_UNDEFINED)) {
null_field:
@@ -309,7 +311,7 @@ innobase_check_index_keys(
}
}
- my_error(ER_WRONG_KEY_COLUMN, MYF(0),
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB",
field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
@@ -323,7 +325,7 @@ innobase_check_index_keys(
continue;
}
- my_error(ER_WRONG_KEY_COLUMN, MYF(0),
+ my_error(ER_WRONG_KEY_COLUMN, MYF(0), "InnoDB",
key_part1.field->field_name);
return(ER_WRONG_KEY_COLUMN);
}
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 4b33d6a780c..d64a95a969e 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -169,7 +169,8 @@ do { \
} \
} while (0)
-#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \
+ !defined __INTEL_COMPILER && !defined __clang__
#define STRUCT_FLD(name, value) name: value
#else
#define STRUCT_FLD(name, value) value
@@ -1209,7 +1210,7 @@ trx_i_s_common_fill_table(
DBUG_ENTER("trx_i_s_common_fill_table");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -1369,7 +1370,7 @@ i_s_cmp_fill_low(
DBUG_ENTER("i_s_cmp_fill_low");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -1641,7 +1642,7 @@ i_s_cmpmem_fill_low(
DBUG_ENTER("i_s_cmpmem_fill_low");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -2274,7 +2275,7 @@ i_s_innodb_buffer_stats_fill_table(
DBUG_ENTER("i_s_innodb_buffer_fill_general");
/* Only allow the PROCESS privilege holder to access the stats */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -2967,7 +2968,7 @@ i_s_innodb_buffer_page_fill_table(
DBUG_ENTER("i_s_innodb_buffer_page_fill_table");
/* deny access to user without PROCESS privilege */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -3512,7 +3513,7 @@ i_s_innodb_buf_page_lru_fill_table(
DBUG_ENTER("i_s_innodb_buf_page_lru_fill_table");
/* deny access to any users that do not hold PROCESS_ACL */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -3746,7 +3747,7 @@ i_s_sys_tables_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4049,7 +4050,7 @@ i_s_sys_tables_fill_table_stats(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4293,7 +4294,7 @@ i_s_sys_indexes_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4530,7 +4531,7 @@ i_s_sys_columns_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4732,7 +4733,7 @@ i_s_sys_fields_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4961,7 +4962,7 @@ i_s_sys_foreign_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5172,7 +5173,7 @@ i_s_sys_foreign_cols_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5387,7 +5388,7 @@ i_s_sys_stats_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5573,7 +5574,7 @@ i_s_innodb_rseg_fill(
DBUG_ENTER("i_s_innodb_rseg_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5797,7 +5798,7 @@ i_s_innodb_table_stats_fill(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5862,7 +5863,7 @@ i_s_innodb_index_stats_fill(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6054,7 +6055,7 @@ i_s_innodb_admin_command_fill(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6431,7 +6432,7 @@ i_s_innodb_buffer_pool_pages_fill(
DBUG_ENTER("i_s_innodb_buffer_pool_pages_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6536,7 +6537,7 @@ i_s_innodb_buffer_pool_pages_index_fill(
DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6605,7 +6606,7 @@ i_s_innodb_buffer_pool_pages_blob_fill(
DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -7009,7 +7010,7 @@ i_s_innodb_undo_logs_fill(
DBUG_ENTER("i_s_innodb_undo_logs_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -7335,7 +7336,7 @@ i_s_innodb_changed_pages_fill(
DBUG_ENTER("i_s_innodb_changed_pages_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -7356,8 +7357,8 @@ i_s_innodb_changed_pages_fill(
}
while(log_online_bitmap_iterator_next(&i) &&
- (!srv_changed_pages_limit ||
- output_rows_num < srv_changed_pages_limit) &&
+ (!srv_max_changed_pages ||
+ output_rows_num < srv_max_changed_pages) &&
/*
There is no need to compare both start LSN and end LSN fields
with maximum value. It's enough to compare only start LSN.
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c
index 77305e42fb1..96c264b32b4 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.c
+++ b/storage/xtradb/ibuf/ibuf0ibuf.c
@@ -2912,6 +2912,14 @@ ibuf_get_volume_buffered_count_func(
ut_a(len == 1);
ut_ad(trx_sys_multiple_tablespace_format);
+ if (rec_get_deleted_flag(rec, 0)) {
+ /* This record has been merged already,
+ but apparently the system crashed before
+ the change was discarded from the buffer.
+ Pretend that the record does not exist. */
+ return(0);
+ }
+
types = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len);
switch (UNIV_EXPECT(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
@@ -4224,11 +4232,11 @@ ibuf_delete(
page, 1);
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
page_cur_delete_rec(&page_cur, index, offsets, mtr);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
if (page_zip) {
@@ -4333,6 +4341,22 @@ ibuf_delete_rec(
ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no);
ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space);
+#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
+ if (ibuf_debug == 2) {
+ /* Inject a fault (crash). We do this before trying
+ optimistic delete, because a pessimistic delete in the
+ change buffer would require a larger test case. */
+
+ /* Flag the buffered record as processed, to avoid
+ an assertion failure after crash recovery. */
+ btr_cur_set_deleted_flag_for_ibuf(
+ btr_pcur_get_rec(pcur), NULL, TRUE, mtr);
+ ibuf_mtr_commit(mtr);
+ log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
+ DBUG_SUICIDE();
+ }
+#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
+
success = btr_cur_optimistic_delete(btr_pcur_get_btr_cur(pcur), mtr);
if (success) {
@@ -4367,7 +4391,13 @@ ibuf_delete_rec(
ut_ad(ibuf_rec_get_page_no(mtr, btr_pcur_get_rec(pcur)) == page_no);
ut_ad(ibuf_rec_get_space(mtr, btr_pcur_get_rec(pcur)) == space);
- /* We have to resort to a pessimistic delete from ibuf */
+ /* We have to resort to a pessimistic delete from ibuf.
+ Delete-mark the record so that it will not be applied again,
+ in case the server crashes before the pessimistic delete is
+ made persistent. */
+ btr_cur_set_deleted_flag_for_ibuf(
+ btr_pcur_get_rec(pcur), NULL, TRUE, mtr);
+
btr_pcur_store_position(pcur, mtr);
ibuf_btr_pcur_commit_specify_mtr(pcur, mtr);
@@ -4448,7 +4478,7 @@ ibuf_merge_or_delete_for_page(
ut_ad(!block || buf_block_get_space(block) == space);
ut_ad(!block || buf_block_get_page_no(block) == page_no);
ut_ad(!block || buf_block_get_zip_size(block) == zip_size);
- ut_ad(!block || buf_block_get_io_fix(block) == BUF_IO_READ);
+ ut_ad(!block || buf_block_get_io_fix_unlocked(block) == BUF_IO_READ);
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE
|| trx_sys_hdr_page(space, page_no)) {
@@ -4648,7 +4678,7 @@ loop:
fputs("InnoDB: Discarding record\n ", stderr);
rec_print_old(stderr, rec);
fputs("\nInnoDB: from the insert buffer!\n\n", stderr);
- } else if (block) {
+ } else if (block && !rec_get_deleted_flag(rec, 0)) {
/* Now we have at pcur a record which should be
applied on the index page; NOTE that the call below
copies pointers to fields in rec, and we must
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index cb44129aeb5..97929d44159 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -636,7 +636,7 @@ btr_cur_set_deleted_flag_for_ibuf(
when the tablespace is
uncompressed */
ibool val, /*!< in: value to set */
- mtr_t* mtr); /*!< in: mtr */
+ mtr_t* mtr); /*!< in/out: mini-transaction */
/*######################################################################*/
/** In the pessimistic delete, if the page data size drops below this
@@ -806,6 +806,11 @@ srv_printf_innodb_monitor(). */
extern ulint btr_cur_n_sea_old;
#endif /* !UNIV_HOTBACKUP */
+#ifdef UNIV_DEBUG
+/* Flag to limit optimistic insert records */
+extern uint btr_cur_limit_optimistic_insert_debug;
+#endif /* UNIV_DEBUG */
+
#ifndef UNIV_NONINL
#include "btr0cur.ic"
#endif
diff --git a/storage/xtradb/include/btr0cur.ic b/storage/xtradb/include/btr0cur.ic
index e31f77c77eb..5fc4651ca13 100644
--- a/storage/xtradb/include/btr0cur.ic
+++ b/storage/xtradb/include/btr0cur.ic
@@ -27,6 +27,16 @@ Created 10/16/1994 Heikki Tuuri
#include "btr0btr.h"
#ifdef UNIV_DEBUG
+# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)\
+if (btr_cur_limit_optimistic_insert_debug\
+ && (NREC) >= (ulint)btr_cur_limit_optimistic_insert_debug) {\
+ CODE;\
+}
+#else
+# define LIMIT_OPTIMISTIC_INSERT_DEBUG(NREC, CODE)
+#endif /* UNIV_DEBUG */
+
+#ifdef UNIV_DEBUG
/*********************************************************//**
Returns the page cursor component of a tree cursor.
@return pointer to page cursor component */
@@ -146,6 +156,9 @@ btr_cur_compress_recommendation(
page = btr_cur_get_page(cursor);
+ LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page) * 2,
+ return(FALSE));
+
if ((page_get_data_size(page) < BTR_CUR_PAGE_COMPRESS_LIMIT)
|| ((btr_page_get_next(page, mtr) == FIL_NULL)
&& (btr_page_get_prev(page, mtr) == FIL_NULL))) {
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index d48c7f0212f..e0d7a974fc3 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -199,6 +199,15 @@ struct buf_pool_info_struct{
typedef struct buf_pool_info_struct buf_pool_info_t;
+/** The occupied bytes of lists in all buffer pools */
+struct buf_pools_list_size_struct {
+ ulint LRU_bytes; /*!< LRU size in bytes */
+ ulint unzip_LRU_bytes; /*!< unzip_LRU size in bytes */
+ ulint flush_list_bytes; /*!< flush_list size in bytes */
+};
+
+typedef struct buf_pools_list_size_struct buf_pools_list_size_t;
+
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
Acquire mutex on all buffer pool instances */
@@ -958,7 +967,7 @@ buf_block_set_file_page(
ulint space, /*!< in: tablespace id */
ulint page_no);/*!< in: page number */
/*********************************************************************//**
-Gets the io_fix state of a block.
+Gets the io_fix state of a block. Requires that the block mutex is held.
@return io_fix state */
UNIV_INLINE
enum buf_io_fix
@@ -967,7 +976,17 @@ buf_page_get_io_fix(
const buf_page_t* bpage) /*!< in: pointer to the control block */
__attribute__((pure));
/*********************************************************************//**
-Gets the io_fix state of a block.
+Gets the io_fix state of a block. Does not assert that the block mutex is
+held, to be used in the cases where it is safe not to hold it.
+@return io_fix state */
+UNIV_INLINE
+enum buf_io_fix
+buf_page_get_io_fix_unlocked(
+/*=========================*/
+ const buf_page_t* bpage) /*!< in: pointer to the control block */
+ __attribute__((pure));
+/*********************************************************************//**
+Gets the io_fix state of a block. Requires that the block mutex is held.
@return io_fix state */
UNIV_INLINE
enum buf_io_fix
@@ -976,6 +995,16 @@ buf_block_get_io_fix(
const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure));
/*********************************************************************//**
+Gets the io_fix state of a block. Does not assert that the block mutex is
+held, to be used in the cases where it is safe not to hold it.
+@return io_fix state */
+UNIV_INLINE
+enum buf_io_fix
+buf_block_get_io_fix_unlocked(
+/*==========================*/
+ const buf_block_t* block) /*!< in: pointer to the control block */
+ __attribute__((pure));
+/*********************************************************************//**
Sets the io_fix state of a block. */
UNIV_INLINE
void
@@ -1054,8 +1083,7 @@ UNIV_INLINE
void
buf_page_set_accessed(
/*==================*/
- buf_page_t* bpage, /*!< in/out: control block */
- ulint time_ms) /*!< in: ut_time_ms() */
+ buf_page_t* bpage) /*!< in/out: control block */
__attribute__((nonnull));
/*********************************************************************//**
Gets the buf_block_t handle of a buffered file block if an uncompressed
@@ -1374,6 +1402,14 @@ buf_get_total_list_len(
ulint* free_len, /*!< out: length of all free lists */
ulint* flush_list_len);/*!< out: length of all flush lists */
/********************************************************************//**
+Get total list size in bytes from all buffer pools. */
+UNIV_INTERN
+void
+buf_get_total_list_size_in_bytes(
+/*=============================*/
+ buf_pools_list_size_t* buf_pools_list_size); /*!< out: list sizes
+ in all buffer pools */
+/********************************************************************//**
Get total buffer pool statistics. */
UNIV_INTERN
void
@@ -1548,10 +1584,11 @@ struct buf_page_struct{
to read this for heuristic
purposes without holding any
mutex or latch */
- unsigned access_time:32; /*!< time of first access, or
- 0 if the block was never accessed
- in the buffer pool */
/* @} */
+ unsigned access_time; /*!< time of first access, or
+ 0 if the block was never accessed
+ in the buffer pool. Protected by
+ block mutex */
ibool space_was_being_deleted;
ibool is_corrupt;
# if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
@@ -1741,6 +1778,8 @@ struct buf_pool_stat_struct{
young because the first access
was not long enough ago, in
buf_page_peek_if_too_old() */
+ ulint LRU_bytes; /*!< LRU size in bytes */
+ ulint flush_list_bytes;/*!< flush_list size in bytes */
};
/** Statistics of buddy blocks of a given size. */
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index 221f86d9d62..8d5c3edeef8 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -434,7 +434,7 @@ buf_block_set_file_page(
}
/*********************************************************************//**
-Gets the io_fix state of a block.
+Gets the io_fix state of a block. Requires that the block mutex is held.
@return io_fix state */
UNIV_INLINE
enum buf_io_fix
@@ -442,6 +442,20 @@ buf_page_get_io_fix(
/*================*/
const buf_page_t* bpage) /*!< in: pointer to the control block */
{
+ ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+ return buf_page_get_io_fix_unlocked(bpage);
+}
+
+/*********************************************************************//**
+Gets the io_fix state of a block. Does not assert that the block mutex is
+held, to be used in the cases where it is safe not to hold it.
+@return io_fix state */
+UNIV_INLINE
+enum buf_io_fix
+buf_page_get_io_fix_unlocked(
+/*=========================*/
+ const buf_page_t* bpage) /*!< in: pointer to the control block */
+{
enum buf_io_fix io_fix = (enum buf_io_fix) bpage->io_fix;
#ifdef UNIV_DEBUG
switch (io_fix) {
@@ -457,7 +471,7 @@ buf_page_get_io_fix(
}
/*********************************************************************//**
-Gets the io_fix state of a block.
+Gets the io_fix state of a block. Requires that the block mutex is held.
@return io_fix state */
UNIV_INLINE
enum buf_io_fix
@@ -469,6 +483,19 @@ buf_block_get_io_fix(
}
/*********************************************************************//**
+Gets the io_fix state of a block. Does not assert that the block mutex is
+held, to be used in the cases where it is safe not to hold it.
+@return io_fix state */
+UNIV_INLINE
+enum buf_io_fix
+buf_block_get_io_fix_unlocked(
+/*==========================*/
+ const buf_block_t* block) /*!< in: pointer to the control block */
+{
+ return(buf_page_get_io_fix_unlocked(&block->page));
+}
+
+/*********************************************************************//**
Sets the io_fix state of a block. */
UNIV_INLINE
void
@@ -638,19 +665,18 @@ UNIV_INLINE
void
buf_page_set_accessed(
/*==================*/
- buf_page_t* bpage, /*!< in/out: control block */
- ulint time_ms) /*!< in: ut_time_ms() */
+ buf_page_t* bpage) /*!< in/out: control block */
{
#ifdef UNIV_DEBUG
- //buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
- //ut_ad(buf_pool_mutex_own(buf_pool));
-#endif
+ buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
+ ut_ad(!buf_pool_mutex_own(buf_pool));
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
+#endif
ut_a(buf_page_in_file(bpage));
if (!bpage->access_time) {
/* Make this the time of the first access. */
- bpage->access_time = time_ms;
+ bpage->access_time = ut_time_ms();
}
}
diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h
index efaa758f27a..2ea4f9b1ecf 100644
--- a/storage/xtradb/include/buf0lru.h
+++ b/storage/xtradb/include/buf0lru.h
@@ -158,7 +158,10 @@ buf_LRU_block_free_non_file_page(
buf_block_t* block, /*!< in: block, must not contain a file page */
ibool have_page_hash_mutex);
/******************************************************************//**
-Adds a block to the LRU list. */
+Adds a block to the LRU list. Please make sure that the zip_size is
+already set into the page zip when invoking the function, so that we
+can get correct zip_size from the buffer page when adding a block
+into LRU */
UNIV_INTERN
void
buf_LRU_add_block(
diff --git a/storage/xtradb/include/data0type.ic b/storage/xtradb/include/data0type.ic
index 757dd815c5e..7ec2cb6cf36 100644
--- a/storage/xtradb/include/data0type.ic
+++ b/storage/xtradb/include/data0type.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 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 the Free Software
@@ -459,36 +459,18 @@ dtype_get_fixed_size_low(
} else if (!comp) {
return(len);
} else {
- /* We play it safe here and ask MySQL for
- mbminlen and mbmaxlen. Although
- mbminlen and mbmaxlen are
- initialized if and only if prtype
- is (in one of the 3 functions in this file),
- it could be that none of these functions
- has been called. */
-
+#ifdef UNIV_DEBUG
ulint i_mbminlen, i_mbmaxlen;
innobase_get_cset_width(
dtype_get_charset_coll(prtype),
&i_mbminlen, &i_mbmaxlen);
- if (UNIV_UNLIKELY
- (DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen)
- != mbminmaxlen)) {
-
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: "
- "mbminlen=%lu, "
- "mbmaxlen=%lu, "
- "type->mbminlen=%lu, "
- "type->mbmaxlen=%lu\n",
- (ulong) i_mbminlen,
- (ulong) i_mbmaxlen,
- (ulong) DATA_MBMINLEN(mbminmaxlen),
- (ulong) DATA_MBMAXLEN(mbminmaxlen));
- }
- if (i_mbminlen == i_mbmaxlen) {
+ ut_ad(DATA_MBMINMAXLEN(i_mbminlen, i_mbmaxlen)
+ == mbminmaxlen);
+#endif /* UNIV_DEBUG */
+ if (DATA_MBMINLEN(mbminmaxlen)
+ == DATA_MBMAXLEN(mbminmaxlen)) {
return(len);
}
}
diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h
index de3605b1dfb..1dd0b3f5082 100644
--- a/storage/xtradb/include/dict0dict.h
+++ b/storage/xtradb/include/dict0dict.h
@@ -903,7 +903,7 @@ dict_index_get_nth_col_no(
Looks for column n in an index.
@return position in internal representation of the index;
ULINT_UNDEFINED if not contained */
-UNIV_INLINE
+UNIV_INTERN
ulint
dict_index_get_nth_col_pos(
/*=======================*/
diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic
index 02eafcc5d9c..eeb916fe181 100644
--- a/storage/xtradb/include/dict0dict.ic
+++ b/storage/xtradb/include/dict0dict.ic
@@ -697,20 +697,6 @@ dict_index_get_nth_col_no(
return(dict_col_get_no(dict_index_get_nth_col(index, pos)));
}
-/********************************************************************//**
-Looks for column n in an index.
-@return position in internal representation of the index;
-ULINT_UNDEFINED if not contained */
-UNIV_INLINE
-ulint
-dict_index_get_nth_col_pos(
-/*=======================*/
- const dict_index_t* index, /*!< in: index */
- ulint n) /*!< in: column number */
-{
- return(dict_index_get_nth_col_or_prefix_pos(index, n, FALSE));
-}
-
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
Returns the minimum data size of an index record.
diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h
index 54593a0b9c7..630942ae2ac 100644
--- a/storage/xtradb/include/dict0mem.h
+++ b/storage/xtradb/include/dict0mem.h
@@ -377,10 +377,15 @@ struct dict_index_struct{
unsigned type:DICT_IT_BITS;
/*!< index type (DICT_CLUSTERED, DICT_UNIQUE,
DICT_UNIVERSAL, DICT_IBUF, DICT_CORRUPT) */
- unsigned trx_id_offset:10;/*!< position of the trx id column
+#define MAX_KEY_LENGTH_BITS 12
+ unsigned trx_id_offset:MAX_KEY_LENGTH_BITS;
+ /*!< position of the trx id column
in a clustered index record, if the fields
before it are known to be of a fixed size,
0 otherwise */
+#if (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
+# error (1<<MAX_KEY_LENGTH_BITS) < MAX_KEY_LENGTH
+#endif
unsigned n_user_defined_cols:10;
/*!< number of columns the user defined to
be in the index: in the internal
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 7da62e68e56..2149d0aadca 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -776,6 +776,21 @@ fil_space_set_corrupt(
/*==================*/
ulint space_id);
+/****************************************************************//**
+Generate redo logs for swapping two .ibd files */
+UNIV_INTERN
+void
+fil_mtr_rename_log(
+/*===============*/
+ ulint old_space_id, /*!< in: tablespace id of the old
+ table. */
+ const char* old_name, /*!< in: old table name */
+ ulint new_space_id, /*!< in: tablespace id of the new
+ table */
+ const char* new_name, /*!< in: new table name */
+ const char* tmp_name); /*!< in: temp table name used while
+ swapping */
+
typedef struct fil_space_struct fil_space_t;
#endif
diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h
index ea636f985b4..2b659ab417e 100644
--- a/storage/xtradb/include/lock0lock.h
+++ b/storage/xtradb/include/lock0lock.h
@@ -798,14 +798,22 @@ lock_rec_get_page_no(
remains set when the waiting lock is granted,
or if the lock is inherited to a neighboring
record */
-#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_MODE_MASK
+#define LOCK_CONV_BY_OTHER 4096 /*!< this bit is set when the lock is created
+ by other transaction */
+#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_MODE_MASK
# error
#endif
-#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION)&LOCK_TYPE_MASK
+#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_CONV_BY_OTHER)&LOCK_TYPE_MASK
# error
#endif
/* @} */
+/** Checks if this is a waiting lock created by lock->trx itself.
+@param type_mode lock->type_mode
+@return whether it is a waiting lock belonging to lock->trx */
+#define lock_is_wait_not_by_other(type_mode) \
+ ((type_mode & (LOCK_CONV_BY_OTHER | LOCK_WAIT)) == LOCK_WAIT)
+
/** Lock operation struct */
typedef struct lock_op_struct lock_op_t;
/** Lock operation struct */
diff --git a/storage/xtradb/include/log0online.h b/storage/xtradb/include/log0online.h
index e7c3f301e45..999a317780e 100644
--- a/storage/xtradb/include/log0online.h
+++ b/storage/xtradb/include/log0online.h
@@ -41,23 +41,51 @@ typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t;
Initializes the online log following subsytem. */
UNIV_INTERN
void
-log_online_read_init();
-/*===================*/
+log_online_read_init(void);
+/*=======================*/
/*********************************************************************//**
Shuts down the online log following subsystem. */
UNIV_INTERN
void
-log_online_read_shutdown();
-/*=======================*/
+log_online_read_shutdown(void);
+/*===========================*/
/*********************************************************************//**
Reads and parses the redo log up to last checkpoint LSN to build the changed
-page bitmap which is then written to disk. */
+page bitmap which is then written to disk.
+
+@return TRUE if log tracking succeeded, FALSE if bitmap write I/O error */
UNIV_INTERN
-void
-log_online_follow_redo_log();
-/*=========================*/
+ibool
+log_online_follow_redo_log(void);
+/*=============================*/
+
+/************************************************************//**
+Delete all the bitmap files for data less than the specified LSN.
+If called with lsn == 0 (i.e. set by RESET request) or
+IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise
+continue it.
+
+@return FALSE to indicate success, TRUE for failure. */
+UNIV_INTERN
+ibool
+log_online_purge_changed_page_bitmaps(
+/*==================================*/
+ ib_uint64_t lsn); /*!<in: LSN to purge files up to */
+
+/************************************************************//**
+Delete all the bitmap files for data less than the specified LSN.
+If called with lsn == 0 (i.e. set by RESET request) or
+IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise
+continue it.
+
+@return FALSE to indicate success, TRUE for failure. */
+UNIV_INTERN
+ibool
+log_online_purge_changed_page_bitmaps(
+/*==================================*/
+ ib_uint64_t lsn); /*!<in: LSN to purge files up to */
#define LOG_BITMAP_ITERATOR_START_LSN(i) \
((i).start_lsn)
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index 4c795d93141..05403a8e752 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -190,6 +190,8 @@ extern ulint os_n_file_reads;
extern ulint os_n_file_writes;
extern ulint os_n_fsyncs;
+#define OS_MIN_LOG_BLOCK_SIZE 512
+
extern ulint srv_log_block_size;
#ifdef UNIV_PFS_IO
diff --git a/storage/xtradb/include/page0zip.h b/storage/xtradb/include/page0zip.h
index fe3d2e52e0b..23a2cac618b 100644
--- a/storage/xtradb/include/page0zip.h
+++ b/storage/xtradb/include/page0zip.h
@@ -156,9 +156,10 @@ page_zip_validate_low(
/*==================*/
const page_zip_des_t* page_zip,/*!< in: compressed page */
const page_t* page, /*!< in: uncompressed page */
+ const dict_index_t* index, /*!< in: index of the page, if known */
ibool sloppy) /*!< in: FALSE=strict,
TRUE=ignore the MIN_REC_FLAG */
- __attribute__((nonnull));
+ __attribute__((nonnull(1,2)));
/**********************************************************************//**
Check that the compressed and decompressed pages match. */
UNIV_INTERN
@@ -166,8 +167,9 @@ ibool
page_zip_validate(
/*==============*/
const page_zip_des_t* page_zip,/*!< in: compressed page */
- const page_t* page) /*!< in: uncompressed page */
- __attribute__((nonnull));
+ const page_t* page, /*!< in: uncompressed page */
+ const dict_index_t* index) /*!< in: index of the page, if known */
+ __attribute__((nonnull(1,2)));
#endif /* UNIV_ZIP_DEBUG */
/**********************************************************************//**
diff --git a/storage/xtradb/include/rem0rec.h b/storage/xtradb/include/rem0rec.h
index 10b74d18c13..98bf889b996 100644
--- a/storage/xtradb/include/rem0rec.h
+++ b/storage/xtradb/include/rem0rec.h
@@ -362,24 +362,6 @@ rec_get_offsets_func(
rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__)
/******************************************************//**
-Determine the offset to each field in a leaf-page record
-in ROW_FORMAT=COMPACT. This is a special case of
-rec_init_offsets() and rec_get_offsets_func(). */
-UNIV_INTERN
-void
-rec_init_offsets_comp_ordinary(
-/*===========================*/
- const rec_t* rec, /*!< in: physical record in
- ROW_FORMAT=COMPACT */
- ulint extra, /*!< in: number of bytes to reserve
- between the record header and
- the data payload
- (usually REC_N_NEW_EXTRA_BYTES) */
- const dict_index_t* index, /*!< in: record descriptor */
- ulint* offsets);/*!< in/out: array of offsets;
- in: n=rec_offs_n_fields(offsets) */
-
-/******************************************************//**
The following function determines the offsets to each field
in the record. It can reuse a previously allocated array. */
UNIV_INTERN
@@ -644,8 +626,48 @@ rec_copy(
/*=====*/
void* buf, /*!< in: buffer */
const rec_t* rec, /*!< in: physical record */
- const ulint* offsets);/*!< in: array returned by rec_get_offsets() */
+ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */
+ __attribute__((nonnull));
#ifndef UNIV_HOTBACKUP
+/**********************************************************//**
+Determines the size of a data tuple prefix in a temporary file.
+@return total size */
+UNIV_INTERN
+ulint
+rec_get_converted_size_temp(
+/*========================*/
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint* extra) /*!< out: extra size */
+ __attribute__((warn_unused_result, nonnull));
+
+/******************************************************//**
+Determine the offset to each field in temporary file.
+@see rec_convert_dtuple_to_temp() */
+UNIV_INTERN
+void
+rec_init_offsets_temp(
+/*==================*/
+ const rec_t* rec, /*!< in: temporary file record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ ulint* offsets)/*!< in/out: array of offsets;
+ in: n=rec_offs_n_fields(offsets) */
+ __attribute__((nonnull));
+
+/*********************************************************//**
+Builds a temporary file record out of a data tuple.
+@see rec_init_offsets_temp() */
+UNIV_INTERN
+void
+rec_convert_dtuple_to_temp(
+/*=======================*/
+ rec_t* rec, /*!< out: record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields) /*!< in: number of fields */
+ __attribute__((nonnull));
+
/**************************************************************//**
Copies the first n fields of a physical record to a new physical record in
a buffer.
@@ -680,21 +702,6 @@ rec_fold(
__attribute__((pure));
#endif /* !UNIV_HOTBACKUP */
/*********************************************************//**
-Builds a ROW_FORMAT=COMPACT record out of a data tuple. */
-UNIV_INTERN
-void
-rec_convert_dtuple_to_rec_comp(
-/*===========================*/
- rec_t* rec, /*!< in: origin of record */
- ulint extra, /*!< in: number of bytes to
- reserve between the record
- header and the data payload
- (normally REC_N_NEW_EXTRA_BYTES) */
- const dict_index_t* index, /*!< in: record descriptor */
- ulint status, /*!< in: status bits of the record */
- const dfield_t* fields, /*!< in: array of data fields */
- ulint n_fields);/*!< in: number of data fields */
-/*********************************************************//**
Builds a physical record out of a data tuple and
stores it into the given buffer.
@return pointer to the origin of physical record */
@@ -727,10 +734,7 @@ UNIV_INTERN
ulint
rec_get_converted_size_comp_prefix(
/*===============================*/
- const dict_index_t* index, /*!< in: record descriptor;
- dict_table_is_comp() is
- assumed to hold, even if
- it does not */
+ const dict_index_t* index, /*!< in: record descriptor */
const dfield_t* fields, /*!< in: array of data fields */
ulint n_fields,/*!< in: number of data fields */
ulint* extra); /*!< out: extra size */
diff --git a/storage/xtradb/include/row0undo.h b/storage/xtradb/include/row0undo.h
index 6eb4ca448b3..9420d022e3b 100644
--- a/storage/xtradb/include/row0undo.h
+++ b/storage/xtradb/include/row0undo.h
@@ -87,10 +87,6 @@ that index record. */
enum undo_exec {
UNDO_NODE_FETCH_NEXT = 1, /*!< we should fetch the next
undo log record */
- UNDO_NODE_PREV_VERS, /*!< the roll ptr to previous
- version of a row is stored in
- node, and undo should be done
- based on it */
UNDO_NODE_INSERT, /*!< undo a fresh insert of a
row to a table */
UNDO_NODE_MODIFY /*!< undo a modify operation
@@ -108,9 +104,6 @@ struct undo_node_struct{
undo_no_t undo_no;/*!< undo number of the record */
ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC,
... */
- roll_ptr_t new_roll_ptr;
- /*!< roll ptr to restore to clustered index
- record */
trx_id_t new_trx_id; /*!< trx id to restore to clustered index
record */
btr_pcur_t pcur; /*!< persistent cursor used in searching the
diff --git a/storage/xtradb/include/row0upd.ic b/storage/xtradb/include/row0upd.ic
index 10646241125..6706c9f8c69 100644
--- a/storage/xtradb/include/row0upd.ic
+++ b/storage/xtradb/include/row0upd.ic
@@ -28,6 +28,7 @@ Created 12/27/1996 Heikki Tuuri
# include "trx0trx.h"
# include "trx0undo.h"
# include "row0row.h"
+# include "lock0lock.h"
#endif /* !UNIV_HOTBACKUP */
#include "page0zip.h"
@@ -171,6 +172,8 @@ row_upd_rec_sys_fields(
#if DATA_TRX_ID + 1 != DATA_ROLL_PTR
# error "DATA_TRX_ID + 1 != DATA_ROLL_PTR"
#endif
+ ut_ad(lock_check_trx_id_sanity(trx_read_trx_id(rec + offset),
+ rec, index, offsets, FALSE));
trx_write_trx_id(rec + offset, trx->id);
trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr);
}
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index 6c5b61487f2..586c1e73879 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -148,7 +148,7 @@ extern my_bool srv_track_changed_pages;
extern ib_uint64_t srv_max_bitmap_file_size;
extern
-ulonglong srv_changed_pages_limit;
+ulonglong srv_max_changed_pages;
extern ibool srv_auto_extend_last_data_file;
extern ulint srv_last_file_size_max;
@@ -249,6 +249,11 @@ extern ulong srv_sys_stats_root_page;
#endif
extern ibool srv_use_doublewrite_buf;
+extern ibool srv_use_atomic_writes;
+#ifdef HAVE_POSIX_FALLOCATE
+extern ibool srv_use_posix_fallocate;
+#endif
+
extern ibool srv_use_checksums;
extern ibool srv_fast_checksum;
@@ -320,6 +325,10 @@ extern ulint srv_fatal_semaphore_wait_threshold;
extern ulint srv_dml_needed_delay;
extern long long srv_kill_idle_transaction;
+#ifdef UNIV_DEBUG
+extern my_bool srv_purge_view_update_only_debug;
+#endif /* UNIV_DEBUG */
+
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
query threads, and lock table: we allocate
it from dynamic memory to get it to the
@@ -400,6 +409,9 @@ extern ibool srv_blocking_lru_restore;
When FALSE, row locks are not taken at all. */
extern my_bool srv_fake_changes_locks;
+/** print all user-level transactions deadlocks to mysqld stderr */
+extern my_bool srv_print_all_deadlocks;
+
/** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
@@ -794,7 +806,9 @@ struct export_var_struct{
ulint innodb_dict_tables;
ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */
ulint innodb_buffer_pool_pages_data; /*!< Data pages */
+ ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */
ulint innodb_buffer_pool_pages_dirty; /*!< Dirty data pages */
+ ulint innodb_buffer_pool_bytes_dirty; /*!< File bytes modified */
ulint innodb_buffer_pool_pages_misc; /*!< Miscellanous pages */
ulint innodb_buffer_pool_pages_free; /*!< Free pages */
#ifdef UNIV_DEBUG
@@ -880,6 +894,11 @@ struct export_var_struct{
ib_int64_t innodb_x_lock_os_waits;
ib_int64_t innodb_x_lock_spin_rounds;
ib_int64_t innodb_x_lock_spin_waits;
+#ifdef UNIV_DEBUG
+ ulint innodb_purge_trx_id_age; /*!< max_trx_id - purged trx_id */
+ ulint innodb_purge_view_trx_id_age; /*!< rw_max_trx_id
+ - purged view's min trx_id */
+#endif /* UNIV_DEBUG */
};
/** Thread slot in the thread table */
diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h
index 4a2f55d90ff..b3b99b10630 100644
--- a/storage/xtradb/include/sync0sync.h
+++ b/storage/xtradb/include/sync0sync.h
@@ -89,6 +89,7 @@ extern mysql_pfs_key_t hash_table_mutex_key;
extern mysql_pfs_key_t ibuf_bitmap_mutex_key;
extern mysql_pfs_key_t ibuf_mutex_key;
extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
+extern mysql_pfs_key_t log_bmp_sys_mutex_key;
extern mysql_pfs_key_t log_sys_mutex_key;
extern mysql_pfs_key_t log_flush_order_mutex_key;
extern mysql_pfs_key_t kernel_mutex_key;
@@ -672,6 +673,7 @@ or row lock! */
#define SYNC_TRX_LOCK_HEAP 298
#define SYNC_TRX_SYS_HEADER 290
#define SYNC_PURGE_QUEUE 200
+#define SYNC_LOG_ONLINE 175
#define SYNC_LOG 170
#define SYNC_LOG_FLUSH_ORDER 156
#define SYNC_RECV 168
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 77acf54d8dc..60c5cc79852 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -49,13 +49,10 @@ Created 1/20/1994 Heikki Tuuri
#define _IB_TO_STR(s) #s
#define IB_TO_STR(s) _IB_TO_STR(s)
-#define INNODB_VERSION_MAJOR 1
-#define INNODB_VERSION_MINOR 1
-#define INNODB_VERSION_BUGFIX 8
+#include <mysql_version.h>
-#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 29.3
-#endif
+#define INNODB_VERSION_MAJOR MYSQL_MAJOR_VERSION
+#define INNODB_VERSION_MINOR MYSQL_MINOR_VERSION
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -66,11 +63,11 @@ component, i.e. we show M.N.P as M.N */
#define INNODB_VERSION_SHORT \
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
-#define INNODB_VERSION_STR \
- IB_TO_STR(INNODB_VERSION_MAJOR) "." \
- IB_TO_STR(INNODB_VERSION_MINOR) "." \
- IB_TO_STR(INNODB_VERSION_BUGFIX) "-" \
- IB_TO_STR(PERCONA_INNODB_VERSION)
+#ifndef PERCONA_INNODB_VERSION
+#define PERCONA_INNODB_VERSION 30.1
+#endif
+
+#define INNODB_VERSION_STR MYSQL_SERVER_VERSION "-" IB_TO_STR(PERCONA_INNODB_VERSION)
#define REFMAN "http://dev.mysql.com/doc/refman/" \
IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
@@ -300,6 +297,24 @@ management to ensure correct alignment for doubles etc. */
========================
*/
+/** There are currently two InnoDB file formats which are used to group
+features with similar restrictions and dependencies. Using an enum allows
+switch statements to give a compiler warning when a new one is introduced. */
+enum innodb_file_formats_enum {
+ /** Antelope File Format: InnoDB/MySQL up to 5.1.
+ This format includes REDUNDANT and COMPACT row formats */
+ UNIV_FORMAT_A = 0,
+
+ /** Barracuda File Format: Introduced in InnoDB plugin for 5.1:
+ This format includes COMPRESSED and DYNAMIC row formats. It
+ includes the ability to create secondary indexes from data that
+ is not on the clustered index page and the ability to store more
+ data off the clustered index page. */
+ UNIV_FORMAT_B = 1
+};
+
+typedef enum innodb_file_formats_enum innodb_file_formats_t;
+
/* The 2-logarithm of UNIV_PAGE_SIZE: */
/* #define UNIV_PAGE_SIZE_SHIFT 14 */
#define UNIV_PAGE_SIZE_SHIFT_MAX 14
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c
index f172ad6695b..47d082ed49f 100644
--- a/storage/xtradb/lock/lock0lock.c
+++ b/storage/xtradb/lock/lock0lock.c
@@ -790,12 +790,16 @@ lock_reset_lock_and_trx_wait(
/*=========================*/
lock_t* lock) /*!< in: record lock */
{
- ut_ad((lock->trx)->wait_lock == lock);
ut_ad(lock_get_wait(lock));
/* Reset the back pointer in trx to this waiting lock request */
- (lock->trx)->wait_lock = NULL;
+ if (!(lock->type_mode & LOCK_CONV_BY_OTHER)) {
+ ut_ad((lock->trx)->wait_lock == lock);
+ (lock->trx)->wait_lock = NULL;
+ } else {
+ ut_ad(lock_get_type_low(lock) == LOCK_REC);
+ }
lock->type_mode &= ~LOCK_WAIT;
}
@@ -1431,9 +1435,9 @@ lock_rec_has_expl(
while (lock) {
if (lock->trx == trx
+ && !lock_is_wait_not_by_other(lock->type_mode)
&& lock_mode_stronger_or_eq(lock_get_mode(lock),
precise_mode & LOCK_MODE_MASK)
- && !lock_get_wait(lock)
&& (!lock_rec_get_rec_not_gap(lock)
|| (precise_mode & LOCK_REC_NOT_GAP)
|| heap_no == PAGE_HEAP_NO_SUPREMUM)
@@ -1731,9 +1735,9 @@ lock_rec_create(
HASH_INSERT(lock_t, hash, lock_sys->rec_hash,
lock_rec_fold(space, page_no), lock);
- lock_sys->rec_num++;
- if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) {
+ lock_sys->rec_num++;
+ if (lock_is_wait_not_by_other(type_mode)) {
lock_set_lock_and_trx_wait(lock, trx);
}
@@ -1763,10 +1767,11 @@ lock_rec_enqueue_waiting(
const buf_block_t* block, /*!< in: buffer block containing
the record */
ulint heap_no,/*!< in: heap number of the record */
+ lock_t* lock, /*!< in: lock object; NULL if a new
+ one should be created. */
dict_index_t* index, /*!< in: index of record */
que_thr_t* thr) /*!< in: query thread */
{
- lock_t* lock;
trx_t* trx;
ulint sec;
ulint ms;
@@ -1803,9 +1808,17 @@ lock_rec_enqueue_waiting(
ut_ad(0);
}
- /* Enqueue the lock request that will wait to be granted */
- lock = lock_rec_create(type_mode | LOCK_WAIT,
- block, heap_no, index, trx);
+ if (lock == NULL) {
+ /* Enqueue the lock request that will wait to be granted */
+ lock = lock_rec_create(type_mode | LOCK_WAIT,
+ block, heap_no, index, trx);
+ } else {
+ ut_ad(lock->type_mode & LOCK_WAIT);
+ ut_ad(lock->type_mode & LOCK_CONV_BY_OTHER);
+
+ lock->type_mode &= ~LOCK_CONV_BY_OTHER;
+ lock_set_lock_and_trx_wait(lock, trx);
+ }
/* Check if a deadlock occurs: if yes, remove the lock request and
return an error code */
@@ -1829,7 +1842,7 @@ lock_rec_enqueue_waiting(
trx->que_state = TRX_QUE_LOCK_WAIT;
trx->was_chosen_as_deadlock_victim = FALSE;
trx->wait_started = time(NULL);
- if (innobase_get_slow_log() && trx->take_stats) {
+ if (UNIV_UNLIKELY(trx->take_stats)) {
ut_usectime(&sec, &ms);
trx->lock_que_wait_ustarted = (ib_uint64_t)sec * 1000000 + ms;
}
@@ -2054,6 +2067,7 @@ lock_rec_lock_slow(
que_thr_t* thr) /*!< in: query thread */
{
trx_t* trx;
+ lock_t* lock;
ut_ad(mutex_own(&kernel_mutex));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
@@ -2068,7 +2082,27 @@ lock_rec_lock_slow(
trx = thr_get_trx(thr);
- if (lock_rec_has_expl(mode, block, heap_no, trx)) {
+ lock = lock_rec_has_expl(mode, block, heap_no, trx);
+ if (lock) {
+ if (lock->type_mode & LOCK_CONV_BY_OTHER) {
+ /* This lock or lock waiting was created by the other
+ transaction, not by the transaction (trx) itself.
+ So, the transaction (trx) should treat it collectly
+ according as whether granted or not. */
+
+ if (lock->type_mode & LOCK_WAIT) {
+ /* This lock request was not granted yet.
+ Should wait for granted. */
+
+ goto enqueue_waiting;
+ } else {
+ /* This lock request was already granted.
+ Just clearing the flag. */
+
+ lock->type_mode &= ~LOCK_CONV_BY_OTHER;
+ }
+ }
+
/* The trx already has a strong enough lock on rec: do
nothing */
@@ -2078,8 +2112,10 @@ lock_rec_lock_slow(
the queue, as this transaction does not have a lock strong
enough already granted on the record, we have to wait. */
+ ut_ad(lock == NULL);
+enqueue_waiting:
return(lock_rec_enqueue_waiting(mode, block, heap_no,
- index, thr));
+ lock, index, thr));
} else if (!impl) {
/* Set the requested lock on the record */
@@ -2221,7 +2257,8 @@ lock_grant(
TRX_QUE_LOCK_WAIT state, and there is no need to end the lock wait
for it */
- if (lock->trx->que_state == TRX_QUE_LOCK_WAIT) {
+ if (!(lock->type_mode & LOCK_CONV_BY_OTHER)
+ && lock->trx->que_state == TRX_QUE_LOCK_WAIT) {
trx_end_lock_wait(lock->trx);
}
}
@@ -2238,6 +2275,7 @@ lock_rec_cancel(
{
ut_ad(mutex_own(&kernel_mutex));
ut_ad(lock_get_type_low(lock) == LOCK_REC);
+ ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER));
/* Reset the bit (there can be only one set bit) in the lock bitmap */
lock_rec_reset_nth_bit(lock, lock_rec_find_set_bit(lock));
@@ -2382,8 +2420,12 @@ lock_rec_reset_and_release_wait(
lock = lock_rec_get_first(block, heap_no);
while (lock != NULL) {
- if (lock_get_wait(lock)) {
+ if (lock_is_wait_not_by_other(lock->type_mode)) {
lock_rec_cancel(lock);
+ } else if (lock_get_wait(lock)) {
+ /* just reset LOCK_WAIT */
+ lock_rec_reset_nth_bit(lock, heap_no);
+ lock_reset_lock_and_trx_wait(lock);
} else {
lock_rec_reset_nth_bit(lock, heap_no);
}
@@ -3271,6 +3313,80 @@ lock_rec_restore_from_page_infimum(
/*=========== DEADLOCK CHECKING ======================================*/
+/*********************************************************************//**
+rewind(3) the file used for storing the latest detected deadlock and
+print a heading message to stderr if printing of all deadlocks to stderr
+is enabled. */
+UNIV_INLINE
+void
+lock_deadlock_start_print()
+/*=======================*/
+{
+ rewind(lock_latest_err_file);
+ ut_print_timestamp(lock_latest_err_file);
+
+ if (srv_print_all_deadlocks) {
+ fprintf(stderr, "InnoDB: transactions deadlock detected, "
+ "dumping detailed information.\n");
+ ut_print_timestamp(stderr);
+ }
+}
+
+/*********************************************************************//**
+Print a message to the deadlock file and possibly to stderr. */
+UNIV_INLINE
+void
+lock_deadlock_fputs(
+/*================*/
+ const char* msg) /*!< in: message to print */
+{
+ fputs(msg, lock_latest_err_file);
+
+ if (srv_print_all_deadlocks) {
+ fputs(msg, stderr);
+ }
+}
+
+/*********************************************************************//**
+Print transaction data to the deadlock file and possibly to stderr. */
+UNIV_INLINE
+void
+lock_deadlock_trx_print(
+/*====================*/
+ trx_t* trx, /*!< in: transaction */
+ ulint max_query_len) /*!< in: max query length to print, or 0 to
+ use the default max length */
+{
+ trx_print(lock_latest_err_file, trx, max_query_len);
+
+ if (srv_print_all_deadlocks) {
+ trx_print(stderr, trx, max_query_len);
+ }
+}
+
+/*********************************************************************//**
+Print lock data to the deadlock file and possibly to stderr. */
+UNIV_INLINE
+void
+lock_deadlock_lock_print(
+/*=====================*/
+ const lock_t* lock) /*!< in: record or table type lock */
+{
+ if (lock_get_type_low(lock) == LOCK_REC) {
+ lock_rec_print(lock_latest_err_file, lock);
+
+ if (srv_print_all_deadlocks) {
+ lock_rec_print(stderr, lock);
+ }
+ } else {
+ lock_table_print(lock_latest_err_file, lock);
+
+ if (srv_print_all_deadlocks) {
+ lock_table_print(stderr, lock);
+ }
+ }
+}
+
/********************************************************************//**
Checks if a lock request results in a deadlock.
@return TRUE if a deadlock was detected and we chose trx as a victim;
@@ -3314,31 +3430,26 @@ retry:
/* If the lock search exceeds the max step
or the max depth, the current trx will be
the victim. Print its information. */
- rewind(lock_latest_err_file);
- ut_print_timestamp(lock_latest_err_file);
+ lock_deadlock_start_print();
- fputs("TOO DEEP OR LONG SEARCH IN THE LOCK TABLE"
- " WAITS-FOR GRAPH, WE WILL ROLL BACK"
- " FOLLOWING TRANSACTION \n",
- lock_latest_err_file);
+ lock_deadlock_fputs(
+ "TOO DEEP OR LONG SEARCH IN THE LOCK TABLE"
+ " WAITS-FOR GRAPH, WE WILL ROLL BACK"
+ " FOLLOWING TRANSACTION \n\n"
+ "*** TRANSACTION:\n");
- fputs("\n*** TRANSACTION:\n", lock_latest_err_file);
- trx_print(lock_latest_err_file, trx, 3000);
+ lock_deadlock_trx_print(trx, 3000);
- fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n",
- lock_latest_err_file);
+ lock_deadlock_fputs(
+ "*** WAITING FOR THIS LOCK TO BE GRANTED:\n");
+
+ lock_deadlock_lock_print(lock);
- if (lock_get_type(lock) == LOCK_REC) {
- lock_rec_print(lock_latest_err_file, lock);
- } else {
- lock_table_print(lock_latest_err_file, lock);
- }
break;
case LOCK_VICTIM_IS_START:
srv_n_lock_deadlock_count++;
- fputs("*** WE ROLL BACK TRANSACTION (2)\n",
- lock_latest_err_file);
+ lock_deadlock_fputs("*** WE ROLL BACK TRANSACTION (2)\n");
break;
default:
@@ -3453,45 +3564,33 @@ lock_deadlock_recursive(
point: a deadlock detected; or we have
searched the waits-for graph too long */
- FILE* ef = lock_latest_err_file;
+ lock_deadlock_start_print();
- rewind(ef);
- ut_print_timestamp(ef);
+ lock_deadlock_fputs("\n*** (1) TRANSACTION:\n");
- fputs("\n*** (1) TRANSACTION:\n", ef);
+ lock_deadlock_trx_print(wait_lock->trx, 3000);
- trx_print(ef, wait_lock->trx, 3000);
+ lock_deadlock_fputs(
+ "*** (1) WAITING FOR THIS LOCK"
+ " TO BE GRANTED:\n");
- fputs("*** (1) WAITING FOR THIS LOCK"
- " TO BE GRANTED:\n", ef);
+ lock_deadlock_lock_print(wait_lock);
- if (lock_get_type_low(wait_lock) == LOCK_REC) {
- lock_rec_print(ef, wait_lock);
- } else {
- lock_table_print(ef, wait_lock);
- }
+ lock_deadlock_fputs("*** (2) TRANSACTION:\n");
- fputs("*** (2) TRANSACTION:\n", ef);
+ lock_deadlock_trx_print(lock->trx, 3000);
- trx_print(ef, lock->trx, 3000);
+ lock_deadlock_fputs(
+ "*** (2) HOLDS THE LOCK(S):\n");
- fputs("*** (2) HOLDS THE LOCK(S):\n", ef);
+ lock_deadlock_lock_print(lock);
- if (lock_get_type_low(lock) == LOCK_REC) {
- lock_rec_print(ef, lock);
- } else {
- lock_table_print(ef, lock);
- }
+ lock_deadlock_fputs(
+ "*** (2) WAITING FOR THIS LOCK"
+ " TO BE GRANTED:\n");
- fputs("*** (2) WAITING FOR THIS LOCK"
- " TO BE GRANTED:\n", ef);
+ lock_deadlock_lock_print(start->wait_lock);
- if (lock_get_type_low(start->wait_lock)
- == LOCK_REC) {
- lock_rec_print(ef, start->wait_lock);
- } else {
- lock_table_print(ef, start->wait_lock);
- }
#ifdef UNIV_DEBUG
if (lock_print_waits) {
fputs("Deadlock detected\n",
@@ -3514,8 +3613,8 @@ lock_deadlock_recursive(
as a victim to try to avoid deadlocking our
recursion starting point transaction */
- fputs("*** WE ROLL BACK TRANSACTION (1)\n",
- ef);
+ lock_deadlock_fputs(
+ "*** WE ROLL BACK TRANSACTION (1)\n");
wait_lock->trx->was_chosen_as_deadlock_victim
= TRUE;
@@ -3600,6 +3699,7 @@ lock_table_create(
ut_ad(table && trx);
ut_ad(mutex_own(&kernel_mutex));
+ ut_ad(!(type_mode & LOCK_CONV_BY_OTHER));
if ((type_mode & LOCK_MODE_MASK) == LOCK_AUTO_INC) {
++table->n_waiting_or_granted_auto_inc_locks;
@@ -3837,7 +3937,7 @@ lock_table_enqueue_waiting(
return(DB_SUCCESS);
}
- if (innobase_get_slow_log() && trx->take_stats) {
+ if (UNIV_UNLIKELY(trx->take_stats)) {
ut_usectime(&sec, &ms);
trx->lock_que_wait_ustarted = (ib_uint64_t)sec * 1000000 + ms;
}
@@ -4163,6 +4263,7 @@ lock_cancel_waiting_and_release(
lock_t* lock) /*!< in: waiting lock request */
{
ut_ad(mutex_own(&kernel_mutex));
+ ut_ad(!(lock->type_mode & LOCK_CONV_BY_OTHER));
if (lock_get_type_low(lock) == LOCK_REC) {
@@ -4658,12 +4759,16 @@ loop:
lock_mutex_exit_kernel();
- mtr_start(&mtr);
+ if (srv_show_verbose_locks) {
+ mtr_start(&mtr);
- buf_page_get_with_no_latch(space, zip_size,
- page_no, &mtr);
+ buf_page_get_gen(space, zip_size, page_no,
+ RW_NO_LATCH, NULL,
+ BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, &mtr);
- mtr_commit(&mtr);
+ mtr_commit(&mtr);
+ }
load_page_first = FALSE;
@@ -5211,7 +5316,7 @@ lock_rec_insert_check_and_lock(
err = lock_rec_enqueue_waiting(LOCK_X | LOCK_GAP
| LOCK_INSERT_INTENTION,
block, next_rec_heap_no,
- index, thr);
+ NULL, index, thr);
} else {
err = DB_SUCCESS;
}
@@ -5287,10 +5392,23 @@ lock_rec_convert_impl_to_expl(
if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, block,
heap_no, impl_trx)) {
+ ulint type_mode = (LOCK_REC | LOCK_X
+ | LOCK_REC_NOT_GAP);
+
+ /* If the delete-marked record was locked already,
+ we should reserve lock waiting for impl_trx as
+ implicit lock. Because cannot lock at this moment.*/
+
+ if (rec_get_deleted_flag(rec, rec_offs_comp(offsets))
+ && lock_rec_other_has_conflicting(
+ LOCK_X | LOCK_REC_NOT_GAP, block,
+ heap_no, impl_trx)) {
+
+ type_mode |= (LOCK_WAIT | LOCK_CONV_BY_OTHER);
+ }
lock_rec_add_to_queue(
- LOCK_REC | LOCK_X | LOCK_REC_NOT_GAP,
- block, heap_no, index, impl_trx);
+ type_mode, block, heap_no, index, impl_trx);
}
}
}
diff --git a/storage/xtradb/log/log0online.c b/storage/xtradb/log/log0online.c
index 55eb9d17c46..be0a9708b8c 100644
--- a/storage/xtradb/log/log0online.c
+++ b/storage/xtradb/log/log0online.c
@@ -36,6 +36,11 @@ Online database log parsing for changed page tracking
enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) };
+#ifdef UNIV_PFS_MUTEX
+/* Key to register log_bmp_sys->mutex with PFS */
+UNIV_INTERN mysql_pfs_key_t log_bmp_sys_mutex_key;
+#endif /* UNIV_PFS_MUTEX */
+
/** Log parsing and bitmap output data structure */
struct log_bitmap_struct {
byte read_buf[FOLLOW_SCAN_SIZE];
@@ -69,6 +74,7 @@ struct log_bitmap_struct {
both the correct type and the tree does
not mind its overwrite during
rbt_next() tree traversal. */
+ mutex_t mutex; /*!< mutex protecting all the fields.*/
};
/* The log parsing and bitmap output struct instance */
@@ -172,6 +178,8 @@ log_online_set_page_bit(
byte search_page[MODIFIED_PAGE_BLOCK_SIZE];
byte *page_ptr;
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
+
ut_a(space != ULINT_UNDEFINED);
ut_a(page_no != ULINT_UNDEFINED);
@@ -312,8 +320,8 @@ its name is correct and use it for (re-)tracking start.
@return the last fully tracked LSN */
static
ib_uint64_t
-log_online_read_last_tracked_lsn()
-/*==============================*/
+log_online_read_last_tracked_lsn(void)
+/*==================================*/
{
byte page[MODIFIED_PAGE_BLOCK_SIZE];
ibool is_last_page = FALSE;
@@ -405,8 +413,10 @@ log_online_can_track_missing(
if (last_tracked_lsn > tracking_start_lsn) {
fprintf(stderr,
- "InnoDB: Error: last tracked LSN is in future. This "
- "can be caused by mismatched bitmap files.\n");
+ "InnoDB: Error: last tracked LSN %llu is ahead of "
+ "tracking start LSN %llu. This can be caused by "
+ "mismatched bitmap files.\n", last_tracked_lsn,
+ tracking_start_lsn);
exit(1);
}
@@ -431,10 +441,10 @@ log_online_track_missing_on_startup(
{
ut_ad(last_tracked_lsn != tracking_start_lsn);
- fprintf(stderr, "InnoDB: last tracked LSN is %llu, but the last "
- "checkpoint LSN is %llu. This might be due to a server "
- "crash or a very fast shutdown. ", last_tracked_lsn,
- tracking_start_lsn);
+ fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' is %llu, but the "
+ "last checkpoint LSN is %llu. This might be due to a server "
+ "crash or a very fast shutdown. ", log_bmp_sys->out.name,
+ last_tracked_lsn, tracking_start_lsn);
/* See if we can fully recover the missing interval */
if (log_online_can_track_missing(last_tracked_lsn,
@@ -446,7 +456,9 @@ log_online_track_missing_on_startup(
log_bmp_sys->start_lsn = ut_max_uint64(last_tracked_lsn,
MIN_TRACKED_LSN);
log_set_tracked_lsn(log_bmp_sys->start_lsn);
- log_online_follow_redo_log();
+ if (!log_online_follow_redo_log()) {
+ exit(1);
+ }
ut_ad(log_bmp_sys->end_lsn >= tracking_start_lsn);
fprintf(stderr,
@@ -484,18 +496,47 @@ log_online_make_bitmap_name(
}
/*********************************************************************//**
-Create a new empty bitmap output file. */
+Check if an old file that has the name of a new bitmap file we are about to
+create should be overwritten. */
static
-void
-log_online_start_bitmap_file()
-/*==========================*/
+ibool
+log_online_should_overwrite(
+/*========================*/
+ const char *path) /*!< in: path to file */
{
- ibool success;
+ ibool success;
+ os_file_stat_t file_info;
- log_bmp_sys->out.file
- = os_file_create(innodb_file_bmp_key, log_bmp_sys->out.name,
- OS_FILE_OVERWRITE, OS_FILE_NORMAL,
- OS_DATA_FILE, &success);
+ /* Currently, it's OK to overwrite 0-sized files only */
+ success = os_file_get_status(path, &file_info);
+ return success && file_info.size == 0LL;
+}
+
+/*********************************************************************//**
+Create a new empty bitmap output file.
+
+@return TRUE if operation succeeded, FALSE if I/O error */
+static
+ibool
+log_online_start_bitmap_file(void)
+/*==============================*/
+{
+ ibool success = TRUE;
+
+ /* Check for an old file that should be deleted first */
+ if (log_online_should_overwrite(log_bmp_sys->out.name)) {
+ success = os_file_delete(log_bmp_sys->out.name);
+ }
+
+ if (UNIV_LIKELY(success)) {
+ log_bmp_sys->out.file
+ = os_file_create_simple_no_error_handling(
+ innodb_file_bmp_key,
+ log_bmp_sys->out.name,
+ OS_FILE_CREATE,
+ OS_FILE_READ_WRITE,
+ &success);
+ }
if (UNIV_UNLIKELY(!success)) {
/* The following call prints an error message */
@@ -503,25 +544,32 @@ log_online_start_bitmap_file()
fprintf(stderr,
"InnoDB: Error: Cannot create \'%s\'\n",
log_bmp_sys->out.name);
- exit(1);
+ log_bmp_sys->out.file = -1;
+ return FALSE;
}
log_bmp_sys->out.offset = 0;
+ return TRUE;
}
/*********************************************************************//**
-Close the current bitmap output file and create the next one. */
+Close the current bitmap output file and create the next one.
+
+@return TRUE if operation succeeded, FALSE if I/O error */
static
-void
+ibool
log_online_rotate_bitmap_file(
/*===========================*/
ib_uint64_t next_file_start_lsn) /*!<in: the start LSN name
part */
{
- os_file_close(log_bmp_sys->out.file);
+ if (log_bmp_sys->out.file != -1) {
+ os_file_close(log_bmp_sys->out.file);
+ log_bmp_sys->out.file = -1;
+ }
log_bmp_sys->out_seq_num++;
log_online_make_bitmap_name(next_file_start_lsn);
- log_online_start_bitmap_file();
+ return log_online_start_bitmap_file();
}
/*********************************************************************//**
@@ -556,8 +604,8 @@ log_online_is_bitmap_file(
Initialize the online log following subsytem. */
UNIV_INTERN
void
-log_online_read_init()
-/*==================*/
+log_online_read_init(void)
+/*======================*/
{
ibool success;
ib_uint64_t tracking_start_lsn
@@ -566,13 +614,16 @@ log_online_read_init()
os_file_stat_t bitmap_dir_file_info;
ib_uint64_t last_file_start_lsn = MIN_TRACKED_LSN;
- /* Assert (could be compile-time assert) that bitmap data start and end
- in a bitmap block is 8-byte aligned */
- ut_a(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0);
- ut_a(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0);
+ /* Bitmap data start and end in a bitmap block must be 8-byte
+ aligned. */
+ compile_time_assert(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0);
+ compile_time_assert(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0);
log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys));
+ mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys->mutex,
+ SYNC_LOG_ONLINE);
+
/* Enumerate existing bitmap files to either open the last one to get
the last tracked LSN either to find that there are none and start
tracking from scratch. */
@@ -629,7 +680,9 @@ log_online_read_init()
if (!success) {
/* New file, tracking from scratch */
- log_online_start_bitmap_file();
+ if (!log_online_start_bitmap_file()) {
+ exit(1);
+ }
}
else {
@@ -637,6 +690,7 @@ log_online_read_init()
ulint size_low;
ulint size_high;
ib_uint64_t last_tracked_lsn;
+ ib_uint64_t file_start_lsn;
success = os_file_get_size(log_bmp_sys->out.file, &size_low,
&size_high);
@@ -667,10 +721,12 @@ log_online_read_init()
if we can retrack any missing data. */
if (log_online_can_track_missing(last_tracked_lsn,
tracking_start_lsn)) {
- log_online_rotate_bitmap_file(last_tracked_lsn);
+ file_start_lsn = last_tracked_lsn;
+ } else {
+ file_start_lsn = tracking_start_lsn;
}
- else {
- log_online_rotate_bitmap_file(tracking_start_lsn);
+ if (!log_online_rotate_bitmap_file(file_start_lsn)) {
+ exit(1);
}
if (last_tracked_lsn < tracking_start_lsn) {
@@ -701,12 +757,15 @@ log_online_read_init()
Shut down the online log following subsystem. */
UNIV_INTERN
void
-log_online_read_shutdown()
-/*======================*/
+log_online_read_shutdown(void)
+/*==========================*/
{
ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list;
- os_file_close(log_bmp_sys->out.file);
+ if (log_bmp_sys->out.file != -1) {
+ os_file_close(log_bmp_sys->out.file);
+ log_bmp_sys->out.file = -1;
+ }
rbt_free(log_bmp_sys->modified_pages);
@@ -716,6 +775,8 @@ log_online_read_shutdown()
free_list_node = next;
}
+ mutex_free(&log_bmp_sys->mutex);
+
ut_free(log_bmp_sys);
}
@@ -759,14 +820,16 @@ from the buffer. If an incomplete record is found, moves it to the end of the
buffer. */
static
void
-log_online_parse_redo_log()
-/*=======================*/
+log_online_parse_redo_log(void)
+/*===========================*/
{
byte *ptr = log_bmp_sys->parse_buf;
byte *end = log_bmp_sys->parse_buf_end;
ulint len = 0;
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
+
while (ptr != end
&& log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {
@@ -857,6 +920,8 @@ log_online_add_to_parse_buf(
ulint actual_data_len = (end_offset >= start_offset)
? end_offset - start_offset : 0;
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
+
ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset,
actual_data_len);
@@ -881,6 +946,8 @@ log_online_parse_redo_log_block(
{
ulint block_data_len;
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
+
block_data_len = log_block_get_data_len(log_block);
ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0
@@ -907,6 +974,8 @@ log_online_follow_log_seg(
byte* log_block_end = log_bmp_sys->read_buf
+ (block_end_lsn - block_start_lsn);
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
+
mutex_enter(&log_sys->mutex);
log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf,
group, block_start_lsn, block_end_lsn);
@@ -969,6 +1038,8 @@ log_online_follow_log_group(
ib_uint64_t block_start_lsn = contiguous_lsn;
ib_uint64_t block_end_lsn;
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
+
log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn;
log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;
@@ -996,19 +1067,26 @@ log_online_follow_log_group(
/*********************************************************************//**
Write, flush one bitmap block to disk and advance the output position if
-successful. */
+successful.
+
+@return TRUE if page written OK, FALSE if I/O error */
static
-void
+ibool
log_online_write_bitmap_page(
/*=========================*/
const byte *block) /*!< in: block to write */
{
ibool success;
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
+
+ /* Simulate a write error */
+ DBUG_EXECUTE_IF("bitmap_page_write_error", return FALSE;);
+
success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file,
block,
(ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF),
- (ulint)(log_bmp_sys->out.offset << 32),
+ (ulint)(log_bmp_sys->out.offset >> 32),
MODIFIED_PAGE_BLOCK_SIZE);
if (UNIV_UNLIKELY(!success)) {
@@ -1016,7 +1094,7 @@ log_online_write_bitmap_page(
os_file_get_last_error(TRUE);
fprintf(stderr, "InnoDB: Error: failed writing changed page "
"bitmap file \'%s\'\n", log_bmp_sys->out.name);
- return;
+ return FALSE;
}
success = os_file_flush(log_bmp_sys->out.file, FALSE);
@@ -1027,25 +1105,38 @@ log_online_write_bitmap_page(
fprintf(stderr, "InnoDB: Error: failed flushing "
"changed page bitmap file \'%s\'\n",
log_bmp_sys->out.name);
- return;
+ return FALSE;
}
+#ifdef UNIV_LINUX
+ posix_fadvise(log_bmp_sys->out.file, log_bmp_sys->out.offset,
+ MODIFIED_PAGE_BLOCK_SIZE, POSIX_FADV_DONTNEED);
+#endif
+
log_bmp_sys->out.offset += MODIFIED_PAGE_BLOCK_SIZE;
+ return TRUE;
}
/*********************************************************************//**
Append the current changed page bitmap to the bitmap file. Clears the
-bitmap tree and recycles its nodes to the free list. */
+bitmap tree and recycles its nodes to the free list.
+
+@return TRUE if bitmap written OK, FALSE if I/O error*/
static
-void
-log_online_write_bitmap()
-/*=====================*/
+ibool
+log_online_write_bitmap(void)
+/*=========================*/
{
ib_rbt_node_t *bmp_tree_node;
const ib_rbt_node_t *last_bmp_tree_node;
+ ibool success = TRUE;
+
+ ut_ad(mutex_own(&log_bmp_sys->mutex));
if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) {
- log_online_rotate_bitmap_file(log_bmp_sys->start_lsn);
+ if (!log_online_rotate_bitmap_file(log_bmp_sys->start_lsn)) {
+ return FALSE;
+ }
}
bmp_tree_node = (ib_rbt_node_t *)
@@ -1056,18 +1147,25 @@ log_online_write_bitmap()
byte *page = rbt_value(byte, bmp_tree_node);
- if (bmp_tree_node == last_bmp_tree_node) {
- mach_write_to_4(page + MODIFIED_PAGE_IS_LAST_BLOCK, 1);
- }
+ /* In case of a bitmap page write error keep on looping over
+ the tree to reclaim its memory through the free list instead of
+ returning immediatelly. */
+ if (UNIV_LIKELY(success)) {
+ if (bmp_tree_node == last_bmp_tree_node) {
+ mach_write_to_4(page
+ + MODIFIED_PAGE_IS_LAST_BLOCK,
+ 1);
+ }
- mach_write_to_8(page + MODIFIED_PAGE_START_LSN,
- log_bmp_sys->start_lsn);
- mach_write_to_8(page + MODIFIED_PAGE_END_LSN,
- log_bmp_sys->end_lsn);
- mach_write_to_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM,
- log_online_calc_checksum(page));
+ mach_write_to_8(page + MODIFIED_PAGE_START_LSN,
+ log_bmp_sys->start_lsn);
+ mach_write_to_8(page + MODIFIED_PAGE_END_LSN,
+ log_bmp_sys->end_lsn);
+ mach_write_to_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM,
+ log_online_calc_checksum(page));
- log_online_write_bitmap_page(page);
+ success = log_online_write_bitmap_page(page);
+ }
bmp_tree_node->left = log_bmp_sys->page_free_list;
log_bmp_sys->page_free_list = bmp_tree_node;
@@ -1077,18 +1175,29 @@ log_online_write_bitmap()
}
rbt_reset(log_bmp_sys->modified_pages);
+ return success;
}
/*********************************************************************//**
Read and parse the redo log up to last checkpoint LSN to build the changed
-page bitmap which is then written to disk. */
+page bitmap which is then written to disk.
+
+@return TRUE if log tracking succeeded, FALSE if bitmap write I/O error */
UNIV_INTERN
-void
-log_online_follow_redo_log()
-/*========================*/
+ibool
+log_online_follow_redo_log(void)
+/*============================*/
{
ib_uint64_t contiguous_start_lsn;
log_group_t* group;
+ ibool result;
+
+ mutex_enter(&log_bmp_sys->mutex);
+
+ if (!srv_track_changed_pages) {
+ mutex_exit(&log_bmp_sys->mutex);
+ return FALSE;
+ }
/* Grab the LSN of the last checkpoint, we will parse up to it */
mutex_enter(&(log_sys->mutex));
@@ -1096,7 +1205,8 @@ log_online_follow_redo_log()
mutex_exit(&(log_sys->mutex));
if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) {
- return;
+ mutex_exit(&log_bmp_sys->mutex);
+ return TRUE;
}
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -1114,9 +1224,12 @@ log_online_follow_redo_log()
tracked LSN, so that LSN tracking for this interval is tested. */
DBUG_EXECUTE_IF("crash_before_bitmap_write", DBUG_SUICIDE(););
- log_online_write_bitmap();
+ result = log_online_write_bitmap();
log_bmp_sys->start_lsn = log_bmp_sys->end_lsn;
log_set_tracked_lsn(log_bmp_sys->start_lsn);
+
+ mutex_exit(&log_bmp_sys->mutex);
+ return result;
}
/*********************************************************************//**
@@ -1514,3 +1627,81 @@ log_online_bitmap_iterator_next(
return TRUE;
}
+
+/************************************************************//**
+Delete all the bitmap files for data less than the specified LSN.
+If called with lsn == 0 (i.e. set by RESET request) or
+IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise
+continue it.
+
+@return FALSE to indicate success, TRUE for failure. */
+UNIV_INTERN
+ibool
+log_online_purge_changed_page_bitmaps(
+/*==================================*/
+ ib_uint64_t lsn) /*!< in: LSN to purge files up to */
+{
+ log_online_bitmap_file_range_t bitmap_files;
+ size_t i;
+ ibool result = FALSE;
+
+ if (lsn == 0) {
+ lsn = IB_ULONGLONG_MAX;
+ }
+
+ if (srv_track_changed_pages) {
+ /* User requests might happen with both enabled and disabled
+ tracking */
+ mutex_enter(&log_bmp_sys->mutex);
+ }
+
+ if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, lsn)) {
+ if (srv_track_changed_pages) {
+ mutex_exit(&log_bmp_sys->mutex);
+ }
+ return TRUE;
+ }
+
+ if (srv_track_changed_pages && lsn >= log_bmp_sys->end_lsn) {
+ /* If we have to delete the current output file, close it
+ first. */
+ os_file_close(log_bmp_sys->out.file);
+ log_bmp_sys->out.file = -1;
+ }
+
+ for (i = 0; i < bitmap_files.count; i++) {
+ if (bitmap_files.files[i].seq_num == 0
+ || bitmap_files.files[i].start_lsn >= lsn) {
+ break;
+ }
+ if (!os_file_delete_if_exists(bitmap_files.files[i].name)) {
+ os_file_get_last_error(TRUE);
+ result = TRUE;
+ break;
+ }
+ }
+
+ if (srv_track_changed_pages) {
+ if (lsn > log_bmp_sys->end_lsn) {
+ ib_uint64_t new_file_lsn;
+ if (lsn == IB_ULONGLONG_MAX) {
+ /* RESET restarts the sequence */
+ log_bmp_sys->out_seq_num = 0;
+ new_file_lsn = 0;
+ } else {
+ new_file_lsn = log_bmp_sys->end_lsn;
+ }
+ if (!log_online_rotate_bitmap_file(new_file_lsn)) {
+ /* If file create failed, signal the log
+ tracking thread to quit next time it wakes
+ up. */
+ srv_track_changed_pages = FALSE;
+ }
+ }
+
+ mutex_exit(&log_bmp_sys->mutex);
+ }
+
+ free(bitmap_files.files);
+ return result;
+}
diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c
index 5ab8c14ae2e..4e179afd50c 100644
--- a/storage/xtradb/log/log0recv.c
+++ b/storage/xtradb/log/log0recv.c
@@ -994,8 +994,11 @@ recv_parse_or_apply_log_rec_body(
not NULL, then the log record is
applied to the page, and the log
record should be complete then */
- mtr_t* mtr) /*!< in: mtr or NULL; should be non-NULL
+ mtr_t* mtr, /*!< in: mtr or NULL; should be non-NULL
if and only if block is non-NULL */
+ ulint space_id)
+ /*!< in: tablespace id obtained by
+ parsing initial log record */
{
dict_index_t* index = NULL;
page_t* page;
@@ -1267,8 +1270,11 @@ recv_parse_or_apply_log_rec_body(
ut_ad(!page || page_type != FIL_PAGE_TYPE_ALLOCATED);
ptr = mlog_parse_string(ptr, end_ptr, page, page_zip);
break;
- case MLOG_FILE_CREATE:
case MLOG_FILE_RENAME:
+ ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type,
+ space_id, 0);
+ break;
+ case MLOG_FILE_CREATE:
case MLOG_FILE_DELETE:
case MLOG_FILE_CREATE2:
ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, 0, 0);
@@ -1672,7 +1678,8 @@ recv_recover_page_func(
recv_parse_or_apply_log_rec_body(recv->type, buf,
buf + recv->len,
- block, &mtr);
+ block, &mtr,
+ recv_addr->space);
if (srv_recovery_stats) {
mutex_enter(&(recv_sys->mutex));
@@ -1704,9 +1711,8 @@ recv_recover_page_func(
if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
- if (page_zip) {
- ut_a(page_zip_validate_low(page_zip, page, FALSE));
- }
+ ut_a(!page_zip
+ || page_zip_validate_low(page_zip, page, NULL, FALSE));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -2158,7 +2164,7 @@ recv_parse_log_rec(
#endif /* UNIV_LOG_LSN_DEBUG */
new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
- NULL, NULL);
+ NULL, NULL, *space);
if (UNIV_UNLIKELY(new_ptr == NULL)) {
return(0);
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 8e0516a84a9..8f1b3e46bb2 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -1454,6 +1454,43 @@ os_file_set_nocache(
#endif
}
+
+#ifdef __linux__
+#include <sys/ioctl.h>
+#ifndef DFS_IOCTL_ATOMIC_WRITE_SET
+#define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint)
+#endif
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ static int first_time = 1;
+ int atomic_option = 1;
+
+ int ret = ioctl (file, DFS_IOCTL_ATOMIC_WRITE_SET, &atomic_option);
+
+ if (ret) {
+ fprintf(stderr,
+ "InnoDB : can't use atomic write on %s, errno %d\n",
+ name, errno);
+ return ret;
+ }
+ return ret;
+}
+#else
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ fprintf(stderr,
+ "InnoDB : can't use atomic writes on %s - not implemented on this platform."
+ "innodb_use_atomic_writes needs to be 0.\n",
+ name);
+#ifdef _WIN32
+ SetLastError(ERROR_INVALID_FUNCTION);
+#else
+ errno = EINVAL;
+#endif
+ return -1;
+}
+#endif
+
/****************************************************************//**
NOTE! Use the corresponding macro os_file_create(), not directly
this function!
@@ -1490,6 +1527,13 @@ os_file_create_func(
DWORD create_flag;
DWORD attributes;
ibool retry;
+
+ DBUG_EXECUTE_IF(
+ "ib_create_table_fail_disk_full",
+ *success = FALSE;
+ SetLastError(ERROR_DISK_FULL);
+ return((os_file_t) -1);
+ );
try_again:
ut_a(name);
@@ -1611,6 +1655,13 @@ try_again:
}
}
+ if (srv_use_atomic_writes && type == OS_DATA_FILE &&
+ os_file_set_atomic_writes(file, name)) {
+ CloseHandle(file);
+ *success = FALSE;
+ file = INVALID_HANDLE_VALUE;
+ }
+
return(file);
#else /* __WIN__ */
os_file_t file;
@@ -1618,6 +1669,12 @@ try_again:
ibool retry;
const char* mode_str = NULL;
+ DBUG_EXECUTE_IF(
+ "ib_create_table_fail_disk_full",
+ *success = FALSE;
+ errno = ENOSPC;
+ return((os_file_t) -1);
+ );
try_again:
ut_a(name);
@@ -1724,6 +1781,12 @@ try_again:
file = -1;
}
#endif /* USE_FILE_LOCK */
+ if (srv_use_atomic_writes && type == OS_DATA_FILE
+ && os_file_set_atomic_writes(file, name)) {
+ close(file);
+ *success = FALSE;
+ file = -1;
+ }
return(file);
#endif /* __WIN__ */
@@ -2068,6 +2131,28 @@ os_file_set_size(
current_size = 0;
desired_size = (ib_int64_t)size + (((ib_int64_t)size_high) << 32);
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ if (posix_fallocate(file, current_size, desired_size) == -1) {
+ fprintf(stderr,
+ "InnoDB: Error: preallocating data for"
+ " file %s failed at\n"
+ "InnoDB: offset 0 size %lld %lld. Operating system"
+ " error number %llu.\n"
+ "InnoDB: Check that the disk is not full"
+ " or a disk quota exceeded.\n"
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ REFMAN "operating-system-error-codes.html\n",
+ name, (long long)size_high, (long long)size, errno);
+
+ return (FALSE);
+ }
+ return (TRUE);
+ }
+#endif
+
/* Write up to 1 megabyte at a time. */
buf_size = ut_min(64, (ulint) (desired_size / UNIV_PAGE_SIZE))
* UNIV_PAGE_SIZE;
@@ -2377,7 +2462,7 @@ os_file_pread(
os_n_file_reads++;
- if (innobase_get_slow_log() && trx && trx->take_stats)
+ if (UNIV_UNLIKELY(trx && trx->take_stats))
{
trx->io_reads++;
trx->io_read += n;
@@ -2410,7 +2495,7 @@ os_file_pread(
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
- if (innobase_get_slow_log() && trx && trx->take_stats && start_time)
+ if (UNIV_UNLIKELY(start_time != 0))
{
ut_usectime(&sec, &ms);
finish_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -2464,7 +2549,7 @@ os_file_pread(
os_n_pending_reads--;
os_mutex_exit(os_file_count_mutex);
- if (innobase_get_slow_log() && trx && trx->take_stats && start_time)
+ if (UNIV_UNLIKELY(start_time != 0)
{
ut_usectime(&sec, &ms);
finish_time = (ib_uint64_t)sec * 1000000 + ms;
@@ -4245,8 +4330,8 @@ os_aio_func(
ut_ad(file);
ut_ad(buf);
ut_ad(n > 0);
- ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0);
- ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
+ ut_ad(n % OS_MIN_LOG_BLOCK_SIZE == 0);
+ ut_ad(offset % OS_MIN_LOG_BLOCK_SIZE == 0);
ut_ad(os_aio_validate_skip());
#ifdef WIN_ASYNC_IO
ut_ad((n & 0xFFFFFFFFUL) == n);
diff --git a/storage/xtradb/page/page0cur.c b/storage/xtradb/page/page0cur.c
index d49b121afab..a722f5b188d 100644
--- a/storage/xtradb/page/page0cur.c
+++ b/storage/xtradb/page/page0cur.c
@@ -310,7 +310,7 @@ page_cur_search_with_match(
#endif /* UNIV_DEBUG */
page = buf_block_get_frame(block);
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
page_check_dir(page);
@@ -1248,7 +1248,7 @@ page_cur_insert_rec_zip(
ut_ad(!page_rec_is_supremum(*current_rec));
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
/* 1. Get the size of the physical record in the page */
@@ -1902,6 +1902,7 @@ page_cur_delete_rec(
/* Save to local variables some data associated with current_rec */
cur_slot_no = page_dir_find_owner_slot(current_rec);
+ ut_ad(cur_slot_no > 0);
cur_dir_slot = page_dir_get_nth_slot(page, cur_slot_no);
cur_n_owned = page_dir_slot_get_n_owned(cur_dir_slot);
@@ -1972,7 +1973,7 @@ page_cur_delete_rec(
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
}
diff --git a/storage/xtradb/page/page0page.c b/storage/xtradb/page/page0page.c
index e29fa2eb1e5..f2ce6c9fe16 100644
--- a/storage/xtradb/page/page0page.c
+++ b/storage/xtradb/page/page0page.c
@@ -626,7 +626,7 @@ page_copy_rec_list_end(
Furthermore, btr_compress() may set FIL_PAGE_PREV to
FIL_NULL on new_page while leaving it intact on
new_page_zip. So, we cannot validate new_page_zip. */
- ut_a(page_zip_validate_low(page_zip, page, TRUE));
+ ut_a(page_zip_validate_low(page_zip, page, index, TRUE));
}
#endif /* UNIV_ZIP_DEBUG */
ut_ad(buf_block_get_frame(block) == page);
@@ -796,8 +796,8 @@ zip_reorganize:
/* Before copying, "ret" was the predecessor
of the predefined supremum record. If it was
the predefined infimum record, then it would
- still be the infimum. Thus, the assertion
- ut_a(ret_pos > 0) would fail here. */
+ still be the infimum, and we would have
+ ret_pos == 0. */
if (UNIV_UNLIKELY
(!page_zip_reorganize(new_block, index, mtr))) {
@@ -946,7 +946,7 @@ page_delete_rec_list_end(
ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE);
ut_ad(!page_zip || page_rec_is_comp(rec));
#ifdef UNIV_ZIP_DEBUG
- ut_a(!page_zip || page_zip_validate(page_zip, page));
+ ut_a(!page_zip || page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
if (page_rec_is_infimum(rec)) {
@@ -988,7 +988,7 @@ page_delete_rec_list_end(
ULINT_UNDEFINED, &heap);
rec = rec_get_next_ptr(rec, TRUE);
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
page_cur_delete_rec(&cur, index, offsets, mtr);
} while (page_offset(rec) != PAGE_NEW_SUPREMUM);
@@ -1052,6 +1052,7 @@ page_delete_rec_list_end(
n_owned = rec_get_n_owned_new(rec2) - count;
slot_index = page_dir_find_owner_slot(rec2);
+ ut_ad(slot_index > 0);
slot = page_dir_get_nth_slot(page, slot_index);
} else {
rec_t* rec2 = rec;
@@ -1067,6 +1068,7 @@ page_delete_rec_list_end(
n_owned = rec_get_n_owned_old(rec2) - count;
slot_index = page_dir_find_owner_slot(rec2);
+ ut_ad(slot_index > 0);
slot = page_dir_get_nth_slot(page, slot_index);
}
@@ -1126,7 +1128,8 @@ page_delete_rec_list_start(
between btr_attach_half_pages() and insert_page = ...
when btr_page_get_split_rec_to_left() holds
(direction == FSP_DOWN). */
- ut_a(!page_zip || page_zip_validate_low(page_zip, page, TRUE));
+ ut_a(!page_zip
+ || page_zip_validate_low(page_zip, page, index, TRUE));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -1197,9 +1200,10 @@ page_move_rec_list_end(
= buf_block_get_page_zip(block);
ut_a(!new_page_zip == !page_zip);
ut_a(!new_page_zip
- || page_zip_validate(new_page_zip, new_page));
+ || page_zip_validate(new_page_zip, new_page, index));
ut_a(!page_zip
- || page_zip_validate(page_zip, page_align(split_rec)));
+ || page_zip_validate(page_zip, page_align(split_rec),
+ index));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -1471,6 +1475,10 @@ page_rec_get_nth_const(
ulint n_owned;
const rec_t* rec;
+ if (nth == 0) {
+ return(page_get_infimum_rec(page));
+ }
+
ut_ad(nth < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
for (i = 0;; i++) {
diff --git a/storage/xtradb/page/page0zip.c b/storage/xtradb/page/page0zip.c
index 4751f4816a9..5357479908f 100644
--- a/storage/xtradb/page/page0zip.c
+++ b/storage/xtradb/page/page0zip.c
@@ -1437,7 +1437,7 @@ err_exit:
page_zip_get_size(page_zip) - PAGE_DATA);
mem_heap_free(heap);
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
if (mtr) {
@@ -3123,6 +3123,7 @@ page_zip_validate_low(
/*==================*/
const page_zip_des_t* page_zip,/*!< in: compressed page */
const page_t* page, /*!< in: uncompressed page */
+ const dict_index_t* index, /*!< in: index of the page, if known */
ibool sloppy) /*!< in: FALSE=strict,
TRUE=ignore the MIN_REC_FLAG */
{
@@ -3210,39 +3211,102 @@ page_zip_validate_low(
committed. Let us tolerate that difference when we
are performing a sloppy validation. */
- if (sloppy) {
- byte info_bits_diff;
- ulint offset
- = rec_get_next_offs(page + PAGE_NEW_INFIMUM,
- TRUE);
- ut_a(offset >= PAGE_NEW_SUPREMUM);
- offset -= 5 /* REC_NEW_INFO_BITS */;
-
- info_bits_diff = page[offset] ^ temp_page[offset];
-
- if (info_bits_diff == REC_INFO_MIN_REC_FLAG) {
- temp_page[offset] = page[offset];
-
- if (!memcmp(page + PAGE_HEADER,
- temp_page + PAGE_HEADER,
- UNIV_PAGE_SIZE - PAGE_HEADER
- - FIL_PAGE_DATA_END)) {
-
- /* Only the minimum record flag
- differed. Let us ignore it. */
- page_zip_fail(("page_zip_validate: "
- "min_rec_flag "
- "(ignored, "
- "%lu,%lu,0x%02lx)\n",
- page_get_space_id(page),
- page_get_page_no(page),
- (ulong) page[offset]));
- goto func_exit;
+ ulint* offsets;
+ mem_heap_t* heap;
+ const rec_t* rec;
+ const rec_t* trec;
+ byte info_bits_diff;
+ ulint offset
+ = rec_get_next_offs(page + PAGE_NEW_INFIMUM, TRUE);
+ ut_a(offset >= PAGE_NEW_SUPREMUM);
+ offset -= 5/*REC_NEW_INFO_BITS*/;
+
+ info_bits_diff = page[offset] ^ temp_page[offset];
+
+ if (info_bits_diff == REC_INFO_MIN_REC_FLAG) {
+ temp_page[offset] = page[offset];
+
+ if (!memcmp(page + PAGE_HEADER,
+ temp_page + PAGE_HEADER,
+ UNIV_PAGE_SIZE - PAGE_HEADER
+ - FIL_PAGE_DATA_END)) {
+
+ /* Only the minimum record flag
+ differed. Let us ignore it. */
+ page_zip_fail(("page_zip_validate: "
+ "min_rec_flag "
+ "(%s"
+ "%lu,%lu,0x%02lx)\n",
+ sloppy ? "ignored, " : "",
+ page_get_space_id(page),
+ page_get_page_no(page),
+ (ulong) page[offset]));
+ valid = sloppy;
+ goto func_exit;
+ }
+ }
+
+ /* Compare the pointers in the PAGE_FREE list. */
+ rec = page_header_get_ptr(page, PAGE_FREE);
+ trec = page_header_get_ptr(temp_page, PAGE_FREE);
+
+ while (rec || trec) {
+ if (page_offset(rec) != page_offset(trec)) {
+ page_zip_fail(("page_zip_validate: "
+ "PAGE_FREE list: %u!=%u\n",
+ (unsigned) page_offset(rec),
+ (unsigned) page_offset(trec)));
+ valid = FALSE;
+ goto func_exit;
+ }
+
+ rec = page_rec_get_next_low(rec, TRUE);
+ trec = page_rec_get_next_low(trec, TRUE);
+ }
+
+ /* Compare the records. */
+ heap = NULL;
+ offsets = NULL;
+ rec = page_rec_get_next_low(
+ page + PAGE_NEW_INFIMUM, TRUE);
+ trec = page_rec_get_next_low(
+ temp_page + PAGE_NEW_INFIMUM, TRUE);
+
+ do {
+ if (page_offset(rec) != page_offset(trec)) {
+ page_zip_fail(("page_zip_validate: "
+ "record list: 0x%02x!=0x%02x\n",
+ (unsigned) page_offset(rec),
+ (unsigned) page_offset(trec)));
+ valid = FALSE;
+ break;
+ }
+
+ if (index) {
+ /* Compare the data. */
+ offsets = rec_get_offsets(
+ rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
+
+ if (memcmp(rec - rec_offs_extra_size(offsets),
+ trec - rec_offs_extra_size(offsets),
+ rec_offs_size(offsets))) {
+ page_zip_fail(
+ ("page_zip_validate: "
+ "record content: 0x%02x",
+ (unsigned) page_offset(rec)));
+ valid = FALSE;
+ break;
}
}
+
+ rec = page_rec_get_next_low(rec, TRUE);
+ trec = page_rec_get_next_low(trec, TRUE);
+ } while (rec || trec);
+
+ if (heap) {
+ mem_heap_free(heap);
}
- page_zip_fail(("page_zip_validate: content\n"));
- valid = FALSE;
}
func_exit:
@@ -3264,9 +3328,10 @@ ibool
page_zip_validate(
/*==============*/
const page_zip_des_t* page_zip,/*!< in: compressed page */
- const page_t* page) /*!< in: uncompressed page */
+ const page_t* page, /*!< in: uncompressed page */
+ const dict_index_t* index) /*!< in: index of the page, if known */
{
- return(page_zip_validate_low(page_zip, page,
+ return(page_zip_validate_low(page_zip, page, index,
recv_recovery_is_on()));
}
#endif /* UNIV_ZIP_DEBUG */
@@ -3597,7 +3662,7 @@ page_zip_write_rec(
page_zip->m_nonempty = TRUE;
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page_align(rec)));
+ ut_a(page_zip_validate(page_zip, page_align(rec), index));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -3644,7 +3709,7 @@ corrupt:
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, NULL));
#endif /* UNIV_ZIP_DEBUG */
memcpy(page + offset,
@@ -3653,7 +3718,7 @@ corrupt:
ptr + 4, BTR_EXTERN_FIELD_REF_SIZE);
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, NULL));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -3720,7 +3785,7 @@ page_zip_write_blob_ptr(
memcpy(externs, field, BTR_EXTERN_FIELD_REF_SIZE);
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
if (mtr) {
@@ -3791,7 +3856,7 @@ corrupt:
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, NULL));
#endif /* UNIV_ZIP_DEBUG */
field = page + offset;
@@ -3812,7 +3877,7 @@ corrupt:
memcpy(storage, ptr + 4, REC_NODE_PTR_SIZE);
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, NULL));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -4039,7 +4104,7 @@ page_zip_clear_rec(
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -4063,7 +4128,7 @@ page_zip_rec_set_deleted(
*slot &= ~(PAGE_ZIP_DIR_SLOT_DEL >> 8);
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page_align(rec)));
+ ut_a(page_zip_validate(page_zip, page_align(rec), NULL));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -4364,14 +4429,14 @@ corrupt:
goto corrupt;
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, NULL));
#endif /* UNIV_ZIP_DEBUG */
memcpy(page + offset, ptr, len);
memcpy(page_zip->data + offset, ptr, len);
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, NULL));
#endif /* UNIV_ZIP_DEBUG */
}
@@ -4449,7 +4514,7 @@ page_zip_reorganize(
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
ut_ad(page_is_comp(page));
ut_ad(!dict_index_is_ibuf(index));
- /* Note that page_zip_validate(page_zip, page) may fail here. */
+ /* Note that page_zip_validate(page_zip, page, index) may fail here. */
UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
@@ -4536,7 +4601,7 @@ page_zip_copy_recs(
FIL_PAGE_PREV or PAGE_LEVEL, causing a temporary min_rec_flag
mismatch. A strict page_zip_validate() will be executed later
during the B-tree operations. */
- ut_a(page_zip_validate_low(src_zip, src, TRUE));
+ ut_a(page_zip_validate_low(src_zip, src, index, TRUE));
#endif /* UNIV_ZIP_DEBUG */
ut_a(page_zip_get_size(page_zip) == page_zip_get_size(src_zip));
if (UNIV_UNLIKELY(src_zip->n_blobs)) {
@@ -4597,7 +4662,7 @@ page_zip_copy_recs(
}
#ifdef UNIV_ZIP_DEBUG
- ut_a(page_zip_validate(page_zip, page));
+ ut_a(page_zip_validate(page_zip, page, index));
#endif /* UNIV_ZIP_DEBUG */
btr_blob_dbg_add(page, index, "page_zip_copy_recs");
diff --git a/storage/xtradb/rem/rem0rec.c b/storage/xtradb/rem/rem0rec.c
index 30fc28561fa..6bd40c54a0c 100644
--- a/storage/xtradb/rem/rem0rec.c
+++ b/storage/xtradb/rem/rem0rec.c
@@ -167,7 +167,6 @@ rec_get_n_extern_new(
{
const byte* nulls;
const byte* lens;
- dict_field_t* field;
ulint null_mask;
ulint n_extern;
ulint i;
@@ -188,10 +187,13 @@ rec_get_n_extern_new(
/* read the lengths of fields 0..n */
do {
- ulint len;
+ const dict_field_t* field
+ = dict_index_get_nth_field(index, i);
+ const dict_col_t* col
+ = dict_field_get_col(field);
+ ulint len;
- field = dict_index_get_nth_field(index, i);
- if (!(dict_field_get_col(field)->prtype & DATA_NOT_NULL)) {
+ if (!(col->prtype & DATA_NOT_NULL)) {
/* nullable field => read the null flag */
if (UNIV_UNLIKELY(!(byte) null_mask)) {
@@ -209,8 +211,6 @@ rec_get_n_extern_new(
if (UNIV_UNLIKELY(!field->fixed_len)) {
/* Variable-length field: read the length */
- const dict_col_t* col
- = dict_field_get_col(field);
len = *lens--;
/* If the maximum length of the field is up
to 255 bytes, the actual length is always
@@ -239,16 +239,15 @@ rec_get_n_extern_new(
Determine the offset to each field in a leaf-page record
in ROW_FORMAT=COMPACT. This is a special case of
rec_init_offsets() and rec_get_offsets_func(). */
-UNIV_INTERN
+UNIV_INLINE __attribute__((nonnull))
void
rec_init_offsets_comp_ordinary(
/*===========================*/
const rec_t* rec, /*!< in: physical record in
ROW_FORMAT=COMPACT */
- ulint extra, /*!< in: number of bytes to reserve
- between the record header and
- the data payload
- (usually REC_N_NEW_EXTRA_BYTES) */
+ ibool temp, /*!< in: whether to use the
+ format for temporary files in
+ index creation */
const dict_index_t* index, /*!< in: record descriptor */
ulint* offsets)/*!< in/out: array of offsets;
in: n=rec_offs_n_fields(offsets) */
@@ -256,27 +255,38 @@ rec_init_offsets_comp_ordinary(
ulint i = 0;
ulint offs = 0;
ulint any_ext = 0;
- const byte* nulls = rec - (extra + 1);
+ const byte* nulls = temp
+ ? rec - 1
+ : rec - (1 + REC_N_NEW_EXTRA_BYTES);
const byte* lens = nulls
- UT_BITS_IN_BYTES(index->n_nullable);
- dict_field_t* field;
ulint null_mask = 1;
#ifdef UNIV_DEBUG
- /* We cannot invoke rec_offs_make_valid() here, because it can hold
- that extra != REC_N_NEW_EXTRA_BYTES. Similarly, rec_offs_validate()
- will fail in that case, because it invokes rec_get_status(). */
+ /* We cannot invoke rec_offs_make_valid() here if temp=TRUE.
+ Similarly, rec_offs_validate() will fail in that case, because
+ it invokes rec_get_status(). */
offsets[2] = (ulint) rec;
offsets[3] = (ulint) index;
#endif /* UNIV_DEBUG */
+ ut_ad(temp || dict_table_is_comp(index->table));
+
+ if (temp && dict_table_is_comp(index->table)) {
+ /* No need to do adjust fixed_len=0. We only need to
+ adjust it for ROW_FORMAT=REDUNDANT. */
+ temp = FALSE;
+ }
+
/* read the lengths of fields 0..n */
do {
- ulint len;
+ const dict_field_t* field
+ = dict_index_get_nth_field(index, i);
+ const dict_col_t* col
+ = dict_field_get_col(field);
+ ulint len;
- field = dict_index_get_nth_field(index, i);
- if (!(dict_field_get_col(field)->prtype
- & DATA_NOT_NULL)) {
+ if (!(col->prtype & DATA_NOT_NULL)) {
/* nullable field => read the null flag */
if (UNIV_UNLIKELY(!(byte) null_mask)) {
@@ -296,10 +306,9 @@ rec_init_offsets_comp_ordinary(
null_mask <<= 1;
}
- if (UNIV_UNLIKELY(!field->fixed_len)) {
+ if (!field->fixed_len
+ || (temp && !dict_col_get_fixed_size(col, temp))) {
/* Variable-length field: read the length */
- const dict_col_t* col
- = dict_field_get_col(field);
len = *lens--;
/* If the maximum length of the field is up
to 255 bytes, the actual length is always
@@ -393,9 +402,8 @@ rec_init_offsets(
= dict_index_get_n_unique_in_tree(index);
break;
case REC_STATUS_ORDINARY:
- rec_init_offsets_comp_ordinary(rec,
- REC_N_NEW_EXTRA_BYTES,
- index, offsets);
+ rec_init_offsets_comp_ordinary(
+ rec, FALSE, index, offsets);
return;
}
@@ -766,17 +774,19 @@ rec_get_nth_field_offs_old(
/**********************************************************//**
Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
@return total size */
-UNIV_INTERN
+UNIV_INLINE __attribute__((warn_unused_result, nonnull(1,2)))
ulint
-rec_get_converted_size_comp_prefix(
-/*===============================*/
+rec_get_converted_size_comp_prefix_low(
+/*===================================*/
const dict_index_t* index, /*!< in: record descriptor;
dict_table_is_comp() is
assumed to hold, even if
it does not */
const dfield_t* fields, /*!< in: array of data fields */
ulint n_fields,/*!< in: number of data fields */
- ulint* extra) /*!< out: extra size */
+ ulint* extra, /*!< out: extra size */
+ ibool temp) /*!< in: whether this is a
+ temporary file record */
{
ulint extra_size;
ulint data_size;
@@ -785,15 +795,25 @@ rec_get_converted_size_comp_prefix(
ut_ad(fields);
ut_ad(n_fields > 0);
ut_ad(n_fields <= dict_index_get_n_fields(index));
+ ut_ad(!temp || extra);
- extra_size = REC_N_NEW_EXTRA_BYTES
+ extra_size = temp
+ ? UT_BITS_IN_BYTES(index->n_nullable)
+ : REC_N_NEW_EXTRA_BYTES
+ UT_BITS_IN_BYTES(index->n_nullable);
data_size = 0;
+ if (temp && dict_table_is_comp(index->table)) {
+ /* No need to do adjust fixed_len=0. We only need to
+ adjust it for ROW_FORMAT=REDUNDANT. */
+ temp = FALSE;
+ }
+
/* read the lengths of fields 0..n */
for (i = 0; i < n_fields; i++) {
const dict_field_t* field;
ulint len;
+ ulint fixed_len;
const dict_col_t* col;
field = dict_index_get_nth_field(index, i);
@@ -809,8 +829,14 @@ rec_get_converted_size_comp_prefix(
continue;
}
- ut_ad(len <= col->len || col->mtype == DATA_BLOB);
+ ut_ad(len <= col->len || col->mtype == DATA_BLOB
+ || (col->len == 0 && col->mtype == DATA_VARCHAR));
+ fixed_len = field->fixed_len;
+ if (temp && fixed_len
+ && !dict_col_get_fixed_size(col, temp)) {
+ fixed_len = 0;
+ }
/* If the maximum length of a variable-length field
is up to 255 bytes, the actual length is always stored
in one byte. If the maximum length is more than 255
@@ -818,11 +844,20 @@ rec_get_converted_size_comp_prefix(
0..127. The length will be encoded in two bytes when
it is 128 or more, or when the field is stored externally. */
- if (field->fixed_len) {
- ut_ad(len == field->fixed_len);
+ if (fixed_len) {
+#ifdef UNIV_DEBUG
+ ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen);
+
+ ut_ad(len <= fixed_len);
+
+ ut_ad(!mbmaxlen || len >= mbminlen
+ * (fixed_len / mbmaxlen));
+
/* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len
- || field->fixed_len == field->prefix_len);
+ || fixed_len == field->prefix_len);
+#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(&fields[i])) {
ut_ad(col->len >= 256 || col->mtype == DATA_BLOB);
extra_size += 2;
@@ -839,7 +874,7 @@ rec_get_converted_size_comp_prefix(
data_size += len;
}
- if (UNIV_LIKELY_NULL(extra)) {
+ if (extra) {
*extra = extra_size;
}
@@ -847,6 +882,23 @@ rec_get_converted_size_comp_prefix(
}
/**********************************************************//**
+Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
+@return total size */
+UNIV_INTERN
+ulint
+rec_get_converted_size_comp_prefix(
+/*===============================*/
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint* extra) /*!< out: extra size */
+{
+ ut_ad(dict_table_is_comp(index->table));
+ return(rec_get_converted_size_comp_prefix_low(
+ index, fields, n_fields, extra, FALSE));
+}
+
+/**********************************************************//**
Determines the size of a data tuple in ROW_FORMAT=COMPACT.
@return total size */
UNIV_INTERN
@@ -890,8 +942,8 @@ rec_get_converted_size_comp(
return(ULINT_UNDEFINED);
}
- return(size + rec_get_converted_size_comp_prefix(index, fields,
- n_fields, extra));
+ return(size + rec_get_converted_size_comp_prefix_low(
+ index, fields, n_fields, extra, FALSE));
}
/***********************************************************//**
@@ -1068,19 +1120,18 @@ rec_convert_dtuple_to_rec_old(
/*********************************************************//**
Builds a ROW_FORMAT=COMPACT record out of a data tuple. */
-UNIV_INTERN
+UNIV_INLINE __attribute__((nonnull))
void
rec_convert_dtuple_to_rec_comp(
/*===========================*/
rec_t* rec, /*!< in: origin of record */
- ulint extra, /*!< in: number of bytes to
- reserve between the record
- header and the data payload
- (normally REC_N_NEW_EXTRA_BYTES) */
const dict_index_t* index, /*!< in: record descriptor */
- ulint status, /*!< in: status bits of the record */
const dfield_t* fields, /*!< in: array of data fields */
- ulint n_fields)/*!< in: number of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint status, /*!< in: status bits of the record */
+ ibool temp) /*!< in: whether to use the
+ format for temporary files in
+ index creation */
{
const dfield_t* field;
const dtype_t* type;
@@ -1092,31 +1143,44 @@ rec_convert_dtuple_to_rec_comp(
ulint n_node_ptr_field;
ulint fixed_len;
ulint null_mask = 1;
- ut_ad(extra == 0 || dict_table_is_comp(index->table));
- ut_ad(extra == 0 || extra == REC_N_NEW_EXTRA_BYTES);
+ ut_ad(temp || dict_table_is_comp(index->table));
ut_ad(n_fields > 0);
- switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
- case REC_STATUS_ORDINARY:
+ if (temp) {
+ ut_ad(status == REC_STATUS_ORDINARY);
ut_ad(n_fields <= dict_index_get_n_fields(index));
n_node_ptr_field = ULINT_UNDEFINED;
- break;
- case REC_STATUS_NODE_PTR:
- ut_ad(n_fields == dict_index_get_n_unique_in_tree(index) + 1);
- n_node_ptr_field = n_fields - 1;
- break;
- case REC_STATUS_INFIMUM:
- case REC_STATUS_SUPREMUM:
- ut_ad(n_fields == 1);
- n_node_ptr_field = ULINT_UNDEFINED;
- break;
- default:
- ut_error;
- return;
+ nulls = rec - 1;
+ if (dict_table_is_comp(index->table)) {
+ /* No need to do adjust fixed_len=0. We only
+ need to adjust it for ROW_FORMAT=REDUNDANT. */
+ temp = FALSE;
+ }
+ } else {
+ nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
+
+ switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
+ case REC_STATUS_ORDINARY:
+ ut_ad(n_fields <= dict_index_get_n_fields(index));
+ n_node_ptr_field = ULINT_UNDEFINED;
+ break;
+ case REC_STATUS_NODE_PTR:
+ ut_ad(n_fields
+ == dict_index_get_n_unique_in_tree(index) + 1);
+ n_node_ptr_field = n_fields - 1;
+ break;
+ case REC_STATUS_INFIMUM:
+ case REC_STATUS_SUPREMUM:
+ ut_ad(n_fields == 1);
+ n_node_ptr_field = ULINT_UNDEFINED;
+ break;
+ default:
+ ut_error;
+ return;
+ }
}
end = rec;
- nulls = rec - (extra + 1);
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
/* clear the SQL-null flags */
memset(lens + 1, 0, nulls - lens);
@@ -1162,6 +1226,10 @@ rec_convert_dtuple_to_rec_comp(
ifield = dict_index_get_nth_field(index, i);
fixed_len = ifield->fixed_len;
+ if (temp && fixed_len
+ && !dict_col_get_fixed_size(ifield->col, temp)) {
+ fixed_len = 0;
+ }
/* If the maximum length of a variable-length field
is up to 255 bytes, the actual length is always stored
in one byte. If the maximum length is more than 255
@@ -1169,8 +1237,17 @@ rec_convert_dtuple_to_rec_comp(
0..127. The length will be encoded in two bytes when
it is 128 or more, or when the field is stored externally. */
if (fixed_len) {
- ut_ad(len == fixed_len);
+#ifdef UNIV_DEBUG
+ ulint mbminlen = DATA_MBMINLEN(
+ ifield->col->mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(
+ ifield->col->mbminmaxlen);
+
+ ut_ad(len <= fixed_len);
+ ut_ad(!mbmaxlen || len >= mbminlen
+ * (fixed_len / mbmaxlen));
ut_ad(!dfield_is_ext(field));
+#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(field)) {
ut_ad(ifield->col->len >= 256
|| ifield->col->mtype == DATA_BLOB);
@@ -1222,8 +1299,7 @@ rec_convert_dtuple_to_rec_new(
rec = buf + extra_size;
rec_convert_dtuple_to_rec_comp(
- rec, REC_N_NEW_EXTRA_BYTES, index, status,
- dtuple->fields, dtuple->n_fields);
+ rec, index, dtuple->fields, dtuple->n_fields, status, FALSE);
/* Set the info bits of the record */
rec_set_info_and_status_bits(rec, dtuple_get_info_bits(dtuple));
@@ -1285,6 +1361,54 @@ rec_convert_dtuple_to_rec(
return(rec);
}
+#ifndef UNIV_HOTBACKUP
+/**********************************************************//**
+Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.
+@return total size */
+UNIV_INTERN
+ulint
+rec_get_converted_size_temp(
+/*========================*/
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields,/*!< in: number of data fields */
+ ulint* extra) /*!< out: extra size */
+{
+ return(rec_get_converted_size_comp_prefix_low(
+ index, fields, n_fields, extra, TRUE));
+}
+
+/******************************************************//**
+Determine the offset to each field in temporary file.
+@see rec_convert_dtuple_to_temp() */
+UNIV_INTERN
+void
+rec_init_offsets_temp(
+/*==================*/
+ const rec_t* rec, /*!< in: temporary file record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ ulint* offsets)/*!< in/out: array of offsets;
+ in: n=rec_offs_n_fields(offsets) */
+{
+ rec_init_offsets_comp_ordinary(rec, TRUE, index, offsets);
+}
+
+/*********************************************************//**
+Builds a temporary file record out of a data tuple.
+@see rec_init_offsets_temp() */
+UNIV_INTERN
+void
+rec_convert_dtuple_to_temp(
+/*=======================*/
+ rec_t* rec, /*!< out: record */
+ const dict_index_t* index, /*!< in: record descriptor */
+ const dfield_t* fields, /*!< in: array of data fields */
+ ulint n_fields) /*!< in: number of fields */
+{
+ rec_convert_dtuple_to_rec_comp(rec, index, fields, n_fields,
+ REC_STATUS_ORDINARY, TRUE);
+}
+
/**************************************************************//**
Copies the first n fields of a physical record to a data tuple. The fields
are copied to the memory heap. */
@@ -1495,6 +1619,7 @@ rec_copy_prefix_to_buf(
return(*buf + (rec - (lens + 1)));
}
+#endif /* UNIV_HOTBACKUP */
/***************************************************************//**
Validates the consistency of an old-style physical record.
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index 61c3720fa2e..fda0c55b5c7 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -2288,7 +2288,10 @@ row_ins_index_entry(
err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
n_ext, thr);
if (err != DB_FAIL) {
-
+ if (index == dict_table_get_first_index(index->table)
+ && thr_get_trx(thr)->mysql_thd != 0) {
+ DEBUG_SYNC_C("row_ins_clust_index_entry_leaf_after");
+ }
return(err);
}
diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c
index 0fd13f5339c..0b6a6302854 100644
--- a/storage/xtradb/row/row0merge.c
+++ b/storage/xtradb/row/row0merge.c
@@ -301,6 +301,7 @@ row_merge_buf_add(
for (i = 0; i < n_fields; i++, field++, ifield++) {
const dict_col_t* col;
ulint col_no;
+ ulint fixed_len;
const dfield_t* row_field;
ulint len;
@@ -349,9 +350,30 @@ row_merge_buf_add(
ut_ad(len <= col->len || col->mtype == DATA_BLOB);
- if (ifield->fixed_len) {
- ut_ad(len == ifield->fixed_len);
+ fixed_len = ifield->fixed_len;
+ if (fixed_len && !dict_table_is_comp(index->table)
+ && DATA_MBMINLEN(col->mbminmaxlen)
+ != DATA_MBMAXLEN(col->mbminmaxlen)) {
+ /* CHAR in ROW_FORMAT=REDUNDANT is always
+ fixed-length, but in the temporary file it is
+ variable-length for variable-length character
+ sets. */
+ fixed_len = 0;
+ }
+
+ if (fixed_len) {
+#ifdef UNIV_DEBUG
+ ulint mbminlen = DATA_MBMINLEN(col->mbminmaxlen);
+ ulint mbmaxlen = DATA_MBMAXLEN(col->mbminmaxlen);
+
+ /* len should be between size calcualted base on
+ mbmaxlen and mbminlen */
+ ut_ad(len <= fixed_len);
+ ut_ad(!mbmaxlen || len >= mbminlen
+ * (fixed_len / mbmaxlen));
+
ut_ad(!dfield_is_ext(field));
+#endif /* UNIV_DEBUG */
} else if (dfield_is_ext(field)) {
extra_size += 2;
} else if (len < 128
@@ -372,12 +394,11 @@ row_merge_buf_add(
ulint size;
ulint extra;
- size = rec_get_converted_size_comp(index,
- REC_STATUS_ORDINARY,
- entry, n_fields, &extra);
+ size = rec_get_converted_size_temp(
+ index, entry, n_fields, &extra);
- ut_ad(data_size + extra_size + REC_N_NEW_EXTRA_BYTES == size);
- ut_ad(extra_size + REC_N_NEW_EXTRA_BYTES == extra);
+ ut_ad(data_size + extra_size == size);
+ ut_ad(extra_size == extra);
}
#endif /* UNIV_DEBUG */
@@ -581,14 +602,9 @@ row_merge_buf_write(
ulint extra_size;
const dfield_t* entry = buf->tuples[i];
- size = rec_get_converted_size_comp(index,
- REC_STATUS_ORDINARY,
- entry, n_fields,
- &extra_size);
+ size = rec_get_converted_size_temp(
+ index, entry, n_fields, &extra_size);
ut_ad(size >= extra_size);
- ut_ad(extra_size >= REC_N_NEW_EXTRA_BYTES);
- extra_size -= REC_N_NEW_EXTRA_BYTES;
- size -= REC_N_NEW_EXTRA_BYTES;
/* Encode extra_size + 1 */
if (extra_size + 1 < 0x80) {
@@ -601,9 +617,8 @@ row_merge_buf_write(
ut_ad(b + size < block[1]);
- rec_convert_dtuple_to_rec_comp(b + extra_size, 0, index,
- REC_STATUS_ORDINARY,
- entry, n_fields);
+ rec_convert_dtuple_to_temp(b + extra_size, index,
+ entry, n_fields);
b += size;
@@ -709,6 +724,8 @@ row_merge_read(
ib_uint64_t ofs = ((ib_uint64_t) offset) * block_size;
ibool success;
+ DBUG_EXECUTE_IF("row_merge_read_failure", return(FALSE););
+
#ifdef UNIV_DEBUG
if (row_merge_print_block_read) {
fprintf(stderr, "row_merge_read fd=%d ofs=%lu\n",
@@ -756,6 +773,8 @@ row_merge_write(
(ulint) (ofs >> 32),
block_size);
+ DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
+
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
fprintf(stderr, "row_merge_write fd=%d ofs=%lu\n",
@@ -872,7 +891,7 @@ err_exit:
*mrec = *buf + extra_size;
- rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets);
+ rec_init_offsets_temp(*mrec, index, offsets);
data_size = rec_offs_data_size(offsets);
@@ -891,7 +910,7 @@ err_exit:
*mrec = b + extra_size;
- rec_init_offsets_comp_ordinary(*mrec, 0, index, offsets);
+ rec_init_offsets_temp(*mrec, index, offsets);
data_size = rec_offs_data_size(offsets);
ut_ad(extra_size + data_size < block_size);
@@ -2261,7 +2280,7 @@ row_merge_drop_temp_indexes(void)
/*********************************************************************//**
Creates temperary merge files, and if UNIV_PFS_IO defined, register
the file descriptor with Performance Schema.
-@return File descriptor */
+@return file descriptor, or -1 on failure */
UNIV_INLINE
int
row_merge_file_create_low(void)
@@ -2283,12 +2302,19 @@ row_merge_file_create_low(void)
#ifdef UNIV_PFS_IO
register_pfs_file_open_end(locker, fd);
#endif
+ if (fd < 0) {
+ fprintf(stderr,
+ "InnoDB: Error: Cannot create temporary merge file\n");
+ return(-1);
+ }
return(fd);
}
+
/*********************************************************************//**
-Create a merge file. */
-static
-void
+Create a merge file.
+@return file descriptor, or -1 on failure */
+static __attribute__((nonnull, warn_unused_result))
+int
row_merge_file_create(
/*==================*/
merge_file_t* merge_file) /*!< out: merge file structure */
@@ -2296,6 +2322,7 @@ row_merge_file_create(
merge_file->fd = row_merge_file_create_low();
merge_file->offset = 0;
merge_file->n_rec = 0;
+ return(merge_file->fd);
}
/*********************************************************************//**
@@ -2541,6 +2568,28 @@ row_merge_rename_tables(
goto err_exit;
}
+ /* Generate the redo logs for file operations */
+ fil_mtr_rename_log(old_table->space, old_name,
+ new_table->space, new_table->name, tmp_name);
+
+ /* What if the redo logs are flushed to disk here? This is
+ tested with following crash point */
+ DBUG_EXECUTE_IF("bug14669848_precommit", log_buffer_flush_to_disk();
+ DBUG_SUICIDE(););
+
+ /* File operations cannot be rolled back. So, before proceeding
+ with file operations, commit the dictionary changes.*/
+ trx_commit_for_mysql(trx);
+
+ /* If server crashes here, the dictionary in InnoDB and MySQL
+ will differ. The .ibd files and the .frm files must be swapped
+ manually by the administrator. No loss of data. */
+ DBUG_EXECUTE_IF("bug14669848", DBUG_SUICIDE(););
+
+ /* Ensure that the redo logs are flushed to disk. The config
+ innodb_flush_log_at_trx_commit must not affect this. */
+ log_buffer_flush_to_disk();
+
/* The following calls will also rename the .ibd data files if
the tables are stored in a single-table tablespace */
@@ -2715,7 +2764,7 @@ row_merge_build_indexes(
ulint block_size;
ulint i;
ulint error;
- int tmpfd;
+ int tmpfd = -1;
ulint merge_sort_block_size;
void* block_mem;
@@ -2741,13 +2790,31 @@ row_merge_build_indexes(
i * merge_sort_block_size);
}
+ /* Initialize all the merge file descriptors, so that we
+ don't call row_merge_file_destroy() on uninitialized
+ merge file descriptor */
+
+ for (i = 0; i < n_indexes; i++) {
+ merge_files[i].fd = -1;
+ }
+
for (i = 0; i < n_indexes; i++) {
- row_merge_file_create(&merge_files[i]);
+ if (row_merge_file_create(&merge_files[i]) < 0)
+ {
+ error = DB_OUT_OF_MEMORY;
+ goto func_exit;
+ }
}
tmpfd = row_merge_file_create_low();
+ if (tmpfd < 0)
+ {
+ error = DB_OUT_OF_MEMORY;
+ goto func_exit;
+ }
+
/* Reset the MySQL row buffer that is used when reporting
duplicate keys. */
innobase_rec_reset(table);
diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c
index 9ab85940760..3a18cfc679e 100644
--- a/storage/xtradb/row/row0mysql.c
+++ b/storage/xtradb/row/row0mysql.c
@@ -1879,7 +1879,8 @@ Creates a table for MySQL. If the name of the table ends in
one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor",
"innodb_table_monitor", then this will also start the printing of monitor
output by the master thread. If the table name ends in "innodb_mem_validate",
-InnoDB will try to invoke mem_validate().
+InnoDB will try to invoke mem_validate(). On failure the transaction will
+be rolled back and the 'table' object will be freed.
@return error code or DB_SUCCESS */
UNIV_INTERN
int
@@ -2017,6 +2018,8 @@ err_exit:
row_drop_table_for_mysql(table->name, trx, FALSE);
trx_commit_for_mysql(trx);
+ } else {
+ dict_mem_table_free(table);
}
break;
@@ -4270,6 +4273,13 @@ end:
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, NULL);
trx->error_state = DB_SUCCESS;
+ } else {
+ if (old_is_tmp && !new_is_tmp) {
+ /* After ALTER TABLE the table statistics
+ needs to be rebuilt. It will be rebuilt
+ when the table is loaded again. */
+ table->stat_initialized = FALSE;
+ }
}
}
diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c
index ec3603f2550..858d50fd5a6 100644
--- a/storage/xtradb/row/row0sel.c
+++ b/storage/xtradb/row/row0sel.c
@@ -2489,6 +2489,9 @@ row_sel_convert_mysql_key_to_innobase(
dfield++;
}
+ DBUG_EXECUTE_IF("innodb_srch_key_buffer_full",
+ ut_a(buf == (original_buf + buf_len)););
+
ut_a(buf <= original_buf + buf_len);
/* We set the length of tuple to n_fields: we assume that the memory
@@ -3641,13 +3644,13 @@ row_search_for_mysql(
should_release = 0;
for (i = 0; i < btr_search_index_num; i++) {
/* we should check all latches (fix Bug#791030) */
- if (rw_lock_get_writer(btr_search_latch_part[i])
- != RW_LOCK_NOT_LOCKED) {
+ if (UNIV_UNLIKELY(rw_lock_get_writer(btr_search_latch_part[i])
+ != RW_LOCK_NOT_LOCKED)) {
should_release |= ((ulint)1 << i);
}
}
- if (should_release) {
+ if (UNIV_UNLIKELY(should_release)) {
/* There is an x-latch request on the adaptive hash index:
release the s-latch to reduce starvation and wait for
@@ -4124,6 +4127,11 @@ wait_table_again:
}
rec_loop:
+ if (trx_is_interrupted(trx)) {
+ err = DB_INTERRUPTED;
+ goto normal_return;
+ }
+
/*-------------------------------------------------------------*/
/* PHASE 4: Look for matching records in a loop */
@@ -5118,11 +5126,15 @@ row_search_autoinc_read_column(
rec_offs_init(offsets_);
- offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
+ offsets = rec_get_offsets(rec, index, offsets, col_no + 1, &heap);
- data = rec_get_nth_field(rec, offsets, col_no, &len);
+ if (rec_offs_nth_sql_null(offsets, col_no)) {
+ /* There is no non-NULL value in the auto-increment column. */
+ value = 0;
+ goto func_exit;
+ }
- ut_a(len != UNIV_SQL_NULL);
+ data = rec_get_nth_field(rec, offsets, col_no, &len);
switch (mtype) {
case DATA_INT:
@@ -5144,14 +5156,15 @@ row_search_autoinc_read_column(
ut_error;
}
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
-
if (!unsigned_type && (ib_int64_t) value < 0) {
value = 0;
}
+func_exit:
+ if (UNIV_LIKELY_NULL(heap)) {
+ mem_heap_free(heap);
+ }
+
return(value);
}
diff --git a/storage/xtradb/row/row0umod.c b/storage/xtradb/row/row0umod.c
index 9597c476125..3c933c87b27 100644
--- a/storage/xtradb/row/row0umod.c
+++ b/storage/xtradb/row/row0umod.c
@@ -69,36 +69,6 @@ If you make a change in this module make sure that no codepath is
introduced where a call to log_free_check() is bypassed. */
/***********************************************************//**
-Checks if also the previous version of the clustered index record was
-modified or inserted by the same transaction, and its undo number is such
-that it should be undone in the same rollback.
-@return TRUE if also previous modify or insert of this row should be undone */
-static
-ibool
-row_undo_mod_undo_also_prev_vers(
-/*=============================*/
- undo_node_t* node, /*!< in: row undo node */
- undo_no_t* undo_no)/*!< out: the undo number */
-{
- trx_undo_rec_t* undo_rec;
- trx_t* trx;
-
- trx = node->trx;
-
- if (node->new_trx_id != trx->id) {
-
- *undo_no = 0;
- return(FALSE);
- }
-
- undo_rec = trx_undo_get_undo_rec_low(node->new_roll_ptr, node->heap);
-
- *undo_no = trx_undo_rec_get_undo_no(undo_rec);
-
- return(trx->roll_limit <= *undo_no);
-}
-
-/***********************************************************//**
Undoes a modify in a clustered index record.
@return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */
static
@@ -226,19 +196,11 @@ row_undo_mod_clust(
btr_pcur_t* pcur;
mtr_t mtr;
ulint err;
- ibool success;
- ibool more_vers;
- undo_no_t new_undo_no;
ut_ad(node && thr);
log_free_check();
- /* Check if also the previous version of the clustered index record
- should be undone in this same rollback operation */
-
- more_vers = row_undo_mod_undo_also_prev_vers(node, &new_undo_no);
-
pcur = &(node->pcur);
mtr_start(&mtr);
@@ -286,20 +248,6 @@ row_undo_mod_clust(
trx_undo_rec_release(node->trx, node->undo_no);
- if (more_vers && err == DB_SUCCESS) {
-
- /* Reserve the undo log record to the prior version after
- committing &mtr: this is necessary to comply with the latching
- order, as &mtr may contain the fsp latch which is lower in
- the latch hierarchy than trx->undo_mutex. */
-
- success = trx_undo_rec_reserve(node->trx, new_undo_no);
-
- if (success) {
- node->state = UNDO_NODE_PREV_VERS;
- }
- }
-
return(err);
}
@@ -571,6 +519,7 @@ row_undo_mod_upd_del_sec(
ulint err = DB_SUCCESS;
ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC);
+ ut_ad(!node->undo_row);
heap = mem_heap_create(1024);
while (node->index != NULL) {
@@ -632,6 +581,8 @@ row_undo_mod_del_mark_sec(
dict_index_t* index;
ulint err;
+ ut_ad(!node->undo_row);
+
heap = mem_heap_create(1024);
while (node->index != NULL) {
@@ -847,7 +798,6 @@ row_undo_mod_parse_undo_rec(
trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
roll_ptr, info_bits, trx,
node->heap, &(node->update));
- node->new_roll_ptr = roll_ptr;
node->new_trx_id = trx_id;
node->cmpl_info = cmpl_info;
}
diff --git a/storage/xtradb/row/row0undo.c b/storage/xtradb/row/row0undo.c
index 09970b7fe21..74fc1baf1d2 100644
--- a/storage/xtradb/row/row0undo.c
+++ b/storage/xtradb/row/row0undo.c
@@ -216,7 +216,7 @@ row_undo_search_clust_to_pcur(
node->row = row_build(ROW_COPY_DATA, clust_index, rec,
offsets, NULL, ext, node->heap);
- if (node->update) {
+ if (node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
node->undo_row = dtuple_copy(node->row, node->heap);
row_upd_replace(node->undo_row, &node->undo_ext,
clust_index, node->update, node->heap);
@@ -282,25 +282,6 @@ row_undo(
} else {
node->state = UNDO_NODE_MODIFY;
}
-
- } else if (node->state == UNDO_NODE_PREV_VERS) {
-
- /* Undo should be done to the same clustered index record
- again in this same rollback, restoring the previous version */
-
- roll_ptr = node->new_roll_ptr;
-
- node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr,
- node->heap);
- node->roll_ptr = roll_ptr;
- node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec);
-
- if (trx_undo_roll_ptr_is_insert(roll_ptr)) {
-
- node->state = UNDO_NODE_INSERT;
- } else {
- node->state = UNDO_NODE_MODIFY;
- }
}
/* Prevent DROP TABLE etc. while we are rolling back this row.
diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c
index 6e210071746..6edfbaa7755 100644
--- a/storage/xtradb/srv/srv0srv.c
+++ b/storage/xtradb/srv/srv0srv.c
@@ -58,6 +58,8 @@ Created 10/8/1995 Heikki Tuuri
*******************************************************/
/* Dummy comment */
+#include "m_string.h" /* for my_sys.h */
+#include "my_sys.h" /* DEBUG_SYNC_C */
#include "srv0srv.h"
#include "ut0mem.h"
@@ -181,7 +183,7 @@ UNIV_INTERN my_bool srv_track_changed_pages = TRUE;
UNIV_INTERN ib_uint64_t srv_max_bitmap_file_size = 100 * 1024 * 1024;
-UNIV_INTERN ulonglong srv_changed_pages_limit = 0;
+UNIV_INTERN ulonglong srv_max_changed_pages = 0;
/** When TRUE, fake change transcations take S rather than X row locks.
When FALSE, row locks are not taken at all. */
@@ -312,58 +314,11 @@ UNIV_INTERN ulong srv_purge_batch_size = 20;
/* the number of rollback segments to use */
UNIV_INTERN ulong srv_rollback_segments = TRX_SYS_N_RSEGS;
-/* variable counts amount of data read in total (in bytes) */
-UNIV_INTERN ulint srv_data_read = 0;
-
/* Internal setting for "innodb_stats_method". Decides how InnoDB treats
NULL value when collecting statistics. By default, it is set to
SRV_STATS_NULLS_EQUAL(0), ie. all NULL value are treated equal */
ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL;
-/* here we count the amount of data written in total (in bytes) */
-UNIV_INTERN ulint srv_data_written = 0;
-
-/* the number of the log write requests done */
-UNIV_INTERN ulint srv_log_write_requests = 0;
-
-/* the number of physical writes to the log performed */
-UNIV_INTERN ulint srv_log_writes = 0;
-
-/* amount of data written to the log files in bytes */
-UNIV_INTERN ulint srv_os_log_written = 0;
-
-/* amount of writes being done to the log files */
-UNIV_INTERN ulint srv_os_log_pending_writes = 0;
-
-/* we increase this counter, when there we don't have enough space in the
-log buffer and have to flush it */
-UNIV_INTERN ulint srv_log_waits = 0;
-
-/* this variable counts the amount of times, when the doublewrite buffer
-was flushed */
-UNIV_INTERN ulint srv_dblwr_writes = 0;
-
-/* here we store the number of pages that have been flushed to the
-doublewrite buffer */
-UNIV_INTERN ulint srv_dblwr_pages_written = 0;
-
-/* in this variable we store the number of write requests issued */
-UNIV_INTERN ulint srv_buf_pool_write_requests = 0;
-
-/* here we store the number of times when we had to wait for a free page
-in the buffer pool. It happens when the buffer pool is full and we need
-to make a flush, in order to be able to read or create a page. */
-UNIV_INTERN ulint srv_buf_pool_wait_free = 0;
-
-/* variable to count the number of pages that were written from buffer
-pool to the disk */
-UNIV_INTERN ulint srv_buf_pool_flushed = 0;
-UNIV_INTERN ulint buf_lru_flush_page_count = 0;
-
-/** Number of buffer pool reads that led to the
-reading of a disk page */
-UNIV_INTERN ulint srv_buf_pool_reads = 0;
-
/** Time in seconds between automatic buffer pool dumps */
UNIV_INTERN uint srv_auto_lru_dump = 0;
@@ -406,6 +361,9 @@ UNIV_INTERN lint srv_conc_n_threads = 0;
InnoDB */
UNIV_INTERN ulint srv_conc_n_waiting_threads = 0;
+/* print all user-level transactions deadlocks to mysqld stderr */
+UNIV_INTERN my_bool srv_print_all_deadlocks = FALSE;
+
typedef struct srv_conc_slot_struct srv_conc_slot_t;
struct srv_conc_slot_struct{
os_event_t event; /*!< event to wait */
@@ -451,6 +409,10 @@ UNIV_INTERN ulong srv_sys_stats_root_page = 0;
#endif
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
+UNIV_INTERN ibool srv_use_atomic_writes = FALSE;
+#ifdef HAVE_POSIX_FALLOCATE
+UNIV_INTERN ibool srv_use_posix_fallocate = TRUE;
+#endif
UNIV_INTERN ibool srv_use_checksums = TRUE;
UNIV_INTERN ibool srv_fast_checksum = FALSE;
@@ -489,23 +451,83 @@ UNIV_INTERN ibool srv_print_log_io = FALSE;
UNIV_INTERN ibool srv_print_latch_waits = FALSE;
#endif /* UNIV_DEBUG */
-UNIV_INTERN ulint srv_n_rows_inserted = 0;
-UNIV_INTERN ulint srv_n_rows_updated = 0;
-UNIV_INTERN ulint srv_n_rows_deleted = 0;
-UNIV_INTERN ulint srv_n_rows_read = 0;
-
static ulint srv_n_rows_inserted_old = 0;
static ulint srv_n_rows_updated_old = 0;
static ulint srv_n_rows_deleted_old = 0;
static ulint srv_n_rows_read_old = 0;
-UNIV_INTERN ulint srv_n_lock_deadlock_count = 0;
-UNIV_INTERN ulint srv_n_lock_wait_count = 0;
-UNIV_INTERN ulint srv_n_lock_wait_current_count = 0;
-UNIV_INTERN ib_int64_t srv_n_lock_wait_time = 0;
-UNIV_INTERN ulint srv_n_lock_max_wait_time = 0;
+/* Ensure counters are on separate cache lines */
+
+#define CACHE_LINE_SIZE 64
+#define CACHE_ALIGNED __attribute__ ((aligned (CACHE_LINE_SIZE)))
+
+UNIV_INTERN byte
+counters_pad_start[CACHE_LINE_SIZE] __attribute__((unused)) = {0};
+
+UNIV_INTERN ulint srv_n_rows_inserted CACHE_ALIGNED = 0;
+UNIV_INTERN ulint srv_n_rows_updated CACHE_ALIGNED = 0;
+UNIV_INTERN ulint srv_n_rows_deleted CACHE_ALIGNED = 0;
+UNIV_INTERN ulint srv_n_rows_read CACHE_ALIGNED = 0;
+
+UNIV_INTERN ulint srv_n_lock_deadlock_count CACHE_ALIGNED = 0;
+UNIV_INTERN ulint srv_n_lock_wait_count CACHE_ALIGNED = 0;
+UNIV_INTERN ulint srv_n_lock_wait_current_count CACHE_ALIGNED = 0;
+UNIV_INTERN ib_int64_t srv_n_lock_wait_time CACHE_ALIGNED = 0;
+UNIV_INTERN ulint srv_n_lock_max_wait_time CACHE_ALIGNED = 0;
-UNIV_INTERN ulint srv_truncated_status_writes = 0;
+UNIV_INTERN ulint srv_truncated_status_writes CACHE_ALIGNED = 0;
+
+/* variable counts amount of data read in total (in bytes) */
+UNIV_INTERN ulint srv_data_read CACHE_ALIGNED = 0;
+
+/* here we count the amount of data written in total (in bytes) */
+UNIV_INTERN ulint srv_data_written CACHE_ALIGNED = 0;
+
+/* the number of the log write requests done */
+UNIV_INTERN ulint srv_log_write_requests CACHE_ALIGNED = 0;
+
+/* the number of physical writes to the log performed */
+UNIV_INTERN ulint srv_log_writes CACHE_ALIGNED = 0;
+
+/* amount of data written to the log files in bytes */
+UNIV_INTERN ulint srv_os_log_written CACHE_ALIGNED = 0;
+
+/* amount of writes being done to the log files */
+UNIV_INTERN ulint srv_os_log_pending_writes CACHE_ALIGNED = 0;
+
+/* we increase this counter, when there we don't have enough space in the
+log buffer and have to flush it */
+UNIV_INTERN ulint srv_log_waits CACHE_ALIGNED = 0;
+
+/* this variable counts the amount of times, when the doublewrite buffer
+was flushed */
+UNIV_INTERN ulint srv_dblwr_writes CACHE_ALIGNED = 0;
+
+/* here we store the number of pages that have been flushed to the
+doublewrite buffer */
+UNIV_INTERN ulint srv_dblwr_pages_written CACHE_ALIGNED = 0;
+
+/* in this variable we store the number of write requests issued */
+UNIV_INTERN ulint srv_buf_pool_write_requests CACHE_ALIGNED = 0;
+
+/* here we store the number of times when we had to wait for a free page
+in the buffer pool. It happens when the buffer pool is full and we need
+to make a flush, in order to be able to read or create a page. */
+UNIV_INTERN ulint srv_buf_pool_wait_free CACHE_ALIGNED = 0;
+
+/** Number of buffer pool reads that led to the
+reading of a disk page */
+UNIV_INTERN ulint srv_buf_pool_reads CACHE_ALIGNED = 0;
+
+/* variable to count the number of pages that were written from buffer
+pool to the disk */
+UNIV_INTERN ulint srv_buf_pool_flushed CACHE_ALIGNED = 0;
+
+/* variable to count the number of LRU flushed pages */
+UNIV_INTERN ulint buf_lru_flush_page_count CACHE_ALIGNED = 0;
+
+UNIV_INTERN byte
+counters_pad_end[CACHE_LINE_SIZE] __attribute__((unused)) = {0};
/*
Set the following to 0 if you want InnoDB to write messages on
@@ -1438,7 +1460,7 @@ retry:
ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch));
#endif /* UNIV_SYNC_DEBUG */
- if (innobase_get_slow_log() && trx->take_stats) {
+ if (UNIV_UNLIKELY(trx->take_stats)) {
ut_usectime(&sec, &ms);
start_time = (ib_uint64_t)sec * 1000000 + ms;
} else {
@@ -1453,7 +1475,7 @@ retry:
trx->op_info = "";
- if (innobase_get_slow_log() && trx->take_stats && start_time) {
+ if (UNIV_UNLIKELY(start_time != 0)) {
ut_usectime(&sec, &ms);
finish_time = (ib_uint64_t)sec * 1000000 + ms;
trx->innodb_que_wait_timer += (ulint)(finish_time - start_time);
@@ -1764,6 +1786,10 @@ srv_suspend_mysql_thread(
trx = thr_get_trx(thr);
+ if (trx->mysql_thd != 0) {
+ DEBUG_SYNC_C("srv_suspend_mysql_thread_enter");
+ }
+
os_event_set(srv_lock_timeout_thread_event);
mutex_enter(&kernel_mutex);
@@ -2193,6 +2219,8 @@ srv_printf_innodb_monitor(
(long) srv_conc_n_threads,
(ulong) srv_conc_n_waiting_threads);
+ mutex_enter(&kernel_mutex);
+
fprintf(file, "%lu read views open inside InnoDB\n",
UT_LIST_GET_LEN(trx_sys->view_list));
@@ -2206,6 +2234,8 @@ srv_printf_innodb_monitor(
}
}
+ mutex_exit(&kernel_mutex);
+
n_reserved = fil_space_get_n_reserved_extents(0);
if (n_reserved > 0) {
fprintf(file,
@@ -2290,16 +2320,18 @@ void
srv_export_innodb_status(void)
/*==========================*/
{
- buf_pool_stat_t stat;
- ulint LRU_len;
- ulint free_len;
- ulint flush_list_len;
- ulint mem_adaptive_hash, mem_dictionary;
- read_view_t* oldest_view;
- ulint i;
+ buf_pool_stat_t stat;
+ buf_pools_list_size_t buf_pools_list_size;
+ ulint LRU_len;
+ ulint free_len;
+ ulint flush_list_len;
+ ulint mem_adaptive_hash, mem_dictionary;
+ read_view_t* oldest_view;
+ ulint i;
buf_get_total_stat(&stat);
buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
+ buf_get_total_list_size_in_bytes(&buf_pools_list_size);
if (btr_search_sys && btr_search_sys->hash_index[0]->heap) {
mem_adaptive_hash = mem_heap_get_size(btr_search_sys->hash_index[0]->heap);
@@ -2364,7 +2396,12 @@ srv_export_innodb_status(void)
export_vars.innodb_buffer_pool_read_ahead_evicted
= stat.n_ra_pages_evicted;
export_vars.innodb_buffer_pool_pages_data = LRU_len;
+ export_vars.innodb_buffer_pool_bytes_data =
+ buf_pools_list_size.LRU_bytes
+ + buf_pools_list_size.unzip_LRU_bytes;
export_vars.innodb_buffer_pool_pages_dirty = flush_list_len;
+ export_vars.innodb_buffer_pool_bytes_dirty =
+ buf_pools_list_size.flush_list_bytes;
export_vars.innodb_buffer_pool_pages_free = free_len;
export_vars.innodb_deadlocks = srv_n_lock_deadlock_count;
#ifdef UNIV_DEBUG
@@ -2497,6 +2534,23 @@ srv_export_innodb_status(void)
export_vars.innodb_rows_deleted = srv_n_rows_deleted;
export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;
+#ifdef UNIV_DEBUG
+ if (trx_sys->max_trx_id < purge_sys->done_trx_no) {
+ export_vars.innodb_purge_trx_id_age = 0;
+ } else {
+ export_vars.innodb_purge_trx_id_age =
+ trx_sys->max_trx_id - purge_sys->done_trx_no;
+ }
+
+ if (!purge_sys->view
+ || trx_sys->max_trx_id < purge_sys->view->up_limit_id) {
+ export_vars.innodb_purge_view_trx_id_age = 0;
+ } else {
+ export_vars.innodb_purge_view_trx_id_age =
+ trx_sys->max_trx_id - purge_sys->view->up_limit_id;
+ }
+#endif /* UNIV_DEBUG */
+
mutex_exit(&srv_innodb_monitor_mutex);
}
@@ -3080,11 +3134,19 @@ srv_redo_log_follow_thread(
os_event_reset(srv_checkpoint_completed_event);
if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
- log_online_follow_redo_log();
+ if (!log_online_follow_redo_log()) {
+ /* TODO: sync with I_S log tracking status? */
+ fprintf(stderr,
+ "InnoDB: Error: log tracking bitmap "
+ "write failed, stopping log tracking "
+ "thread!\n");
+ break;
+ }
}
} while (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE);
+ srv_track_changed_pages = FALSE;
log_online_read_shutdown();
os_event_set(srv_redo_log_thread_finished_event);
@@ -3329,6 +3391,26 @@ loop:
for (i = 0; i < 10; i++) {
ulint cur_time = ut_time_ms();
+#ifdef UNIV_DEBUG
+ if (btr_cur_limit_optimistic_insert_debug
+ && srv_n_purge_threads == 0) {
+ /* If btr_cur_limit_optimistic_insert_debug is enabled
+ and no purge_threads, purge opportunity is increased
+ by x100 (1purge/100msec), to speed up debug scripts
+ which should wait for purged. */
+ next_itr_time -= 900;
+
+ srv_main_thread_op_info = "master purging";
+
+ srv_master_do_purge();
+
+ if (srv_fast_shutdown && srv_shutdown_state > 0) {
+
+ goto background_loop;
+ }
+ }
+#endif /* UNIV_DEBUG */
+
n_pages_flushed = 0; /* initialize */
/* ALTER TABLE in MySQL requires on Unix that the table handler
@@ -3487,8 +3569,7 @@ loop:
buf_pool = buf_pool_from_array(j);
- /* The scanning flush_list is optimistic here */
-
+ buf_flush_list_mutex_enter(buf_pool);
level = 0;
n_blocks = 0;
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
@@ -3502,6 +3583,7 @@ loop:
bpage = UT_LIST_GET_NEXT(flush_list, bpage);
n_blocks++;
}
+ buf_flush_list_mutex_exit(buf_pool);
if (level) {
bpl += ((ib_uint64_t) n_blocks * n_blocks
@@ -3567,30 +3649,25 @@ retry_flush_batch:
/* prev_flush_info[j] should be the previous loop's */
for (j = 0; j < srv_buf_pool_instances; j++) {
- lint blocks_num, new_blocks_num, flushed_blocks_num;
- ibool found;
+ lint blocks_num, new_blocks_num = 0;
+ lint flushed_blocks_num;
buf_pool = buf_pool_from_array(j);
+ buf_flush_list_mutex_enter(buf_pool);
blocks_num = UT_LIST_GET_LEN(buf_pool->flush_list);
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
- new_blocks_num = 0;
- found = FALSE;
while (bpage != NULL) {
if (prev_flush_info[j].space == bpage->space
&& prev_flush_info[j].offset == bpage->offset
&& prev_flush_info[j].oldest_modification
== bpage->oldest_modification) {
- found = TRUE;
break;
}
bpage = UT_LIST_GET_NEXT(flush_list, bpage);
new_blocks_num++;
}
- if (!found) {
- new_blocks_num = blocks_num;
- }
flushed_blocks_num = new_blocks_num + prev_flush_info[j].count
- blocks_num;
@@ -3605,7 +3682,9 @@ retry_flush_batch:
prev_flush_info[j].space = bpage->space;
prev_flush_info[j].offset = bpage->offset;
prev_flush_info[j].oldest_modification = bpage->oldest_modification;
+ buf_flush_list_mutex_exit(buf_pool);
} else {
+ buf_flush_list_mutex_exit(buf_pool);
prev_flush_info[j].space = 0;
prev_flush_info[j].offset = 0;
prev_flush_info[j].oldest_modification = 0;
@@ -3631,6 +3710,7 @@ retry_flush_batch:
/* store previous first pages of the flush_list */
for (j = 0; j < srv_buf_pool_instances; j++) {
buf_pool = buf_pool_from_array(j);
+ buf_flush_list_mutex_enter(buf_pool);
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
@@ -3639,7 +3719,9 @@ retry_flush_batch:
prev_flush_info[j].space = bpage->space;
prev_flush_info[j].offset = bpage->offset;
prev_flush_info[j].oldest_modification = bpage->oldest_modification;
+ buf_flush_list_mutex_exit(buf_pool);
} else {
+ buf_flush_list_mutex_exit(buf_pool);
prev_flush_info[j].space = 0;
prev_flush_info[j].offset = 0;
prev_flush_info[j].oldest_modification = 0;
diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c
index 2faa68cb87c..9e0477253cd 100644
--- a/storage/xtradb/srv/srv0start.c
+++ b/storage/xtradb/srv/srv0start.c
@@ -1155,6 +1155,11 @@ void
init_log_online(void)
/*=================*/
{
+ if (UNIV_UNLIKELY(srv_force_recovery > 0)) {
+ srv_track_changed_pages = FALSE;
+ return;
+ }
+
if (srv_track_changed_pages) {
log_online_read_init();
diff --git a/storage/xtradb/sync/sync0sync.c b/storage/xtradb/sync/sync0sync.c
index efc43c4cbe5..25f96d9817a 100644
--- a/storage/xtradb/sync/sync0sync.c
+++ b/storage/xtradb/sync/sync0sync.c
@@ -315,9 +315,9 @@ mutex_create_func(
/* NOTE! The very first mutexes are not put to the mutex list */
- if ((mutex == &mutex_list_mutex)
+ if (mutex == &mutex_list_mutex
#ifdef UNIV_SYNC_DEBUG
- || (mutex == &sync_thread_mutex)
+ || mutex == &sync_thread_mutex
#endif /* UNIV_SYNC_DEBUG */
) {
diff --git a/storage/xtradb/trx/trx0purge.c b/storage/xtradb/trx/trx0purge.c
index 122aab119ba..b048dc66efe 100644
--- a/storage/xtradb/trx/trx0purge.c
+++ b/storage/xtradb/trx/trx0purge.c
@@ -61,6 +61,10 @@ UNIV_INTERN mysql_pfs_key_t trx_purge_latch_key;
UNIV_INTERN mysql_pfs_key_t purge_sys_bh_mutex_key;
#endif /* UNIV_PFS_MUTEX */
+#ifdef UNIV_DEBUG
+UNIV_INTERN my_bool srv_purge_view_update_only_debug;
+#endif /* UNIV_DEBUG */
+
/*****************************************************************//**
Checks if trx_id is >= purge_view: then it is guaranteed that its update
undo log still exists in the system.
@@ -236,6 +240,7 @@ trx_purge_sys_create(
purge_sys->purge_trx_no = 0;
purge_sys->purge_undo_no = 0;
purge_sys->next_stored = FALSE;
+ ut_d(purge_sys->done_trx_no = 0);
rw_lock_create(trx_purge_latch_key,
&purge_sys->latch, SYNC_PURGE_LATCH);
@@ -656,6 +661,12 @@ trx_purge_truncate_if_arr_empty(void)
{
static ulint count;
+#ifdef UNIV_DEBUG
+ if (purge_sys->arr->n_used == 0) {
+ purge_sys->done_trx_no = purge_sys->purge_trx_no;
+ }
+#endif /* UNIV_DEBUG */
+
if (!(++count % TRX_SYS_N_RSEGS) && purge_sys->arr->n_used == 0) {
trx_purge_truncate_history();
@@ -1172,6 +1183,12 @@ trx_purge(
rw_lock_x_unlock(&(purge_sys->latch));
+#ifdef UNIV_DEBUG
+ if (srv_purge_view_update_only_debug) {
+ return(0);
+ }
+#endif
+
purge_sys->state = TRX_PURGE_ON;
purge_sys->handle_limit = purge_sys->n_pages_handled + limit;
diff --git a/storage/xtradb/trx/trx0rec.c b/storage/xtradb/trx/trx0rec.c
index db4897c368d..ef42152aeb7 100644
--- a/storage/xtradb/trx/trx0rec.c
+++ b/storage/xtradb/trx/trx0rec.c
@@ -36,6 +36,7 @@ Created 3/26/1996 Heikki Tuuri
#ifndef UNIV_HOTBACKUP
#include "dict0dict.h"
#include "ut0mem.h"
+#include "read0read.h"
#include "row0ext.h"
#include "row0upd.h"
#include "que0que.h"
@@ -1647,6 +1648,25 @@ trx_undo_prev_version_build(
if (row_upd_changes_field_size_or_external(index, offsets, update)) {
ulint n_ext;
+ /* We should confirm the existence of disowned external data,
+ if the previous version record is delete marked. If the trx_id
+ of the previous record is seen by purge view, we should treat
+ it as missing history, because the disowned external data
+ might be purged already.
+
+ The inherited external data (BLOBs) can be freed (purged)
+ after trx_id was committed, provided that no view was started
+ before trx_id. If the purge view can see the committed
+ delete-marked record by trx_id, no transactions need to access
+ the BLOB. */
+
+ if ((update->info_bits & REC_INFO_DELETED_FLAG)
+ && read_view_sees_trx_id(purge_sys->view, trx_id)) {
+ /* treat as a fresh insert, not to
+ cause assertion error at the caller. */
+ return(DB_SUCCESS);
+ }
+
/* We have to set the appropriate extern storage bits in the
old version of the record: the extern bits in rec for those
fields that update does NOT update, as well as the bits for
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c
index 99b4276fbee..a17f8abdad0 100644
--- a/storage/xtradb/trx/trx0trx.c
+++ b/storage/xtradb/trx/trx0trx.c
@@ -235,7 +235,7 @@ trx_allocate_for_mysql(void)
mutex_exit(&kernel_mutex);
- if (innobase_get_slow_log() && trx->take_stats) {
+ if (UNIV_UNLIKELY(trx->take_stats)) {
trx->distinct_page_access_hash = mem_alloc(DPAH_SIZE);
memset(trx->distinct_page_access_hash, 0, DPAH_SIZE);
}
@@ -1269,7 +1269,7 @@ trx_end_lock_wait(
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
}
- if (innobase_get_slow_log() && trx->take_stats) {
+ if (UNIV_UNLIKELY(trx->take_stats)) {
ut_usectime(&sec, &ms);
now = (ib_uint64_t)sec * 1000000 + ms;
trx->lock_que_wait_timer += (ulint)(now - trx->lock_que_wait_ustarted);
@@ -1304,7 +1304,7 @@ trx_lock_wait_to_suspended(
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
}
- if (innobase_get_slow_log() && trx->take_stats) {
+ if (UNIV_UNLIKELY(trx->take_stats)) {
ut_usectime(&sec, &ms);
now = (ib_uint64_t)sec * 1000000 + ms;
trx->lock_que_wait_timer += (ulint)(now - trx->lock_que_wait_ustarted);
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index fd327925fb8..f8455344498 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -364,9 +364,14 @@ int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)),
{
if (str >= end)
return MY_CS_TOOSMALL;
-
- *wc=cs_to_uni[*str];
- return (!wc[0] && str[0]) ? -1 : 1;
+ /*
+ There are no unassigned characters in latin1.
+ Every code point in latin1 is mapped to some Unicode code point.
+ We can always return 1, no needs to check the value of cs_to_uni[*str].
+ */
+ *wc= cs_to_uni[*str];
+ DBUG_ASSERT(wc[0] || !str[0]);
+ return 1;
}
static
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index fa43f36fb84..edb42862e50 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2003, 2012, Oracle and/or its affiliates
- Copyright (c) 2009, 2011, Monty Program Ab
+ Copyright (c) 2009, 2013, Monty Program Ab.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -40,11 +40,11 @@
#undef ULONGLONG_MAX
#define ULONGLONG_MAX (~(ulonglong) 0)
-#define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000))
+#define MAX_NEGATIVE_NUMBER ((ulonglong) 0x8000000000000000LL)
#define INIT_CNT 9
-#define LFACTOR ULL(1000000000)
-#define LFACTOR1 ULL(10000000000)
-#define LFACTOR2 ULL(100000000000)
+#define LFACTOR 1000000000ULL
+#define LFACTOR1 10000000000ULL
+#define LFACTOR2 100000000000ULL
#if defined(HAVE_CHARSET_utf32) || defined(HAVE_CHARSET_mb2)
static unsigned long lfactor[9]=
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 88bab1fac76..b96ca0e5bbe 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2404,46 +2404,33 @@ static int my_utf8_uni_no_range(CHARSET_INFO *cs __attribute__((unused)),
static int my_uni_utf8 (CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, uchar *r, uchar *e)
{
- int count;
-
- if (r >= e)
- return MY_CS_TOOSMALL;
-
if (wc < 0x80)
- count = 1;
- else if (wc < 0x800)
- count = 2;
- else if (wc < 0x10000)
- count = 3;
-#ifdef UNICODE_32BIT
- else if (wc < 0x200000)
- count = 4;
- else if (wc < 0x4000000)
- count = 5;
- else if (wc <= 0x7fffffff)
- count = 6;
-#endif
- else return MY_CS_ILUNI;
-
- /*
- e is a character after the string r, not the last character of it.
- Because of it (r+count > e), not (r+count-1 >e )
- */
- if ( r+count > e )
- return MY_CS_TOOSMALLN(count);
-
- switch (count) {
- /* Fall through all cases!!! */
-#ifdef UNICODE_32BIT
- case 6: r[5] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x4000000;
- case 5: r[4] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x200000;
- case 4: r[3] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x10000;
-#endif
- case 3: r[2] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0x800;
- case 2: r[1] = (uchar) (0x80 | (wc & 0x3f)); wc = wc >> 6; wc |= 0xc0;
- case 1: r[0] = (uchar) wc;
+ {
+ if (r >= e)
+ return MY_CS_TOOSMALL;
+ *r= (uchar) wc;
+ return 1;
}
- return count;
+ if (wc < 0x800)
+ {
+ if (r + 2 > e)
+ return MY_CS_TOOSMALLN(2);
+ /* U+0080..U+07FF: 00000xxx.xxyyyyyy -> 110xxxxx 10yyyyyy */
+ *r++= (uchar) (0xC0 | (wc >> 6));
+ *r= (uchar) (0x80 | (wc & 0x3F));
+ return 2;
+ }
+ if (wc < 0x10000)
+ {
+ if (r + 3 > e)
+ return MY_CS_TOOSMALLN(3);
+ /* U+0800..U+FFFF: xxxxyyyy.yyzzzzzz -> 1110xxxx 10yyyyyy 10zzzzzz */
+ *r++= (uchar) (0xE0 | (wc >> 12));
+ *r++= (uchar) (0x80 | ((wc >> 6) & 0x3f));
+ *r= (uchar) (0x80 | (wc & 0x3f));
+ return 3;
+ }
+ return MY_CS_ILUNI;
}
@@ -4353,6 +4340,10 @@ static const char filename_safe_char[128]=
#define MY_FILENAME_ESCAPE '@'
+/*
+ note, that we cannot trust 'e' here, it's may be fake,
+ see strconvert()
+*/
static int
my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e)
@@ -4374,7 +4365,7 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
return MY_CS_TOOSMALL3;
byte1= s[1];
- byte2= s[2];
+ byte2= byte1 ? s[2] : 0;
if (byte1 >= 0x30 && byte1 <= 0x7F &&
byte2 >= 0x30 && byte2 <= 0x7F)
@@ -4399,7 +4390,7 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
(byte2= hexlo(byte2)) >= 0)
{
int byte3= hexlo(s[3]);
- int byte4= hexlo(s[4]);
+ int byte4= hexlo(s[3] ? s[4] : 0);
if (byte3 >=0 && byte4 >=0)
{
*pwc= (byte1 << 12) + (byte2 << 8) + (byte3 << 4) + byte4;
diff --git a/strings/decimal.c b/strings/decimal.c
index f318a234d3f..edff4c02885 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009, 2011, Monty Program Ab
+ Copyright (c) 2009, 2013, Monty Program Ab
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
@@ -669,7 +669,7 @@ int decimal_shift(decimal_t *dec, int shift)
if (do_left)
{
do_mini_left_shift(dec, l_mini_shift, beg, end);
- mini_shift=- l_mini_shift;
+ mini_shift= -l_mini_shift;
}
else
{
@@ -1032,7 +1032,7 @@ int decimal2ulonglong(const decimal_t *from, ulonglong *to)
if (from->sign)
{
- *to=ULL(0);
+ *to= 0;
return E_DEC_OVERFLOW;
}
@@ -1445,7 +1445,9 @@ int decimal_bin_size(int precision, int scale)
intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1,
intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1;
- DBUG_ASSERT(scale >= 0 && precision > 0 && scale <= precision);
+ DBUG_ASSERT(scale >= 0);
+ DBUG_ASSERT(precision > 0);
+ DBUG_ASSERT(scale <= precision);
return intg0*sizeof(dec1)+dig2bytes[intg0x]+
frac0*sizeof(dec1)+dig2bytes[frac0x];
}
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index 48d548242a8..7130f6253a8 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2003 TXT DataKonsult Ab
- Copyright (c) 2009-2011, Monty Program Ab
+ Copyright (c) 2009, 2013, Monty Program Ab.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -29,11 +29,11 @@
#include "strings_def.h"
#include <my_sys.h> /* Needed for MY_ERRNO_ERANGE */
-#define MAX_NEGATIVE_NUMBER ((ulonglong) LL(0x8000000000000000))
+#define MAX_NEGATIVE_NUMBER ((ulonglong) 0x8000000000000000ULL)
#define INIT_CNT 9
-#define LFACTOR ULL(1000000000)
-#define LFACTOR1 ULL(10000000000)
-#define LFACTOR2 ULL(100000000000)
+#define LFACTOR 1000000000ULL
+#define LFACTOR1 10000000000ULL
+#define LFACTOR2 100000000000ULL
static unsigned long lfactor[9]=
{
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 2d629c766e8..bac22fc96a9 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -370,7 +370,6 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
Summary: MySQL - Shared libraries
Group: Applications/Databases
Provides: MySQL-shared
-Conflicts: mysql-libs mysql-libs-advanced
Obsoletes: MySQL-shared-standard MySQL-shared-pro
Obsoletes: MySQL-shared-pro-cert MySQL-shared-pro-gpl
Obsoletes: MySQL-shared-pro-gpl-cert MySQL-shared
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh
index 156865b61ad..b5ba10bd265 100644
--- a/support-files/rpm/server-postin.sh
+++ b/support-files/rpm/server-postin.sh
@@ -5,41 +5,46 @@ if [ $1 = 1 ] ; then
/sbin/chkconfig --add mysql
fi
- mysql_dirs=(`%{_sbindir}/mysqld --verbose --help 2>/dev/null|sed -ne 's/^\(basedir\|datadir\)[[:space:]]*\(.*\)$/\2/p'`)
- basedir="${mysql_dirs[0]}"
- datadir="${mysql_dirs[1]}"
- # datadir may be relative to a basedir!
- if expr $datadir : / > /dev/null; then
- mysql_datadir=$datadir
+ basedir=`%{_bindir}/my_print_defaults --mysqld|sed -ne 's/^--basedir=//p'|tail -1`
+ if [ -z "$basedir" ] ; then
+ basedir=%{mysqlbasedir}
+ fi
+
+ datadir=`%{_bindir}/my_print_defaults --mysqld|sed -ne 's/^--datadir=//p'|tail -1`
+ if [ -z "$datadir" ] ; then
+ datadir=%{mysqldatadir}
else
- mysql_datadir=$basedir/$datadir
+ # datadir may be relative to a basedir!
+ if ! expr $datadir : / > /dev/null; then
+ datadir=$basedir/$datadir
+ fi
fi
# Create a MySQL user and group. Do not report any problems if it already
# exists.
groupadd -r %{mysqld_group} 2> /dev/null || true
- useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
+ useradd -M -r -d $datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# The user may already exist, make sure it has the proper group nevertheless (BUG#12823)
usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
- chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
+ chown -R %{mysqld_user}:%{mysqld_group} $datadir
- if [ ! -e $mysql_datadir ]; then
+ if [ ! -e $datadir ]; then
# Create data directory
- mkdir -p $mysql_datadir/{mysql,test}
+ mkdir -p $datadir/{mysql,test}
# Initiate databases
%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user}
fi
# Change permissions again to fix any new files.
- chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir
+ chown -R %{mysqld_user}:%{mysqld_group} $datadir
# Fix permissions for the permission database so that only the user
# can read them.
- chmod -R og-rw $mysql_datadir/mysql
+ chmod -R og-rw $datadir/mysql
fi
# install SELinux files - but don't override existing ones
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 93ed18ed565..d926334bb7f 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -1,5 +1,5 @@
/* Copyright (c) 2002, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+ Copyright (c) 2008, 2013, Monty Program Ab
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
@@ -6204,7 +6204,7 @@ static void test_date_dt()
static void test_pure_coverage()
{
MYSQL_STMT *stmt;
- MYSQL_BIND my_bind[1];
+ MYSQL_BIND my_bind[2];
int rc;
ulong length;
@@ -8880,7 +8880,7 @@ static void test_parse_error_and_bad_length()
DIE_UNLESS(rc);
if (!opt_silent)
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
- rc= mysql_real_query(mysql, "SHOW DATABASES", 100);
+ rc= mysql_real_query(mysql, STRING_WITH_LEN("SHOW DATABASES\0AAAAAAAA"));
DIE_UNLESS(rc);
if (!opt_silent)
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
@@ -8891,7 +8891,7 @@ static void test_parse_error_and_bad_length()
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
stmt= mysql_stmt_init(mysql);
DIE_UNLESS(stmt);
- rc= mysql_stmt_prepare(stmt, "SHOW DATABASES", 100);
+ rc= mysql_stmt_prepare(stmt, STRING_WITH_LEN("SHOW DATABASES\0AAAAAAA"));
DIE_UNLESS(rc != 0);
if (!opt_silent)
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_stmt_error(stmt));
@@ -9862,11 +9862,11 @@ static void test_bug3035()
const uint32 uint32_max= 4294967295U;
/* it might not work okay everyplace */
- const longlong int64_max= LL(9223372036854775807);
+ const longlong int64_max= 9223372036854775807LL;
const longlong int64_min= -int64_max - 1;
const ulonglong uint64_min= 0U;
- const ulonglong uint64_max= ULL(18446744073709551615);
+ const ulonglong uint64_max= 18446744073709551615ULL;
const char *stmt_text;
@@ -12533,7 +12533,7 @@ static void test_truncation()
/* double -> longlong, negative fp number to signed integer: no loss */
DIE_UNLESS(my_bind++ < bind_array + bind_count);
- DIE_UNLESS(! *my_bind->error && * (longlong*) my_bind->buffer == LL(-12345678910));
+ DIE_UNLESS(! *my_bind->error && * (longlong*) my_bind->buffer == -12345678910LL);
/* big numeric string -> number */
DIE_UNLESS(my_bind++ < bind_array + bind_count);
@@ -14535,7 +14535,7 @@ static void test_bug12925()
{
myheader("test_bug12925");
if (opt_getopt_ll_test)
- DIE_UNLESS(opt_getopt_ll_test == LL(25600*1024*1024));
+ DIE_UNLESS(opt_getopt_ll_test == 25600LL*1024*1024);
}
@@ -16926,7 +16926,8 @@ static void test_bug31669()
rc= mysql_change_user(conn, "", "", "");
DIE_UNLESS(rc);
- memset(buff, 'a', sizeof(buff));
+ memset(buff, 'a', sizeof(buff) - 1);
+ buff[sizeof(buff) - 1]= 0;
mysql_close(conn);
conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
diff --git a/vio/vio.c b/vio/vio.c
index a18482f3dfd..56dff377105 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -249,6 +249,7 @@ Vio *mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, ui
if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
{
vio_init(vio, type, sd, flags);
+ vio->desc= (vio->type == VIO_TYPE_SOCKET ? "socket" : "TCP/IP");
vio->mysql_socket= mysql_socket;
}
DBUG_RETURN(vio);
@@ -278,6 +279,7 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
{
vio_init(vio, VIO_TYPE_NAMEDPIPE, 0, VIO_LOCALHOST);
+ vio->desc= "named pipe";
/* Create an object for event notification. */
vio->overlapped.hEvent= CreateEvent(NULL, FALSE, FALSE, NULL);
if (vio->overlapped.hEvent == NULL)
@@ -286,7 +288,6 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
DBUG_RETURN(NULL);
}
vio->hPipe= hPipe;
- strmov(vio->desc, "named pipe");
}
DBUG_RETURN(vio);
}
@@ -302,6 +303,7 @@ Vio *vio_new_win32shared_memory(HANDLE handle_file_map, HANDLE handle_map,
if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
{
vio_init(vio, VIO_TYPE_SHARED_MEMORY, 0, VIO_LOCALHOST);
+ vio->desc= "shared memory";
vio->handle_file_map= handle_file_map;
vio->handle_map= handle_map;
vio->event_server_wrote= event_server_wrote;
@@ -311,7 +313,6 @@ Vio *vio_new_win32shared_memory(HANDLE handle_file_map, HANDLE handle_map,
vio->event_conn_closed= event_conn_closed;
vio->shared_memory_remain= 0;
vio->shared_memory_pos= handle_map;
- strmov(vio->desc, "shared memory");
}
DBUG_RETURN(vio);
}
diff --git a/vio/viosocket.c b/vio/viosocket.c
index e1319843e48..f84d7e802be 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -616,12 +616,6 @@ int vio_close(Vio *vio)
const char *vio_description(Vio * vio)
{
- if (!vio->desc[0])
- {
- my_snprintf(vio->desc, VIO_DESCRIPTION_SIZE,
- (vio->type == VIO_TYPE_SOCKET ? "socket (%d)" : "TCP/IP (%d)"),
- mysql_socket_getfd(vio->mysql_socket));
- }
return vio->desc;
}